Example #1
0
        /// <summary>
        /// Record the mapping from .NET to Dex
        /// </summary>
        public virtual void RecordMapping(MapFile mapFile)
        {
            var entry = CreateMappingEntry();

            mapFile.Add(entry);

            if (fieldBuilders != null) fieldBuilders.ForEach(x => x.RecordMapping(entry));
            if (methodBuilders != null) methodBuilders.ForEach(x => x.RecordMapping(entry, mapFile));

            // Create mapping of nested classes
            if (nestedBuilders != null) nestedBuilders.ForEach(x => x.RecordMapping(mapFile));
        }
Example #2
0
 /// <summary>
 /// Record the mapping from .NET to Dex
 /// </summary>
 public void RecordMapping(MapFile mapFile)
 {
     var dexName = (classDef != null) ? classDef.Fullname : null;
     var mapFileId = (classDef != null) ? classDef.MapFileId : 0;
     var entry = new TypeEntry(typeDef.ClassName, "<java>", dexName, mapFileId);
     if (fieldBuilders != null) fieldBuilders.ForEach(x => x.RecordMapping(entry));
     if (methodBuilders != null) methodBuilders.ForEach(x => x.RecordMapping(entry));
     mapFile.Add(entry);
 }
Example #3
0
        public override void RecordMapping(MapFile mapFile)
        {
            base.RecordMapping(mapFile);

            // create the mapping for all our instance type.
            foreach (var instance in delegateType.Instances)
            {
                // Create mapping
                var dexName = instance.InstanceDefinition.Fullname;
                var mapFileId = instance.InstanceDefinition.MapFileId;
                var scopeId = XType.ScopeId.Substring(XType.ScopeId.IndexOf(':') + 1);
                scopeId += ":delegate:" + instance.CalledMethod.DeclaringType.ScopeId + "|" + instance.CalledMethod.ScopeId;
                
                var entry = new TypeEntry(Type.FullName, Type.Scope.Name, dexName, mapFileId, scopeId);
                mapFile.Add(entry);
            }
        }
Example #4
0
        /// <summary>
        /// Merge the given set of map files into 1.
        /// </summary>
        private static MapFile MergeMapFiles(List<MapFile> mapFiles)
        {
            if (mapFiles.Count == 0) return new MapFile();
            if (mapFiles.Count == 1) return mapFiles[0];

            var result = new MapFile();
            foreach (var entry in mapFiles.SelectMany(mapFile => mapFile))
            {
                result.Add(entry);
            }
            return result;
        }
Example #5
0
        /// <summary>
        /// Record the mapping from .NET to Dex
        /// </summary>
        public void RecordMapping(MapFile mapFile)
        {
            // Create mapping
            var dexName = (classDef != null) ? classDef.Fullname : null;
            var mapFileId = (classDef != null) ? classDef.MapFileId : 0;
            var entry = new TypeEntry(typeDef.FullName, typeDef.Scope.Name, dexName, mapFileId);
            if (fieldBuilders != null) fieldBuilders.ForEach(x => x.RecordMapping(entry));
            if (methodBuilders != null) methodBuilders.ForEach(x => x.RecordMapping(entry));
            mapFile.Add(entry);

            // Create mapping of nested classes
            if (nestedBuilders != null) nestedBuilders.ForEach(x => x.RecordMapping(mapFile));
        }