コード例 #1
0
        private List <DebuggingHandle> AsExportHandle()
        {
            List <DebuggingHandle> handles = new List <DebuggingHandle>();

            _reader.Reset();

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

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

                    break;
                }

                handle--;

                var numBits = _reader.ReadIntPacked();

                DebuggingHandle debuggingHandle = new DebuggingHandle
                {
                    Handle  = handle,
                    NumBits = numBits
                };

                handles.Add(debuggingHandle);

                if (numBits == 0)
                {
                    continue;
                }

                _reader.SkipBits((int)numBits);

                if (_reader.IsError)
                {
                    return(null);
                }
            }

            return(handles);
        }
コード例 #2
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;
                }
            }
        }