コード例 #1
0
        public FieldMeta(ISharedTable stringTable, TypeMeta declaringType, BinaryReader reader)
        {
            byte[] rawData = reader.ReadBytes(12);

            this.name          = stringTable.FetchString(rawData[0] | (rawData[1] << 8) | (rawData[2] << 16));
            this.errorMessage  = stringTable.FetchString(rawData[3] | (rawData[4] << 8) | (rawData[5] << 16));
            this.declaringType = stringTable.FetchString(rawData[6] | (rawData[7] << 8) | (rawData[8] << 16));
            this.type          = stringTable.FetchString(rawData[9] | (rawData[10] << 8) | (rawData[11] << 16));
        }
コード例 #2
0
        public AssemblyMeta(ISharedTable sharedStringTable, BinaryReader reader)
        {
            this.assemblyPath = reader.ReadString();

            this.friendAssemblies = new string[reader.ReadUInt16()];

            byte[] rawData = reader.ReadBytes(this.friendAssemblies.Length * 3);

            for (int i = 0, j = 0, max = this.friendAssemblies.Length; i < max; ++i, j += 3)
            {
                this.friendAssemblies[i] = sharedStringTable.FetchString(rawData[j] | (rawData[j + 1] << 8) | (rawData[j + 2] << 16));
            }

            this.types = new TypeMeta[reader.ReadInt32()];

            rawData = reader.ReadBytes(this.types.Length * 3);

            for (int i = 0, j = 0, max = this.types.Length; i < max; ++i, j += 3)
            {
                try
                {
                    TypeMeta typeMeta = sharedStringTable.FetchType(rawData[j] | (rawData[j + 1] << 8) | (rawData[j + 2] << 16));
                    this.types[i] = typeMeta;
                    this.typeCache.Add(typeMeta.FullName, typeMeta);
                }
                catch (Exception)
                {
                    Debug.LogError("Type #" + i + " failed in assembly \"" + this.assemblyPath + "\".");
                    throw;
                }
            }
        }
コード例 #3
0
        public EventMeta(ISharedTable stringTable, TypeMeta declaringType, BinaryReader reader)
        {
            byte[] rawData = reader.ReadBytes(10);

            this.name          = stringTable.FetchString(rawData[0] | (rawData[1] << 8) | (rawData[2] << 16));
            this.declaringType = stringTable.FetchString(rawData[3] | (rawData[4] << 8) | (rawData[5] << 16));
            this.type          = stringTable.FetchString(rawData[6] | (rawData[7] << 8) | (rawData[8] << 16));

            byte flags = rawData[9];

            this.hasAdd    = (flags & 1) != 0;
            this.hasRemove = (flags & 2) != 0;

            if ((flags & 4) != 0)
            {
                this.errorMessage = stringTable.FetchString(reader.ReadInt24());
            }
        }
コード例 #4
0
        public MethodMeta(ISharedTable stringTable, TypeMeta declaringType, BinaryReader reader)
        {
            byte[] rawData = reader.ReadBytes(12);

            this.name          = stringTable.FetchString(rawData[0] | (rawData[1] << 8) | (rawData[2] << 16));
            this.declaringType = stringTable.FetchString(rawData[3] | (rawData[4] << 8) | (rawData[5] << 16));
            this.returnType    = stringTable.FetchString(rawData[6] | (rawData[7] << 8) | (rawData[8] << 16));

            byte flags = rawData[9];

            this.isPublic = (flags & 1) != 0;

            int length = rawData[10] | (rawData[11] << 8);

            this.parametersType = new string[length];
            this.parametersName = new string[length];

            rawData = reader.ReadBytes(length * 6);

            for (int i = 0, j = 0; j < length; ++j, i += 6)
            {
                this.parametersType[j] = stringTable.FetchString(rawData[i] | (rawData[i + 1] << 8) | (rawData[i + 2] << 16));
                this.parametersName[j] = stringTable.FetchString(rawData[i + 3] | (rawData[i + 4] << 8) | (rawData[i + 5] << 16));
            }

            if ((flags & 4) != 0)
            {
                this.errorMessage = stringTable.FetchString(reader.ReadInt24());
            }
        }
コード例 #5
0
        public TypeMeta(ISharedTable stringTable, BinaryReader reader)
        {
            byte[] rawData = reader.ReadBytes(7);

            this.@namespace = stringTable.FetchString(rawData[0] | (rawData[1] << 8) | (rawData[2] << 16));
            this.name       = stringTable.FetchString(rawData[3] | (rawData[4] << 8) | (rawData[5] << 16));

            byte flags = rawData[6];

            this.isPublic = (flags & 1) != 0;
            if ((flags & 4) != 0)
            {
                this.errorMessage = stringTable.FetchString(reader.ReadInt24());
            }

            if ((flags & 8) != 0)
            {
                this.events = new EventMeta[reader.ReadUInt16()];
            }
            else
            {
                this.events = new EventMeta[reader.ReadByte()];
            }

            for (int i = 0, max = this.events.Length; i < max; ++i)
            {
                this.events[i] = stringTable.FetchEvent(reader.ReadInt24());
            }

            if ((flags & 16) != 0)
            {
                this.fields = new FieldMeta[reader.ReadUInt16()];
            }
            else
            {
                this.fields = new FieldMeta[reader.ReadByte()];
            }

            for (int i = 0, max = this.fields.Length; i < max; ++i)
            {
                this.fields[i] = stringTable.FetchField(reader.ReadInt24());
            }

            if ((flags & 32) != 0)
            {
                this.properties = new PropertyMeta[reader.ReadUInt16()];
            }
            else
            {
                this.properties = new PropertyMeta[reader.ReadByte()];
            }

            for (int i = 0, max = this.properties.Length; i < max; ++i)
            {
                this.properties[i] = stringTable.FetchProperty(reader.ReadInt24());
            }

            if ((flags & 64) != 0)
            {
                this.methods = new MethodMeta[reader.ReadUInt16()];
            }
            else
            {
                this.methods = new MethodMeta[reader.ReadByte()];
            }

            for (int i = 0, max = this.methods.Length; i < max; ++i)
            {
                this.methods[i] = stringTable.FetchMethod(reader.ReadInt24());
            }
        }