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; } }); }
public void Dispose() { _loadOrder.Dispose(); _outputMod.WriteToBinary(_outputPath, new BinaryWriteParameters { MasterFlag = BinaryWriteParameters.MasterFlagOption.ExceptionOnMismatch }); }
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); }
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 }); }
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, }); }
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); }
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()) }); }); }
public void Dispose() { _loadOrder.Dispose(); _outputMod.WriteToBinary(_outputPath, Utils.SafeBinaryWriteParameters); }