예제 #1
0
        public void Write_MasterListSync_Throw()
        {
            using var tmp = GetFile();
            var mod = new SkyrimMod(WriteKey, SkyrimRelease.SkyrimLE);

            mod.Weapons.RecordCache.Set(
                new Weapon(FormKey.Factory("012345:Skyrim.esm"), SkyrimRelease.SkyrimLE));
            Assert.Throws <RecordException>(
                () =>
            {
                try
                {
                    mod.WriteToBinary(
                        tmp.File.Path,
                        new BinaryWriteParameters()
                    {
                        ModKey             = BinaryWriteParameters.ModKeyOption.NoCheck,
                        MastersListContent = BinaryWriteParameters.MastersListContentOption.NoCheck,
                    });
                }
                catch (RecordException ex)
                {
                    Assert.IsType <ArgumentException>(ex.InnerException);
                    throw;
                }
            });
        }
예제 #2
0
 public void Dispose()
 {
     _loadOrder.Dispose();
     _outputMod.WriteToBinary(_outputPath, new BinaryWriteParameters
     {
         MasterFlag = BinaryWriteParameters.MasterFlagOption.ExceptionOnMismatch
     });
 }
예제 #3
0
        public static string CreateDummyPlugin(string folder, string fileName, Action <SkyrimMod> addRecords)
        {
            Directory.CreateDirectory(folder);
            var outputPath = Path.Combine(folder, fileName);

            var mod = new SkyrimMod(ModKey.FromNameAndExtension(fileName), SkyrimRelease.SkyrimSE);

            addRecords(mod);
            mod.WriteToBinary(outputPath, Utils.SafeBinaryWriteParameters);
            return(fileName);
        }
예제 #4
0
        public void BasicWrite()
        {
            using var tmp = GetFile();
            var mod  = new SkyrimMod(WriteKey, SkyrimRelease.SkyrimLE);
            var weap = mod.Weapons.AddNew();

            mod.WriteToBinary(
                tmp.File.Path,
                new BinaryWriteParameters()
            {
                ModKey             = BinaryWriteParameters.ModKeyOption.NoCheck,
                MastersListContent = BinaryWriteParameters.MastersListContentOption.NoCheck
            });
        }
예제 #5
0
        public void Write_MasterListSync()
        {
            using var tmp = GetFile();
            var mod = new SkyrimMod(WriteKey, SkyrimRelease.SkyrimLE);

            mod.Weapons.RecordCache.Set(
                new Weapon(FormKey.Factory("012345:Skyrim.esm"), SkyrimRelease.SkyrimLE));
            mod.WriteToBinary(
                tmp.File.Path,
                new BinaryWriteParameters()
            {
                ModKey             = BinaryWriteParameters.ModKeyOption.NoCheck,
                MastersListContent = BinaryWriteParameters.MastersListContentOption.Iterate,
            });
        }
예제 #6
0
        public static string CreateDummyPlugin(string folder, string fileName, Action <SkyrimMod> addRecords)
        {
            Directory.CreateDirectory(folder);
            var outputPath = Path.Combine(folder, fileName);

            var mod = new SkyrimMod(ModKey.FromNameAndExtension(fileName), SkyrimRelease.SkyrimSE);

            addRecords(mod);
            mod.WriteToBinary(outputPath, new BinaryWriteParameters
            {
                MasterFlag  = BinaryWriteParameters.MasterFlagOption.ExceptionOnMismatch,
                RecordCount = BinaryWriteParameters.RecordCountOption.Iterate
            });
            return(fileName);
        }
예제 #7
0
        public void Write_ModNotOnLoadOrder()
        {
            using var tmp = GetFile();
            var mod = new SkyrimMod(WriteKey, SkyrimRelease.SkyrimLE);

            mod.Weapons.RecordCache.Set(
                new Weapon(FormKey.Factory("012345:Skyrim.esm"), SkyrimRelease.SkyrimLE));
            mod.Weapons.RecordCache.Set(
                new Weapon(FormKey.Factory("012345:SomeOtherMod.esp"), SkyrimRelease.SkyrimLE));
            Assert.Throws <MissingModException>(() =>
            {
                mod.WriteToBinary(
                    tmp.File,
                    new BinaryWriteParameters()
                {
                    ModKey              = BinaryWriteParameters.ModKeyOption.NoCheck,
                    MastersListContent  = BinaryWriteParameters.MastersListContentOption.Iterate,
                    MastersListOrdering = new BinaryWriteParameters.MastersListOrderingByLoadOrder(
                        Skyrim.Constants.Skyrim.AsEnumerable())
                });
            });
        }
예제 #8
0
 public void Dispose()
 {
     _loadOrder.Dispose();
     _outputMod.WriteToBinary(_outputPath, Utils.SafeBinaryWriteParameters);
 }