public static SaveFile Load(Stream input) { SaveFile save = new SaveFile(); save.Version = input.ReadValueU32(); if (save.Version != 29) { throw new FormatException("todo: fix earlier save version support (not really important)"); } UnrealStream stream = new UnrealStream(input, true, save.Version); save.Serialize(stream); if (save.Version >= 27) { // sanity check, cos if we read a strange crc it'll break anyway if (input.Position != input.Length - 4) { throw new FormatException("bad checksum position"); } save.Checksum = input.ReadValueU32(); } // did we consume the entire save file? if (input.Position != input.Length) { throw new FormatException("did not consume entire file"); } return save; }
private void LoadSaveFromStream(Stream stream) { FileFormats.SaveFile saveFile = FileFormats.SaveFile.Load(stream); this.SaveFile = saveFile; this.UpdatePlotEditors(); }