Example #1
0
        private static void TraverseMap(XmlNode node, PsoBuilder pb, PsoStructureEntryInfo entry, PsoStructureInfo infos, byte[] data, PsoArrayResults arrayResults)
        {
            var mapidx1     = entry.ReferenceKey & 0x0000FFFF;
            var mapidx2     = (entry.ReferenceKey >> 16) & 0x0000FFFF;
            var mapreftype1 = infos.Entries[mapidx2];
            var mapreftype2 = infos.Entries[mapidx1];

            if (mapreftype2.ReferenceKey != 0)
            {
            }

            var xStruct = pb.AddMapNodeStructureInfo((MetaName)mapreftype2.ReferenceKey);
            var xName   = xStruct.IndexInfo.NameHash;
            var kEntry  = xStruct?.FindEntry(MetaName.Key);
            var iEntry  = xStruct?.FindEntry(MetaName.Item);

            if (kEntry.Type != PsoDataType.String)
            {
            }



            List <byte[]> nodesData = new List <byte[]>();

            foreach (XmlNode cnode in node.ChildNodes)
            {
                var kattr = cnode.Attributes["key"].Value;
                var tattr = cnode.Attributes["type"].Value;//CW invention for convenience..!
                var khash = (MetaName)(uint)GetHash(kattr);
                var thash = (MetaName)(uint)GetHash(tattr);

                byte[] strucBytes = Traverse(cnode, pb, thash);
                byte[] nodeBytes  = new byte[xStruct.StructureLength];

                TraverseStringRaw(kattr, pb, kEntry, nodeBytes); //write the key

                if (xName != (MetaName)MetaTypeName.ARRAYINFO)   // (mapreftype2.ReferenceKey != 0)
                {
                    //value struct embedded in ARRAYINFO node
                    Buffer.BlockCopy(strucBytes, 0, nodeBytes, iEntry.DataOffset, strucBytes.Length);
                }
                else
                {
                    //normal ARRAYINFO with pointer value
                    var itemptr = pb.AddItemPtr(thash, strucBytes);
                    itemptr.SwapEnd(); //big schmigg
                    var ptrbytes = MetaTypes.ConvertToBytes(itemptr);
                    Buffer.BlockCopy(ptrbytes, 0, nodeBytes, iEntry.DataOffset, ptrbytes.Length);
                }

                nodesData.Add(nodeBytes);
            }



            Write(0x1000000, data, entry.DataOffset);
            Write(0, data, entry.DataOffset + 4);

            arrayResults.Structures[entry.DataOffset + 8] = pb.AddItemArrayPtr(xName, nodesData.ToArray());  //pb.AddPointerArray(nodeptrs);
        }
Example #2
0
        private static void TraverseStringRaw(string str, PsoBuilder pb, PsoStructureEntryInfo entry, byte[] data)
        {
            switch (entry.Unk_5h)
            {
            default:
                break;

            case 0:
                var str0len = (int)((entry.ReferenceKey >> 16) & 0xFFFF);
                if (!string.IsNullOrEmpty(str))
                {
                    byte[] strdata = Encoding.ASCII.GetBytes(str);
                    Buffer.BlockCopy(strdata, 0, data, entry.DataOffset, strdata.Length);
                    if (strdata.Length > str0len)
                    {
                    }
                }
                break;

            case 1:
            case 2:
                if (!string.IsNullOrEmpty(str))
                {
                    var bptr = pb.AddString(str);
                    var ptr  = new PsoPOINTER(bptr.BlockID, bptr.Offset);
                    ptr.SwapEnd();
                    var val = MetaTypes.ConvertToBytes(ptr);
                    Buffer.BlockCopy(val, 0, data, entry.DataOffset, val.Length);
                }
                break;

            case 3:
                if (!string.IsNullOrEmpty(str))
                {
                    var bptr = pb.AddString(str);
                    var ptr  = new CharPointer(bptr.Pointer, str.Length);
                    ptr.SwapEnd();
                    var val = MetaTypes.ConvertToBytes(ptr);
                    Buffer.BlockCopy(val, 0, data, entry.DataOffset, val.Length);
                }
                break;

            case 7:    //hash only?
            case 8:    //hash with STRF entry?

                var hashVal = string.IsNullOrEmpty(str) ? 0 : GetHash(str);
                Write(hashVal, data, entry.DataOffset);

                if (entry.Unk_5h == 8)
                {
                    pb.AddStringToSTRF(str);
                }
                break;
            }
        }
