jellyfin/MediaBrowser.Model/ApiClient/ServerInfo.cs

60 lines
1.8 KiB
C#
Raw Normal View History

2014-10-29 18:17:31 -07:00
using MediaBrowser.Model.Connect;
using MediaBrowser.Model.System;
2014-10-26 20:06:01 -07:00
using System;
2014-10-02 20:48:59 -07:00
using System.Collections.Generic;
namespace MediaBrowser.Model.ApiClient
{
public class ServerInfo
{
public String Name { get; set; }
public String Id { get; set; }
public String LocalAddress { get; set; }
public String RemoteAddress { get; set; }
public String UserId { get; set; }
public String AccessToken { get; set; }
2014-10-03 18:42:38 -07:00
public List<WakeOnLanInfo> WakeOnLanInfos { get; set; }
2014-10-13 13:14:53 -07:00
public DateTime DateLastAccessed { get; set; }
2014-10-18 14:25:04 -07:00
public String ExchangeToken { get; set; }
2014-10-29 18:17:31 -07:00
public UserLinkType? UserLinkType { get; set; }
2014-10-02 20:48:59 -07:00
2014-11-13 23:27:10 -07:00
public bool IsLocalAddressFixed { get; set; }
2014-10-02 20:48:59 -07:00
public ServerInfo()
{
2014-10-03 18:42:38 -07:00
WakeOnLanInfos = new List<WakeOnLanInfo>();
2014-10-02 20:48:59 -07:00
}
2014-10-26 20:06:01 -07:00
public void ImportInfo(PublicSystemInfo systemInfo)
{
Name = systemInfo.ServerName;
Id = systemInfo.Id;
2014-11-13 23:27:10 -07:00
if (!IsLocalAddressFixed && !string.IsNullOrEmpty(systemInfo.LocalAddress))
2014-10-26 20:06:01 -07:00
{
LocalAddress = systemInfo.LocalAddress;
}
2014-11-13 23:27:10 -07:00
2014-10-26 20:06:01 -07:00
if (!string.IsNullOrEmpty(systemInfo.WanAddress))
{
RemoteAddress = systemInfo.WanAddress;
}
var fullSystemInfo = systemInfo as SystemInfo;
if (fullSystemInfo != null)
{
WakeOnLanInfos = new List<WakeOnLanInfo>();
if (!string.IsNullOrEmpty(fullSystemInfo.MacAddress))
{
WakeOnLanInfos.Add(new WakeOnLanInfo
{
MacAddress = fullSystemInfo.MacAddress
});
}
}
}
2014-10-02 20:48:59 -07:00
}
}