Beispiel #1
0
        public static MethodMappings createSavedMethodMappings(this O2MappedAstData astData, Dictionary <string, List <KeyValuePair <INode, IMethodOrProperty> > > mappings)
        {
            //"creating SavedMethodMappings object from {0} mappings".info(mappings.size());
            var savedMethodMappings = new MethodMappings();

            foreach (var mapping in mappings)
            {
                try
                {
                    string key = mapping.Key;
                    var    methodMappingItem = new MethodMappingItem()
                    {
                        Key = key
                    };
                    List <KeyValuePair <INode, IMethodOrProperty> > items = mapping.Value;
                    foreach (var keyValuePair in items)
                    {
                        var iNode             = keyValuePair.Key;
                        var iMethodOrProperty = keyValuePair.Value;
                        methodMappingItem.MethodMappings.Add(astData.methodMapping(iMethodOrProperty, iNode, key));
                    }
                    savedMethodMappings.MethodMappingItems.Add(methodMappingItem);
                }
                catch (Exception ex)
                {
                    ex.log("in createSavedMethodMappings");
                }
            }
            return(savedMethodMappings);
        }
Beispiel #2
0
        public static MethodMappings loadAndMergeMethodMappings(this List <string> targetFiles)
        {
            "Creating MethodMappings from {0} files".info(targetFiles.size());
            var mergedMethodMappings = new Dictionary <string, List <MethodMapping> >();

            foreach (var targetFile in targetFiles)
            {
                var tempMethodMappings = loadMethodMappings(targetFile);
                var indexedMappings    = tempMethodMappings.indexedByKey("");
                foreach (var item in indexedMappings)
                {
                    foreach (var methodMapping in item.Value)
                    {
                        mergedMethodMappings.add(item.Key, methodMapping);
                    }
                }
            }
            var methodMappings = new MethodMappings();

            foreach (var item in mergedMethodMappings)
            {
                var methodMappingItem = new MethodMappingItem()
                {
                    Key = item.Key
                };
                methodMappingItem.MethodMappings = item.Value;
                methodMappings.MethodMappingItems.Add(methodMappingItem);
            }
            return(methodMappings);
        }
 public static MethodMappings createSavedMethodMappings(this O2MappedAstData astData, Dictionary<string,List<KeyValuePair<INode,IMethodOrProperty>>> mappings)
 {
     //"creating SavedMethodMappings object from {0} mappings".info(mappings.size());
     var savedMethodMappings = new MethodMappings();
     foreach(var mapping in mappings)
     {
         try
         {
             string key = mapping.Key;
             var methodMappingItem = new MethodMappingItem() { Key =  key};
             List<KeyValuePair<INode,IMethodOrProperty>> items = mapping.Value;
             foreach(var keyValuePair in items)
             {
                 var iNode = keyValuePair.Key;
                 var iMethodOrProperty = keyValuePair.Value;
                 methodMappingItem.MethodMappings.Add(astData.methodMapping(iMethodOrProperty,iNode,key));
             }
             savedMethodMappings.MethodMappingItems.Add(methodMappingItem);
         }
         catch(Exception ex)
         {
             ex.log("in createSavedMethodMappings");
         }
     }
     return savedMethodMappings;
 }
        public static MethodMappings loadAndMergeMethodMappings(this List<string> targetFiles)
        {
            "Creating MethodMappings from {0} files".info(targetFiles.size());
            var mergedMethodMappings = new Dictionary<string, List<MethodMapping>>();
            foreach(var targetFile in targetFiles)
            {

            var tempMethodMappings = loadMethodMappings(targetFile);
            var indexedMappings = tempMethodMappings.indexedByKey("");
            foreach(var item in indexedMappings)
                foreach(var methodMapping in item.Value)
                    mergedMethodMappings.add(item.Key, methodMapping);
            }
            var methodMappings = new MethodMappings();
            foreach(var item in mergedMethodMappings)
            {
            var methodMappingItem = new MethodMappingItem() { Key = item.Key};
            methodMappingItem.MethodMappings = item.Value;
            methodMappings.MethodMappingItems.Add(methodMappingItem);
            }
            return methodMappings;
        }