ConfigAppSettings.cs
1.0 KB
using System;
using System.Configuration;
using System.Threading;
using System.Xml;
using System.Windows.Forms;
namespace OnlineStore.Common
{
public class ConfigAppSettings
{
//public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static int seq = 1;
public static int nextSeq()
{
if (seq.Equals(Int32.MaxValue))
{
LogUtil.info("seq当前值:" + seq + ",重置seq=0");
seq = 0;
}
Interlocked.Increment(ref seq);
return seq;
}
public static T GetValue<T>(string key, T defaultVal = default(T), string comment = "")
{
ConfigHelper.Config.SetComment(key, comment);
return ConfigHelper.Config.Get(key, defaultVal);
}
public static void SetValue<T>(string key, T defaultVal = default(T))
{
ConfigHelper.Config.Set(key, defaultVal);
}
}
}