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", "nemesis,sock,mt,ssm,shm,auto"); hash["internode_channel"] = new Setting("internode_channel", "", "ssm", "nemesis,sock,mt,ssm"); 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; }
private void UpdateHash(Hashtable h) { // update or add entries to the internal hash for each key in the input hash foreach (string str in h.Keys) { if (str != "binary") // ignore the smpd binary key because it is machine specific { if (hash.Contains(str)) { ((Setting)hash[str])._value = (string)h[str]; } else { hash[str] = new Setting(str, (string)h[str], "", ""); } } } // remove settings from the internal hash for keys not in the input hash foreach (string str in hash.Keys) { if (!h.Contains(str)) { ((Setting)hash[str])._value = ""; } } }