private void btnOk_Click(object sender, EventArgs e) { var file = txtTargetFile.Text.Trim(); txtTargetFile.Text = file; if (file == "") { MessageDisplayer.Tell("File to delete is mandatory.", Text); txtTargetFile.Focus(); return; } if (file.IndexOf("\"", StringComparison.Ordinal) >= 0) { MessageDisplayer.Tell("File to delete cannot contain quotes.", Text); txtTargetFile.Focus(); return; } if (file.StartsWith("-")) { MessageDisplayer.Tell("File to delete cannot start with \"-\".", Text); txtTargetFile.Focus(); return; } var helper = new InProcessJobIdentifyerHelper(); JobIdentiftyerString = helper.GetIdentifyerString(InProcessJobIdentifyer.DeleteFile); Arguments = DeleteFileArguments.CreateArgumentString(file, GetFileNotFoundBehaviour()); DialogResult = DialogResult.OK; }
private void btnOk_Click(object sender, EventArgs e) { var sourceUrl = txtSourceUrl.Text.Trim(); txtSourceUrl.Text = sourceUrl; if (sourceUrl == "") { MessageDisplayer.Tell("Source URL is mandatory.", Text); txtSourceUrl.Focus(); return; } if (sourceUrl.IndexOf("\"", StringComparison.Ordinal) >= 0) { MessageDisplayer.Tell("Source URL cannot contain quotes.", Text); txtSourceUrl.Focus(); return; } if (sourceUrl.StartsWith("-")) { MessageDisplayer.Tell("Source URL cannot start with \"-\".", Text); txtSourceUrl.Focus(); return; } var targetFile = txtTargetFile.Text.Trim(); txtTargetFile.Text = targetFile; if (targetFile == "") { MessageDisplayer.Tell("Target file is mandatory.", Text); txtTargetFile.Focus(); return; } if (targetFile.IndexOf("\"", StringComparison.Ordinal) >= 0) { MessageDisplayer.Tell("Target file cannot contain quotes.", Text); txtTargetFile.Focus(); return; } var helper = new InProcessJobIdentifyerHelper(); JobIdentiftyerString = helper.GetIdentifyerString(InProcessJobIdentifyer.DownloadString); Arguments = DownloadStringArguments.CreateArgumentString(sourceUrl, targetFile, GetExistsBehaviour()); DialogResult = DialogResult.OK; }
private void downloadTextToolStripMenuItem_Click(object sender, EventArgs e) { var helper = new InProcessJobIdentifyerHelper(); var jobIdentiftyerString = helper.GetIdentifyerString(InProcessJobIdentifyer.DownloadString); var program = txtProgram.Text.Trim(); var x = new DownloadStringDialog(); if (string.Compare(jobIdentiftyerString, program, StringComparison.InvariantCultureIgnoreCase) == 0) { x.Arguments = txtArguments.Text.Trim(); } if (x.ShowDialog(this) != DialogResult.OK) { return; } txtProgram.Text = x.JobIdentiftyerString; txtArguments.Text = x.Arguments; }