Beispiel #1
0
        /// <summary>
        ///     分析文件程序集
        /// </summary>
        /// <param name="assembly"></param>
        public static SolutionConfig Import(Assembly assembly)
        {
            var importer = new AssemblyImporter
            {
                _assembly = assembly,
                _project  = new SolutionConfig
                {
                    Entities = new ObservableCollection <EntityConfig>()
                }
            };

            importer.ReadEntities();
            return(importer._project);
        }
Beispiel #2
0
        /// <summary>
        ///     打开并分析文件
        /// </summary>
        /// <param name="file"></param>
        public static SolutionConfig Import(string file)
        {
            var importer = new AssemblyImporter
            {
                _assembly = Assembly.LoadFile(file),
                _project  = new SolutionConfig
                {
                    Entities = new ObservableCollection <EntityConfig>()
                }
            };

            importer.ReadEntities();
            return(importer._project);
        }
Beispiel #3
0
        /// <summary>
        ///     打开并分析文件
        /// </summary>
        /// <param name="project"></param>
        /// <param name="file"></param>
        public static ProjectConfig Import(ProjectConfig project, string file)
        {
            var importer = new AssemblyImporter(project, file);

            try
            {
                importer._assembly = importer.LoadReflection(file);
                importer.ReadTypes();
                importer.ReadEntities();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
            }
            return(importer._project);
        }
Beispiel #4
0
        /// <summary>
        ///     打开并分析文件
        /// </summary>
        /// <param name="project"></param>
        /// <param name="assembly"></param>
        public static ProjectConfig Import(ProjectConfig project, Assembly assembly)
        {
            var importer = new AssemblyImporter(project, assembly.Location)
            {
                IncludeBaseType = false
            };

            try
            {
                importer._assembly = assembly;
                importer.ReadTypes();
                importer.ReadEntities();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
            }
            return(importer._project);
        }