public bool Execute() { var batchFile = new BatchFile(this.FileName, this.Server, this.PgDumpPath, this.Tenant); this.BatchFileName = batchFile.Create(); using(var process = new System.Diagnostics.Process()) { process.StartInfo.FileName = this.BatchFileName; process.StartInfo.CreateNoWindow = true; process.StartInfo.ErrorDialog = false; process.StartInfo.RedirectStandardInput = true; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.ErrorDataReceived += this.Data_Received; process.OutputDataReceived += this.Data_Received; process.Disposed += this.Completed; process.Start(); process.BeginErrorReadLine(); process.BeginOutputReadLine(); process.WaitForExit(); return true; } }
public bool Execute() { var batchFile = new BatchFile(this.FileName, this.Server, this.PgDumpPath, this.Tenant); this.BatchFileName = batchFile.Create(); using (var process = new System.Diagnostics.Process()) { process.StartInfo.FileName = this.BatchFileName; process.StartInfo.CreateNoWindow = true; process.StartInfo.ErrorDialog = false; process.StartInfo.RedirectStandardInput = true; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.ErrorDataReceived += this.Data_Received; process.OutputDataReceived += this.Data_Received; process.Disposed += this.Completed; process.Start(); process.BeginErrorReadLine(); process.BeginOutputReadLine(); process.WaitForExit(); return(true); } }
private void Completed(object sender, EventArgs e) { var complete = this.BackupComplete; if(complete != null) { var batchFile = new BatchFile(this.BatchFileName); batchFile.Delete(); complete(this, e); } }
private void Completed(object sender, EventArgs e) { var complete = this.BackupComplete; if (complete != null) { var batchFile = new BatchFile(this.BatchFileName); batchFile.Delete(); complete(this, e); } }