/// <summary> /// find a file from file list view. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FilesFind(object sender, EventArgs e) { PromptForm findForm = new PromptForm("Find file name:") { Owner = this }; findForm.ShowDialog(); for (int i = 0; i < ListViewFiles.Items.Count; i++) { if (ListViewFiles.Items[i].SubItems[1].Text.IndexOf(findForm.ConfirmedMessage) != -1) { ListViewFiles.Items[i].Selected = true; ListViewFiles.Items[i].EnsureVisible(); } } }
/// <summary> /// changing the file types from default type of * /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ChangeFileTypes(object sender, EventArgs e) { if (ListViewFetching.SelectedItems.Count < 1) { MessageBox.Show( "You have to select at lease one line to update.", "Changing File Types", MessageBoxButtons.OK, MessageBoxIcon.Error ); return; } PromptForm prompt = new PromptForm("Please input types you want to fetch, using ';' to seperate.") { Owner = this }; prompt.ShowDialog(); if (prompt.ConfirmedMessage == null) { return; } string changingTypes = prompt.ConfirmedMessage; changingTypes = changingTypes.Replace(" ", ""); if (changingTypes == "") { changingTypes = "*"; } foreach (ListViewItem item in ListViewFetching.SelectedItems) { DBLinker.Execute($@" update main set fileType = '{ changingTypes }' where path = '{ item.SubItems[0].Text }' "); } ReloadListViewFetching(); }
/// <summary> /// set the arguments of file when running. /// these arguments will not remove by reload fetching. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EditArguments(object sender, EventArgs e) { if (ListViewFiles.SelectedItems.Count < 1) { MessageBox.Show( "At least select one file, to set its arguments when running.", "Set Arguments", MessageBoxButtons.OK, MessageBoxIcon.Error ); return; } PromptForm promptForm = new PromptForm( "Set Arguments for " + ListViewFiles.SelectedItems[0].SubItems[1].Text + " ...", ListViewFiles.SelectedItems[0].SubItems[6].Text ); promptForm.ShowDialog(); string confirmedArguments = promptForm.ConfirmedMessage; foreach (ListViewItem item in ListViewFiles.SelectedItems) { DBLinker.Execute($@" delete from arguments where fileMainName = '{ item.SubItems[1].Text }' and path = '{ item.SubItems[0].Text }'; "); DBLinker.Execute($@" insert into arguments values( '{ item.SubItems[1].Text }', '{ item.SubItems[0].Text }', '{ confirmedArguments }' ); "); } GetFileList(); }