Parse() public method

public Parse ( string errorOutput, bool compilationHadFailure ) : IEnumerable
errorOutput string
compilationHadFailure bool
return IEnumerable
示例#1
0
		internal static void RunManagedProgram(string exe, string args, string workingDirectory, CompilerOutputParserBase parser)
		{
			using (ManagedProgram managedProgram = new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "4.0", exe, args))
			{
				managedProgram.GetProcessStartInfo().WorkingDirectory = workingDirectory;
				managedProgram.Start();
				managedProgram.WaitForExit();
				if (managedProgram.ExitCode != 0)
				{
					if (parser != null)
					{
						string[] errorOutput = managedProgram.GetErrorOutput();
						string[] standardOutput = managedProgram.GetStandardOutput();
						IEnumerable<CompilerMessage> enumerable = parser.Parse(errorOutput, standardOutput, true);
						foreach (CompilerMessage current in enumerable)
						{
							Debug.LogPlayerBuildError(current.message, current.file, current.line, current.column);
						}
					}
					Debug.LogError(string.Concat(new string[]
					{
						"Failed running ",
						exe,
						" ",
						args,
						"\n\n",
						managedProgram.GetAllOutput()
					}));
					throw new Exception(string.Format("{0} did not run properly!", exe));
				}
			}
		}
示例#2
0
 internal static void RunManagedProgram(string exe, string args, string workingDirectory, CompilerOutputParserBase parser)
 {
   Stopwatch stopwatch = new Stopwatch();
   stopwatch.Start();
   Program program;
   if (Application.platform == RuntimePlatform.WindowsEditor)
     program = new Program(new ProcessStartInfo()
     {
       Arguments = args,
       CreateNoWindow = true,
       FileName = exe
     });
   else
     program = (Program) new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "4.0", exe, args);
   using (program)
   {
     program.GetProcessStartInfo().WorkingDirectory = workingDirectory;
     program.Start();
     program.WaitForExit();
     stopwatch.Stop();
     Console.WriteLine("{0} exited after {1} ms.", (object) exe, (object) stopwatch.ElapsedMilliseconds);
     if (program.ExitCode != 0)
     {
       if (parser != null)
       {
         string[] errorOutput = program.GetErrorOutput();
         string[] standardOutput = program.GetStandardOutput();
         foreach (CompilerMessage compilerMessage in parser.Parse(errorOutput, standardOutput, true))
           UnityEngine.Debug.LogPlayerBuildError(compilerMessage.message, compilerMessage.file, compilerMessage.line, compilerMessage.column);
       }
       UnityEngine.Debug.LogError((object) ("Failed running " + exe + " " + args + "\n\n" + program.GetAllOutput()));
       throw new Exception(string.Format("{0} did not run properly!", (object) exe));
     }
   }
 }
示例#3
0
 internal static void RunManagedProgram(string exe, string args, string workingDirectory, CompilerOutputParserBase parser)
 {
     using (ManagedProgram program = new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "4.0", exe, args))
     {
         program.GetProcessStartInfo().WorkingDirectory = workingDirectory;
         program.Start();
         program.WaitForExit();
         if (program.ExitCode != 0)
         {
             if (parser != null)
             {
                 string[] errorOutput = program.GetErrorOutput();
                 string[] standardOutput = program.GetStandardOutput();
                 IEnumerator<CompilerMessage> enumerator = parser.Parse(errorOutput, standardOutput, true).GetEnumerator();
                 try
                 {
                     while (enumerator.MoveNext())
                     {
                         CompilerMessage current = enumerator.Current;
                         Debug.LogPlayerBuildError(current.message, current.file, current.line, current.column);
                     }
                 }
                 finally
                 {
                     if (enumerator == null)
                     {
                     }
                     enumerator.Dispose();
                 }
             }
             Debug.LogError("Failed running " + exe + " " + args + "\n\n" + program.GetAllOutput());
             throw new Exception(string.Format("{0} did not run properly!", exe));
         }
     }
 }
示例#4
0
 internal static void RunManagedProgram(string exe, string args, string workingDirectory, CompilerOutputParserBase parser, Action<ProcessStartInfo> setupStartInfo)
 {
     Program program;
     Stopwatch stopwatch = new Stopwatch();
     stopwatch.Start();
     if (Application.platform == RuntimePlatform.WindowsEditor)
     {
         ProcessStartInfo info = new ProcessStartInfo {
             Arguments = args,
             CreateNoWindow = true,
             FileName = exe
         };
         if (setupStartInfo != null)
         {
             setupStartInfo(info);
         }
         program = new Program(info);
     }
     else
     {
         program = new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), null, exe, args, false, setupStartInfo);
     }
     using (program)
     {
         program.GetProcessStartInfo().WorkingDirectory = workingDirectory;
         program.Start();
         program.WaitForExit();
         stopwatch.Stop();
         Console.WriteLine("{0} exited after {1} ms.", exe, stopwatch.ElapsedMilliseconds);
         if (program.ExitCode != 0)
         {
             if (parser != null)
             {
                 string[] errorOutput = program.GetErrorOutput();
                 string[] standardOutput = program.GetStandardOutput();
                 IEnumerable<CompilerMessage> enumerable = parser.Parse(errorOutput, standardOutput, true);
                 foreach (CompilerMessage message in enumerable)
                 {
                     Debug.LogPlayerBuildError(message.message, message.file, message.line, message.column);
                 }
             }
             Debug.LogError("Failed running " + exe + " " + args + "\n\n" + program.GetAllOutput());
             throw new Exception(string.Format("{0} did not run properly!", exe));
         }
     }
 }
	private static bool StartManagedProgram(string exe, string arguments, CompilerOutputParserBase parser, ref IEnumerable<CompilerMessage> compilerMessages)
	{
		using (ManagedProgram managedProgram = GendarmeValidationRule.ManagedProgramFor(exe, arguments))
		{
			managedProgram.LogProcessStartInfo();
			try
			{
				managedProgram.Start();
			}
			catch
			{
				throw new Exception("Could not start " + exe);
			}
			managedProgram.WaitForExit();
			if (managedProgram.ExitCode == 0)
			{
				return true;
			}
			compilerMessages = parser.Parse(managedProgram.GetErrorOutput(), managedProgram.GetStandardOutput(), true);
		}
		return false;
	}