using System;
namespace EC.Utils.Storage
{
public class LocalStorage
{
private const string Section = "LocalStorage";
private static IniFileHelper _iniFile;
public static void Init()
{
_iniFile = new IniFileHelper(AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "LocalStorage.ini");
}
public static string GetStorage(string name)
{
return _iniFile.IniReadValue(Section, name);
}
public static void SetStorage(string name, string strVal)
{
_iniFile.WriteString(Section, name, strVal);
}
public static int GetStorageInt(string name)
{
return FormatCom.ToInt(GetStorage(name));
}
///
/// [扩展]写入Int数值,如果不存在 节-键,则会自动创建
///
/// 键
/// 写入值
public static void SetStorage(string name, int intVal)
{
_iniFile.WriteInt(Section, name, intVal);
}
}
}