private void AddToIgnore(object sender, EventArgs e) { if (m_imagePreviewPanel.CurrentImageInfo != null) { Array.Resize(ref m_coreOptions.ignorePath, m_coreOptions.ignorePath.Length + 1); m_coreOptions.ignorePath[m_coreOptions.ignorePath.Length - 1] = new CorePathWithSubFolder(m_imagePreviewPanel.CurrentImageInfo.path, false); m_coreOptions.Validate(m_core, m_options.onePath); m_resultsListView.RefreshResults(); } }
static public CoreOptions Load(string fileName, CoreLib core, bool onePath) { FileInfo fileInfo = new FileInfo(fileName); if (fileInfo.Exists) { FileStream fileStream = null; try { XmlSerializer xmlSerializer = new XmlSerializer(typeof(CoreOptions)); fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); CoreOptions coreOptions = (CoreOptions)xmlSerializer.Deserialize(fileStream); fileStream.Close(); coreOptions.Validate(core, onePath); return(coreOptions); } catch { if (fileStream != null) { fileStream.Close(); } return(new CoreOptions(core)); } } else { return(new CoreOptions(core)); } }
private void OnAddFolderButtonClick(object sender, EventArgs e) { CorePathWithSubFolder[] path = GetCurrentPath(); if (path == null) { return; } FolderBrowserDialog dialog = new FolderBrowserDialog(); dialog.ShowNewFolderButton = false; dialog.SelectedPath = GetInitialPath(path); if (dialog.ShowDialog() == DialogResult.OK) { Array.Resize(ref path, path.Length + 1); path[path.Length - 1] = new CorePathWithSubFolder(); if (dialog.SelectedPath[dialog.SelectedPath.Length - 1] == Path.DirectorySeparatorChar) { path[path.Length - 1].path = dialog.SelectedPath.Remove(dialog.SelectedPath.Length - 1); } else { path[path.Length - 1].path = dialog.SelectedPath; } path[path.Length - 1].enableSubFolder = true; SetCurrentPath(path); m_newCoreOptions.Validate(m_core, m_options.onePath); UpdatePath(); UpdateButtonEnabling(); } }