Esempio n. 1
0
        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());
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
 public static void DelSection(string section, string fileName)
 {
     IniFunc.WritePrivateProfileString(section, null, null, fileName);
 }
Esempio n. 5
0
 public static void DelKey(string section, string key, string fileName)
 {
     IniFunc.WritePrivateProfileString(section, key, null, fileName);
 }
Esempio n. 6
0
 public static void WriteString(string section, string key, string strVal, string fileName)
 {
     IniFunc.WritePrivateProfileString(section, key, strVal, fileName);
 }
Esempio n. 7
0
 public static void WriteInt(string section, string key, int iVal, string fileName)
 {
     IniFunc.WritePrivateProfileString(section, key, iVal.ToString(), fileName);
 }
Esempio n. 8
0
 public static int GetInt(string section, string key, int def, string fileName)
 {
     return(IniFunc.GetPrivateProfileInt(section, key, def, fileName));
 }