Пример #1
0
        /// <summary>
        /// Replace fields from another item
        /// </summary>
        /// <param name="item">DatItem to pull new information from</param>
        /// <param name="fields">List of Fields representing what should be updated</param>
        public override void ReplaceFields(DatItem item, List <Field> fields)
        {
            // Replace common fields first
            base.ReplaceFields(item, fields);

            // If we don't have a SlotOption to replace from, ignore specific fields
            if (item.ItemType != ItemType.SlotOption)
            {
                return;
            }

            // Cast for easier access
            SlotOption newItem = item as SlotOption;

            // Replace the fields
            if (fields.Contains(Field.DatItem_SlotOption_Name))
            {
                Name = newItem.Name;
            }

            if (fields.Contains(Field.DatItem_SlotOption_DeviceName))
            {
                DeviceName = newItem.DeviceName;
            }

            if (fields.Contains(Field.DatItem_SlotOption_Default))
            {
                Default = newItem.Default;
            }
        }
Пример #2
0
        public override bool Equals(DatItem other)
        {
            // If we don't have a SlotOption, return false
            if (ItemType != other.ItemType)
            {
                return(false);
            }

            // Otherwise, treat it as a SlotOption
            SlotOption newOther = other as SlotOption;

            // If the SlotOption information matches
            return(Name == newOther.Name &&
                   DeviceName == newOther.DeviceName &&
                   Default == newOther.Default);
        }