首次提交:添加src文件夹代码
This commit is contained in:
222
Cowain.Bake.Common/Core/SettingProvider.cs
Normal file
222
Cowain.Bake.Common/Core/SettingProvider.cs
Normal file
@@ -0,0 +1,222 @@
|
||||
using Cowain.Bake.Common.Core;
|
||||
using Cowain.Bake.Common.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Cowain.Bake.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();
|
||||
private int? _waterPallet;
|
||||
//private int? _stoveLayers;
|
||||
private int? _palletRows;
|
||||
private int? _palletCols;
|
||||
|
||||
private Enums.EDispatchMode _dispMode;
|
||||
public Enums.EDispatchMode DispMode
|
||||
{
|
||||
get
|
||||
{
|
||||
return _dispMode;
|
||||
}
|
||||
set
|
||||
{
|
||||
_dispMode = (Enums.EDispatchMode)value;
|
||||
INIHelper.Write(MAIN, "DispatchMode", _dispMode.ToString());
|
||||
}
|
||||
}
|
||||
public int WaterPallet
|
||||
{
|
||||
get
|
||||
{
|
||||
if (null == _waterPallet)
|
||||
{
|
||||
_waterPallet = INIHelper.ReadInt(MAIN, "WaterPallet", 0);
|
||||
}
|
||||
|
||||
return _waterPallet ?? 0;
|
||||
}
|
||||
set
|
||||
{
|
||||
_waterPallet = value;
|
||||
INIHelper.Write(MAIN, "WaterPallet", _waterPallet.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
//public int StoveLayers
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// if (null == _stoveLayers)
|
||||
// {
|
||||
// _stoveLayers = INIHelper.ReadInt(MAIN, "StoveLayers", 0);
|
||||
// }
|
||||
// return _stoveLayers ?? 0;
|
||||
// }
|
||||
//}
|
||||
|
||||
public int PalletRows
|
||||
{
|
||||
get
|
||||
{
|
||||
if (null == _palletRows)
|
||||
{
|
||||
_palletRows = INIHelper.ReadInt(MAIN, "PalletRows", 48);
|
||||
}
|
||||
return _palletRows ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int PalletCols
|
||||
{
|
||||
get
|
||||
{
|
||||
if (null == _palletCols)
|
||||
{
|
||||
_palletCols = INIHelper.ReadInt(MAIN, "PalletCols", 2);
|
||||
}
|
||||
return _palletCols ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int? _skinType;
|
||||
public int SkinType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (null == _skinType)
|
||||
{
|
||||
_skinType = INIHelper.ReadInt(MAIN, "SkinType", 0);
|
||||
}
|
||||
|
||||
return _skinType ?? 0;
|
||||
}
|
||||
set
|
||||
{
|
||||
_skinType = value;
|
||||
INIHelper.Write(MAIN, "SkinType", _skinType.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
private EIsReverseOrder? _stoveDispDirection;
|
||||
public EIsReverseOrder StoveDispDirection
|
||||
{
|
||||
get
|
||||
{
|
||||
if (null == _stoveDispDirection)
|
||||
{
|
||||
_stoveDispDirection = (EIsReverseOrder)INIHelper.ReadInt(MAIN, "StoveDispDirection", 0);
|
||||
}
|
||||
|
||||
return _stoveDispDirection.Value;
|
||||
}
|
||||
}
|
||||
|
||||
private EIsReverseOrder? _isReverseOrder;
|
||||
public EIsReverseOrder IsReverseOrder
|
||||
{
|
||||
get
|
||||
{
|
||||
if (null == _isReverseOrder)
|
||||
{
|
||||
_isReverseOrder = (EIsReverseOrder)INIHelper.ReadInt(MAIN, "IsReverseOrder", 0);
|
||||
}
|
||||
|
||||
return _isReverseOrder.Value;
|
||||
}
|
||||
}
|
||||
|
||||
private int? _countCmd;
|
||||
public int CountCmd
|
||||
{
|
||||
get
|
||||
{
|
||||
if (null == _countCmd)
|
||||
{
|
||||
_countCmd = INIHelper.ReadInt(MAIN, "CountCmd", 0);
|
||||
}
|
||||
if (3000 <= _countCmd)
|
||||
{
|
||||
CountCmd = 0;
|
||||
}
|
||||
return _countCmd ?? 0;
|
||||
}
|
||||
set
|
||||
{
|
||||
_countCmd = value;
|
||||
INIHelper.Write(MAIN, "CountCmd", _countCmd.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static SettingProvider Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (locker)
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new SettingProvider();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
SettingProvider()
|
||||
{
|
||||
PWD = INIHelper.ReadString(MAIN, "PassWord", "cowain2024");
|
||||
DispMode = (Enums.EDispatchMode)INIHelper.ReadInt(MAIN, "DispatchMode", 2);
|
||||
ProductionLineName = INIHelper.ReadString(MAIN, "ProductionLineName", ""); //有乱码
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user