You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
using EC.Helper.Common;
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
namespace OnvifSocketServer
|
|
|
|
{
|
|
|
|
public class AppConfig
|
|
|
|
{
|
|
|
|
#region Attr
|
|
|
|
|
|
|
|
private static IConfiguration config;
|
|
|
|
|
|
|
|
private static IConfiguration Config
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (config == null)
|
|
|
|
{
|
|
|
|
string configPath = Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json");
|
|
|
|
config = ConfigHelper.ReadConfiguration(configPath);
|
|
|
|
}
|
|
|
|
return config;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static T Get<T>(string key)
|
|
|
|
{
|
|
|
|
return Config.GetValue<T>(key);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion Attr
|
|
|
|
|
|
|
|
#region Apis
|
|
|
|
|
|
|
|
public static string GetApi(string key)
|
|
|
|
{
|
|
|
|
return Get<string>($"Apis:{key}");
|
|
|
|
}
|
|
|
|
|
|
|
|
public static string GetOnvifHttpUrl()
|
|
|
|
{
|
|
|
|
return GetApi("onvif_http_url");
|
|
|
|
}
|
|
|
|
|
|
|
|
public static string GetOnvifHttpsUrl()
|
|
|
|
{
|
|
|
|
return GetApi("onvif_https_url");
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion Apis
|
|
|
|
}
|
|
|
|
}
|