static void sendToRawMaterial(string path, bool copy = false) { // "delete" it by sending it to raw material var material = Configs.Current.Get(ConfigKey.FilepathSortMusicKeepAsMaterialDir); if (string.IsNullOrEmpty(material) || !Directory.Exists(material)) { material = InputBoxForm.GetStrInput( "Choose a directory where deleted music will be sent as raw material:", Configs.Current.Get(ConfigKey.FilepathSortMusicKeepAsMaterialDir), mustBeDirectory: true); if (string.IsNullOrEmpty(material) || !Directory.Exists(material)) { throw new CoordinatePicturesException("Directory not found."); } else { Configs.Current.Set(ConfigKey.FilepathSortMusicKeepAsMaterialDir, material); } } var dest = Path.Combine(material, Path.GetFileName(path) + Utils.GetRandomDigits()); if (copy) { SimpleLog.Current.WriteLog("Send to raw-material. File.Copy " + path + " to " + dest); File.Copy(path, dest); } else { SimpleLog.Current.WriteLog("Send to raw-material. File.Move " + path + " to " + dest); File.Move(path, dest); } }
static void OnSetConfigsDir(string info, object sender, ConfigKey key) { var message = (sender as ToolStripItem).Text + Utils.NL + info; var chosenDirectory = InputBoxForm.GetStrInput(message, Configs.Current.Get(key), mustBeDirectory: true); if (!string.IsNullOrEmpty(chosenDirectory)) { Configs.Current.Set(key, chosenDirectory); } }
private void MnuEditLocal_Click(object sender, EventArgs e) { // current limitations: // 1) can't be undone // 2) doesn't edit underlying file yet, until you assign a category if (this.listBox.SelectedItems.Count != 1) { MessageBox.Show("You should first select exactly one."); return; } var index = this.listBox.SelectedIndices[0]; var next = InputBoxForm.GetStrInput("edit:", this.listBox.Items[index].ToString()); if (!string.IsNullOrEmpty(next)) { this.listBox.Items.RemoveAt(index); this.listBox.Items.Insert(index, next); } }
static string AskUserForDirectory(InputBoxHistory mruKey) { return(InputBoxForm.GetStrInput( "Enter directory:", null, mruKey, mustBeDirectory: true)); }