Ejemplo n.º 1
0
        public byte[] ReadByteArray(string Sections, string Key, int Length)
        {
            byte[] buffer1;
            if (Length > 0)
            {
                try
                {
                    byte[] buffer2 = new byte[(Length - 1) + 1];
                    if (INIOperator.GetPrivateProfileStruct(Sections, Key, buffer2, buffer2.Length, this.Filename) == 0)
                    {
                        return(null);
                    }
                    return(buffer2);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);

                    buffer1 = null;
                    return(buffer1);
                }
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获得操作系统配置文件的对像
        /// </summary>
        /// <returns></returns>
        public static INIOperator GetSysINI()
        {
            string      tempIniFilePath   = Application.StartupPath + "\\SysSettings.ini";
            INIOperator returnINIOperator = new INIOperator(tempIniFilePath);

            return(returnINIOperator);
        }
Ejemplo n.º 3
0
        public bool DeleteSections(string Section)
        {
            bool flag1;

            try
            {
                flag1 = INIOperator.WritePrivateProfileSections(Sections, null, this.Filename) != 0;
            }
            catch (Exception)
            {
                //MessageBox.Show(ex.Message);
                flag1 = false;
                return(flag1);
            }
            return(flag1);
        }
Ejemplo n.º 4
0
        public bool DeleteKey(string Key)
        {
            bool flag1;

            try
            {
                flag1 = INIOperator.WritePrivateProfileString(this.Sections, Key, null, this.Filename) != 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                flag1 = false;
                return(flag1);
            }
            return(flag1);
        }
Ejemplo n.º 5
0
        public bool Write(string Sections, string Key, string Value)
        {
            bool flag1;

            try
            {
                flag1 = INIOperator.WritePrivateProfileString(Sections, Key, Value, this.Filename) != 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                flag1 = false;
                return(flag1);
            }
            return(flag1);
        }
Ejemplo n.º 6
0
        public int ReadInteger(string Sections, string Key, int DefaultValue)
        {
            int num1;

            try
            {
                num1 = INIOperator.GetPrivateProfileInt(Sections, Key, DefaultValue, this.Filename);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                num1 = DefaultValue;
                return(num1);
            }
            return(num1);
        }
Ejemplo n.º 7
0
        public string ReadString(string Sections, string Key, string DefaultValue)
        {
            string text1;

            try
            {
                StringBuilder builder1 = new StringBuilder(MAX_ENTRY);
                int           num1     = INIOperator.GetPrivateProfileString(Sections, Key, DefaultValue, builder1, MAX_ENTRY, this.Filename);
                text1 = builder1.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                text1 = DefaultValue;
                return(text1);
            }
            return(text1);
        }