You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.2 KiB
47 lines
1.2 KiB
using System.Text;
|
|
|
|
namespace EC.Utils.Storage
|
|
{
|
|
public class IniFileManager
|
|
{
|
|
private static IniFileHelper inifile = null;
|
|
|
|
public static void Init()
|
|
{
|
|
inifile = new IniFileHelper(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase.ToString() + "Config.ini");
|
|
}
|
|
|
|
/// <summary>
|
|
/// [扩展]写入Int数值,如果不存在 节-键,则会自动创建
|
|
/// </summary>
|
|
/// <param name="section">节</param>
|
|
/// <param name="name">键</param>
|
|
/// <param name="Ival">写入值</param>
|
|
public void WriteInt(string section, string name, int Ival)
|
|
{
|
|
inifile.WriteInt(section, name, Ival);
|
|
}
|
|
|
|
public void ReadInt(string section, string name, int Ival)
|
|
{
|
|
inifile.ReadInt(section, name, Ival);
|
|
}
|
|
|
|
/// <summary>
|
|
/// [扩展]写入String字符串,如果不存在 节-键,则会自动创建
|
|
/// </summary>
|
|
/// <param name="section">节</param>
|
|
/// <param name="name">键</param>
|
|
/// <param name="strVal">写入值</param>
|
|
public void WriteValue(string section, string name, string strVal)
|
|
{
|
|
inifile.WriteString(section, name, strVal);
|
|
}
|
|
|
|
public string ReadValue(string section, string name)
|
|
{
|
|
StringBuilder strSb = new StringBuilder(256);
|
|
return inifile.IniReadValue(section, name);
|
|
}
|
|
}
|
|
}
|