public void TestVersion(uint header, int version, GameVersion?expected) { var stream = new MemoryStream(4); var writer = new BinaryWriter(stream); writer.Write(header); writer.Write(version); stream.Position = 0; Assert.Equal(expected, SaveKh2.GetGameVersion(stream)); }
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(); }