|
|
|
@ -1,6 +1,9 @@
|
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Xml;
|
|
|
|
|
|
|
|
|
|
#region << 版 本 注 释 >>
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
@ -58,6 +61,27 @@ namespace SlnMesnac.Config
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string redisConfig { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 修改配置文件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="appConfig"></param>
|
|
|
|
|
public void SetValue(AppConfig appConfig)
|
|
|
|
|
{
|
|
|
|
|
var jsonObject = JsonConvert.SerializeObject(new
|
|
|
|
|
{
|
|
|
|
|
AppConfig = new
|
|
|
|
|
{
|
|
|
|
|
logPath = appConfig.logPath,
|
|
|
|
|
SqlConfig = appConfig.sqlConfig,
|
|
|
|
|
PlcConfig = appConfig.plcConfig,
|
|
|
|
|
RfidConfig = appConfig.rfidConfig,
|
|
|
|
|
RedisConfig = appConfig.redisConfig,
|
|
|
|
|
}
|
|
|
|
|
}, Newtonsoft.Json.Formatting.Indented);
|
|
|
|
|
var appSettingsPath = Path.Combine(AppContext.BaseDirectory, "appsettings.json");
|
|
|
|
|
File.WriteAllText(appSettingsPath, jsonObject);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AppConfig Value => this;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|