| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace System.Fire.Ini {
- public class iniCategorie {
- private string _name;
- private List<iniValue> _values = new List<iniValue>();
- private iniHandle _Handle;
- private bool _hasChanged = false;
- public bool hasChanged {
- get { return _hasChanged; }
- set {
- this._Handle.hasChanged = value;
- _hasChanged = value;
- }
- }
- public iniCategorie(iniHandle Handler, string Name) {
- this._name = Name;
- this._Handle = Handler;
- this.hasChanged = true;
- this._Handle.hasChanged = true;
- }
- public iniValue this[string VariableName] {
- get { return this.Value(VariableName); }
- }
- public string Name {
- get { return this._name; }
- set {
- this.hasChanged = true;
- this._Handle.hasChanged = true;
- this._name = value;
- }
- }
- public override string ToString() {
- string tmp = "[" + this._name + "]";
- foreach (iniValue iv in this._values)
- tmp += "\r\n" + iv.ToString();
- return tmp;
- }
- public iniHandle Ini {
- get { return this._Handle; }
- }
- public bool HasValue(string ValueName) {
- foreach (iniValue ic in this._values)
- if (ic.Name.ToLower() == ValueName.ToLower())
- return true;
- return false;
- }
- public iniValue Value(string Name) {
- //System.Diagnostics.Debug.WriteLine("iniCategorie::Value('"+Name+"')");
- foreach (iniValue ic in this._values)
- if (ic.Name.ToLower() == Name.ToLower()) {
- //System.Diagnostics.Debug.WriteLine("Found Value");
- return ic;
- }
- //System.Diagnostics.Debug.WriteLine("Create Value");
- this._hasChanged = true;
- iniValue icn = new iniValue(this._Handle, this, Name);
- this._values.Add(icn);
- //System.Diagnostics.Debug.WriteLine("Value created: " + icn.Name);
- return icn;
- }
- public iniValue Value(int ID) {
- if (ID < this._values.Count)
- return this._values[ID];
- return null;
- }
- public iniValue Value(string Name, string Default) {
- foreach (iniValue ic in this._values)
- if (ic.Name.ToLower() == Name.ToLower())
- return ic;
- this._hasChanged = true;
- iniValue icn = new iniValue(this._Handle, this, Name);
- icn.Value = Default;
- this._values.Add(icn);
- return icn;
- }
- public iniValue Value(string Name, Int16 Default) {
- foreach (iniValue ic in this._values)
- if (ic.Name.ToLower() == Name.ToLower())
- return ic;
- this._hasChanged = true;
- iniValue icn = new iniValue(this._Handle, this, Name);
- icn.Int16 = Default;
- this._values.Add(icn);
- return icn;
- }
- public iniValue Value(string Name, Int32 Default) {
- foreach (iniValue ic in this._values)
- if (ic.Name.ToLower() == Name.ToLower())
- return ic;
- this._hasChanged = true;
- iniValue icn = new iniValue(this._Handle, this, Name);
- icn.Int32 = Default;
- this._values.Add(icn);
- return icn;
- }
- public iniValue Value(string Name, Int64 Default) {
- foreach (iniValue ic in this._values)
- if (ic.Name.ToLower() == Name.ToLower())
- return ic;
- this._hasChanged = true;
- iniValue icn = new iniValue(this._Handle, this, Name);
- icn.Int64 = Default;
- this._values.Add(icn);
- return icn;
- }
- public iniValue Value(string Name, bool Default) {
- foreach (iniValue ic in this._values)
- if (ic.Name.ToLower() == Name.ToLower()) {
- return ic;
- }
- this._hasChanged = true;
- iniValue icn = new iniValue(this._Handle, this, Name);
- icn.Bool = Default;
- this._values.Add(icn);
- return icn;
- }
- public iniValue Value(string Name, double Default) {
- foreach (iniValue ic in this._values)
- if (ic.Name.ToLower() == Name.ToLower())
- return ic;
- this._hasChanged = true;
- iniValue icn = new iniValue(this._Handle, this, Name);
- icn.Double = Default;
- this._values.Add(icn);
- return icn;
- }
- public iniValue Value(string Name, byte Default) {
- foreach (iniValue ic in this._values)
- if (ic.Name.ToLower() == Name.ToLower())
- return ic;
- this._hasChanged = true;
- iniValue icn = new iniValue(this._Handle, this, Name);
- icn.Byte = Default;
- this._values.Add(icn);
- return icn;
- }
- }
- }
|