using WingServerCommon.Config.Parameters;
namespace WingServerCommon.Config
{
///
/// 环境配置帮助类
///
public class EnvironmentConfigs
{
public static General General { get; } = new General();
public static Rtmp Rtmp { get; } = new Rtmp();
public static Rtc Rtc { get; } = new Rtc();
public static Storage Storage { get; } = new Storage();
}
public class BaseEnvironment
{
protected readonly string _name;
public BaseEnvironment()
{
_name = GetType().Name;
}
}
///
/// General
///
public class General : BaseEnvironment
{
public General() : base()
{
}
public string LiveProtocol
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "LiveProtocol").Value;
}
}
///
/// General read live config
///
public T LiveProtocolDetail()
{
var t = default(T);
if (LiveProtocol.ToLower() == "rtmp")
{
t = (T)Enum.Parse(typeof(T), EnvironmentConfigs.Rtmp.RTMPType);
}
else
{
t = (T)Enum.Parse(typeof(T), EnvironmentConfigs.Rtc.RTCType);
}
return t;
}
}
///
/// RTMP
///
public class Rtmp : BaseEnvironment
{
public Rtmp() : base()
{
}
public string RTMPType
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "RTMPType").Value;
}
}
public string RTMPAppId
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "RTMPAppId").Value;
}
}
public string RTMPAppKey
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "RTMPAppKey").Value;
}
}
public string RTMPPlayUrl
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "RTMPPlayUrl").Value;
}
}
public string RTMPPushUrl
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "RTMPPushUrl").Value;
}
}
}
///
/// RTC
///
public class Rtc : BaseEnvironment
{
public Rtc() : base()
{
}
public string RTCType
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "RTCType").Value;
}
}
public string AppId
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "AppId").Value;
}
}
public string RTCAppKey
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "RTCAppKey").Value;
}
}
public int RTCBizid
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "RTCBizid").Value;
}
}
public string RTCPlayUrl
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "RTCPlayUrl").Value;
}
}
public string RTCPushUrl
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "RTCPushUrl").Value;
}
}
public string RTCStartingRoomId
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "RTCStartingRoomId").Value;
}
}
}
///
/// Storage
///
public class Storage : BaseEnvironment
{
public Storage() : base()
{
}
public int AutoSliceSizeForUpload
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "AutoSliceSizeForUpload").Value;
}
}
public int ManualDivisionForUpload
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "ManualDivisionForUpload").Value;
}
}
public string OtherNodes
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "OtherNodes").Value;
}
}
public string ServerHost
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "ServerHost").Value;
}
}
public string StorageServer
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "StorageServer").Value;
}
}
public string AppId
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "AppId").Value;
}
}
public string Sercret
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "Sercret").Value;
}
}
public string CFSServerUrl
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "CFSServerUrl").Value;
}
}
public string CDNServerUrl
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "CDNServerUrl").Value;
}
}
public string VCSStorageDisk
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "VCSStorageDisk").Value;
}
}
}
///
/// Gateway
///
public class Gateway : BaseEnvironment
{
public Gateway() : base()
{
}
public string Host
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "Host").Value;
}
}
public string Domains
{
get
{
return EnvironmentConfigManager.GetParammeter(_name, "Domains").Value;
}
}
}
}