ServerInfo.cs 1.6 KB

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