using Bowin.Common.Utility; using Microsoft.Extensions.Configuration; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; namespace YLShipBuildLandMap.Web { public class Configuration { public static Configuration Current { get { var configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json") .Build(); Configuration result = new Configuration(); result.AppSettings = configuration.GetSection("AppSettings").Get(); //result.CROSDomainList = configuration.GetSection("Web") // .GetSection("Cros") // .GetValue("Domain") // .Split(",", StringSplitOptions.RemoveEmptyEntries) // .Select(x => x.Trim()).ToList(); return result; } } public AppSettings AppSettings { get; set; } public static List Assemblies { get { var configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("servicemapping.json") .Build(); return configuration.GetSection("Assemblies").Get>() ?? new List(); } } //public List CROSDomainList { get; set; } } public class AppSettings { public string TemplatePath { get; set; } public string PicturePath { get; set; } public string FilePath { get; set; } public string TemplatePhysicalPath { get { return HttpHelper.MapPath(TemplatePath); } } } }