예제 #1
0
 /// <summary>
 /// Try to get a type from the given clr type name name.
 /// Will ignore the case.
 /// </summary>
 public bool TryGetFromClrName(string clrTypeName, out TypeEntry entry)
 {
     return(typeMap.TryGetValue(clrTypeName, out entry));
 }
예제 #2
0
        private void Add(TypeEntry entry)
        {
            // if there are duplicates in any field, assume the more "important"
            // definition comes first.

            if (!string.IsNullOrEmpty(entry.DexName))
            {
                if (!_typesByDexName.ContainsKey(entry.DexName))
                {
                    _typesByDexName[entry.DexName] = entry;
                }
            }

            if (!string.IsNullOrEmpty(entry.Name))
            {
                if (!_typesByClrName.ContainsKey(entry.Name))
                {
                    _typesByClrName[entry.Name] = entry;
                }
            }

            if (!string.IsNullOrEmpty(entry.DexSignature))
            {
                if (!_typesBySignature.ContainsKey(entry.DexSignature))
                {
                    _typesBySignature[entry.DexSignature] = entry;
                }
            }

            if (entry.Id != 0)
            {
                _typesById[entry.Id] = entry;
            }

            if (entry.Methods.Count > 0)
            {
                string typeDexName      = entry.DexName;
                string typeDexSignature = entry.DexSignature;

                if (entry.Id == 0)
                {
                    // all methods are in the generated class
                    if (_map.GeneratedType != null)
                    {
                        typeDexName      = _map.GeneratedType.DexName;
                        typeDexSignature = _map.GeneratedType.DexSignature;
                    }
                }

                if (typeDexName != null) // should not happen, but guard against anyways.
                {
                    foreach (var m in entry.Methods)
                    {
                        if (m.Id != 0)
                        {
                            _typesByMethodId[m.Id] = entry;
                        }

                        _methodsByFullSignature[Tuple.Create(typeDexName, m.DexName, m.DexSignature)]      = m;
                        _methodsByFullSignature[Tuple.Create(typeDexSignature, m.DexName, m.DexSignature)] = m;
                    }
                }
            }
        }
예제 #3
0
 /// <summary>
 /// Try to get a type from the given java class name.
 /// Will ignore the case.
 /// </summary>
 public bool TryGetFromClassName(string javaClassName, out TypeEntry entry)
 {
     return(classMap.TryGetValue(javaClassName, out entry));
 }