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);

            ConsequenceMapControl?.Open(Pcc, "ConsequenceMap");

            RecentsController.AddRecent(path, false);
            RecentsController.SaveRecentList(true);
            Title = $"Plot Editor - {path}";
            OnPropertyChanged(nameof(CurrentFile));

            //Hiding "Recents" panel
            if (MainTabControl.SelectedIndex == 0)
            {
                MainTabControl.SelectedIndex = 1;
            }
        }
 public void GoToStateEvent(KeyValuePair <int, BioStateEvent> targetEvent)
 {
     if ((bool)ConsequenceMapControl?.StateEvents.Contains(targetEvent))
     {
         MainTabControl.SelectedValue = ConsequenceMapControl;
         ConsequenceMapControl.SelectStateEvent(targetEvent);
     }
     else
     {
         MainTabControl.SelectedValue = StateEventMapControl;
         StateEventMapControl.SelectStateEvent(targetEvent);
     }
 }
        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);
        }