Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- StringBuilder errS = new StringBuilder();
- Boolean errYes = false;
- Thread runProc = new Thread(() =>
- {
- Process reCache = new Process();
- try
- {
- this.UIThread(() =>
- {
- panel2.Location = new Point(0, 0);
- panel2.Enabled = true;
- panel2.Visible = true;
- });
- reCache.StartInfo.FileName = copiedFileLoc;
- reCache.StartInfo.RedirectStandardOutput = true;
- reCache.StartInfo.UseShellExecute = false;
- reCache.StartInfo.CreateNoWindow = true;
- reCache.Start();
- StreamReader localSW = reCache.StandardOutput;
- string aLine = "";
- while ((aLine = reCache.StandardOutput.ReadLine()) != null)
- {
- if (
- (aLine.ToLower().Contains("error")) ||
- (aLine.ToLower().Contains("error:"))
- )
- {
- if (!errYes)
- {
- errYes = true;
- }
- errS.Append(aLine + Environment.NewLine);
- }
- this.UIThread(() =>
- {
- textBox7.Text += aLine + Environment.NewLine;
- });
- }
- reCache.WaitForExit();
- if (errYes)
- {
- MessageBox.Show("Errors may have occured. Note that SQL errors are \"expected\"" +
- Environment.NewLine + Environment.NewLine +
- errS.ToString(),
- "Possible Errors",
- MessageBoxButtons.OK,
- MessageBoxIcon.Warning);
- }
- }
- catch (SecurityException secEx)
- {
- MessageBox.Show("There was a security/access issue with this file." +
- Environment.NewLine +
- secEx.Message +
- Environment.NewLine + Environment.NewLine +
- secEx.StackTrace,
- "Security/Access error",
- MessageBoxButtons.OK,
- MessageBoxIcon.Exclamation);
- return;
- }
- catch (Exception ex)
- {
- MessageBox.Show("ERROR: " + ex.Message + Environment.NewLine + Environment.NewLine +
- ex.StackTrace,
- "ERROR",
- MessageBoxButtons.OK,
- MessageBoxIcon.Error);
- return;
- }
- finally
- {
- reCache.Dispose();
- this.UIThread(() =>
- {
- panel2.Location = new Point(1400, 1400);
- panel2.Enabled = false;
- panel2.Visible = false;
- LoadorReLoad(true);
- });
- }
- });
- runProc.Start();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement