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();
        }
示例#2
0
        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);
        }