public INIEntry this[string entryName, string default_value, string description] { get { INIEntry result; //this. foreach (INIEntry entry in this) { if (String.Compare(entry.ToString(), entryName, true) == 0) { return(entry); } } result = new INIEntry(this, entryName, default_value); if (INIControl.DialogEnable) { INIForm form = new INIForm(this.ini.file, this.s, result, default_value, description); form.ShowDialog(); this.Add(result); this.ini.Save(); } else { result.Value = default_value; this.Add(result); this.ini.Save(); } return(result); } set { INIEntry entry; bool found = false; foreach (INIEntry _entry in this) { if (String.Compare(_entry.ToString(), entryName, true) == 0) { found = true; entry = _entry; break; } } if (!found) { entry = new INIEntry(this, entryName); this.Add(entry); } } }
OptionEntry Search(string entryName, string default_val, string description) { if (CheckIsPath(entryName)) { String here; String there; SplitPath(entryName, out here, out there); foreach (OptionEntry entry in sub_options) { if (String.Compare(entry.ToString(), here, true) == 0) { return(entry[there, default_val, description]); } } OptionEntry blank; if (description == null) { blank = new OptionEntry(this.sub_options, here); } else { blank = new OptionEntry(this.sub_options, here, description); } if (default_val != null) { if (section.fallback_ini) { blank.Value = INI.Default[blank.INISectionName][blank.m_name, default_val]; } else { if (INIControl.DialogEnable) { INIForm form = new INIForm(entryName, default_val); form.ShowDialog(); blank.Value = form.ToString(); } else { blank.Value = default_val; } } } sub_options.Add(blank); return(blank[there, default_val, description]); } else { foreach (OptionEntry entry in sub_options) { if (String.Compare(entry.ToString(), entryName, true) == 0) { return(entry); } } OptionEntry blank = new OptionEntry(sub_options, entryName, description); if (default_val != null) { if (section.fallback_ini) { blank.Value = INI.Default[blank.INISectionName][blank.m_name, default_val]; } else { if (INIControl.DialogEnable) { INIForm form = new INIForm(entryName, default_val); form.ShowDialog(); blank.Value = form.ToString(); } else { blank.Value = default_val; } } } sub_options.Add(blank); return(blank); } //return null; }