/// <summary> /// Event: Occurs when an extension it to be added to the extension list /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void addExtlinkLabel_Click(object sender, System.EventArgs e) { if (this.extTextBox.Text.Trim().Length > 0) { string[] exts = extTextBox.Text.Trim().Split(';'); string duplicates = string.Empty; foreach (string s in exts) { List <string> extensions = new List <string>(ExtensionHandler.GetSearchOptionFormat()); string ext = null; if (s.IndexOf('.') > 0) { string[] extA = s.Split('.'); string extension = string.Format("*.{0}", extA[1].ToLower()); if (!extensions.Contains(extension)) { ext = extension; } else { duplicates += string.Format("{0} ", extension); } } else { string extension = string.Format("*.{0}", s.ToLower()); if (!extensions.Contains(extension)) { ext = extension; } else { duplicates += string.Format("{0} ", extension); } } if (ext != null) { Settings.Default.Extensions += string.Format("/{0}", ext); this.Extensions.Items.Clear(); this.Extensions.Items.AddRange(ExtensionHandler.GetSearchOptionFormat()); } } if (duplicates.Length > 0) { Forms.MessageBox.Show("Extensions (" + duplicates + ") already exist!", "Duplicates", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning); } } }
private void GetFiles() { string[] extensions = ExtensionHandler.GetSearchOptionFormat(); if ((_Pictures == null || _Pictures.Count == 0) && _Dir != null) { _Pictures = new List <Picture>(); foreach (string ext in extensions) { FileInfo[] files = _Dir.GetFiles(ext); foreach (FileInfo file in files) { if (file.Exists) { _Pictures.Add(new Picture(file.FullName)); } } } } }
/// <summary> /// Loads the current settings into the settings box for viewing and changing /// Updates controls with setting values /// </summary> private void LoadSettings() { foreach (KeyValuePair <string, string> kvp in settings) { string s = kvp.Key; switch (s) { case SHOWTINYIMAGE: this.ShowTinyImage.Checked = Convert.ToBoolean(settings[s]); break; case REPEATSLIDESHOW: this.repeatCheckBox.Checked = Convert.ToBoolean(settings[s]); break; case STARTMAXIMIZED: this.StartMaximized.Checked = Convert.ToBoolean(settings[s]); break; case AUTONAVIGATION: this.AutoNavigation.Checked = Convert.ToBoolean(settings[s]); break; case AUTOREPEATDELAY: this.AutoRepeatDelay.Text = settings[s]; break; case TABCHARACTERS: this.TabCharacters.Text = settings[s]; break; case HASHSIZE: this.HashSize.Text = settings[s]; break; case CLONEBOXNAVIGATION: this.CloneBoxNavigation.Checked = Convert.ToBoolean(settings[s]); break; case DEFAULTORIENTATION: this.HorizontalOrientation.Checked = (settings[s] == Orientation.Horizontal.ToString()); this.VerticalOrientation.Checked = (settings[s] == Orientation.Vertical.ToString()); break; case SHOWBORDER: this.ShowBorder.Checked = Convert.ToBoolean(settings[s]); break; case SHOWMENUBAR: this.ShowMenuBar.Checked = Convert.ToBoolean(settings[s]); break; case SLIDESHOWDELAY: this.SlideShowDelay.Text = settings[s]; break; case RANDOMIZESLIDESHOW: this.checkBoxRandomize.Checked = Convert.ToBoolean(settings[s]); break; } } this.Extensions.ClearSelected(); this.Extensions.Items.AddRange(ExtensionHandler.GetSearchOptionFormat()); }