// ========================================================================
        // Methods

        #region === Methods

        /// <summary>
        ///   Starts the functionality of the plugin.
        /// </summary>
        protected void Launch()
        {
            if (Workspace.HasActiveProject)
            {
                string fileName;
                using (OpenFileDialog dialog = new OpenFileDialog())
                {
                    dialog.Filter = Strings.OpenFileDialog_Filter;
                    if (dialog.ShowDialog() == DialogResult.Cancel)
                    {
                        return;
                    }
                    fileName = dialog.FileName;
                }

                ImportSettings settings = new ImportSettings();
                using (ImportSettingsForm settingsForm = new ImportSettingsForm(settings))
                {
                    if (settingsForm.ShowDialog() == DialogResult.OK)
                    {
                        Diagram   diagram  = new Diagram(CSharpLanguage.Instance);
                        NETImport importer = new NETImport(diagram, settings);

                        if (importer.ImportAssembly(fileName))
                        {
                            Workspace.ActiveProject.Add(diagram);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        public void Launch(ProjectCore project)
        {
            if (project == null)
            {
                return;
            }

            if (project.Language.Name != "C#")
            {
                MessageBox.Show("The " + project.Language.Name + " language is not supported.",
                                "Assembly Importer", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            string fileName;

            using (OpenFileDialog dialog = new OpenFileDialog()) {
                dialog.Filter = "Assemblies (*.exe, *.dll)|*.exe;*.dll";
                if (dialog.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }
                fileName = dialog.FileName;
            }

            ImportSettings settings = new ImportSettings();

            using (ImportSettingsForm settingsForm = new ImportSettingsForm(settings)) {
                if (settingsForm.ShowDialog() == DialogResult.OK && project.NewProject())
                {
                    NETImport importer = new NETImport(project, settings);
                    importer.ImportAssembly(fileName);
                }
            }
        }
Esempio n. 3
0
    // ========================================================================
    // Methods

    #region === Methods

    /// <summary>
    ///   Starts the functionality of the plugin.
    /// </summary>
    protected void Launch()
    {
      if(Workspace.HasActiveProject)
      {
        string fileName;
        using (OpenFileDialog dialog = new OpenFileDialog())
        {
          dialog.Filter = Strings.OpenFileDialog_Filter;
          if (dialog.ShowDialog() == DialogResult.Cancel)
            return;
          fileName = dialog.FileName;
        }

        ImportSettings settings = new ImportSettings();
        using(ImportSettingsForm settingsForm = new ImportSettingsForm(settings))
        {
          if(settingsForm.ShowDialog() == DialogResult.OK)
          {
            ClassDiagram diagram = new ClassDiagram(CSharpLanguage.Instance);
            NETImport importer = new NETImport(diagram, settings);

            if(importer.ImportAssembly(fileName))
            {
              Workspace.ActiveProject.Add(diagram);
            }
          }
        }
      }
    }