Example #1
0
        public override void ReadDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (ele.TryPathTo("EditorID", false, out subEle))
            {
                if (EditorID == null)
                {
                    EditorID = new SimpleSubrecord <String>();
                }

                EditorID.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Name", false, out subEle))
            {
                if (Name == null)
                {
                    Name = new SimpleSubrecord <String>();
                }

                Name.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("CellFlags", false, out subEle))
            {
                if (CellFlags == null)
                {
                    CellFlags = new SimpleSubrecord <CellFlags>();
                }

                CellFlags.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Grid", false, out subEle))
            {
                if (Grid == null)
                {
                    Grid = new CellGrid();
                }

                Grid.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Lighting", false, out subEle))
            {
                if (Lighting == null)
                {
                    Lighting = new CellLighting();
                }

                Lighting.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("FootstepMaterial", false, out subEle))
            {
                if (FootstepMaterial == null)
                {
                    FootstepMaterial = new FootstepMaterial();
                }

                FootstepMaterial.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("LightTemplate", false, out subEle))
            {
                if (LightTemplate == null)
                {
                    LightTemplate = new RecordReference();
                }

                LightTemplate.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("LightTemplateInherit", false, out subEle))
            {
                if (LightTemplateInherit == null)
                {
                    LightTemplateInherit = new SimpleSubrecord <LightTemplateInheritFlags>();
                }

                LightTemplateInherit.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("WaterHeight", false, out subEle))
            {
                if (WaterHeight == null)
                {
                    WaterHeight = new SimpleSubrecord <Single>();
                }

                WaterHeight.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("WaterNoiseTexture", false, out subEle))
            {
                if (WaterNoiseTexture == null)
                {
                    WaterNoiseTexture = new SimpleSubrecord <String>();
                }

                WaterNoiseTexture.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Regions", false, out subEle))
            {
                if (Regions == null)
                {
                    Regions = new SortedFormArray();
                }

                Regions.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("ImageSpace", false, out subEle))
            {
                if (ImageSpace == null)
                {
                    ImageSpace = new RecordReference();
                }

                ImageSpace.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Unknown", false, out subEle))
            {
                if (Unknown == null)
                {
                    Unknown = new SimpleSubrecord <Byte>();
                }

                Unknown.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("EncounterZone", false, out subEle))
            {
                if (EncounterZone == null)
                {
                    EncounterZone = new RecordReference();
                }

                EncounterZone.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Climate", false, out subEle))
            {
                if (Climate == null)
                {
                    Climate = new RecordReference();
                }

                Climate.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Water", false, out subEle))
            {
                if (Water == null)
                {
                    Water = new RecordReference();
                }

                Water.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Owner", false, out subEle))
            {
                if (Owner == null)
                {
                    Owner = new RecordReference();
                }

                Owner.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("FactionRank", false, out subEle))
            {
                if (FactionRank == null)
                {
                    FactionRank = new SimpleSubrecord <Int32>();
                }

                FactionRank.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("AcousticSpace", false, out subEle))
            {
                if (AcousticSpace == null)
                {
                    AcousticSpace = new RecordReference();
                }

                AcousticSpace.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Unused", false, out subEle))
            {
                if (Unused == null)
                {
                    Unused = new SimpleSubrecord <Byte>();
                }

                Unused.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("MusicType", false, out subEle))
            {
                if (MusicType == null)
                {
                    MusicType = new RecordReference();
                }

                MusicType.ReadXML(subEle, master);
            }
        }
Example #2
0
 public override void WriteData(ESPWriter writer)
 {
     if (EditorID != null)
     {
         EditorID.WriteBinary(writer);
     }
     if (Name != null)
     {
         Name.WriteBinary(writer);
     }
     if (CellFlags != null)
     {
         CellFlags.WriteBinary(writer);
     }
     if (Grid != null)
     {
         Grid.WriteBinary(writer);
     }
     if (Lighting != null)
     {
         Lighting.WriteBinary(writer);
     }
     if (FootstepMaterial != null)
     {
         FootstepMaterial.WriteBinary(writer);
     }
     if (LightTemplate != null)
     {
         LightTemplate.WriteBinary(writer);
     }
     if (LightTemplateInherit != null)
     {
         LightTemplateInherit.WriteBinary(writer);
     }
     if (WaterHeight != null)
     {
         WaterHeight.WriteBinary(writer);
     }
     if (WaterNoiseTexture != null)
     {
         WaterNoiseTexture.WriteBinary(writer);
     }
     if (Regions != null)
     {
         Regions.WriteBinary(writer);
     }
     if (ImageSpace != null)
     {
         ImageSpace.WriteBinary(writer);
     }
     if (Unknown != null)
     {
         Unknown.WriteBinary(writer);
     }
     if (EncounterZone != null)
     {
         EncounterZone.WriteBinary(writer);
     }
     if (Climate != null)
     {
         Climate.WriteBinary(writer);
     }
     if (Water != null)
     {
         Water.WriteBinary(writer);
     }
     if (Owner != null)
     {
         Owner.WriteBinary(writer);
     }
     if (FactionRank != null)
     {
         FactionRank.WriteBinary(writer);
     }
     if (AcousticSpace != null)
     {
         AcousticSpace.WriteBinary(writer);
     }
     if (Unused != null)
     {
         Unused.WriteBinary(writer);
     }
     if (MusicType != null)
     {
         MusicType.WriteBinary(writer);
     }
 }
Example #3
0
        public override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (EditorID != null)
            {
                ele.TryPathTo("EditorID", true, out subEle);
                EditorID.WriteXML(subEle, master);
            }
            if (Name != null)
            {
                ele.TryPathTo("Name", true, out subEle);
                Name.WriteXML(subEle, master);
            }
            if (CellFlags != null)
            {
                ele.TryPathTo("CellFlags", true, out subEle);
                CellFlags.WriteXML(subEle, master);
            }
            if (Grid != null)
            {
                ele.TryPathTo("Grid", true, out subEle);
                Grid.WriteXML(subEle, master);
            }
            if (Lighting != null)
            {
                ele.TryPathTo("Lighting", true, out subEle);
                Lighting.WriteXML(subEle, master);
            }
            if (FootstepMaterial != null)
            {
                ele.TryPathTo("FootstepMaterial", true, out subEle);
                FootstepMaterial.WriteXML(subEle, master);
            }
            if (LightTemplate != null)
            {
                ele.TryPathTo("LightTemplate", true, out subEle);
                LightTemplate.WriteXML(subEle, master);
            }
            if (LightTemplateInherit != null)
            {
                ele.TryPathTo("LightTemplateInherit", true, out subEle);
                LightTemplateInherit.WriteXML(subEle, master);
            }
            if (WaterHeight != null)
            {
                ele.TryPathTo("WaterHeight", true, out subEle);
                WaterHeight.WriteXML(subEle, master);
            }
            if (WaterNoiseTexture != null)
            {
                ele.TryPathTo("WaterNoiseTexture", true, out subEle);
                WaterNoiseTexture.WriteXML(subEle, master);
            }
            if (Regions != null)
            {
                ele.TryPathTo("Regions", true, out subEle);
                Regions.WriteXML(subEle, master);
            }
            if (ImageSpace != null)
            {
                ele.TryPathTo("ImageSpace", true, out subEle);
                ImageSpace.WriteXML(subEle, master);
            }
            if (Unknown != null)
            {
                ele.TryPathTo("Unknown", true, out subEle);
                Unknown.WriteXML(subEle, master);
            }
            if (EncounterZone != null)
            {
                ele.TryPathTo("EncounterZone", true, out subEle);
                EncounterZone.WriteXML(subEle, master);
            }
            if (Climate != null)
            {
                ele.TryPathTo("Climate", true, out subEle);
                Climate.WriteXML(subEle, master);
            }
            if (Water != null)
            {
                ele.TryPathTo("Water", true, out subEle);
                Water.WriteXML(subEle, master);
            }
            if (Owner != null)
            {
                ele.TryPathTo("Owner", true, out subEle);
                Owner.WriteXML(subEle, master);
            }
            if (FactionRank != null)
            {
                ele.TryPathTo("FactionRank", true, out subEle);
                FactionRank.WriteXML(subEle, master);
            }
            if (AcousticSpace != null)
            {
                ele.TryPathTo("AcousticSpace", true, out subEle);
                AcousticSpace.WriteXML(subEle, master);
            }
            if (Unused != null)
            {
                ele.TryPathTo("Unused", true, out subEle);
                Unused.WriteXML(subEle, master);
            }
            if (MusicType != null)
            {
                ele.TryPathTo("MusicType", true, out subEle);
                MusicType.WriteXML(subEle, master);
            }
        }
Example #4
0
        public override void ReadData(ESPReader reader, long dataEnd)
        {
            while (reader.BaseStream.Position < dataEnd)
            {
                string subTag = reader.PeekTag();

                switch (subTag)
                {
                case "EDID":
                    if (EditorID == null)
                    {
                        EditorID = new SimpleSubrecord <String>();
                    }

                    EditorID.ReadBinary(reader);
                    break;

                case "FULL":
                    if (Name == null)
                    {
                        Name = new SimpleSubrecord <String>();
                    }

                    Name.ReadBinary(reader);
                    break;

                case "DATA":
                    if (CellFlags == null)
                    {
                        CellFlags = new SimpleSubrecord <CellFlags>();
                    }

                    CellFlags.ReadBinary(reader);
                    break;

                case "XCLC":
                    if (Grid == null)
                    {
                        Grid = new CellGrid();
                    }

                    Grid.ReadBinary(reader);
                    break;

                case "XCLL":
                    if (Lighting == null)
                    {
                        Lighting = new CellLighting();
                    }

                    Lighting.ReadBinary(reader);
                    break;

                case "IMPF":
                    if (FootstepMaterial == null)
                    {
                        FootstepMaterial = new FootstepMaterial();
                    }

                    FootstepMaterial.ReadBinary(reader);
                    break;

                case "LTMP":
                    if (LightTemplate == null)
                    {
                        LightTemplate = new RecordReference();
                    }

                    LightTemplate.ReadBinary(reader);
                    break;

                case "LNAM":
                    if (LightTemplateInherit == null)
                    {
                        LightTemplateInherit = new SimpleSubrecord <LightTemplateInheritFlags>();
                    }

                    LightTemplateInherit.ReadBinary(reader);
                    break;

                case "XCLW":
                    if (WaterHeight == null)
                    {
                        WaterHeight = new SimpleSubrecord <Single>();
                    }

                    WaterHeight.ReadBinary(reader);
                    break;

                case "XNAM":
                    if (WaterNoiseTexture == null)
                    {
                        WaterNoiseTexture = new SimpleSubrecord <String>();
                    }

                    WaterNoiseTexture.ReadBinary(reader);
                    break;

                case "XCLR":
                    if (Regions == null)
                    {
                        Regions = new SortedFormArray();
                    }

                    Regions.ReadBinary(reader);
                    break;

                case "XCIM":
                    if (ImageSpace == null)
                    {
                        ImageSpace = new RecordReference();
                    }

                    ImageSpace.ReadBinary(reader);
                    break;

                case "XCET":
                    if (Unknown == null)
                    {
                        Unknown = new SimpleSubrecord <Byte>();
                    }

                    Unknown.ReadBinary(reader);
                    break;

                case "XEZN":
                    if (EncounterZone == null)
                    {
                        EncounterZone = new RecordReference();
                    }

                    EncounterZone.ReadBinary(reader);
                    break;

                case "XCCM":
                    if (Climate == null)
                    {
                        Climate = new RecordReference();
                    }

                    Climate.ReadBinary(reader);
                    break;

                case "XCWT":
                    if (Water == null)
                    {
                        Water = new RecordReference();
                    }

                    Water.ReadBinary(reader);
                    break;

                case "XOWN":
                    if (Owner == null)
                    {
                        Owner = new RecordReference();
                    }

                    Owner.ReadBinary(reader);
                    break;

                case "XRNK":
                    if (FactionRank == null)
                    {
                        FactionRank = new SimpleSubrecord <Int32>();
                    }

                    FactionRank.ReadBinary(reader);
                    break;

                case "XCAS":
                    if (AcousticSpace == null)
                    {
                        AcousticSpace = new RecordReference();
                    }

                    AcousticSpace.ReadBinary(reader);
                    break;

                case "XCMT":
                    if (Unused == null)
                    {
                        Unused = new SimpleSubrecord <Byte>();
                    }

                    Unused.ReadBinary(reader);
                    break;

                case "XCMO":
                    if (MusicType == null)
                    {
                        MusicType = new RecordReference();
                    }

                    MusicType.ReadBinary(reader);
                    break;

                default:
                    throw new Exception();
                }
            }
        }
        public override void ReadDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (ele.TryPathTo("EditorID", false, out subEle))
            {
                if (EditorID == null)
                {
                    EditorID = new SimpleSubrecord <String>();
                }

                EditorID.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Name", false, out subEle))
            {
                if (Name == null)
                {
                    Name = new SimpleSubrecord <String>();
                }

                Name.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("EncounterZone", false, out subEle))
            {
                if (EncounterZone == null)
                {
                    EncounterZone = new RecordReference();
                }

                EncounterZone.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("ParentWorldspace", false, out subEle))
            {
                if (ParentWorldspace == null)
                {
                    ParentWorldspace = new RecordReference();
                }

                ParentWorldspace.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("ParentWorldspaceFlags", false, out subEle))
            {
                if (ParentWorldspaceFlags == null)
                {
                    ParentWorldspaceFlags = new SimpleSubrecord <ParentWorldspaceFlags>();
                }

                ParentWorldspaceFlags.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Climate", false, out subEle))
            {
                if (Climate == null)
                {
                    Climate = new RecordReference();
                }

                Climate.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Water", false, out subEle))
            {
                if (Water == null)
                {
                    Water = new RecordReference();
                }

                Water.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("LODWater/Type", false, out subEle))
            {
                if (LODWaterType == null)
                {
                    LODWaterType = new RecordReference();
                }

                LODWaterType.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("LODWater/Height", false, out subEle))
            {
                if (LODWaterHeight == null)
                {
                    LODWaterHeight = new SimpleSubrecord <Single>();
                }

                LODWaterHeight.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("LandData", false, out subEle))
            {
                if (LandData == null)
                {
                    LandData = new WorldLandData();
                }

                LandData.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Icon/Large", false, out subEle))
            {
                if (LargeIcon == null)
                {
                    LargeIcon = new SimpleSubrecord <String>();
                }

                LargeIcon.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Icon/Small", false, out subEle))
            {
                if (SmallIcon == null)
                {
                    SmallIcon = new SimpleSubrecord <String>();
                }

                SmallIcon.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("MapData", false, out subEle))
            {
                if (MapData == null)
                {
                    MapData = new MapData();
                }

                MapData.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("WorldMapOffsetData", false, out subEle))
            {
                if (WorldMapOffsetData == null)
                {
                    WorldMapOffsetData = new WorldMapOffsetData();
                }

                WorldMapOffsetData.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("ImageSpace", false, out subEle))
            {
                if (ImageSpace == null)
                {
                    ImageSpace = new RecordReference();
                }

                ImageSpace.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("WorldspaceFlags", false, out subEle))
            {
                if (WorldspaceFlags == null)
                {
                    WorldspaceFlags = new SimpleSubrecord <WorldspaceFlags>();
                }

                WorldspaceFlags.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("ObjectBounds/Min", false, out subEle))
            {
                if (MinObjectBounds == null)
                {
                    MinObjectBounds = new SimpleSubrecord <XYFloat>();
                }

                MinObjectBounds.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("ObjectBounds/Max", false, out subEle))
            {
                if (MaxObjectBounds == null)
                {
                    MaxObjectBounds = new SimpleSubrecord <XYFloat>();
                }

                MaxObjectBounds.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Music", false, out subEle))
            {
                if (Music == null)
                {
                    Music = new RecordReference();
                }

                Music.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("CanopyShadow", false, out subEle))
            {
                if (CanopyShadow == null)
                {
                    CanopyShadow = new SimpleSubrecord <String>();
                }

                CanopyShadow.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("WaterNoiseTexture", false, out subEle))
            {
                if (WaterNoiseTexture == null)
                {
                    WaterNoiseTexture = new SimpleSubrecord <String>();
                }

                WaterNoiseTexture.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("SwappedImpacts", false, out subEle))
            {
                if (SwappedImpacts == null)
                {
                    SwappedImpacts = new List <SwappedImpact>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    SwappedImpact tempIMPS = new SwappedImpact();
                    tempIMPS.ReadXML(e, master);
                    SwappedImpacts.Add(tempIMPS);
                }
            }
            if (ele.TryPathTo("FootstepMaterial", false, out subEle))
            {
                if (FootstepMaterial == null)
                {
                    FootstepMaterial = new FootstepMaterial();
                }

                FootstepMaterial.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("OffsetDataSize", false, out subEle))
            {
                if (OffsetDataSize == null)
                {
                    OffsetDataSize = new SimpleSubrecord <UInt32>();
                }

                OffsetDataSize.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("OffsetData", false, out subEle))
            {
                if (OffsetData == null)
                {
                    OffsetData = new SimpleSubrecord <Byte[]>();
                }

                OffsetData.ReadXML(subEle, master);
            }
        }
        public override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (EditorID != null)
            {
                ele.TryPathTo("EditorID", true, out subEle);
                EditorID.WriteXML(subEle, master);
            }
            if (Name != null)
            {
                ele.TryPathTo("Name", true, out subEle);
                Name.WriteXML(subEle, master);
            }
            if (EncounterZone != null)
            {
                ele.TryPathTo("EncounterZone", true, out subEle);
                EncounterZone.WriteXML(subEle, master);
            }
            if (ParentWorldspace != null)
            {
                ele.TryPathTo("ParentWorldspace", true, out subEle);
                ParentWorldspace.WriteXML(subEle, master);
            }
            if (ParentWorldspaceFlags != null)
            {
                ele.TryPathTo("ParentWorldspaceFlags", true, out subEle);
                ParentWorldspaceFlags.WriteXML(subEle, master);
            }
            if (Climate != null)
            {
                ele.TryPathTo("Climate", true, out subEle);
                Climate.WriteXML(subEle, master);
            }
            if (Water != null)
            {
                ele.TryPathTo("Water", true, out subEle);
                Water.WriteXML(subEle, master);
            }
            if (LODWaterType != null)
            {
                ele.TryPathTo("LODWater/Type", true, out subEle);
                LODWaterType.WriteXML(subEle, master);
            }
            if (LODWaterHeight != null)
            {
                ele.TryPathTo("LODWater/Height", true, out subEle);
                LODWaterHeight.WriteXML(subEle, master);
            }
            if (LandData != null)
            {
                ele.TryPathTo("LandData", true, out subEle);
                LandData.WriteXML(subEle, master);
            }
            if (LargeIcon != null)
            {
                ele.TryPathTo("Icon/Large", true, out subEle);
                LargeIcon.WriteXML(subEle, master);
            }
            if (SmallIcon != null)
            {
                ele.TryPathTo("Icon/Small", true, out subEle);
                SmallIcon.WriteXML(subEle, master);
            }
            if (MapData != null)
            {
                ele.TryPathTo("MapData", true, out subEle);
                MapData.WriteXML(subEle, master);
            }
            if (WorldMapOffsetData != null)
            {
                ele.TryPathTo("WorldMapOffsetData", true, out subEle);
                WorldMapOffsetData.WriteXML(subEle, master);
            }
            if (ImageSpace != null)
            {
                ele.TryPathTo("ImageSpace", true, out subEle);
                ImageSpace.WriteXML(subEle, master);
            }
            if (WorldspaceFlags != null)
            {
                ele.TryPathTo("WorldspaceFlags", true, out subEle);
                WorldspaceFlags.WriteXML(subEle, master);
            }
            if (MinObjectBounds != null)
            {
                ele.TryPathTo("ObjectBounds/Min", true, out subEle);
                MinObjectBounds.WriteXML(subEle, master);
            }
            if (MaxObjectBounds != null)
            {
                ele.TryPathTo("ObjectBounds/Max", true, out subEle);
                MaxObjectBounds.WriteXML(subEle, master);
            }
            if (Music != null)
            {
                ele.TryPathTo("Music", true, out subEle);
                Music.WriteXML(subEle, master);
            }
            if (CanopyShadow != null)
            {
                ele.TryPathTo("CanopyShadow", true, out subEle);
                CanopyShadow.WriteXML(subEle, master);
            }
            if (WaterNoiseTexture != null)
            {
                ele.TryPathTo("WaterNoiseTexture", true, out subEle);
                WaterNoiseTexture.WriteXML(subEle, master);
            }
            if (SwappedImpacts != null)
            {
                ele.TryPathTo("SwappedImpacts", true, out subEle);
                List <string> xmlNames = new List <string> {
                    "SwappedImpact"
                };
                int i = 0;
                foreach (var entry in SwappedImpacts)
                {
                    i = i % xmlNames.Count();
                    XElement newEle = new XElement(xmlNames[i]);
                    entry.WriteXML(newEle, master);
                    subEle.Add(newEle);
                    i++;
                }
            }
            if (FootstepMaterial != null)
            {
                ele.TryPathTo("FootstepMaterial", true, out subEle);
                FootstepMaterial.WriteXML(subEle, master);
            }
            if (OffsetDataSize != null)
            {
                ele.TryPathTo("OffsetDataSize", true, out subEle);
                OffsetDataSize.WriteXML(subEle, master);
            }
            if (OffsetData != null)
            {
                ele.TryPathTo("OffsetData", true, out subEle);
                OffsetData.WriteXML(subEle, master);
            }
        }
        public override void WriteData(ESPWriter writer)
        {
            if (EditorID != null)
            {
                EditorID.WriteBinary(writer);
            }
            if (Name != null)
            {
                Name.WriteBinary(writer);
            }
            if (EncounterZone != null)
            {
                EncounterZone.WriteBinary(writer);
            }
            if (ParentWorldspace != null)
            {
                ParentWorldspace.WriteBinary(writer);
            }
            if (ParentWorldspaceFlags != null)
            {
                ParentWorldspaceFlags.WriteBinary(writer);
            }
            if (Climate != null)
            {
                Climate.WriteBinary(writer);
            }
            if (Water != null)
            {
                Water.WriteBinary(writer);
            }
            if (LODWaterType != null)
            {
                LODWaterType.WriteBinary(writer);
            }
            if (LODWaterHeight != null)
            {
                LODWaterHeight.WriteBinary(writer);
            }
            if (LandData != null)
            {
                LandData.WriteBinary(writer);
            }
            if (LargeIcon != null)
            {
                LargeIcon.WriteBinary(writer);
            }
            if (SmallIcon != null)
            {
                SmallIcon.WriteBinary(writer);
            }
            if (MapData != null)
            {
                MapData.WriteBinary(writer);
            }
            if (WorldMapOffsetData != null)
            {
                WorldMapOffsetData.WriteBinary(writer);
            }
            if (ImageSpace != null)
            {
                ImageSpace.WriteBinary(writer);
            }
            if (WorldspaceFlags != null)
            {
                WorldspaceFlags.WriteBinary(writer);
            }
            if (MinObjectBounds != null)
            {
                MinObjectBounds.WriteBinary(writer);
            }
            if (MaxObjectBounds != null)
            {
                MaxObjectBounds.WriteBinary(writer);
            }
            if (Music != null)
            {
                Music.WriteBinary(writer);
            }
            if (CanopyShadow != null)
            {
                CanopyShadow.WriteBinary(writer);
            }
            if (WaterNoiseTexture != null)
            {
                WaterNoiseTexture.WriteBinary(writer);
            }
            if (SwappedImpacts != null)
            {
                foreach (var item in SwappedImpacts)
                {
                    item.WriteBinary(writer);
                }
            }
            if (FootstepMaterial != null)
            {
                FootstepMaterial.WriteBinary(writer);
            }
            if (OffsetDataSize != null)
            {
                OffsetDataSize.WriteBinary(writer);
            }

            WriteOffsetData(writer);
        }
        public override void ReadData(ESPReader reader, long dataEnd)
        {
            while (reader.BaseStream.Position < dataEnd)
            {
                string subTag = reader.PeekTag();

                switch (subTag)
                {
                case "EDID":
                    if (EditorID == null)
                    {
                        EditorID = new SimpleSubrecord <String>();
                    }

                    EditorID.ReadBinary(reader);
                    break;

                case "FULL":
                    if (Name == null)
                    {
                        Name = new SimpleSubrecord <String>();
                    }

                    Name.ReadBinary(reader);
                    break;

                case "XEZN":
                    if (EncounterZone == null)
                    {
                        EncounterZone = new RecordReference();
                    }

                    EncounterZone.ReadBinary(reader);
                    break;

                case "WNAM":
                    if (ParentWorldspace == null)
                    {
                        ParentWorldspace = new RecordReference();
                    }

                    ParentWorldspace.ReadBinary(reader);
                    break;

                case "PNAM":
                    if (ParentWorldspaceFlags == null)
                    {
                        ParentWorldspaceFlags = new SimpleSubrecord <ParentWorldspaceFlags>();
                    }

                    ParentWorldspaceFlags.ReadBinary(reader);
                    break;

                case "CNAM":
                    if (Climate == null)
                    {
                        Climate = new RecordReference();
                    }

                    Climate.ReadBinary(reader);
                    break;

                case "NAM2":
                    if (Water == null)
                    {
                        Water = new RecordReference();
                    }

                    Water.ReadBinary(reader);
                    break;

                case "NAM3":
                    if (LODWaterType == null)
                    {
                        LODWaterType = new RecordReference();
                    }

                    LODWaterType.ReadBinary(reader);
                    break;

                case "NAM4":
                    if (LODWaterHeight == null)
                    {
                        LODWaterHeight = new SimpleSubrecord <Single>();
                    }

                    LODWaterHeight.ReadBinary(reader);
                    break;

                case "DNAM":
                    if (LandData == null)
                    {
                        LandData = new WorldLandData();
                    }

                    LandData.ReadBinary(reader);
                    break;

                case "ICON":
                    if (LargeIcon == null)
                    {
                        LargeIcon = new SimpleSubrecord <String>();
                    }

                    LargeIcon.ReadBinary(reader);
                    break;

                case "MICO":
                    if (SmallIcon == null)
                    {
                        SmallIcon = new SimpleSubrecord <String>();
                    }

                    SmallIcon.ReadBinary(reader);
                    break;

                case "MNAM":
                    if (MapData == null)
                    {
                        MapData = new MapData();
                    }

                    MapData.ReadBinary(reader);
                    break;

                case "ONAM":
                    if (WorldMapOffsetData == null)
                    {
                        WorldMapOffsetData = new WorldMapOffsetData();
                    }

                    WorldMapOffsetData.ReadBinary(reader);
                    break;

                case "INAM":
                    if (ImageSpace == null)
                    {
                        ImageSpace = new RecordReference();
                    }

                    ImageSpace.ReadBinary(reader);
                    break;

                case "DATA":
                    if (WorldspaceFlags == null)
                    {
                        WorldspaceFlags = new SimpleSubrecord <WorldspaceFlags>();
                    }

                    WorldspaceFlags.ReadBinary(reader);
                    break;

                case "NAM0":
                    if (MinObjectBounds == null)
                    {
                        MinObjectBounds = new SimpleSubrecord <XYFloat>();
                    }

                    MinObjectBounds.ReadBinary(reader);
                    break;

                case "NAM9":
                    if (MaxObjectBounds == null)
                    {
                        MaxObjectBounds = new SimpleSubrecord <XYFloat>();
                    }

                    MaxObjectBounds.ReadBinary(reader);
                    break;

                case "ZNAM":
                    if (Music == null)
                    {
                        Music = new RecordReference();
                    }

                    Music.ReadBinary(reader);
                    break;

                case "NNAM":
                    if (CanopyShadow == null)
                    {
                        CanopyShadow = new SimpleSubrecord <String>();
                    }

                    CanopyShadow.ReadBinary(reader);
                    break;

                case "XNAM":
                    if (WaterNoiseTexture == null)
                    {
                        WaterNoiseTexture = new SimpleSubrecord <String>();
                    }

                    WaterNoiseTexture.ReadBinary(reader);
                    break;

                case "IMPS":
                    if (SwappedImpacts == null)
                    {
                        SwappedImpacts = new List <SwappedImpact>();
                    }

                    SwappedImpact tempIMPS = new SwappedImpact();
                    tempIMPS.ReadBinary(reader);
                    SwappedImpacts.Add(tempIMPS);
                    break;

                case "IMPF":
                    if (FootstepMaterial == null)
                    {
                        FootstepMaterial = new FootstepMaterial();
                    }

                    FootstepMaterial.ReadBinary(reader);
                    break;

                case "XXXX":
                    if (OffsetDataSize == null)
                    {
                        OffsetDataSize = new SimpleSubrecord <UInt32>();
                    }

                    OffsetDataSize.ReadBinary(reader);
                    break;

                case "OFST":
                    ReadOffsetData(reader);
                    break;

                default:
                    throw new Exception();
                }
            }
        }