示例#1
0
 private static void LogException(Exception exc)
 {
     if (exc != null)
     {
         Logger.ApplicationLog(new LogMessage(exc.Message, exc));
         ExceptionForm exceptionForm = new ExceptionForm(exc);
         exceptionForm.ShowDialog();
     }
 }
示例#2
0
        private bool ExecuteCommand(string process, string argument)
        {
            string result = string.Empty;

            System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo(process);
            procStartInfo.Arguments = argument;
            procStartInfo.RedirectStandardOutput = true;
            procStartInfo.UseShellExecute        = false;
            procStartInfo.CreateNoWindow         = true;
            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            proc.StartInfo = procStartInfo;
            proc.Start();
            result = proc.StandardOutput.ReadToEnd();

            string[] resultArr = result.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            if (resultArr.Length >= 4 && resultArr[3].Length > 50)
            {
                Logger.ApplicationLog(new LogMessage("Build Error", new Exception(String.Join("\r\n", resultArr, 2, resultArr.Length - 2).Replace("'", ""))));
                ExceptionForm exceptionForm = new ExceptionForm(new Exception(result));
                exceptionForm.ShowDialog();
                return(false);
            }
            return(true);
        }