public void SaveFile() { if (Pcc == null) { return; } if (CodexMapControl != null) { if (CodexMapView.TryFindCodexMap(Pcc, out IExportEntry export, out int _)) { using (var stream = new MemoryStream()) { var codexMap = CodexMapControl.ToCodexMap(); var binaryCodexMap = new BinaryBioCodexMap(codexMap.Sections, codexMap.Pages); binaryCodexMap.Save(stream); export.setBinaryData(stream.ToArray()); } } } if (QuestMapControl != null) { if (QuestMapControl.TryFindQuestMap(Pcc, out IExportEntry export, out int _)) { using (var stream = new MemoryStream()) { var questMap = QuestMapControl.ToQuestMap(); var binaryQuestMap = new BinaryBioQuestMap(questMap.Quests, questMap.BoolTaskEvals, questMap.IntTaskEvals, questMap.FloatTaskEvals); binaryQuestMap.Save(stream); export.setBinaryData(stream.ToArray()); } } } if (StateEventMapControl != null) { if (StateEventMapView.TryFindStateEventMap(Pcc, out IExportEntry export)) { using (var stream = new MemoryStream()) { var stateEventMap = StateEventMapControl.ToStateEventMap(); var binaryStateEventMap = new BinaryBioStateEventMap(stateEventMap.StateEvents); binaryStateEventMap.Save(stream); export.setBinaryData(stream.ToArray()); } } } Pcc.save(); }
public void SaveFile(string filepath = null) { if (Pcc == null) { return; } if (CodexMapControl != null) { if (CodexMapView.TryFindCodexMap(Pcc, out ExportEntry export, out int _)) { using (var stream = new MemoryStream()) { var codexMap = CodexMapControl.ToCodexMap(); var binaryCodexMap = new BinaryBioCodexMap(codexMap.Sections, codexMap.Pages); binaryCodexMap.Save(stream); export.WriteBinary(stream.ToArray()); } } } if (QuestMapControl != null) { if (QuestMapControl.TryFindQuestMap(Pcc, out ExportEntry export, out int _)) { using (var stream = new MemoryStream()) { var questMap = QuestMapControl.ToQuestMap(); var binaryQuestMap = new BinaryBioQuestMap(questMap.Quests, questMap.BoolTaskEvals, questMap.IntTaskEvals, questMap.FloatTaskEvals); binaryQuestMap.Save(stream); export.WriteBinary(stream.ToArray()); } } } if (StateEventMapControl != null) { if (StateEventMapView.TryFindStateEventMap(Pcc, out ExportEntry export)) { using (var stream = new MemoryStream()) { var stateEventMap = StateEventMapControl.ToStateEventMap(); var binaryStateEventMap = new BinaryBioStateEventMap(stateEventMap.StateEvents); binaryStateEventMap.Save(stream); export.WriteBinary(stream.ToArray()); } } } if (ConsequenceMapControl != null) { if (StateEventMapView.TryFindStateEventMap(Pcc, out ExportEntry export, "ConsequenceMap")) { using (var stream = new MemoryStream()) { var consequenceMap = ConsequenceMapControl.ToStateEventMap(); var binaryConsequenceMap = new BinaryBioStateEventMap(consequenceMap.StateEvents); binaryConsequenceMap.Save(stream); export.WriteBinary(stream.ToArray()); } } } if (filepath == null) { filepath = Pcc.FilePath; } Pcc.Save(filepath); }
public void SaveFile() { if (PccPackage == null) { return; } if (CodexMapViewModel != null) { int exportIndex; int dataOffset; if (CodexMapViewModel.TryFindCodexMap(PccPackage, out exportIndex, out dataOffset)) { var mapData = PccPackage.Exports[exportIndex].Data; byte[] bytes; using (var stream = new MemoryStream()) { var codexMap = CodexMapViewModel.ToCodexMap(); var binaryCodexMap = new BinaryBioCodexMap(codexMap.Sections, codexMap.Pages); binaryCodexMap.Save(stream); bytes = stream.ToArray(); } Array.Resize(ref mapData, dataOffset + bytes.Length); bytes.CopyTo(mapData, dataOffset); var temp = PccPackage.Exports[exportIndex]; Array.Resize(ref temp.Data, mapData.Length); mapData.CopyTo(temp.Data, 0); PccPackage.Exports[exportIndex] = temp; } } if (QuestMapViewModel != null) { int exportIndex; int dataOffset; if (QuestMapViewModel.TryFindQuestMap(PccPackage, out exportIndex, out dataOffset)) { var mapData = PccPackage.Exports[exportIndex].Data; byte[] bytes; using (var stream = new MemoryStream()) { var questMap = QuestMapViewModel.ToQuestMap(); var binaryQuestMap = new BinaryBioQuestMap(questMap.Quests, questMap.BoolTaskEvals, questMap.IntTaskEvals, questMap.FloatTaskEvals); binaryQuestMap.Save(stream); bytes = stream.ToArray(); } Array.Resize(ref mapData, dataOffset + bytes.Length); bytes.CopyTo(mapData, dataOffset); var temp = PccPackage.Exports[exportIndex]; Array.Resize(ref temp.Data, mapData.Length); mapData.CopyTo(temp.Data, 0); PccPackage.Exports[exportIndex] = temp; } } if (StateEventMapViewModel != null) { int exportIndex; int dataOffset; if (StateEventMapViewModel.TryFindStateEventMap(PccPackage, out exportIndex, out dataOffset)) { var mapData = PccPackage.Exports[exportIndex].Data; byte[] bytes; using (var stream = new MemoryStream()) { var stateEventMap = StateEventMapViewModel.ToStateEventMap(); var binaryStateEventMap = new BinaryBioStateEventMap(stateEventMap.StateEvents); binaryStateEventMap.Save(stream); bytes = stream.ToArray(); } Array.Resize(ref mapData, dataOffset + bytes.Length); bytes.CopyTo(mapData, dataOffset); var temp = PccPackage.Exports[exportIndex]; Array.Resize(ref temp.Data, mapData.Length); mapData.CopyTo(temp.Data, 0); PccPackage.Exports[exportIndex] = temp; } } PccPackage.Save(FileName); }