} // Read

        public static uint Read(this NativeReader reader, uint offset, out ScopeReferenceHandle handle)
        {
            uint value;
            offset = reader.DecodeUnsigned(offset, out value);
            handle = new ScopeReferenceHandle((int)value);
            handle._Validate();
            return offset;
        } // Read
        } // Read

        public static uint Read(this NativeReader reader, uint offset, out ScopeReferenceHandle[] values)
        {
            uint count;
            offset = reader.DecodeUnsigned(offset, out count);
            if (count == 0)
            {
                values = s_emptyScopeReferenceHandleArray;
            }
            else
            {
                values = new ScopeReferenceHandle[count];
                for (uint i = 0; i < count; ++i)
                {
                    ScopeReferenceHandle tmp;
                    offset = reader.Read(offset, out tmp);
                    values[i] = tmp;
                }
            }
            return offset;
        } // Read
        } // IsNull

        internal bool IsNull(ScopeReferenceHandle handle)
        {
            return (handle._value & 0x00FFFFFF) == 0;
        } // IsNull
        } // ToHandle

        internal Handle ToHandle(ScopeReferenceHandle handle)
        {
            return new Handle(handle._value);
        } // ToHandle
        } // GetScopeDefinition

        public ScopeReference GetScopeReference(ScopeReferenceHandle handle)
        {
            var record = new ScopeReference() { _reader = this, _handle = handle };
            var offset = (uint)handle.Offset;
            offset = _streamReader.Read(offset, out record._flags);
            offset = _streamReader.Read(offset, out record._name);
            offset = _streamReader.Read(offset, out record._majorVersion);
            offset = _streamReader.Read(offset, out record._minorVersion);
            offset = _streamReader.Read(offset, out record._buildNumber);
            offset = _streamReader.Read(offset, out record._revisionNumber);
            offset = _streamReader.Read(offset, out record._publicKeyOrToken);
            offset = _streamReader.Read(offset, out record._culture);
            offset = _streamReader.Read(offset, out record._customAttributes);
            return record;
        } // GetScopeReference
        } // Equals

        public bool Equals(ScopeReferenceHandle handle)
        {
            return _value == handle._value;
        } // Equals
Example #7
0
        } // Read

        public static uint Read(this NativeReader reader, uint offset, out ScopeReferenceHandle[] values)
        {
            uint count;
            offset = reader.DecodeUnsigned(offset, out count);
            #if !NETFX_45
            if (count == 0)
            {
                values = Array.Empty<ScopeReferenceHandle>();
            }
            else
            #endif
            {
                values = new ScopeReferenceHandle[count];
                for (uint i = 0; i < count; ++i)
                {
                    ScopeReferenceHandle tmp;
                    offset = reader.Read(offset, out tmp);
                    values[i] = tmp;
                }
            }
            return offset;
        } // Read