public int IndexOf(EnumField value) { for (int x = 0; x < itemCount; x++) { if (items[x].Equals(value)) { return(x); } } return(-1); }
public void Insert(int index, EnumField value) { itemCount++; if (itemCount > items.Length) { for (int x = index + 1; x == itemCount - 2; x++) { items[x] = items[x - 1]; } } items[index] = value; }
public EnumField Clone() { EnumField e = new EnumField(); e.Name = Name; e.enumType = enumType; e.Caption = Caption; e.Description = Description; e.CustomColumnName = CustomColumnName; e.CustomPrivateName = CustomPrivateName; return(e); }
public int Add(EnumField value) { itemCount++; if (itemCount > items.GetUpperBound(0) + 1) { EnumField[] tempitems = new EnumField[itemCount * 2]; for (int x = 0; x <= items.GetUpperBound(0); x++) { tempitems[x] = items[x]; } items = tempitems; } items[itemCount - 1] = value; return(itemCount - 1); }
public void MoveDown(EnumField c) { int i = IndexOf(c); // Don't do anything if this field is already on bottom if (i == this.Count - 1) { return; } EnumField swap = items[i + 1]; items[i + 1] = c; items[i] = swap; }
public void MoveUp(EnumField c) { int i = IndexOf(c); // Don't do anything if this field is already on top if (i == 0) { return; } EnumField swap = items[i - 1]; items[i - 1] = c; items[i] = swap; }
public ClassFolder(XmlTextReader r, string version) : this() { if (r.Name != "ClassFolder") { throw new Exception(string.Format("Source file does not match NitroCast DTD; " + "expected 'ClassModel', found '{0}'.", r.Name)); } base.ParseXml(r); if (r.Name == "Builder") { ClassFolderBuilder.Builders.TryGetValue(r.ReadElementString("Builder"), out builder); } _isExpanded = bool.Parse(r.ReadElementString("IsExpanded")); _isItemListExpanded = bool.Parse(r.ReadElementString("IsItemListExpanded")); if (r.Name == "IsReadOnly") { _isReadOnly = bool.Parse(r.ReadElementString("IsReadOnly")); } else { _isReadOnly = false; } if (r.Name == "IsBrowsable") { _isBrowsable = bool.Parse(r.ReadElementString("IsBrowsable")); } else { _isBrowsable = true; } if (r.Name == "IsPartition") { _isPartition = bool.Parse(r.ReadElementString("IsPartition")); } else { _isPartition = false; } if (r.Name == "DataMode") { _dataMode = (ClassFolderDataMode)Enum.Parse(typeof(ClassFolderDataMode), r.ReadElementString("DataMode"), true); } else { _dataMode = ClassFolderDataMode.Integrated; } if (r.Name == "Items") { if (!r.IsEmptyElement) { r.Read(); while ((r.Name == "FieldEntry" | r.Name == "ChildEntry" | r.Name == "EnumField")) { //r.Read(); switch (r.LocalName) { case "FieldEntry": ValueField vf = new ValueField(r, version); vf.ParentFolder = this; items.Add(vf); break; case "ChildEntry": ReferenceField rf = new ReferenceField(r, version); rf.ParentFolder = this; items.Add(rf); break; case "EnumField": EnumField ef = new EnumField(r, version); ef.ParentFolder = this; items.Add(ef); break; } } r.ReadEndElement(); } else { r.Read(); } } if (r.Name == "Extensions") { if (!r.IsEmptyElement) { r.Read(); while (r.Name == "Extension") { ClassFolderExtension newExtension = (ClassFolderExtension) ObjectExtension.Build(r, version); extensions.Add(newExtension.GetType(), newExtension); r.ReadEndElement(); } r.ReadEndElement(); } else { r.Read(); } } r.ReadEndElement(); }
public bool Contains(EnumField value) { return(IndexOf(value) != -1); }
public int CompareTo(EnumField x) { return(Name.CompareTo(x.Name)); }