public MethodDefinition(ClassDefinition owner, string name, Prototype prototype) : this() { Owner = owner; Name = name; Prototype = prototype; }
private void ReadMethodDefinitions(BinaryReader reader, ClassDefinition classDefinition, uint methodcount, bool isVirtual) { uint methodIndex = 0; for (var i = 0; i < methodcount; i++) { methodIndex += reader.ReadULEB128(); var accessFlags = reader.ReadULEB128(); var codeOffset = reader.ReadULEB128(); var mdef = (MethodDefinition)Dex.MethodReferences[(int)methodIndex]; mdef.AccessFlags = (AccessFlags)accessFlags; mdef.Owner = classDefinition; mdef.IsVirtual = isVirtual; classDefinition.Methods.Add(mdef); if (codeOffset > 0) ReadMethodBody(reader, mdef, codeOffset); } }
private void ReadStaticValues(BinaryReader reader, ClassDefinition classDefinition, uint staticValuesOffset) { reader.PreserveCurrentPosition(staticValuesOffset, () => { var values = ReadValues(reader); for (var j = 0; j < values.Length; j++) classDefinition.Fields[j].Value = values[j]; }); }
private void ReadFieldDefinitions(BinaryReader reader, ClassDefinition classDefinition, uint fieldcount) { uint fieldIndex = 0; for (var i = 0; i < fieldcount; i++) { fieldIndex += reader.ReadULEB128(); var accessFlags = reader.ReadULEB128(); var fdef = (FieldDefinition)Dex.FieldReferences[(int)fieldIndex]; fdef.AccessFlags = (AccessFlags)accessFlags; fdef.Owner = classDefinition; classDefinition.Fields.Add(fdef); } }
private void ReadInterfaces(BinaryReader reader, ClassDefinition classDefinition, uint interfaceOffset) { reader.PreserveCurrentPosition(interfaceOffset, () => { var typecount = reader.ReadUInt32(); for (var j = 0; j < typecount; j++) { var typeIndex = reader.ReadUInt16(); classDefinition.Interfaces.Add((ClassReference)Dex.TypeReferences[typeIndex]); } }); }
private void ReadClassDefinition(BinaryReader reader, ClassDefinition classDefinition, uint classDataOffset) { reader.PreserveCurrentPosition(classDataOffset, () => { var staticFieldSize = reader.ReadULEB128(); var instanceFieldSize = reader.ReadULEB128(); var directMethodSize = reader.ReadULEB128(); var virtualMethodSize = reader.ReadULEB128(); ReadFieldDefinitions(reader, classDefinition, staticFieldSize); ReadFieldDefinitions(reader, classDefinition, instanceFieldSize); ReadMethodDefinitions(reader, classDefinition, directMethodSize, false); ReadMethodDefinitions(reader, classDefinition, virtualMethodSize, true); }); }
private void PrefetchClassDefinitions(BinaryReader reader, bool prefetchMembers) { reader.PreserveCurrentPosition(Header.ClassDefinitionsOffset, () => { for (var i = 0; i < Header.ClassDefinitionsSize; i++) { var classIndex = reader.ReadInt32(); var reference = Dex.TypeReferences[classIndex] as ClassDefinition; if (reference == null) { var cdef = new ClassDefinition((ClassReference)Dex.TypeReferences[classIndex]); Dex.TypeReferences[classIndex] = cdef; Dex.Classes.Add(cdef); } reader.ReadInt32(); // skip access_flags reader.ReadInt32(); // skip superclass_idx reader.ReadInt32(); // skip interfaces_off reader.ReadInt32(); // skip source_file_idx reader.ReadInt32(); // skip annotations_off var classDataOffset = reader.ReadUInt32(); if ((classDataOffset > 0) && prefetchMembers) { PrefetchClassDefinition(reader, classDataOffset); } reader.ReadInt32(); // skip static_values_off } }); }
public bool Equals(ClassDefinition other) { // Should be enough (ownership) return base.Equals(other); }
// ReSharper restore ValueParameterNotUsed public bool Equals(ClassDefinition other) { // Should be enough (ownership) return(base.Equals(other)); }
public MethodDefinition(ClassDefinition owner, string name, Prototype prototype) : this() { Owner = owner; Name = name; Prototype = prototype; }