public EventClassPickerDialog(string serverIn, string user, string pw, ClassFilters filters) { server = serverIn; connectAs = user; password = pw; classFilters = filters; // // Required for Windows Form Designer support // InitializeComponent(); DialogDescription.ReadOnly = true; DialogDescription.Text = "Select Event Class"; DialogDescription.Multiline = true; DialogDescription.BorderStyle = System.Windows.Forms.BorderStyle.None; DialogDescription.Font = new System.Drawing.Font("Microsoft Sans Serif", 8, System.Drawing.FontStyle.Bold); DialogDescription.TabIndex = 10; DialogDescription.Size = new System.Drawing.Size(360, 88); DialogDescription.Location = new Point(0, 0); DialogDescription.BackColor = System.Drawing.Color.White; this.Controls.Add(this.DialogDescription); }
public WMIClassTreeView(string serverIn, string user, string pw, ClassFilters filters, string[] expandedNS) { server = serverIn; connectAs = user; password = pw; currentFilters = filters; this.Location = new Point(16, 63); this.Size = (Size) new Point(200, 270); this.ShowPlusMinus = true; this.ShowLines = true; this.BeforeExpand += (new TreeViewCancelEventHandler(this.BeforeNodeExpand)); this.HideSelection = false; this.FullRowSelect = true; this.Sorted = true; EnumNamespaces("root", 0); }
public SelectWMIClassTreeDialog(String server, ClassFilters filters, StringTable selClasses /*TODO: credentials */ ) { try { try { rm = new ResourceManager("Microsoft.VSDesigner.WMI.Res", // Name of the resource. ".", // Use current directory. null); } catch (Exception) { //do nothing, will use static RM } currentFilters = filters; machineName = server; selectedClasses = selClasses; this.Text = WMISys.GetString("WMISE_ClassSelectorLbl"); this.AcceptButton = okBtn; this.AutoScaleBaseSize = (Size) new Point(5, 13); this.BorderStyle = FormBorderStyle.FixedSingle; this.CancelButton = cancelBtn; int dlgWidth = 527; int dlgHeight = 480; this.ClientSize = (Size) new Point(dlgWidth, dlgHeight); //this.add_KeyUp(new KeyEventHandler(this.OnKeyUp)); this.ShowInTaskbar = false; labelSearch.Location = new Point(16, 16); labelSearch.Size = (Size) new Point(200, 13); labelSearch.TabStop = false; labelSearch.Text = WMISys.GetString("WMISE_ClassSelectorLblSearch"); editSearch.Location = new Point(16, 33); editSearch.Size = (Size) new Point(200, 20); editSearch.TabStop = true; editSearch.TextChanged += new EventHandler(this.SearchPattern_changed); editSearch.AcceptsReturn = true; //??? editSearch.TabIndex = 0; btnGo.Location = new Point(226, 33); btnGo.TabStop = true; btnGo.Text = WMISys.GetString("WMISE_ClassSelectorBtnSearch"); btnGo.Click += new EventHandler(this.Search_click); classList.Location = new Point(16, 63); classList.Size = (Size) new Point(200, 270); classList.ShowPlusMinus = true; classList.ShowLines = true; classList.BeforeExpand += (new TreeViewCancelEventHandler(this.BeforeNodeExpand)); classList.DoubleClick += (new EventHandler(this.Add_click)); classList.BeforeCollapse += (new TreeViewCancelEventHandler(this.BeforeNodeCollapse)); classList.AfterSelect += (new TreeViewEventHandler(this.AfterNodeSelect)); classList.KeyUp += (new KeyEventHandler(this.OnTreeKeyUp)); classList.HideSelection = false; classList.FullRowSelect = true; //Image symbols = Image.FromFile("symbols.bmp"); //imgList.Images.AddStrip(symbols); imgList.TransparentColor = defaultBackColor; //didn't help!!!!!!! if (rm != null) { imgList.Images.Add((Image)rm.GetObject("Microsoft.VSDesigner.WMI.closed_fol.bmp"), defaultBackColor); imgList.Images.Add((Image)rm.GetObject("Microsoft.VSDesigner.WMI.open_fol.bmp"), defaultBackColor); imgList.Images.Add((Image)rm.GetObject("Microsoft.VSDesigner.WMI.class.bmp"), defaultBackColor); imgList.Images.Add((Image)rm.GetObject("Microsoft.VSDesigner.WMI.classassoc.bmp"), defaultBackColor); imgList.Images.Add((Image)rm.GetObject("Microsoft.VSDesigner.WMI.abstr1.bmp"), defaultBackColor); imgList.Images.Add((Image)rm.GetObject("Microsoft.VSDesigner.WMI.abstr2.bmp"), defaultBackColor); imgList.Images.Add((Image)rm.GetObject("Microsoft.VSDesigner.WMI.abstr_assoc1.bmp"), defaultBackColor); //SCHEMA_ASSOC_ABSTRACT1 imgList.Images.Add((Image)rm.GetObject("Microsoft.VSDesigner.WMI.abstr_assoc2.bmp"), defaultBackColor); //SCHEMA_ASSOC_ABSTRACT2 } else { imgList.Images.Add((Image) new Bitmap(GetType(), "closed_fol.bmp"), defaultBackColor); imgList.Images.Add((Image) new Bitmap(GetType(), "open_fol.bmp"), defaultBackColor); imgList.Images.Add((Image) new Bitmap(GetType(), "class.bmp"), defaultBackColor); imgList.Images.Add((Image) new Bitmap(GetType(), "classassoc.bmp"), defaultBackColor); imgList.Images.Add((Image) new Bitmap(GetType(), "abstr1.bmp"), defaultBackColor); imgList.Images.Add((Image) new Bitmap(GetType(), "abstr2.bmp"), defaultBackColor); imgList.Images.Add((Image) new Bitmap(GetType(), "abstr_assoc1.bmp"), defaultBackColor); //SCHEMA_ASSOC_ABSTRACT1 imgList.Images.Add((Image) new Bitmap(GetType(), "abstr_assoc2.bmp"), defaultBackColor); //SCHEMA_ASSOC_ABSTRACT2 } //classList.ImageList = imgList; /* * TODO: * ADD * MORE IMAGES * TO THE STRIP AND USE THE STRIP * closed & open folder, assoc folders, obj groups etc.? */ /* * * TODO: USE TRANSPARENT COLOR * RIGHT NOW, BITMAPS HAVE WHITE INSTEAD OF TRANSPARENT */ btnAdd.Location = new Point(226, 150); btnAdd.TabStop = true; btnAdd.Text = WMISys.GetString("WMISE_ClassSelectorBtnAdd"); btnAdd.Click += new EventHandler(this.Add_click); btnAdd.Enabled = false; btnRemove.Location = new Point(226, 200); btnRemove.TabStop = true; btnRemove.Text = WMISys.GetString("WMISE_ClassSelectorBtnRemove"); btnRemove.Click += new EventHandler(this.Remove_click); btnRemove.Enabled = false; labelSelected.Location = new Point(311, 43); labelSelected.Size = (Size) new Point(200, 20); labelSelected.TabStop = false; labelSelected.Text = WMISys.GetString("WMISE_ClassSelectorSelClassesLbl"); selectedClassList.Location = new Point(311, 63); selectedClassList.Size = (Size) new Point(200, 270); selectedClassList.SelectionMode = SelectionMode.MultiExtended; selectedClassList.Sorted = true; //initialize selected class list String[] arSel = selectedClasses.ToArray(); for (int i = 0; i < arSel.Length; i++) { selectedClassList.Items.Add(arSel[i]); } selectedClassList.Click += new EventHandler(this.AfterClassSelect); selectedClassList.KeyUp += new KeyEventHandler(this.OnClassListKeyUp); selectedClassList.DoubleClick += (new EventHandler(this.Remove_click)); /* * chkShowData.Checked = ((currentFilters & SchemaFilters.NoData) == 0); * chkShowData.Location = new Point(500, 370); * chkShowData.Text = "Data"; * chkShowData.Click += new EventHandler(this.Filter_click); * chkShowData.Visible = false; * * chkShowSystem.Checked = ((currentFilters & SchemaFilters.NoSystem) == 0); * chkShowSystem.Location = new Point(550, 370); * chkShowSystem.Text = "System"; * chkShowSystem.Click += new EventHandler(this.Filter_click); * chkShowSystem.Visible = false; * * chkShowEvent.Checked = ((currentFilters & SchemaFilters.NoEvent) == 0); * chkShowEvent.Location = new Point(500, 400); * chkShowEvent.Text = "Event"; * chkShowEvent.Click += new EventHandler(this.Filter_click); * chkShowEvent.Visible = false; * * chkShowAbstract.Checked = ((currentFilters & SchemaFilters.NoAbstract) == 0); * chkShowAbstract.Location = new Point( 550, 400); * chkShowAbstract.Text = "Abstract"; * chkShowAbstract.Click += new EventHandler(this.Filter_click); * chkShowAbstract.Visible = false; */ descr.Text = ""; descr.Location = new Point(16, 342); descr.Size = (Size) new Point(500, 75); descr.Multiline = true; descr.ReadOnly = true; descr.ScrollBars = ScrollBars.Vertical; okBtn.Text = WMISys.GetString("WMISE_OK"); okBtn.TabIndex = 1; okBtn.Location = new Point(350, 427); okBtn.DialogResult = DialogResult.OK; okBtn.Click += new EventHandler(this.OK_click); cancelBtn.Text = WMISys.GetString("WMISE_Cancel"); cancelBtn.TabIndex = 2; cancelBtn.Location = new Point(436, 427); cancelBtn.DialogResult = DialogResult.Cancel; this.Controls.All = new Control[] { cancelBtn, okBtn, classList, selectedClassList, //chkShowAbstract, //chkShowSystem, //chkShowEvent, //chkShowData, labelSearch, labelSelected, editSearch, btnGo, btnAdd, btnRemove, descr }; wbemLocator = WmiHelper.WbemLocator; //(ISWbemLocator)(new SWbemLocator()); EnumNamespaces("root", 0); } catch (Exception exc) { MessageBox.Show(WMISys.GetString("WMISE_Exception", exc.Message, exc.StackTrace)); } }
public SelectWMIClassTreeDialog(string server, string connectAsIn, string passwordIn, ClassFilters filters, ArrayList selClasses /*TODO: credentials */ ) { try { currentFilters = filters; machineName = server; selectedClasses = selClasses; connectAs = connectAsIn; password = passwordIn; this.Text = WMISys.GetString("WMISE_ClassSelectorLbl"); this.AcceptButton = okBtn; this.AutoScaleBaseSize = (Size) new Point(5, 13); this.BorderStyle = FormBorderStyle.FixedDialog; this.CancelButton = cancelBtn; int dlgWidth = 527; int dlgHeight = 480; this.ClientSize = (Size) new Point(dlgWidth, dlgHeight); //this.add_KeyUp(new KeyEventHandler(this.OnKeyUp)); this.ShowInTaskbar = false; this.MinimizeBox = false; this.MaximizeBox = false; labelSearch.Location = new Point(16, 16); labelSearch.Size = (Size) new Point(200, 13); labelSearch.TabStop = false; labelSearch.Text = WMISys.GetString("WMISE_ClassSelectorLblSearch"); editSearch.Location = new Point(16, 33); editSearch.Size = (Size) new Point(200, 20); editSearch.TabStop = true; editSearch.TextChanged += new EventHandler(this.SearchPattern_changed); editSearch.AcceptsReturn = true; //??? editSearch.TabIndex = 0; btnGo.Location = new Point(226, 33); btnGo.TabStop = true; btnGo.Text = WMISys.GetString("WMISE_ClassSelectorBtnSearch"); btnGo.Click += new EventHandler(this.Search_click); classList = new WMIClassTreeView(machineName, connectAs, password, currentFilters, null); classList.Location = new Point(16, 63); classList.Size = (Size) new Point(200, 270); classList.ShowPlusMinus = true; classList.ShowLines = true; classList.DoubleClick += (new EventHandler(this.Add_click)); classList.BeforeCollapse += (new TreeViewCancelEventHandler(this.BeforeNodeCollapse)); classList.AfterSelect += (new TreeViewEventHandler(this.AfterNodeSelect)); classList.KeyUp += (new KeyEventHandler(this.OnTreeKeyUp)); classList.HideSelection = false; classList.FullRowSelect = true; //Image symbols = Image.FromFile("symbols.bmp"); //imgList.Images.AddStrip(symbols); imgList.TransparentColor = defaultBackColor; //didn't help!!!!!!! imgList.Images.Add((Image) new Bitmap(GetType(), "closed_fol.bmp"), defaultBackColor); imgList.Images.Add((Image) new Bitmap(GetType(), "open_fol.bmp"), defaultBackColor); imgList.Images.Add((Image) new Bitmap(GetType(), "class.bmp"), defaultBackColor); imgList.Images.Add((Image) new Bitmap(GetType(), "classassoc.bmp"), defaultBackColor); imgList.Images.Add((Image) new Bitmap(GetType(), "abstr1.bmp"), defaultBackColor); imgList.Images.Add((Image) new Bitmap(GetType(), "abstr2.bmp"), defaultBackColor); imgList.Images.Add((Image) new Bitmap(GetType(), "abstr_assoc1.bmp"), defaultBackColor); //SCHEMA_ASSOC_ABSTRACT1 imgList.Images.Add((Image) new Bitmap(GetType(), "abstr_assoc2.bmp"), defaultBackColor); //SCHEMA_ASSOC_ABSTRACT2 btnAdd.Location = new Point(226, 150); btnAdd.TabStop = true; btnAdd.Text = WMISys.GetString("WMISE_ClassSelectorBtnAdd"); btnAdd.Click += new EventHandler(this.Add_click); btnAdd.Enabled = false; btnRemove.Location = new Point(226, 200); btnRemove.TabStop = true; btnRemove.Text = WMISys.GetString("WMISE_ClassSelectorBtnRemove"); btnRemove.Click += new EventHandler(this.Remove_click); btnRemove.Enabled = false; labelSelected.Location = new Point(311, 43); labelSelected.Size = (Size) new Point(200, 20); labelSelected.TabStop = false; labelSelected.Text = WMISys.GetString("WMISE_ClassSelectorSelClassesLbl"); selectedClassList.Location = new Point(311, 63); selectedClassList.Size = (Size) new Point(200, 270); selectedClassList.SelectionMode = SelectionMode.MultiExtended; selectedClassList.Sorted = true; //initialize selected class list String[] arSel = new String[selectedClasses.Count]; selectedClasses.CopyTo(arSel, 0); for (int i = 0; i < arSel.Length; i++) { selectedClassList.Items.Add(arSel[i]); } selectedClassList.Click += new EventHandler(this.AfterClassSelect); selectedClassList.KeyUp += new KeyEventHandler(this.OnClassListKeyUp); selectedClassList.DoubleClick += (new EventHandler(this.Remove_click)); /* * chkShowData.Checked = ((currentFilters & SchemaFilters.NoData) == 0); * chkShowData.Location = new Point(500, 370); * chkShowData.Text = "Data"; * chkShowData.Click += new EventHandler(this.Filter_click); * chkShowData.Visible = false; * * chkShowSystem.Checked = ((currentFilters & SchemaFilters.NoSystem) == 0); * chkShowSystem.Location = new Point(550, 370); * chkShowSystem.Text = "System"; * chkShowSystem.Click += new EventHandler(this.Filter_click); * chkShowSystem.Visible = false; * * chkShowEvent.Checked = ((currentFilters & SchemaFilters.NoEvent) == 0); * chkShowEvent.Location = new Point(500, 400); * chkShowEvent.Text = "Event"; * chkShowEvent.Click += new EventHandler(this.Filter_click); * chkShowEvent.Visible = false; * * chkShowAbstract.Checked = ((currentFilters & SchemaFilters.NoAbstract) == 0); * chkShowAbstract.Location = new Point( 550, 400); * chkShowAbstract.Text = "Abstract"; * chkShowAbstract.Click += new EventHandler(this.Filter_click); * chkShowAbstract.Visible = false; */ descr.Text = ""; descr.Location = new Point(16, 342); descr.Size = (Size) new Point(500, 75); descr.Multiline = true; descr.ReadOnly = true; descr.ScrollBars = ScrollBars.Vertical; okBtn.Text = WMISys.GetString("WMISE_OK"); okBtn.TabIndex = 1; okBtn.Location = new Point(350, 427); okBtn.DialogResult = DialogResult.OK; okBtn.Click += new EventHandler(this.OK_click); cancelBtn.Text = WMISys.GetString("WMISE_Cancel"); cancelBtn.TabIndex = 2; cancelBtn.Location = new Point(436, 427); cancelBtn.DialogResult = DialogResult.Cancel; this.Controls.Add(cancelBtn); this.Controls.Add(okBtn); this.Controls.Add(classList); this.Controls.Add(selectedClassList); //chkShowAbstract, //chkShowSystem, //chkShowEvent, //chkShowData, this.Controls.Add(labelSearch); this.Controls.Add(labelSelected); this.Controls.Add(editSearch); this.Controls.Add(btnGo); this.Controls.Add(btnAdd); this.Controls.Add(btnRemove); this.Controls.Add(descr); } catch (Exception exc) { MessageBox.Show(WMISys.GetString("WMISE_Exception", exc.Message, exc.StackTrace)); } }
/// <summary> /// When overridden in a derived class, executes the task. /// </summary> /// <returns> /// true if the task successfully executed; otherwise, false. /// </returns> public override bool Execute() { var reportFilePatterns = Array.Empty <string>(); var targetDirectory = TargetDirectory; var sourceDirectories = Array.Empty <string>(); string historyDirectory = HistoryDirectory; var reportTypes = Array.Empty <string>(); var plugins = Array.Empty <string>(); var assemblyFilters = Array.Empty <string>(); var classFilters = Array.Empty <string>(); var fileFilters = Array.Empty <string>(); string verbosityLevel = VerbosityLevel; string tag = Tag; var config = Config.Build(ProjectDirectory).GetSection(SectionName); string value = null; if (ReportFiles.Length > 0) { reportFilePatterns = ReportFiles.Select(r => r.ItemSpec).ToArray(); } else if (config.TryGetString("reports", out value)) { reportFilePatterns = value.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); } else { reportFilePatterns = config .GetAll("report") .Select(x => x.RawValue) .Where(x => !string.IsNullOrEmpty(x)) .ToArray(); } if (reportFilePatterns.Length == 0) { Log.LogError($"{nameof(ReportFiles)} is required."); return(false); } if (string.IsNullOrEmpty(targetDirectory) && config.TryGetString("targetdir", out value)) { targetDirectory = value; } if (string.IsNullOrEmpty(targetDirectory)) { Log.LogError($"{nameof(TargetDirectory)} is required."); return(false); } if (SourceDirectories.Length > 0) { sourceDirectories = SourceDirectories.Select(r => r.ItemSpec).ToArray(); } else if (config.TryGetString("sourcedirs", out value)) { sourceDirectories = value.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); } else { sourceDirectories = config .GetAll("sourcedir") .Select(x => x.RawValue) .Where(x => !string.IsNullOrEmpty(x)) .ToArray(); } if (string.IsNullOrEmpty(HistoryDirectory) && config.TryGetString("historydir", out value)) { historyDirectory = value; } if (ReportTypes.Length > 0) { reportTypes = ReportTypes.Select(r => r.ItemSpec).ToArray(); } else if (config.TryGetString("reporttypes", out value)) { reportTypes = value.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); } else { reportTypes = config .GetAll("reporttype") .Select(x => x.RawValue) .Where(x => !string.IsNullOrEmpty(x)) .ToArray(); } if (Plugins.Length > 0) { plugins = Plugins.Select(r => r.ItemSpec).ToArray(); } else if (config.TryGetString("plugins", out value)) { plugins = value.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); } else { plugins = config .GetAll("plugin") .Select(x => x.RawValue) .Where(x => !string.IsNullOrEmpty(x)) .ToArray(); } if (AssemblyFilters.Length > 0) { assemblyFilters = AssemblyFilters.Select(r => r.ItemSpec).ToArray(); } else if (Filters.Length > 0) { assemblyFilters = Filters.Select(r => r.ItemSpec).ToArray(); } else if (config.TryGetString("assemblyfilters", out value)) { assemblyFilters = value.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); } else { assemblyFilters = config .GetAll("assemblyfilter") .Select(x => x.RawValue) .Where(x => !string.IsNullOrEmpty(x)) .ToArray(); } if (ClassFilters.Length > 0) { classFilters = ClassFilters.Select(r => r.ItemSpec).ToArray(); } else if (config.TryGetString("classfilters", out value)) { classFilters = value.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); } else { classFilters = config .GetAll("classfilter") .Select(x => x.RawValue) .Where(x => !string.IsNullOrEmpty(x)) .ToArray(); } if (FileFilters.Length > 0) { fileFilters = FileFilters.Select(r => r.ItemSpec).ToArray(); } else if (config.TryGetString("filefilters", out value)) { fileFilters = value.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); } else { fileFilters = config .GetAll("filefilter") .Select(x => x.RawValue) .Where(x => !string.IsNullOrEmpty(x)) .ToArray(); } if (string.IsNullOrEmpty(verbosityLevel) && config.TryGetString("verbosity", out value)) { verbosityLevel = value; } if (string.IsNullOrEmpty(tag) && config.TryGetString("tag", out value)) { tag = value; } var configuration = new ReportConfiguration( reportFilePatterns, targetDirectory, sourceDirectories, historyDirectory, reportTypes, plugins, assemblyFilters, classFilters, fileFilters, verbosityLevel, tag); return(new Generator().GenerateReport(configuration)); }