private Field[] ReadFields(ulong count, BinaryReader reader, Dictionary <uint, List <Annotation> > annotations) { var fields = new Field[count]; long position = 0; ulong currentFieldIndex = 0; for (ulong index = 0; index < count; index++) { currentFieldIndex += Leb128.ReadUleb(reader); var accessFlags = Leb128.ReadUleb(reader); position = reader.BaseStream.Position; var field = Dex.GetField((uint)currentFieldIndex); field.AccessFlags = (AccessFlag)accessFlags; List <Annotation> annotation = null; annotations.TryGetValue((uint)currentFieldIndex, out annotation); if (annotation != null) { field.Annotations = annotation; } fields[index] = field; reader.BaseStream.Position = position; } return(fields); }
public string GetFieldName(uint index, Class currentClass, bool isClass = false) { var field = _dex.GetField(index); // Static reference. Return class.field if (isClass) { // Remove the package name for fields in the current class var className = field.ClassIndex == currentClass.ClassIndex ? currentClass.Name.Substring(currentClass.Name.LastIndexOf('.') + 1) : _dex.GetTypeName(field.ClassIndex); return(className + "." + field.Name); } if (field.ClassIndex == currentClass.ClassIndex) { return("this." + field.Name); } return(field.Name); }