Example #3
0
        public static byte[] GetByteArray(PsoFile pso, PsoStructureEntryInfo entry, int offset)
        {
            var aCount   = (entry.ReferenceKey >> 16) & 0x0000FFFF;
            var aBlockId = (int)entry.ReferenceKey & 0x0000FFFF;
            var block    = pso.GetBlock(aBlockId);

            if (block == null)
            {
                return(null);
            }

            //block.Offset

            return(null);
        }
Example #4
0
        public override void Read(DataReader reader)
        {
            uint x = reader.ReadUInt32();

            this.Type            = (byte)((x & 0xFF000000) >> 24);
            this.EntriesCount    = (short)(x & 0xFFFF);
            this.Unk             = (byte)((x & 0x00FF0000) >> 16);
            this.StructureLength = reader.ReadInt32();
            this.Unk_Ch          = reader.ReadUInt32();

            Entries = new PsoStructureEntryInfo[EntriesCount];
            for (int i = 0; i < EntriesCount; i++)
            {
                var entry = new PsoStructureEntryInfo();
                entry.Read(reader);
                Entries[i] = entry;
            }
        }
Example #5
0
 private static void TraverseString(XmlNode node, PsoBuilder pb, PsoStructureEntryInfo entry, byte[] data)
 {
     TraverseStringRaw(node.InnerText, pb, entry, data);
 }
