Ejemplo n.º 1
0
        private void MetaBuildEnumInfos(PsoDefinitionXml xmlInfo)
        {
            foreach (var xmlEnumInfo in xmlInfo.Enums)
            {
                var idxInfo = new PsoElementIndexInfo();
                idxInfo.Offset   = 0;
                idxInfo.NameHash = xmlEnumInfo.NameHash;

                var info = new PsoEnumInfo();
                info.Entries = new List <PsoEnumEntryInfo>();
                foreach (var xmlEnumEntryInfo in xmlEnumInfo.Entries)
                {
                    var enumEntryInfo = new PsoEnumEntryInfo();
                    enumEntryInfo.EntryNameHash = xmlEnumEntryInfo.NameHash;
                    enumEntryInfo.EntryKey      = xmlEnumEntryInfo.Value;
                    info.Entries.Add(enumEntryInfo);
                }

                meta.DefinitionSection.EntriesIdx.Add(idxInfo);
                meta.DefinitionSection.Entries.Add(info);
            }
        }
Ejemplo n.º 2
0
 public PsoXmlImporter(PsoDefinitionXml xmlinfos)
 {
     this.xmlInfos = xmlinfos;
     MetaBuildStructureInfos(xmlinfos);
 }
Ejemplo n.º 3
0
        private void MetaBuildStructureInfos(PsoDefinitionXml xmlInfo)
        {
            //meta.DefinitionSection.EntriesIdx = new List<PsoElementIndexInfo>();
            //meta.DefinitionSection.Entries = new List<PsoElementInfo>();
            strList = new List <Tuple <int, PsoStructureInfo> >();

            foreach (var xmlStructureInfo in xmlInfo.Structures)
            {
                var idxInfo = new PsoElementIndexInfo();
                idxInfo.Offset   = 0;
                idxInfo.NameHash = xmlStructureInfo.NameHash;

                var structureInfo = new PsoStructureInfo();
                structureInfo.Type            = 1;
                structureInfo.Unk             = (byte)xmlStructureInfo.Unknown;
                structureInfo.StructureLength = xmlStructureInfo.Length;
                structureInfo.Entries         = new List <PsoStructureEntryInfo>();
                foreach (var xmlStructureEntryInfo in xmlStructureInfo.Entries)
                {
                    var xmlArrayTypeStack = new Stack <PsoStructureEntryXml>();
                    var xmlArrayType      = xmlStructureEntryInfo.ArrayType;
                    while (xmlArrayType != null)
                    {
                        xmlArrayTypeStack.Push(xmlArrayType);
                        xmlArrayType = xmlArrayType.ArrayType;
                    }

                    while (xmlArrayTypeStack.Count > 0)
                    {
                        xmlArrayType = xmlArrayTypeStack.Pop();
                        var arrayStructureEntryInfo = new PsoStructureEntryInfo();
                        arrayStructureEntryInfo.EntryNameHash = xmlArrayType.NameHash;
                        arrayStructureEntryInfo.Type          = (DataType)xmlArrayType.Type;
                        arrayStructureEntryInfo.Unk_5h        = (byte)xmlArrayType.Unknown;
                        arrayStructureEntryInfo.DataOffset    = (short)xmlArrayType.Offset;
                        if (arrayStructureEntryInfo.Type == DataType.Array)
                        {
                            arrayStructureEntryInfo.ReferenceKey = (short)(structureInfo.Entries.Count - 1);
                        }
                        else
                        {
                            arrayStructureEntryInfo.ReferenceKey = 0;
                        }
                        arrayStructureEntryInfo.ReferenceKey = xmlArrayType.TypeHash;
                        structureInfo.Entries.Add(arrayStructureEntryInfo);
                    }

                    var structureEntryInfo = new PsoStructureEntryInfo();
                    structureEntryInfo.EntryNameHash = xmlStructureEntryInfo.NameHash;
                    structureEntryInfo.Type          = (DataType)xmlStructureEntryInfo.Type;
                    structureEntryInfo.Unk_5h        = (byte)xmlStructureEntryInfo.Unknown;
                    structureEntryInfo.DataOffset    = (short)xmlStructureEntryInfo.Offset;
                    if (structureEntryInfo.Type == DataType.Array)
                    {
                        structureEntryInfo.ReferenceKey = (short)(structureInfo.Entries.Count - 1);
                    }
                    else
                    {
                        structureEntryInfo.ReferenceKey = 0;
                    }
                    structureEntryInfo.ReferenceKey = xmlStructureEntryInfo.TypeHash;

                    structureInfo.Entries.Add(structureEntryInfo);
                }

                strList.Add(new Tuple <int, PsoStructureInfo>(idxInfo.NameHash, structureInfo));
            }
        }