Exemplo n.º 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("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);
            }
        }
Exemplo n.º 2
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 "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();
                }
            }
        }