📄 wmpiconfig.cs
字号:
#define VERIFY_USING_REGISTRYusing System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;using Microsoft.Win32; // registry reading/writingusing System.Net; // Dnsusing System.IO; // Fileusing System.Diagnostics; // Processusing System.Runtime.InteropServices;using System.Text; // StringBuildernamespace wmpiconfig{ /// <summary> /// Summary description for Form1. /// </summary> public class wmpiconfig : System.Windows.Forms.Form { private bool domain_populated; private Color setting_color; private Hashtable hash; private string smpd; private string mpiexec; private System.Windows.Forms.Label host_label; private System.Windows.Forms.TextBox host_textBox; private System.Windows.Forms.Button get_settings_button; private System.Windows.Forms.ListView list; private System.Windows.Forms.Button apply_button; private System.Windows.Forms.Button cancel_button; private System.Windows.Forms.ListView hosts_list; private System.Windows.Forms.Label domain_label; private System.Windows.Forms.Button scan_button; private System.Windows.Forms.ColumnHeader HostsHeader; private System.Windows.Forms.ColumnHeader SettingsHeader; private System.Windows.Forms.ColumnHeader DefaultHeader; private System.Windows.Forms.ColumnHeader AvailableHeader; private System.Windows.Forms.TextBox output_textBox; private System.Windows.Forms.Button ok_button; private System.Windows.Forms.ComboBox domain_comboBox; private System.Windows.Forms.Button get_hosts_button; private System.Windows.Forms.Button apply_all_button; private System.Windows.Forms.CheckBox append_checkBox; private System.Windows.Forms.CheckBox click_checkBox; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; private System.Windows.Forms.Button toggle_button; private System.Windows.Forms.ProgressBar scan_progressBar; private ToolTip tool_tip; private System.Windows.Forms.Button versions_button; private System.Windows.Forms.ColumnHeader VersionHeader; private Color orig_background; public wmpiconfig() { // // Required for Windows Form Designer support // InitializeComponent(); hash = new Hashtable(); smpd = get_smpd(); mpiexec = get_mpiexec(); setting_color = Color.FromArgb(204,230,230); domain_comboBox.Text = Environment.UserDomainName; domain_populated = false; host_textBox.Text = Environment.MachineName.ToLower(); hosts_list.Items.Add(host_textBox.Text); // set defaults hash["log"] = new Setting("log", "", "no", "yes,no"); hash["logfile"] = new Setting("logfile", "", "none", @"filename (example: c:\temp\smpd.log)"); hash["channel"] = new Setting("channel", "", "sock", "sock,mt,ssm,essm,shm,sshm,ib,auto"); hash["internode_channel"] = new Setting("internode_channel", "", "ssm", "sock,mt,ssm,essm,ib"); hash["phrase"] = new Setting("phrase", "", "", ""); hash["hosts"] = new Setting("hosts", "", "localhost", "list of hostnames (example: foo bar bazz)"); hash["max_logfile_size"] = new Setting("max_logfile_size", "", "unlimited", "max number of bytes"); hash["timeout"] = new Setting("timeout", "", "infinite", "max number of seconds"); //hash["map_drives"] = new Setting("map_drives", "", "no", "yes,no"); hash["exitcodes"] = new Setting("exitcodes", "", "no", "yes,no"); hash["port"] = new Setting("port", "", "8676", ""); hash["noprompt"] = new Setting("noprompt", "", "no", "yes,no"); hash["priority"] = new Setting("priority", "", "2:3", "0..4[:0..5] idle, below, normal, above, high[:idle, lowest, below, normal, above, highest]"); hash["app_path"] = new Setting("app_path", "", "", "path to search for user executables"); hash["plaintext"] = new Setting("plaintext", "", "no", "yes,no"); hash["localonly"] = new Setting("localonly", "", "no", "yes,no"); hash["nocache"] = new Setting("nocache", "", "no", "yes,no"); hash["delegate"] = new Setting("delegate", "", "no", "yes,no"); hash["sspi_protect"] = new Setting("sspi_protect", "", "no", "yes,no"); UpdateHash(get_settings(host_textBox.Text)); UpdateListBox(); orig_background = list.BackColor; } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(wmpiconfig)); this.host_label = new System.Windows.Forms.Label(); this.host_textBox = new System.Windows.Forms.TextBox(); this.get_settings_button = new System.Windows.Forms.Button(); this.list = new System.Windows.Forms.ListView(); this.SettingsHeader = new System.Windows.Forms.ColumnHeader(); this.DefaultHeader = new System.Windows.Forms.ColumnHeader(); this.AvailableHeader = new System.Windows.Forms.ColumnHeader(); this.apply_button = new System.Windows.Forms.Button(); this.cancel_button = new System.Windows.Forms.Button(); this.hosts_list = new System.Windows.Forms.ListView(); this.HostsHeader = new System.Windows.Forms.ColumnHeader(); this.domain_label = new System.Windows.Forms.Label(); this.scan_button = new System.Windows.Forms.Button(); this.output_textBox = new System.Windows.Forms.TextBox(); this.ok_button = new System.Windows.Forms.Button(); this.domain_comboBox = new System.Windows.Forms.ComboBox(); this.get_hosts_button = new System.Windows.Forms.Button(); this.apply_all_button = new System.Windows.Forms.Button(); this.append_checkBox = new System.Windows.Forms.CheckBox(); this.click_checkBox = new System.Windows.Forms.CheckBox(); this.toggle_button = new System.Windows.Forms.Button(); this.scan_progressBar = new System.Windows.Forms.ProgressBar(); this.versions_button = new System.Windows.Forms.Button(); this.VersionHeader = new System.Windows.Forms.ColumnHeader(); this.SuspendLayout(); // // host_label // this.host_label.Location = new System.Drawing.Point(144, 8); this.host_label.Name = "host_label"; this.host_label.Size = new System.Drawing.Size(32, 16); this.host_label.TabIndex = 0; this.host_label.Text = "Host:"; // // host_textBox // this.host_textBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.host_textBox.Location = new System.Drawing.Point(176, 8); this.host_textBox.Name = "host_textBox"; this.host_textBox.Size = new System.Drawing.Size(312, 20); this.host_textBox.TabIndex = 1; this.host_textBox.Text = "localhost"; // // get_settings_button // this.get_settings_button.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.get_settings_button.Location = new System.Drawing.Point(408, 32); this.get_settings_button.Name = "get_settings_button"; this.get_settings_button.Size = new System.Drawing.Size(80, 23); this.get_settings_button.TabIndex = 2; this.get_settings_button.Text = "&Get Settings"; this.get_settings_button.Click += new System.EventHandler(this.get_settings_button_Click); // // list // this.list.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.list.CheckBoxes = true; this.list.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.SettingsHeader, this.DefaultHeader, this.AvailableHeader}); this.list.FullRowSelect = true; this.list.GridLines = true; this.list.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; this.list.Location = new System.Drawing.Point(144, 64); this.list.Name = "list"; this.list.Size = new System.Drawing.Size(344, 376); this.list.TabIndex = 3; this.list.View = System.Windows.Forms.View.Details; this.list.ItemActivate += new System.EventHandler(this.list_ItemActivate); this.list.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.list_AfterLabelEdit); this.list.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.list_ItemCheck); // // SettingsHeader // this.SettingsHeader.Text = "Settings"; this.SettingsHeader.Width = 132; // // DefaultHeader // this.DefaultHeader.Text = "Default"; // // AvailableHeader // this.AvailableHeader.Text = "Available options"; this.AvailableHeader.Width = 122; // // apply_button // this.apply_button.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.apply_button.Location = new System.Drawing.Point(248, 448); this.apply_button.Name = "apply_button"; this.apply_button.TabIndex = 4; this.apply_button.Text = "&Apply"; this.apply_button.Click += new System.EventHandler(this.apply_button_Click); // // cancel_button // this.cancel_button.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.cancel_button.Location = new System.Drawing.Point(416, 448); this.cancel_button.Name = "cancel_button"; this.cancel_button.TabIndex = 14; this.cancel_button.Text = "&Cancel"; this.cancel_button.Click += new System.EventHandler(this.cancel_button_Click); // // hosts_list // this.hosts_list.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.hosts_list.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.HostsHeader, this.VersionHeader}); this.hosts_list.FullRowSelect = true; this.hosts_list.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; this.hosts_list.Location = new System.Drawing.Point(8, 144); this.hosts_list.Name = "hosts_list"; this.hosts_list.Size = new System.Drawing.Size(128, 328); this.hosts_list.TabIndex = 12; this.hosts_list.View = System.Windows.Forms.View.Details; this.hosts_list.KeyUp += new System.Windows.Forms.KeyEventHandler(this.hosts_list_KeyUp); this.hosts_list.SelectedIndexChanged += new System.EventHandler(this.hosts_list_SelectedIndexChanged); // // HostsHeader // this.HostsHeader.Text = "Hosts"; this.HostsHeader.Width = 91; // // domain_label // this.domain_label.Location = new System.Drawing.Point(8, 8); this.domain_label.Name = "domain_label"; this.domain_label.Size = new System.Drawing.Size(48, 16); this.domain_label.TabIndex = 7; this.domain_label.Text = "Domain:"; // // scan_button // this.scan_button.Location = new System.Drawing.Point(8, 80); this.scan_button.Name = "scan_button"; this.scan_button.Size = new System.Drawing.Size(80, 23); this.scan_button.TabIndex = 9; this.scan_button.Text = "&Scan Hosts"; this.scan_button.Click += new System.EventHandler(this.scan_button_Click); // // output_textBox // this.output_textBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.output_textBox.Location = new System.Drawing.Point(144, 32); this.output_textBox.Multiline = true; this.output_textBox.Name = "output_textBox"; this.output_textBox.ReadOnly = true; this.output_textBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.output_textBox.Size = new System.Drawing.Size(256, 32); this.output_textBox.TabIndex = 15; this.output_textBox.Text = ""; // // ok_button // this.ok_button.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.ok_button.Location = new System.Drawing.Point(336, 448); this.ok_button.Name = "ok_button"; this.ok_button.Size = new System.Drawing.Size(72, 23); this.ok_button.TabIndex = 13; this.ok_button.Text = "OK"; this.ok_button.Click += new System.EventHandler(this.ok_button_Click); // // domain_comboBox // this.domain_comboBox.Location = new System.Drawing.Point(8, 24); this.domain_comboBox.Name = "domain_comboBox"; this.domain_comboBox.Size = new System.Drawing.Size(112, 21); this.domain_comboBox.TabIndex = 6; this.domain_comboBox.DropDown += new System.EventHandler(this.domain_comboBox_DropDown); // // get_hosts_button // this.get_hosts_button.Location = new System.Drawing.Point(8, 48); this.get_hosts_button.Name = "get_hosts_button"; this.get_hosts_button.TabIndex = 7; this.get_hosts_button.Text = "Get &Hosts"; this.get_hosts_button.Click += new System.EventHandler(this.get_hosts_button_Click); // // apply_all_button // this.apply_all_button.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.apply_all_button.Location = new System.Drawing.Point(168, 448); this.apply_all_button.Name = "apply_all_button"; this.apply_all_button.TabIndex = 5; this.apply_all_button.Text = "Apply All"; this.apply_all_button.Click += new System.EventHandler(this.apply_all_button_Click); // // append_checkBox // this.append_checkBox.Appearance = System.Windows.Forms.Appearance.Button; this.append_checkBox.Location = new System.Drawing.Point(88, 51); this.append_checkBox.Name = "append_checkBox"; this.append_checkBox.Size = new System.Drawing.Size(16, 16); this.append_checkBox.TabIndex = 8; this.append_checkBox.Text = "+"; // // click_checkBox // this.click_checkBox.Appearance = System.Windows.Forms.Appearance.Button; this.click_checkBox.Location = new System.Drawing.Point(96, 80); this.click_checkBox.Name = "click_checkBox"; this.click_checkBox.Size = new System.Drawing.Size(40, 24); this.click_checkBox.TabIndex = 10; this.click_checkBox.Text = "click"; // // toggle_button // this.toggle_button.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.toggle_button.Location = new System.Drawing.Point(144, 448); this.toggle_button.Name = "toggle_button"; this.toggle_button.Size = new System.Drawing.Size(16, 23); this.toggle_button.TabIndex = 16; this.toggle_button.Text = "^"; this.toggle_button.Click += new System.EventHandler(this.toggle_button_Click); // // scan_progressBar // this.scan_progressBar.Location = new System.Drawing.Point(8, 136); this.scan_progressBar.Name = "scan_progressBar"; this.scan_progressBar.Size = new System.Drawing.Size(128, 8); this.scan_progressBar.Step = 1; this.scan_progressBar.TabIndex = 17; // // versions_button // this.versions_button.Location = new System.Drawing.Point(8, 112); this.versions_button.Name = "versions_button"; this.versions_button.Size = new System.Drawing.Size(128, 23); this.versions_button.TabIndex = 11; this.versions_button.Text = "Scan for &Versions"; this.versions_button.Click += new System.EventHandler(this.versions_button_Click); // // VersionHeader // this.VersionHeader.Text = "Version"; // // wmpiconfig // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(496, 483); this.Controls.Add(this.versions_button); this.Controls.Add(this.scan_progressBar); this.Controls.Add(this.toggle_button); this.Controls.Add(this.cancel_button); this.Controls.Add(this.apply_button); this.Controls.Add(this.click_checkBox); this.Controls.Add(this.append_checkBox); this.Controls.Add(this.apply_all_button); this.Controls.Add(this.get_hosts_button); this.Controls.Add(this.domain_comboBox); this.Controls.Add(this.ok_button); this.Controls.Add(this.output_textBox); this.Controls.Add(this.host_textBox); this.Controls.Add(this.scan_button); this.Controls.Add(this.domain_label); this.Controls.Add(this.hosts_list); this.Controls.Add(this.list); this.Controls.Add(this.get_settings_button); this.Controls.Add(this.host_label); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MinimumSize = new System.Drawing.Size(504, 256); this.Name = "wmpiconfig"; this.Text = "MPICH2 Configurable Settings";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -