first commit
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using JSMachine.WMS.Infrastructure.AppConfiguration;
|
||||
using JSMachine.WMS.Infrastructure.Helper;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
|
||||
namespace JSMachine.WMS.Common
|
||||
{
|
||||
public static class Global
|
||||
{
|
||||
public static AppSettings AppSettings { get; set; } = new AppSettings();
|
||||
|
||||
static Global()
|
||||
{
|
||||
string filePath = $@"{AppDomain.CurrentDomain.BaseDirectory}\appSettingsWebhost.json";
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
string json = File.ReadAllText(filePath);
|
||||
if (!string.IsNullOrEmpty(json))
|
||||
{
|
||||
JObject jobject = JObject.Parse(json);
|
||||
string appSettings = jobject["AppSettings"].ToString();
|
||||
|
||||
AppSettings = JsonConvert.DeserializeObject<AppSettings>(appSettings);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LogHelper.Error("配置文件读取错误!");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user