public static string GetString(string section, string key, string def, string fileName, int size) { StringBuilder stringBuilder = new StringBuilder(); IniFunc.GetPrivateProfileString(section, key, def, stringBuilder, size, fileName); return(stringBuilder.ToString()); }
public static List <string> ReadKeyValues(string section, string filePath) { byte[] array = new byte[32767]; List <string> list = new List <string>(); int privateProfileSection = IniFunc.GetPrivateProfileSection(section, array, array.GetUpperBound(0), filePath); int num = 0; for (int i = 0; i < privateProfileSection; i++) { if (array[i] == 0) { string text = Encoding.Default.GetString(array, num, i - num).Trim(); num = i + 1; if (text.Length > 0) { list.Add(text); } } } return(list); }
public static List <string> ReadSections(string filePath) { byte[] array = new byte[65535]; int privateProfileSectionNamesA = IniFunc.GetPrivateProfileSectionNamesA(array, array.GetUpperBound(0), filePath); List <string> list = new List <string>(); if (privateProfileSectionNamesA > 0) { int num = 0; for (int i = 0; i < privateProfileSectionNamesA; i++) { if (array[i] == 0) { string text = Encoding.Default.GetString(array, num, i - num).Trim(); num = i + 1; if (text != "") { list.Add(text); } } } } return(list); }
public static void DelSection(string section, string fileName) { IniFunc.WritePrivateProfileString(section, null, null, fileName); }
public static void DelKey(string section, string key, string fileName) { IniFunc.WritePrivateProfileString(section, key, null, fileName); }
public static void WriteString(string section, string key, string strVal, string fileName) { IniFunc.WritePrivateProfileString(section, key, strVal, fileName); }
public static void WriteInt(string section, string key, int iVal, string fileName) { IniFunc.WritePrivateProfileString(section, key, iVal.ToString(), fileName); }
public static int GetInt(string section, string key, int def, string fileName) { return(IniFunc.GetPrivateProfileInt(section, key, def, fileName)); }