Ejemplo n.º 1
0
        public static DebugConstantType Parse(DebugBytecodeReader reader, DebugBytecodeReader typeReader)
        {
            var result = new DebugConstantType();

            result.ParameterClass = typeReader.ReadEnum16 <ParameterClass>("ParameterClass");
            result.ParameterType  = typeReader.ReadEnum16 <ParameterType>("ParameterType");
            result.Rows           = typeReader.ReadUInt16("Rows");
            result.Columns        = typeReader.ReadUInt16("Columns");
            result.Elements       = typeReader.ReadUInt16("Elements");
            result.MemberCount    = typeReader.ReadUInt16("Members");
            var memberInfoOffset = typeReader.ReadUInt32("MemberInfoOffset");

            if (memberInfoOffset != 0)
            {
                var memberInfoReader = reader.CopyAtOffset("MemberReader", typeReader, (int)memberInfoOffset);
                for (int i = 0; i < result.MemberCount; i++)
                {
                    var nameOffset = memberInfoReader.ReadUInt32($"Member{i}NameOffset");
                    var nameReader = reader.CopyAtOffset($"Member{i}NameReader", memberInfoReader, (int)nameOffset);
                    nameReader.ReadString("Name");
                    var typeOffset       = memberInfoReader.ReadUInt32($"Member{i}TypeOffset");
                    var memberTypeReader = reader.CopyAtOffset($"Member{i}TypeReader", memberInfoReader, (int)typeOffset);
                    result.Members.Add(DebugConstantType.Parse(reader, memberTypeReader));
                }
            }
            return(result);
        }
        public DebugConstantStructMember Parse(DebugBytecodeReader reader, DebugBytecodeReader memberReader)
        {
            var result     = new DebugConstantStructMember();
            var nameOffset = memberReader.ReadUInt32("NameOffset");
            var nameReader = reader.CopyAtOffset("NameReader", memberReader, (int)nameOffset);

            result.Name = Name;
            var typeOffset = memberReader.ReadUInt32("TypeOffset");
            var typeReader = reader.CopyAtOffset("TypeREader", memberReader, (int)typeOffset);

            result.Type = DebugConstantType.Parse(reader, typeReader);
            return(result);
        }