public void TestWriteWithoutChanges(string filePath) => File.OpenRead(filePath).Using(stream => { var mem = new MemoryStream((int)stream.Length); SaveKh3.Read(stream).Write(mem); AssertSaveGame(SaveKh3.Read(mem.SetPosition(0))); });
public void TestWriteWithChanges(string filePath) { MemoryStream mem = null; File.OpenRead(filePath).Using(stream => { var tempSave = SaveKh3.Read(stream); tempSave.TotalExp = 1234; tempSave.Difficulty = DifficultyType.Normal; tempSave.GameTime = new TimeSpan(12, 34, 56); tempSave.MapPath = "TestPath"; tempSave.Shortcuts[0].Triangle = CommandType.SeaBlizzard; tempSave.Magics[0] = CommandType.SeaFire; mem = new MemoryStream((int)stream.Length); tempSave.Write(mem); }); var save = SaveKh3.Read(mem.SetPosition(0)); Assert.Equal(1234, save.TotalExp); Assert.Equal(DifficultyType.Normal, save.Difficulty); Assert.Equal(new TimeSpan(12, 34, 56), save.GameTime); Assert.Equal("TestPath", save.MapPath); Assert.Equal(CommandType.SeaBlizzard, save.Shortcuts[0].Triangle); Assert.Equal(CommandType.SeaFire, save.Magics[0]); }
public void ReadDlcFieldsFor109() { var save = File.OpenRead(File109Path).Using(stream => SaveKh3.Read(stream)); Assert.Equal("/Game/Levels/rg_DLC/rg_03/rg_03", save.DlcMapPath); Assert.Equal("rg_03_Lv_Start_01", save.DlcSpawnPoint); }
public Kh3Test() { using (var stream = File.OpenRead(FilePath)) { save = SaveKh3.Read(stream); } }
public void IgnoreDlcFieldsFor100() { var save = File.OpenRead(FilePath).Using(stream => SaveKh3.Read(stream)); save.DlcMapPath = "DlcMapPath"; save.DlcSpawnPoint = "DlcSpawnPoint"; Assert.Equal(string.Empty, save.DlcMapPath); Assert.Equal(string.Empty, save.DlcSpawnPoint); }
public void TestWriteWithoutChanges() { var mem = new MemoryStream(9758960); save.Write(mem); mem.Position = 0; save = SaveKh3.Read(mem); TestRead(); }
public void TestWriteWithChanges() { save.TotalExp = 1234; save.Difficulty = DifficultyType.Normal; save.GameTime = new TimeSpan(12, 34, 56); save.MapPath = "TestPath"; save.Shortcuts[0].Triangle = CommandType.SeaBlizzard; save.Magics[0] = CommandType.SeaFire; var mem = new MemoryStream(9758960); save.Write(mem); mem.Position = 0; var save2 = SaveKh3.Read(mem); Assert.Equal(1234, save2.TotalExp); Assert.Equal(DifficultyType.Normal, save2.Difficulty); Assert.Equal(new TimeSpan(12, 34, 56), save2.GameTime); Assert.Equal("TestPath", save2.MapPath); Assert.Equal(CommandType.SeaBlizzard, save2.Shortcuts[0].Triangle); Assert.Equal(CommandType.SeaFire, save2.Magics[0]); }
public void OpenStream(Stream stream) { Save = SaveKh3.Read(stream); RefreshUi(); }
public Kh3ViewModel(Stream stream) { Save = SaveKh3.Read(stream); RefreshUi(); }
public void ReadSaveTest(string filePath) => File.OpenRead(filePath).Using(stream => AssertSaveGame(SaveKh3.Read(stream)));