//////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> Constructs an ItemisedClass from an existing class </summary> /// <remarks> The existing class must already contain an "items" property</remarks> /// <param name="source"> The class from which the ItemisedClass is constructed </param> //////////////////////////////////////////////////////////////////////////////////////////////////// public ItemisedClass(ConfigClass source) : base(source.Name, source.ParentName) { _items = this["items"] as IntProperty; foreach (ConfigProperty e in source) { base.Add(e); } RenumberItems(); }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> Visit int property. </summary> /// <param name="node"> The node. </param> //////////////////////////////////////////////////////////////////////////////////////////////////// protected virtual void VisitIntProperty(IntProperty node) { //nothing to be done for basic type }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> Constructs a new ItemisedClass from scratch </summary> /// <remarks> The items property is automatically added to the new class</remarks> /// <param name="name"> The name of the class. </param> //////////////////////////////////////////////////////////////////////////////////////////////////// public ItemisedClass(string name) : base(name, "") { _items = new IntProperty("items", 0); base.Add(_items); }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> Visit configuration int. </summary> /// <remarks> Neil MacMullen, 18/02/2011. </remarks> /// <param name="node"> The node. </param> //////////////////////////////////////////////////////////////////////////////////////////////////// protected override void VisitIntProperty(IntProperty node) { AppendLineIndented(node.Name + "=" + TextFile.ToString(node.Value) + ";"); base.VisitIntProperty(node); }