예제 #1
0
        public override Record Deserialize(World input)
        {
            var record  = new Record(RecordName);
            var records = new MultipleRecords();

            if (input.GscFileName != null)
            {
                records.Records.Add(GscFile, RecordExtensions.GetSingleDataRecord(GscFile, input.GscFileName));
            }
            if (input.Administration.MultipleRecords != null)
            {
                records.AddMultipleRecords(Administration, input.Administration.MultipleRecords);
            }
            records.AddMixedDataRecord(MissionObjects, MissionObjectsSerializer.Deserialize(input.MissionObjects));
            records.AddMixedDataRecord(Patrols, PatrolsSerializer.Deserialize(input.Patrols));
            if (input.SpecialAreas.MultipleRecords != null)
            {
                records.AddMixedDataRecord(SpecialAreas, input.SpecialAreas.MultipleRecords);
            }
            if (input.SoundAreas.MultipleRecords != null)
            {
                records.AddMixedDataRecord(SoundAreas, input.SoundAreas.MultipleRecords);
            }
            record.Data = records;
            return(record);
        }
예제 #2
0
        public override World Serialize(Record record)
        {
            var multipleRecords = record.GetMultipleRecords();
            var world           = new World
            {
                GscFileName    = multipleRecords.GetStringValue(GscFile),
                Administration = new Administration(multipleRecords.GetMultipleRecord(Administration)),
                MissionObjects = MissionObjectsSerializer.Serialize(multipleRecords.GetRecord(MissionObjects)),
                SpecialAreas   = new SpecialAreas(multipleRecords.GetMixedDataRecordTemp(SpecialAreas)),
                SoundAreas     = new SoundAreas(multipleRecords.GetMixedDataRecordTemp(SoundAreas)),
            };
            var patrols = PatrolsSerializer.Serialize(multipleRecords.GetRecord(Patrols));

            foreach (var patrol in patrols)
            {
                world.Patrols.Add(patrol);
            }

            return(world);
        }