public void TestWriteBackTheSameExactFile() => File.OpenRead(FilePath).Using(stream => Helpers.AssertStream(stream, inStream => { var save = SaveKh2.Read <SaveKh2.SaveFinalMix>(inStream); var outStream = new MemoryStream(); SaveKh2.Write(outStream, save); return(outStream); }));
public void OpenStream(Stream stream) { try { save = SaveKh2.Read(stream); RefreshUi(); } catch (NotImplementedException ex) { throw new SaveNotSupportedException(ex.Message); } }
public void OpenStream(Stream stream) { switch (SaveKh2.GetGameVersion(stream)) { case GameVersion.Japanese: throw new SaveNotSupportedException("Japanese save file is not yet supported."); case GameVersion.American: throw new SaveNotSupportedException("American or European save file is not yet supported."); case GameVersion.FinalMix: save = SaveKh2.Read <SaveKh2.SaveFinalMix>(stream); break; case null: throw new SaveNotSupportedException("An invalid version has been specified."); default: throw new SaveNotSupportedException("The version has been recognized but it is not supported."); } RefreshUi(); }