상속: BioStateEventMap
        public static BinaryBioStateEventMap Load(Stream stream)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            using (var reader = new BioStateEventMapReader(stream))
            {
                var map = new BinaryBioStateEventMap();

                var eventsCount = reader.ReadInt32();
                map.StateEvents = new Dictionary <int, BioStateEvent>();

                for (var i = 0; i < eventsCount; i++)
                {
                    var id         = reader.ReadInt32();
                    var stateEvent = reader.ReadStateEvent();

                    if (!map.StateEvents.ContainsKey(id))
                    {
                        map.StateEvents.Add(id, stateEvent);
                    }
                    else
                    {
                        map.StateEvents[id] = stateEvent;
                    }
                }

                return(map);
            }
        }
		public static BinaryBioStateEventMap Load(Stream stream)
		{
			if (stream == null)
			{
				throw new ArgumentNullException(nameof(stream));
			}

			using (var reader = new BioStateEventMapReader(stream))
			{
				var map = new BinaryBioStateEventMap();

				var eventsCount = reader.ReadInt32();
				map.StateEvents = new Dictionary<int, BioStateEvent>();

				for (var i = 0; i < eventsCount; i++)
				{
					var id = reader.ReadInt32();
					var stateEvent = reader.ReadStateEvent();

					if (!map.StateEvents.ContainsKey(id))
					{
						map.StateEvents.Add(id, stateEvent);
					}
					else
					{
						map.StateEvents[id] = stateEvent;
					}
				}

				return map;
			}
		}
예제 #3
0
        public void SaveFile()
        {
            if (pcc == null)
            {
                return;
            }

            if (CodexMapControl != null)
            {
                IExportEntry export;
                int dataOffset;

                if (CodexMapView.TryFindCodexMap(pcc, out export, out dataOffset))
                {
                    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)
            {
                IExportEntry export;
                int dataOffset;

                if (QuestMapControl.TryFindQuestMap(pcc, out export, out dataOffset))
                {
                    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)
            {
                IExportEntry export;
                int dataOffset;

                if (StateEventMapControl.TryFindStateEventMap(pcc, out export, out dataOffset))
                {
                    using (var stream = new MemoryStream())
                    {
                        var stateEventMap = StateEventMapControl.ToStateEventMap();
                        var binaryStateEventMap = new BinaryBioStateEventMap(stateEventMap.StateEvents);

                        binaryStateEventMap.Save(stream);

                        export.setBinaryData(stream.ToArray());
                    }
                }
            }

            pcc.save(FileName);
        }