Пример #1
0
        private object[] AsArray()
        {
            _reader.Reset();

            uint totalElements = _reader.ReadIntPacked();

            object[] data = new object[totalElements];


            while (true)
            {
                uint index = _reader.ReadIntPacked();

                if (index == 0)
                {
                    if (_reader.GetBitsLeft() == 8)
                    {
                        uint terminator = _reader.ReadIntPacked();

                        if (terminator != 0x00)
                        {
                            //Log error
                            return(null);
                        }
                    }

                    if (_reader.IsError || !_reader.AtEnd())
                    {
                        return(null);
                    }

                    return(data);
                }

                --index;

                if (index >= totalElements)
                {
                    return(null);
                }

                List <DebuggingHandle> handles = new List <DebuggingHandle>();
                bool isExportHandles           = false;

                while (true)
                {
                    DebuggingHandle debuggingHandle = new DebuggingHandle();

                    uint handle = _reader.ReadIntPacked();

                    debuggingHandle.Handle = handle;

                    if (handle == 0)
                    {
                        break;
                    }

                    --handle;

                    uint numBits = _reader.ReadIntPacked();

                    debuggingHandle.NumBits = numBits;

                    DebuggingObject obj = new DebuggingObject();

                    NetBitReader tempReader = new NetBitReader(_reader.ReadBits(numBits));
                    tempReader.EngineNetworkVersion = _reader.EngineNetworkVersion;

                    obj.Serialize(tempReader);

                    data[index] = obj;

                    handles.Add(debuggingHandle);
                }

                //Assume it's an export handle
                if (handles.Count > 0)
                {
                    data[index] = handles;
                }
            }
        }
Пример #2
0
        private DebuggingObject[] AsArray()
        {
            _reader.Reset();

            uint totalElements = _reader.ReadIntPacked();

            DebuggingObject[] data = new DebuggingObject[totalElements];

            while (true)
            {
                uint index = _reader.ReadIntPacked();

                if (index == 0)
                {
                    if (index == 0)
                    {
                        if (_reader.GetBitsLeft() == 8)
                        {
                            uint terminator = _reader.ReadIntPacked();

                            if (terminator != 0x00)
                            {
                                //Log error
                                return(null);
                            }
                        }

                        if (_reader.IsError || !_reader.AtEnd())
                        {
                            return(null);
                        }

                        return(data);
                    }
                }

                --index;

                if (index >= totalElements)
                {
                    return(null);
                }

                while (true)
                {
                    uint handle = _reader.ReadIntPacked();

                    if (handle == 0)
                    {
                        break;
                    }

                    --handle;
                    uint numBits = _reader.ReadIntPacked();

                    DebuggingObject obj = new DebuggingObject();


                    NetBitReader tempReader = new NetBitReader(_reader.ReadBits(numBits));
                    tempReader.EngineNetworkVersion = _reader.EngineNetworkVersion;

                    obj.Serialize(tempReader);

                    data[index] = obj;
                }
            }
        }