示例#1
0
        public static T[] ConvertDataArray <T>(MetaFile meta, Array_StructurePointer array) where T : struct
        {
            uint count = array.Count1;

            if (count == 0)
            {
                return(null);
            }

            MetaPOINTER[] ptrs = GetPointerArray(meta, array);

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

            T[] items     = new T[count];
            int itemsize  = Marshal.SizeOf(typeof(T));
            int itemsleft = (int)count; //large arrays get split into chunks...

            //MetaName blocktype = 0;
            for (int i = 0; i < count; i++)
            {
                var ptr    = ptrs[i];
                var offset = ptr.Offset;
                var block  = meta.GetBlock(ptr.BlockID);

                if (block == null)
                {
                    continue;
                }

                if ((offset < 0) || (block.Data == null) || (offset >= block.Data.Count))
                {
                    continue;
                }

                items[i] = ConvertData <T>(block.Data, offset);
            }

            return(items);
        }
示例#2
0
 public static T[] ConvertDataArray <T>(MetaFile meta, Array_Structure array) where T : struct
 {
     return(ConvertDataArray <T>(meta, array.Pointer, array.Count1));
 }