예제 #1
0
        public BfCache(Dictionary <string, AssemblyTuple> nameToAssemblyTuple)
        {
            GetTypes(nameToAssemblyTuple);

            Assemblies.AddRange(new HashSet <BfAssembly>(_dictionary.Values));

            var index = 0;

            while (index < Types.Count)
            {
                var bfType = Types[index];

                if (bfType.Name != "<Module>")
                {
                    bfType.Populate();

                    Methods.AddRange(bfType.Methods);
                    Events.AddRange(bfType.Events);
                    Fields.AddRange(bfType.Fields);
                }

                ++index;
            }

            // ReSharper disable once ForCanBeConvertedToForeach
            for (var i = 0; i < Types.Count; ++i)
            {
                Types[i].Methods.Distinct().ForEach(m => m.Populate());
            }

            Types.Distinct().ForEach(bfType => bfType.Commit());

            Types.Distinct().ForEach(bfType =>
            {
                bfType.Methods.ForEach(m => m.Dispose());
                bfType.Events.ForEach(m => m.Dispose());
                bfType.Fields.ForEach(m => m.Dispose());
            });

            Assemblies.Distinct().ForEach(bfAssembly => bfAssembly.Dispose());

            Delegates();
            ReIndex();
        }
예제 #2
0
 internal void RemoveDuplicates()
 {
     Assemblies = Assemblies.Distinct().ToList();
     Types      = Types.Distinct().ToList();
 }