/// <summary> /// 获得操作系统配置文件的对像 /// </summary> /// <returns></returns> public static INIOperator GetSysINI() { string tempIniFilePath = Application.StartupPath + "\\SysSettings.ini"; INIOperator returnINIOperator = new INIOperator(tempIniFilePath); return(returnINIOperator); }
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); } }
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); }
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); }
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); }
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); }
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); }
public ArrayList GetSectionsNames() { int num1; ArrayList list1 = new ArrayList(); byte[] buffer1 = new byte[MAX_ENTRY]; int num2 = 0; try { num1 = INIOperator.GetPrivateProfileSectionsNames(buffer1, MAX_ENTRY, this.Filename); } catch (Exception ex) { MessageBox.Show(ex.Message); return(list1); } ASCIIEncoding encoding1 = new ASCIIEncoding(); if (num1 > 0) { string text1 = encoding1.GetString(buffer1); num1 = 0; num2 = -1; while (true) { num1 = text1.IndexOf('\0', (int)(num2 + 1)); if (((num1 - num2) == 1) || (num1 == -1)) { return(list1); } try { list1.Add(text1.Substring(num2 + 1, num1 - num2)); } catch (Exception ex) { MessageBox.Show(ex.Message); } num2 = num1; } } return(list1); }