public void LoadFile(string path) { if (path == null) { throw new ArgumentNullException(nameof(path)); } if (!File.Exists(path)) { return; } LoadMEPackage(path); CodexMapControl?.Open(Pcc); QuestMapControl?.Open(Pcc); StateEventMapControl?.Open(Pcc); AddRecent(path, false); SaveRecentList(); RefreshRecent(true, RFiles); Title = $"Plot Editor - {path}"; OnPropertyChanged(nameof(CurrentFile)); //Hiding "Recents" panel if (MainTabControl.SelectedIndex == 0) { MainTabControl.SelectedIndex = 1; } }
public void OpenPccFile(string path) { if (path == null) { throw new ArgumentNullException(nameof(path)); } if (!File.Exists(path)) { return; } FileName = path; LoadME3Package(path); if (CodexMapControl != null) { CodexMapControl.Open(pcc); } if (QuestMapControl != null) { QuestMapControl.Open(pcc); } if (StateEventMapControl != null) { StateEventMapControl.Open(pcc); } }
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); }