public void ExploreAssembly(IMetadataAssembly assembly, IProject project, UnitTestElementConsumer consumer)
        {
            AssemblyExplorer explorer = new AssemblyExplorer(this, assembly, project, consumer);

            explorer.Explore();
        }
Example #2
0
        public void Parse(object path)
        {
            if (!(path is string) || String.IsNullOrEmpty((string)path))
            {
                MessageBox.Show("Can't read installation path from Registry\nLocalMachine/Software/gViewGisOS/Install_Dir", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            DirectoryInfo di;

            try
            {
                di = new DirectoryInfo((string)path);
                if (!di.Exists)
                {
                    return;
                }
            }
            catch { return; }

            AssemblyExplorer explorer = new AssemblyExplorer();

            explorer.AddPlugin          += new AssemblyExplorer.AddPluginEvent(explorer_AddPlugin);
            explorer.AddPluginException += new AssemblyExplorer.AddPluginExceptionEvent(explorer_AddPluginException);

            FileInfo[] fis = di.GetFiles("*.dll");

            int pos = 1;

            foreach (FileInfo ass in fis)
            {
                if (ParseAssembly != null)
                {
                    ParseAssembly(ass.FullName, pos, fis.Length);
                }

                string xml = explorer.Explore(ass.FullName);

                if (!String.IsNullOrEmpty(xml))
                {
                    try
                    {
                        addComponent(ass.FullName);
                        if (AddComponent != null)
                        {
                            AddComponent(ass.FullName);
                        }
                        writeComponents();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
                else if (xml == null) // Canceled...
                {
                    break;
                }
                pos++;
            }
            if (Finished != null)
            {
                Finished();
            }
        }