public bool SetName(string sKey) { sKey = sKey.Trim(); if (sKey.Length != 0) { IniKey key = this.m_section.GetKey(sKey); if (key != this && key != null) { return(false); } try { this.m_section.m_keys.Remove(this.m_sKey); this.m_section.m_keys[sKey] = this; this.m_sKey = sKey; return(true); } catch (Exception ex) { Trace.WriteLine(ex.Message); } return(false); } return(false); }
public bool RenameKey(string sSection, string sKey, string sNewKey) { IniSection section = this.GetSection(sSection); if (section != null) { IniKey key = section.GetKey(sKey); if (key != null) { return(key.SetName(sNewKey)); } } return(false); }
public string GetKeyValue(string sSection, string sKey) { IniSection section = this.GetSection(sSection); if (section != null) { IniKey key = section.GetKey(sKey); if (key != null) { return(key.Value); } } return(string.Empty); }
public bool SetKeyValue(string sSection, string sKey, string sValue) { IniSection iniSection = this.AddSection(sSection); if (iniSection != null) { IniKey iniKey = iniSection.AddKey(sKey); if (iniKey != null) { iniKey.Value = sValue; return(true); } } return(false); }
public bool RemoveKey(IniKey Key) { if (Key != null) { try { this.m_keys.Remove(Key.Name); return(true); } catch (Exception ex) { Trace.WriteLine(ex.Message); } return(false); } return(false); }
public IniKey AddKey(string sKey) { sKey = sKey.Trim(); IniKey iniKey = null; if (sKey.Length != 0) { if (this.m_keys.ContainsKey(sKey)) { iniKey = (IniKey)this.m_keys[sKey]; } else { iniKey = new IniKey(this, sKey); this.m_keys[sKey] = iniKey; } } return(iniKey); }