ServerInfo.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using MediaBrowser.Model.Connect;
  2. using MediaBrowser.Model.System;
  3. using System;
  4. using System.Collections.Generic;
  5. namespace MediaBrowser.Model.ApiClient
  6. {
  7. public class ServerInfo
  8. {
  9. public String Name { get; set; }
  10. public String Id { get; set; }
  11. public String LocalAddress { get; set; }
  12. public String RemoteAddress { get; set; }
  13. public String UserId { get; set; }
  14. public String AccessToken { get; set; }
  15. public List<WakeOnLanInfo> WakeOnLanInfos { get; set; }
  16. public DateTime DateLastAccessed { get; set; }
  17. public String ExchangeToken { get; set; }
  18. public UserLinkType? UserLinkType { get; set; }
  19. public ServerInfo()
  20. {
  21. WakeOnLanInfos = new List<WakeOnLanInfo>();
  22. }
  23. public void ImportInfo(PublicSystemInfo systemInfo)
  24. {
  25. Name = systemInfo.ServerName;
  26. Id = systemInfo.Id;
  27. if (!string.IsNullOrEmpty(systemInfo.LocalAddress))
  28. {
  29. LocalAddress = systemInfo.LocalAddress;
  30. }
  31. if (!string.IsNullOrEmpty(systemInfo.WanAddress))
  32. {
  33. RemoteAddress = systemInfo.WanAddress;
  34. }
  35. var fullSystemInfo = systemInfo as SystemInfo;
  36. if (fullSystemInfo != null)
  37. {
  38. WakeOnLanInfos = new List<WakeOnLanInfo>();
  39. if (!string.IsNullOrEmpty(fullSystemInfo.MacAddress))
  40. {
  41. WakeOnLanInfos.Add(new WakeOnLanInfo
  42. {
  43. MacAddress = fullSystemInfo.MacAddress
  44. });
  45. }
  46. }
  47. }
  48. }
  49. }