예제 #1
0
        private static IDictionary <int, IList <Type> > GetAncestorsWithMethod(Type type, string signature)
        {
            var        metaType = new Dictionary <int, IList <Type> >();
            MethodInfo method;

            while ((method = ConfigureCollection.Create(type).SingleOrDefault(m => m.ToString() == signature)) != null)
            {
                metaType.AddOrUpdateValue(method.MetadataToken, new List <Type> {
                    type
                },
                                          (key, oldT, newT) =>
                {
                    foreach (var t in newT)
                    {
                        oldT.Add(t);
                    }

                    return(oldT);
                });

                type = type.BaseType;
            }

            return(metaType);
        }
예제 #2
0
        public ConfigureMethodInfo(Tuple <Type, ConfigurePriority, string> method)
        {
            var configures = ConfigureCollection.Create(method.Item1);

            Method              = configures.Single(m => m.ToString() == method.Item3);
            _metadataTypeMap    = GetAncestorsWithMethod(method.Item1, Method.ToString());
            MethodAncestorTypes = _metadataTypeMap.SelectMany(types => types.Value);
            Type     = _metadataTypeMap[Method.MetadataToken].Last();
            Priority = method.Item2;
        }
예제 #3
0
 /// <summary>
 /// Creates and enumerable of Configure(...) method info based on the given type.
 /// Useful to have different sorts to support old Sharpmake versions or to analyze
 /// dependencies between Configure functions.
 /// </summary>
 /// <param name="type">type on which to get the configure methods</param>
 /// <returns>an ordered enumeration of method info</returns>
 public IEnumerable <MethodInfo> CreateConfigureCollection(Type type)
 {
     return(ConfigureCollection.Create(type, ConfigureOrder, OrderConfigure));
 }