Example #6
0
        private static void TraverseArray(XmlNode node, PsoBuilder pb, PsoStructureEntryInfo entry, PsoStructureEntryInfo arrEntry, PsoArrayResults results, byte[] data, PsoStructureInfo structInfo)
        {
            int  offset = entry.DataOffset;
            uint aCount = (entry.ReferenceKey >> 16) & 0x0000FFFF;
            uint aPtr   = (entry.ReferenceKey) & 0x0000FFFF;

            byte[] adata = null;

            //how do we know when it's an "embedded" array?
            bool embedded = true;

            switch (entry.Unk_5h)
            {
            default:
                //ErrorXml(sb, indent, ename + ": WIP! Unsupported Array subtype: " + entry.Unk_5h.ToString());
                break;

            case 0:     //Array_Structure
                //var arrStruc = MetaTypes.ConvertData<Array_Structure>(data, eoffset);
                embedded = false;
                break;

            case 1:     //Raw in-line array
                break;

            case 2:     //also raw in-line array, but how different from above?
                break;

            case 4:                       //pointer array? default array?
                if (arrEntry.Unk_5h == 3) //pointers...
                {
                    //var arrStruc4 = MetaTypes.ConvertData<Array_Structure>(data, eoffset);
                    embedded = false;
                }
                else
                {
                }
                break;

            case 129:     //also raw inline array? in junctions.pso  (AutoJunctionAdjustments)
                break;
            }



            switch (arrEntry.Type)
            {
            case PsoDataType.Structure:
            {
                if (embedded)
                {
                    if (arrEntry.ReferenceKey != 0)
                    {
                        var datas   = TraverseArrayStructureRaw(node, pb, (MetaName)arrEntry.ReferenceKey);
                        int aoffset = offset;
                        for (int i = 0; i < datas.Length; i++)
                        {
                            Buffer.BlockCopy(datas[i], 0, data, aoffset, datas[i].Length);
                            aoffset += datas[i].Length;
                        }
                    }
                    else
                    {
                        var ptrs = TraverseArrayStructurePointerRaw(node, pb);
                        adata = MetaTypes.ConvertArrayToBytes(ptrs);
                    }
                }
                else
                {
                    if (arrEntry.ReferenceKey != 0)
                    {
                        results.Structures[offset] = TraverseArrayStructure(node, pb, (MetaName)arrEntry.ReferenceKey);
                    }
                    else
                    {
                        results.StructurePointers[offset] = TraverseArrayStructurePointer(node, pb);
                    }
                }
                break;
            }

            case PsoDataType.Float2:
            {
                var arr = TraverseVector2ArrayRaw(node);
                if (embedded)
                {
                    adata   = MetaTypes.ConvertArrayToBytes(arr);
                    aCount *= 8;
                }
                else
                {
                    results.Float_XYZs[offset] = pb.AddVector2ArrayPtr(arr);
                }
                break;
            }

            case PsoDataType.Float3:
            {
                var arr = TraverseVector3ArrayRaw(node);
                if (embedded)
                {
                    adata   = MetaTypes.ConvertArrayToBytes(arr);
                    aCount *= 16;
                }
                else
                {
                    results.Float_XYZs[offset] = pb.AddPaddedVector3ArrayPtr(arr);
                }
                break;
            }

            case PsoDataType.UByte:
            {
                var arr = TraverseUByteArrayRaw(node);
                if (embedded)
                {
                    adata = arr;
                }
                else
                {
                    results.UBytes[offset] = pb.AddByteArrayPtr(arr);
                }
                break;
            }

            case PsoDataType.Bool:
            {
                var arr = TraverseUByteArrayRaw(node);
                if (embedded)
                {
                    adata = arr;
                }
                else
                {
                    results.UBytes[offset] = pb.AddByteArrayPtr(arr);
                }
                break;
            }

            case PsoDataType.UInt:
            {
                var arr = TraverseUIntArrayRaw(node);
                if (embedded)
                {
                    adata   = MetaTypes.ConvertArrayToBytes(arr);
                    aCount *= 4;
                }
                else
                {
                    results.UInts[offset] = pb.AddUIntArrayPtr(arr);
                }
                break;
            }

            case PsoDataType.SInt:
            {
                var arr = TraverseSIntArrayRaw(node);
                if (embedded)
                {
                    adata   = MetaTypes.ConvertArrayToBytes(arr);
                    aCount *= 4;
                }
                else
                {
                    results.UInts[offset] = pb.AddSIntArrayPtr(arr);
                }
                break;
            }

            case PsoDataType.Float:
            {
                var arr = TraverseFloatArrayRaw(node);
                if (embedded)
                {
                    adata   = MetaTypes.ConvertArrayToBytes(arr);
                    aCount *= 4;
                }
                else
                {
                    results.Floats[offset] = pb.AddFloatArrayPtr(arr);
                }
                break;
            }

            case PsoDataType.UShort:
            {
                var arr = TraverseUShortArrayRaw(node);
                if (embedded)
                {
                    adata   = MetaTypes.ConvertArrayToBytes(arr);
                    aCount *= 2;
                }
                else
                {
                    results.UShorts[offset] = pb.AddUShortArrayPtr(arr);
                }
                break;
            }

            case PsoDataType.String:
            {
                switch (entry.Unk_5h)
                {
                default:
                    //ErrorXml(sb, indent, ename + ": Unexpected String array subtype: " + entry.Unk_5h.ToString());
                    break;

                case 0:             //hash array...
                    var hashes = TraverseHashArrayRaw(node);
                    if (embedded)
                    {
                        adata   = MetaTypes.ConvertArrayToBytes(hashes);
                        aCount *= 4;
                    }
                    else
                    {
                        results.Hashes[offset] = pb.AddHashArrayPtr(hashes);
                    }
                    break;
                }


                break;
            }


            case PsoDataType.Enum:
            {
                var hashes = TraverseHashArrayRaw(node);

                if (arrEntry.ReferenceKey != 0)
                {
                    var _infos = PsoTypes.GetEnumInfo((MetaName)arrEntry.ReferenceKey);
                    pb.AddEnumInfo(_infos.IndexInfo.NameHash);

                    var values = new uint[hashes.Length];
                    for (int i = 0; i < hashes.Length; i++)
                    {
                        var enumname = (MetaName)MetaTypes.SwapBytes(hashes[i]);        //yeah swap it back to little endian..!
                        var enuminf  = _infos.FindEntryByName(enumname);
                        if (enuminf != null)
                        {
                            values[i] = MetaTypes.SwapBytes((uint)enuminf.EntryKey);
                        }
                        else
                        {
                        }           //error?
                    }

                    if (embedded)
                    {
                    }           //TODO?
                    else
                    {
                        results.UInts[offset] = pb.AddUIntArrayPtr(values);
                    }
                }
                else
                {
                }


                break;
            }


            case PsoDataType.Array:
            {
                //array array...
                var rk0 = (entry.ReferenceKey >> 16) & 0x0000FFFF;
                var rk1 = arrEntry.ReferenceKey & 0x0000FFFF;
                if (rk0 > 0)         //should be count of items
                {
                    var subarrEntry = structInfo.GetEntry((int)rk1);
                    var subarrType  = (MetaName)subarrEntry.ReferenceKey;

                    var origOffset = arrEntry.DataOffset;
                    arrEntry.DataOffset = entry.DataOffset;        //slight hack for traversing array array
                    foreach (XmlNode cnode in node.ChildNodes)
                    {
                        TraverseArray(cnode, pb, arrEntry, subarrEntry, results, data, structInfo);

                        arrEntry.DataOffset += 16;        //ptr size... todo: what if not pointer array?
                    }
                    arrEntry.DataOffset = origOffset;
                }


                break;
            }



            default:
                break;
            }

            if (embedded)
            {
                if (adata?.Length > 0)
                {
                    if (adata.Length > aCount)
                    {
                    }  //bad! old data won't fit in new slot...

                    Buffer.BlockCopy(adata, 0, data, offset, adata.Length);
                }
                else
                {
                }
            }
        }
