Example #1
0
        public bool Execute()
        {
            BatchFile batchFile = new BatchFile(this.FileName, this.Server, this.PgDumpPath);

            this.BatchFileName = batchFile.Create();

            using (Process process = new 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()
        {
            BatchFile batchFile = new BatchFile(this.FileName, this.Server, this.PgDumpPath);
            this.BatchFileName = batchFile.Create();

            using (Process process = new 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;
            }
        }
Example #3
0
        private void Completed(object sender, EventArgs e)
        {
            BackupComplete complete = this.BackupComplete;

            if (complete != null)
            {
                BatchFile batchFile = new BatchFile(this.BatchFileName);
                batchFile.Delete();

                complete(this, e);
            }
        }
        private void Completed(object sender, EventArgs e)
        {
            BackupComplete complete = this.BackupComplete;

            if (complete != null)
            {
                BatchFile batchFile = new BatchFile(this.BatchFileName);
                batchFile.Delete();

                complete(this, e);
            }
        }