Beispiel #1
0
        public MainForm()
        {
            // We don't have a host license key, so we will load the user key, if
            // stored at the expected location.
            string licenseFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"PostSharp 2.0\PostSharp.license");
            string licenseKey  = null;

            if (File.Exists(licenseFile))
            {
                licenseKey = File.ReadAllText(licenseFile);
            }

            if (!LicenseManager.Initialize(licenseKey))
            {
                MessageBox.Show("Invalid license.");
                Environment.Exit(1);
            }


            InitializeComponent();

            this.domain = new Domain();


            // Load assemblies.
            foreach (string path in UserConfiguration.GetLoadedAssemblies())
            {
                try
                {
                    this.LoadAssembly(path);
                }
                catch (Exception e)
                {
                    UserConfiguration.RemoveAssembly(path);
                    MessageBox.Show(this, string.Format("Cannot load the assembly {0}: {1}",
                                                        Path.GetFileName(path), e.Message), "Load Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Beispiel #2
0
 public void RemoveModule(ModuleTreeNode treeNode)
 {
     this.treeView.Nodes.Remove(treeNode);
     UserConfiguration.RemoveAssembly(treeNode.ModulePath);
 }