Files
6098-5/Cowain.Preheat.Common/Core/SettingProvider.cs
T
2026-05-28 22:11:13 +08:00

80 lines
2.0 KiB
C#

using Cowain.Preheat.Common.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Cowain.Preheat.Common.Core
{
public class SettingProvider
{
const string MAIN = "Main";
private static SettingProvider instance;
public string PWD;
public string ProductionLineName;
private static readonly object locker = new object();
public bool? _autoUpdate;
public bool AutoUpdate
{
get
{
if (null == _autoUpdate)
{
_autoUpdate = INIHelper.ReadBool(MAIN, "AutoUpdate", false);
}
return _autoUpdate ?? false;
}
set
{
_autoUpdate = value;
INIHelper.Write(MAIN, "AutoUpdate", _autoUpdate.Value ? "1" : "0");
}
}
public string _autoUpdateUrl;
public string AutoUpdateUrl
{
get
{
if (string.IsNullOrEmpty(_autoUpdateUrl))
{
_autoUpdateUrl = INIHelper.ReadString(MAIN, "AutoUpdateUrl", "http://127.0.0.1:6688/update/update.xml");
}
return _autoUpdateUrl;
}
set
{
_autoUpdateUrl = value;
INIHelper.Write(MAIN, "AutoUpdateUrl", _autoUpdateUrl);
}
}
public static SettingProvider Instance
{
get
{
lock (locker)
{
if (instance == null)
{
instance = new SettingProvider();
}
return instance;
}
}
}
SettingProvider()
{
PWD = INIHelper.ReadString(MAIN, "PassWord", "cowain2024");
ProductionLineName = INIHelper.ReadString(MAIN, "ProductionLineName", ""); //有乱码
}
}
}