PatchServerInfo.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #if ENABLE_MONO && (DEVELOPMENT_BUILD || UNITY_EDITOR)
  2. using System;
  3. using SingularityGroup.HotReload.Newtonsoft.Json;
  4. using UnityEngine;
  5. namespace SingularityGroup.HotReload {
  6. [Serializable]
  7. class PatchServerInfo {
  8. public readonly string hostName;
  9. public readonly int port;
  10. public readonly string commitHash;
  11. public readonly string rootPath;
  12. [Obsolete]public readonly bool isRemote;
  13. public readonly string customRequestOrigin;
  14. public const string UnknownCommitHash = "unknown";
  15. /// <param name="hostName">an ip address or "localhost"</param>
  16. public PatchServerInfo(string hostName, string commitHash, string rootPath) {
  17. this.hostName = hostName;
  18. this.commitHash = commitHash ?? UnknownCommitHash;
  19. this.rootPath = rootPath;
  20. this.port = RequestHelper.defaultPort;
  21. }
  22. /// <param name="hostName">an ip address or "localhost"</param>
  23. // constructor should (must?) have a param for each field
  24. [JsonConstructor]
  25. public PatchServerInfo(string hostName, int port, string commitHash, string rootPath, bool isRemote = false, string customRequestOrigin = null) {
  26. this.hostName = hostName;
  27. this.port = port;
  28. this.commitHash = commitHash ?? UnknownCommitHash;
  29. this.rootPath = rootPath;
  30. #pragma warning disable CS0612 // Type or member is obsolete
  31. this.isRemote = isRemote;
  32. #pragma warning restore CS0612 // Type or member is obsolete
  33. this.customRequestOrigin = customRequestOrigin;
  34. }
  35. }
  36. }
  37. #endif