Пример #1
0
            public override void Add(Type elementType)
            {
                if (elementType.IsAbstract)
                {
                    throw new ArgumentException("Must pass a concrete element type.", "elementType");
                }

                if (!typeof(ComponentDataType).IsAssignableFrom(elementType))
                {
                    throw new ArgumentException("The element type must belong to the generic type of the list.", "elementType");
                }

                ComponentDataType newElement;

                if (elementType == typeof(CDTResourceKey))
                {
                    newElement = new CDTResourceKey(0, elementHandler, _ParentTGIBlocks);
                }
                else if (elementType == typeof(CDTAssetResourceName))
                {
                    newElement = new CDTAssetResourceName(0, elementHandler, _ParentTGIBlocks);
                }
                else
                {
                    newElement = Activator.CreateInstance(elementType, new object[] { (int)0, elementHandler, }) as ComponentDataType;
                }
                base.Add(newElement);
            }
Пример #2
0
            public override int CompareTo(ComponentDataType other)
            {
                if (this.GetType() != other.GetType())
                {
                    return(-1);
                }
                CDTResourceKey oth = (CDTResourceKey)other;
                int            res = key.CompareTo(oth.key); if (res != 0)

                {
                    return(res);
                }

                res = controlCode.CompareTo(oth.controlCode); if (res != 0)
                {
                    return(res);
                }
                return(data.CompareTo(oth.data));
            }
Пример #3
0
 public CDTResourceKey(int APIversion, EventHandler handler, CDTResourceKey basis, DependentList <TGIBlock> ParentTGIBlocks = null)
     : this(APIversion, handler, basis.key, basis.controlCode, basis.data, ParentTGIBlocks ?? basis.ParentTGIBlocks)
 {
 }