示例#1
0
 public override void DeepCopyIn(
     IMajorRecord item,
     IMajorRecordGetter rhs,
     ErrorMaskBuilder?errorMask,
     TranslationCrystal?copyMask,
     bool deepCopy)
 {
     this.DeepCopyIn(
         item: (IGameSetting)item,
         rhs: (IGameSettingGetter)rhs,
         errorMask: errorMask,
         copyMask: copyMask,
         deepCopy: deepCopy);
 }
 public override void DeepCopyIn(
     IMajorRecord item,
     IMajorRecordGetter rhs,
     ErrorMaskBuilder?errorMask,
     TranslationCrystal?copyMask,
     bool deepCopy)
 {
     this.DeepCopyIn(
         item: (IActorValueInformation)item,
         rhs: (IActorValueInformationGetter)rhs,
         errorMask: errorMask,
         copyMask: copyMask,
         deepCopy: deepCopy);
 }
示例#3
0
        private TMajor ConfirmCorrectType(IMajorRecord record, string paramName)
        {
            if (record == null)
            {
                throw new ArgumentNullException(paramName);
            }
            if (record is not TMajor cast)
            {
                throw new ArgumentException(
                          $"A record was added of the wrong type.  Expected {typeof(TMajor)}, but was given {record.GetType()}",
                          paramName);
            }

            return(cast);
        }
示例#4
0
        public void DisableAPI()
        {
            // Some calls assuring the Disable() API is accessible and working.
            SkyrimMod    sourceMod    = new SkyrimMod(TestConstants.PluginModKey, SkyrimRelease.SkyrimSE);
            FormKey      key          = sourceMod.GetNextFormKey();
            PlacedObject placedObject = new PlacedObject(key, SkyrimRelease.SkyrimSE);

            // Simplistic Disable access and verification.
            PlacedObject disabledObj = placedObject;

            disabledObj.Disable();
            //_testOutputHelper.WriteLine($"{disabledPlacedObject.MajorRecordFlagsRaw}");
            Assert.True(EnumExt.HasFlag(disabledObj.MajorRecordFlagsRaw, Constants.InitiallyDisabled));
            MajorRecord majorRecord = placedObject;

            majorRecord.Disable();
            Assert.True(EnumExt.HasFlag(majorRecord.MajorRecordFlagsRaw, Constants.InitiallyDisabled));
            IMajorRecord interfaceRecord = placedObject;

            interfaceRecord.Disable();
            Assert.True(EnumExt.HasFlag(interfaceRecord.MajorRecordFlagsRaw, Constants.InitiallyDisabled));
            IPlaced interfacePlaced = placedObject;

            interfacePlaced.Disable();
            Assert.True(EnumExt.HasFlag(interfacePlaced.MajorRecordFlagsRaw, Constants.InitiallyDisabled));

            // Sanity test both API are invokable under Placed context.
            PlacedTrap placedTrap = new PlacedTrap(key, SkyrimRelease.SkyrimSE);

            placedTrap.Disable(IPlaced.DisableType.DisableWithoutZOffset);
            interfacePlaced = placedTrap;
            interfacePlaced.Disable(IPlaced.DisableType.JustInitiallyDisabled);
            IPlaced abstractPlaced = placedTrap;

            abstractPlaced.Disable();
            abstractPlaced.Disable(IPlaced.DisableType.SafeDisable);

            //Try any other object other than Placed (invoke MajorRecord.Disable() and see if it works)
            var armor = new Armor(key, SkyrimRelease.SkyrimSE);

            armor.Disable();
            Assert.True(EnumExt.HasFlag(armor.MajorRecordFlagsRaw, Constants.InitiallyDisabled));
        }
示例#5
0
 /// <inheritdoc />
 public void SetUntyped(IMajorRecord record) => Set(ConfirmCorrectType(record, nameof(record)));
示例#6
0
 public void AddUntyped(IMajorRecord record)
 {
     Add(ConfirmCorrectType(record, nameof(record)));
 }
 public static void SetEditorID(this IMajorRecord rec, string id, IMajorRecordGetter mr)
 {
     rec.EditorID = id.Replace(" ", "") + mr.FormKey.ToString().Replace(":", "");
 }