コード例 #1
0
        public Assembly Process()
        {
            IIOService ioService = new IOService();
            string     asmPath   = ioService.OpenFileDialog();

            if (asmPath != null)
            {
                AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += new ResolveEventHandler(CurrentDomain_ReflectionOnlyAssemblyResolve);
                System.Reflection.Assembly       asm          = System.Reflection.Assembly.ReflectionOnlyLoadFrom(asmPath);
                AssemblyInfoProcessor            asmProcessor = new AssemblyInfoProcessor(asm);
                AssemblyResult                   asmRes       = asmProcessor.GetStructeredInfo();
                ObservableCollection <NameSpace> namespaces   = new ObservableCollection <NameSpace>();
                foreach (NamespaceResult namesp in  asmRes.Namespaces)
                {
                    ObservableCollection <DataType> types = new ObservableCollection <DataType>();
                    foreach (TypeResult typeRes in namesp.DataTypeResult)
                    {
                        DataType type = new DataType {
                            Name     = typeRes.Name,
                            TypeInfo = new ObservableCollection <string>(typeRes.Fields.Concat(typeRes.Properties).Concat(typeRes.Methods))
                        };
                        types.Add(type);
                    }
                    NameSpace nmsp = new NameSpace {
                        Name = namesp.Name, Types = types
                    };
                    namespaces.Add(nmsp);
                }
                Assembly result = new Assembly {
                    Name = asm.GetName().Name, Namespaces = namespaces
                };
                return(result);
            }
            return(null);
        }
コード例 #2
0
        public void Initialize()
        {
            Assembly asm = Assembly.ReflectionOnlyLoadFrom("./TestAssemblyProcessor.dll");
            AssemblyInfoProcessor asmInfoProcessor = new AssemblyInfoProcessor(asm);

            asmResult     = asmInfoProcessor.GetStructeredInfo();
            testClassType = typeof(UnitTest1);
        }