Ejemplo n.º 1
0
 public static SavegameFile Read(
     string path,
     IReadSavegameProgress progress = null)
 {
     if (progress != null)
     {
         progress.Report(true, true, 0, 0);
     }
     using (var compressedInputStream = File.OpenRead(path))
         using (var inputStream = ChunkedLz4File.Decompress(compressedInputStream))
             using (var reader = new BinaryReader(inputStream, Encoding.ASCII, true))
             {
                 var savegameFile = new SavegameFile();
                 savegameFile.ReadHeader(reader);
                 savegameFile.ReadFooter(reader);
                 savegameFile.ReadStringTable(reader);
                 savegameFile.ReadVariableTable(reader);
                 if (progress != null)
                 {
                     progress.Report(true, false, 0, savegameFile.VariableTableEntries.Length);
                 }
                 savegameFile.ReadVariables(reader, progress);
                 savegameFile.ReferenceVariable(reader, progress);
                 if (progress != null)
                 {
                     progress.Report(false, false, 0, 0);
                 }
                 return(savegameFile);
             }
 }
Ejemplo n.º 2
0
 public static SavegameFile Read(
     string path,
     IReadSavegameProgress progress = null)
 {
     if (progress != null) progress.Report(true, true, 0, 0);
     using (var compressedInputStream = File.OpenRead(path))
     using (var inputStream = ChunkedLz4File.Decompress(compressedInputStream))
     using (var reader = new BinaryReader(inputStream, Encoding.ASCII, true))
     {
         var savegameFile = new SavegameFile();
         savegameFile.ReadHeader(reader);
         savegameFile.ReadFooter(reader);
         savegameFile.ReadStringTable(reader);
         savegameFile.ReadVariableTable(reader);
         if (progress != null) progress.Report(true, false, 0, savegameFile.VariableTableEntries.Length);
         savegameFile.ReadVariables(reader, progress);
         savegameFile.ReferenceVariable(reader, progress);
         if (progress != null) progress.Report(false, false, 0, 0);
         return savegameFile;
     }
 }