public void WriteData(GameDataSnapshot gameData) { string sectionId = info.sections.Count.ToString("D3"); using var zip = ZipFile; foreach (var(mapId, mapData) in gameData.mapData) { zip.AddEntry($"maps/{sectionId}_{mapId}_save", mapData); } foreach (var(mapId, mapCmdData) in gameData.mapCmds) { if (mapId >= 0) { zip.AddEntry($"maps/{sectionId}_{mapId}_cmds", SerializeCmds(mapCmdData)); } } if (gameData.mapCmds.TryGetValue(ScheduledCommand.Global, out var worldCmds)) { zip.AddEntry($"world/{sectionId}_cmds", SerializeCmds(worldCmds)); } zip.AddEntry($"world/{sectionId}_save", gameData.gameData); info.sections.Add(new ReplaySection(gameData.cachedAtTime, TickPatch.Timer)); zip.UpdateEntry("info", DirectXmlSaver.XElementFromObject(info, typeof(ReplayInfo)).ToString()); zip.Save(); }
public void WriteInfo() { using (var zip = ZipFile) { zip.UpdateEntry("info", DirectXmlSaver.XElementFromObject(info, typeof(ReplayInfo)).ToString()); zip.Save(); } }
public static void Save() { try { var xDocument = new XDocument(); var content = DirectXmlSaver.XElementFromObject(data, typeof(BadPeoplePerfsData)); xDocument.Add(content); xDocument.Save(prefsFilePath); } catch (Exception ex) { GenUI.ErrorDialog("ProblemSavingFile".Translate(prefsFilePath, ex.ToString())); Log.Error("Exception saving prefs: " + ex); } }
public static void Save() { try { XDocument xDocument = new XDocument(); XElement content = DirectXmlSaver.XElementFromObject(data, typeof(ConceptKnowledge)); xDocument.Add(content); xDocument.Save(GenFilePaths.ConceptKnowledgeFilePath); } catch (Exception ex) { GenUI.ErrorDialog("ProblemSavingFile".Translate(GenFilePaths.ConceptKnowledgeFilePath, ex.ToString())); Log.Error("Exception saving knowledge database: " + ex); } }
public static void Save() { Other.Tutorials.UpdateTutorialFlags(); try { var xDocument = new XDocument(); var content = DirectXmlSaver.XElementFromObject(data, typeof(PrisonLaborPrefsData)); xDocument.Add(content); xDocument.Save(prefsFilePath); } catch (Exception ex) { GenUI.ErrorDialog("ProblemSavingFile".Translate(prefsFilePath, ex.ToString())); Log.Error("Exception saving prefs: " + ex); } }