1、//
//INIClass.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace BoitBoy.MyFile
{
/// 2、ry>
public static String SpeatorString = “,-,”;
[System.Runtime.InteropServices.DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
[System.Runtime.InteropServices.DllImport("kernel3 3、2")]
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
/// 4、NIPath)
{
inipath = INIPath;
}
/// 5、iWriteValue(string Section, string Key, object Value)
{
if (Value == null)
return;
if (Value.GetType() != typeof(System.Collections.ArrayList))
WritePrivateProfileString(Section, Key, Value.ToString(), this.inipath);
e 6、lse
{
System.Collections.ArrayList TempArray = Value as System.Collections.ArrayList;
String StringValue = “”;
if (TempArray != null)
{
foreach (object Temp in TempArray)
{
7、 StringValue += Temp.ToString() + SpeatorString;
}
}
IniWriteValue(Section, Key, StringValue);
}
}
/// 8、目名称(如 [TypeName] )
/// 键
public string IniReadValue_S(string Section, string Key)
{
StringBuilder temp = new StringBuilder(500);
int i = GetPrivateProfileString(Section, Key, “”, temp, 500, this.inipath);
9、 return temp.ToString();
}
public double IniReadValue(string Section, string Key)
{
String Temp = IniReadValue_S(Section, Key);
double temp = 0;
double.TryParse(Temp, out temp);
return temp;
}
public 10、 int IniReadValue_I(string Section, string Key)
{
String Temp = IniReadValue_S(Section, Key);
int temp = 0;
int.TryParse(Temp, out temp);
return temp;
}
/// 11、
///
/// 12、ring[1];
Splitor[0] = SpeatorString;
String[] Values = Value.Split(Splitor, StringSplitOptions.RemoveEmptyEntries);
System.Collections.ArrayList Back = new System.Collections.ArrayList();
foreach (String Temp in Values)
{
13、 Back.Add(Temp);
}
return Back;
}
///






