Exemple #1
0
        // Token: 0x06000019 RID: 25 RVA: 0x00002788 File Offset: 0x00000988
        public static string[] INIGetAllItemKeys(string iniFile, string section)
        {
            string[] value = new string[0];
            if (string.IsNullOrEmpty(section))
            {
                throw new ArgumentException("必须指定节点名称", "section");
            }
            char[] chars         = new char[10240];
            uint   bytesReturned = Win32API.GetPrivateProfileString(section, null, null, chars, 10240u, iniFile);

            if (bytesReturned != 0u)
            {
                string text      = new string(chars);
                char[] separator = new char[1];
                value = text.Split(separator, StringSplitOptions.RemoveEmptyEntries);
            }
            return(value);
        }
Exemple #2
0
        // Token: 0x0600001A RID: 26 RVA: 0x00002804 File Offset: 0x00000A04
        public static string INIGetStringValue(string iniFile, string section, string key, string defaultValue)
        {
            string value = defaultValue;

            if (string.IsNullOrEmpty(section))
            {
                throw new ArgumentException("必须指定节点名称", "section");
            }
            if (string.IsNullOrEmpty(key))
            {
                throw new ArgumentException("必须指定键名称(key)", "key");
            }
            StringBuilder sb            = new StringBuilder(10240);
            uint          bytesReturned = Win32API.GetPrivateProfileString(section, key, defaultValue, sb, 10240u, iniFile);

            if (bytesReturned != 0u)
            {
                value = sb.ToString();
            }
            return(value);
        }