37 lines
1.0 KiB
C#
37 lines
1.0 KiB
C#
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("配置文件读取错误!");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|