Example #1
0
        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);
        }));
Example #2
0
 public void OpenStream(Stream stream)
 {
     try
     {
         save = SaveKh2.Read(stream);
         RefreshUi();
     }
     catch (NotImplementedException ex)
     {
         throw new SaveNotSupportedException(ex.Message);
     }
 }
Example #3
0
        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();
        }