Example #7
0
        private static byte[] Traverse(XmlNode node, PsoBuilder pb, MetaName type = 0, bool isRoot = false)
        {
            if (type == 0)
            {
                type = (MetaName)(uint)GetHash(node.Name);
            }

            var infos = PsoTypes.GetStructureInfo(type);

            if (infos != null)
            {
                byte[] data         = new byte[infos.StructureLength];
                var    arrayResults = new PsoArrayResults();

                arrayResults.Structures        = new Dictionary <int, Array_Structure>();
                arrayResults.StructurePointers = new Dictionary <int, Array_StructurePointer>();
                arrayResults.UInts             = new Dictionary <int, Array_uint>();
                arrayResults.UShorts           = new Dictionary <int, Array_ushort>();
                arrayResults.UBytes            = new Dictionary <int, Array_byte>();
                arrayResults.Floats            = new Dictionary <int, Array_float>();
                arrayResults.Float_XYZs        = new Dictionary <int, Array_Vector3>();
                arrayResults.Hashes            = new Dictionary <int, Array_uint>();

                Array.Clear(data, 0, infos.StructureLength); //shouldn't really be necessary...

                PsoStructureEntryInfo arrEntry = null;


                //if (isRoot)
                //{
                //    pb.EnsureBlock(type);
                //}

                for (int i = 0; i < infos.Entries.Length; i++)
                {
                    var entry = infos.Entries[i];
                    var cnode = GetEntryNode(node.ChildNodes, entry.EntryNameHash);

                    if (entry.EntryNameHash == (MetaName)MetaTypeName.ARRAYINFO)
                    {
                        arrEntry = entry;
                        continue;
                    }

                    if (cnode == null)
                    {
                        //warning: node not found in XML for this entry!
                        continue;
                    }

                    switch (entry.Type)
                    {
                    case PsoDataType.Array:
                    {
                        TraverseArray(cnode, pb, entry, arrEntry, arrayResults, data, infos);
                        break;
                    }

                    case PsoDataType.Structure:
                    {
                        var stype = (MetaName)entry.ReferenceKey;
                        if (stype == 0)
                        {
                            var stypestr = Xml.GetStringAttribute(cnode, "type");
                            if (!string.IsNullOrEmpty(stypestr))
                            {
                                stype = (MetaName)(uint)GetHash(stypestr);
                            }
                        }
                        var struc = Traverse(cnode, pb, stype);
                        if (struc != null)
                        {
                            switch (entry.Unk_5h)
                            {
                            default:
                                //ErrorXml(sb, cind, ename + ": Unexpected Structure subtype: " + entry.Unk_5h.ToString());
                                break;

                            case 0:             //default structure

                                Buffer.BlockCopy(struc, 0, data, entry.DataOffset, struc.Length);

                                break;

                            case 3:             //structure pointer...
                            case 4:             //also pointer? what's the difference?

                                var bptr = pb.AddItem(stype, struc);
                                var ptr  = new PsoPOINTER(bptr.BlockID, bptr.Offset);
                                ptr.SwapEnd();
                                var ptrb = MetaTypes.ConvertToBytes(ptr);

                                Buffer.BlockCopy(ptrb, 0, data, entry.DataOffset, ptrb.Length);

                                break;
                            }
                        }
                        else
                        {
                        }
                        break;
                    }

                    case PsoDataType.Map:
                    {
                        TraverseMap(cnode, pb, entry, infos, data, arrayResults);

                        break;
                    }

                    case PsoDataType.Bool:
                    {
                        byte val = (cnode.Attributes["value"].Value == "false") ? (byte)0 : (byte)1;
                        data[entry.DataOffset] = val;
                        break;
                    }

                    case PsoDataType.SByte:
                    {
                        var val = Convert.ToSByte(cnode.Attributes["value"].Value);
                        data[entry.DataOffset] = (byte)val;
                        break;
                    }

                    case PsoDataType.UByte:
                    {
                        var val = Convert.ToByte(cnode.Attributes["value"].Value);
                        data[entry.DataOffset] = val;
                        break;
                    }

                    case PsoDataType.SShort:
                    {
                        var val = Convert.ToInt16(cnode.Attributes["value"].Value);
                        Write(val, data, entry.DataOffset);
                        break;
                    }

                    case PsoDataType.UShort:
                    {
                        var val = Convert.ToUInt16(cnode.Attributes["value"].Value);
                        Write(val, data, entry.DataOffset);
                        break;
                    }

                    case PsoDataType.SInt:
                    {
                        var val = Convert.ToInt32(cnode.Attributes["value"].Value);
                        Write(val, data, entry.DataOffset);
                        break;
                    }

                    case PsoDataType.UInt:
                    {
                        switch (entry.Unk_5h)
                        {
                        default:
                            //ErrorXml(sb, cind, ename + ": Unexpected Integer subtype: " + entry.Unk_5h.ToString());
                            break;

                        case 0:             //signed int (? flags?)
                            var sval = Convert.ToInt32(cnode.Attributes["value"].Value);
                            Write(sval, data, entry.DataOffset);
                            break;

                        case 1:             //unsigned int
                            var  ustr = cnode.Attributes["value"].Value;
                            uint uval = 0;
                            if (ustr.StartsWith("0x"))
                            {
                                ustr = ustr.Substring(2);
                                uval = Convert.ToUInt32(ustr, 16);
                            }
                            else
                            {
                                uval = Convert.ToUInt32(ustr);
                            }
                            Write(uval, data, entry.DataOffset);
                            break;
                        }

                        break;
                    }

                    case PsoDataType.Float:
                    {
                        float val = FloatUtil.Parse(cnode.Attributes["value"].Value);
                        Write(val, data, entry.DataOffset);
                        break;
                    }

                    case PsoDataType.Float2:
                    {
                        float x = FloatUtil.Parse(cnode.Attributes["x"].Value);
                        float y = FloatUtil.Parse(cnode.Attributes["y"].Value);
                        Write(x, data, entry.DataOffset);
                        Write(y, data, entry.DataOffset + sizeof(float));
                        break;
                    }

                    case PsoDataType.Float3:
                    {
                        float x = FloatUtil.Parse(cnode.Attributes["x"].Value);
                        float y = FloatUtil.Parse(cnode.Attributes["y"].Value);
                        float z = FloatUtil.Parse(cnode.Attributes["z"].Value);
                        Write(x, data, entry.DataOffset);
                        Write(y, data, entry.DataOffset + sizeof(float));
                        Write(z, data, entry.DataOffset + sizeof(float) * 2);
                        break;
                    }

                    case PsoDataType.Float4:
                    {
                        float x = FloatUtil.Parse(cnode.Attributes["x"].Value);
                        float y = FloatUtil.Parse(cnode.Attributes["y"].Value);
                        float z = FloatUtil.Parse(cnode.Attributes["z"].Value);
                        float w = FloatUtil.Parse(cnode.Attributes["w"].Value);
                        Write(x, data, entry.DataOffset);
                        Write(y, data, entry.DataOffset + sizeof(float));
                        Write(z, data, entry.DataOffset + sizeof(float) * 2);
                        Write(w, data, entry.DataOffset + sizeof(float) * 3);
                        break;
                    }

                    case PsoDataType.String:
                    {
                        TraverseString(cnode, pb, entry, data);
                        break;
                    }

                    case PsoDataType.Enum:
                    {
                        pb.AddEnumInfo((MetaName)entry.ReferenceKey);
                        switch (entry.Unk_5h)
                        {
                        default:
                            //ErrorXml(sb, cind, ename + ": Unexpected Enum subtype: " + entry.Unk_5h.ToString());
                            break;

                        case 0:             //int enum
                            int ival = GetEnumInt((MetaName)entry.ReferenceKey, cnode.InnerText, entry.Type);
                            Write(ival, data, entry.DataOffset);
                            break;

                        case 1:             //short enum?
                            short sval = (short)GetEnumInt((MetaName)entry.ReferenceKey, cnode.InnerText, entry.Type);
                            Write(sval, data, entry.DataOffset);
                            break;

                        case 2:             //byte enum
                            byte bval = (byte)GetEnumInt((MetaName)entry.ReferenceKey, cnode.InnerText, entry.Type);
                            data[entry.DataOffset] = bval;
                            break;
                        }
                        break;
                    }

                    case PsoDataType.Flags:
                    {
                        //uint fCount = (entry.ReferenceKey >> 16) & 0x0000FFFF;
                        uint        fEntry    = (entry.ReferenceKey & 0xFFF);
                        var         fEnt      = (fEntry != 0xFFF) ? infos.GetEntry((int)fEntry) : null;
                        PsoEnumInfo flagsInfo = null;
                        MetaName    fEnum     = (MetaName)(fEnt?.ReferenceKey ?? 0);
                        if ((fEnt != null) && (fEnt.EntryNameHash == (MetaName)MetaTypeName.ARRAYINFO))
                        {
                            flagsInfo = PsoTypes.GetEnumInfo(fEnum);
                        }
                        if (flagsInfo == null)
                        {
                            if (fEntry != 0xFFF)
                            {
                            }
                            //flagsInfo = PsoTypes.GetEnumInfo(entry.EntryNameHash);
                        }
                        if (flagsInfo != null)
                        {
                            pb.AddEnumInfo(flagsInfo.IndexInfo.NameHash);
                        }
                        else
                        {
                        }          //error?

                        switch (entry.Unk_5h)
                        {
                        default:
                            //ErrorXml(sb, cind, ename + ": Unexpected Flags subtype: " + entry.Unk_5h.ToString());
                            break;

                        case 0:             //int flags
                            int ival = GetEnumInt(fEnum, cnode.InnerText, entry.Type);
                            Write(ival, data, entry.DataOffset);
                            break;

                        case 1:             //short flags
                            short sval = (short)GetEnumInt(fEnum, cnode.InnerText, entry.Type);
                            Write(sval, data, entry.DataOffset);
                            break;

                        case 2:             //byte flags
                            byte bval = (byte)GetEnumInt(fEnum, cnode.InnerText, entry.Type);
                            data[entry.DataOffset] = bval;
                            break;
                        }
                        break;
                    }

                    case PsoDataType.Float3a:
                    {
                        float x = FloatUtil.Parse(cnode.Attributes["x"].Value);
                        float y = FloatUtil.Parse(cnode.Attributes["y"].Value);
                        float z = FloatUtil.Parse(cnode.Attributes["z"].Value);
                        Write(x, data, entry.DataOffset);
                        Write(y, data, entry.DataOffset + sizeof(float));
                        Write(z, data, entry.DataOffset + sizeof(float) * 2);
                        break;
                    }

                    case PsoDataType.Float4a:
                    {
                        float x = FloatUtil.Parse(cnode.Attributes["x"].Value);
                        float y = FloatUtil.Parse(cnode.Attributes["y"].Value);
                        float z = FloatUtil.Parse(cnode.Attributes["z"].Value);
                        //float w = FloatUtil.Parse(cnode.Attributes["w"].Value);
                        Write(x, data, entry.DataOffset);
                        Write(y, data, entry.DataOffset + sizeof(float));
                        Write(z, data, entry.DataOffset + sizeof(float) * 2);
                        //Write(w, data, entry.DataOffset + sizeof(float) * 3);
                        break;
                    }

                    case PsoDataType.HFloat:
                    {
                        var val = Convert.ToInt16(cnode.Attributes["value"].Value);
                        Write(val, data, entry.DataOffset);
                        break;
                    }

                    case PsoDataType.Long:
                    {
                        var uval = Convert.ToUInt64(cnode.Attributes["value"].Value);
                        Write(uval, data, entry.DataOffset);
                        break;
                    }


                    default:
                        break;
                    }
                }


                arrayResults.WriteArrays(data);

                pb.AddStructureInfo(infos.IndexInfo.NameHash);

                if (isRoot)
                {
                    pb.RootPointer = pb.AddItem(type, data);
                }

                return(data);
            }
            else
            {
            }  //info not found

            return(null);
        }