Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. private static void RunCSharpCompiler(BoltCompilerOperation op, ManualResetEvent evnt)
  2. {
  3. string str = "\"{0}\" -out:\"{1}\" {2} -platform:anycpu -target:library -debug+ -optimize- -warn:{3} ";
  4. if (BoltCore.get_isDebugMode())
  5. {
  6. str += "-define:DEBUG ";
  7. }
  8. if (BoltUserAssemblyCompiler.isUnity5)
  9. {
  10. str += "-sdk:2 ";
  11. }
  12. Process p = new Process();
  13. p.StartInfo.FileName = BoltUserAssemblyCompiler.monoPath;
  14. p.StartInfo.Arguments = string.Format(str + BoltUserAssemblyCompiler.sourceFileList, new object[]
  15. {
  16. BoltUserAssemblyCompiler.csharpCompilerPath,
  17. BoltUserAssemblyCompiler.boltUserAssemblyPath,
  18. BoltUserAssemblyCompiler.assemblyReferencesList,
  19. Mathf.Clamp(BoltRuntimeSettings.get_instance().compilationWarnLevel, 0, 4)
  20. });
  21. p.EnableRaisingEvents = true;
  22. p.StartInfo.CreateNoWindow = true;
  23. p.StartInfo.UseShellExecute = false;
  24. p.StartInfo.RedirectStandardError = true;
  25. p.StartInfo.RedirectStandardOutput = true;
  26. p.ErrorDataReceived += new DataReceivedEventHandler(BoltUserAssemblyCompiler.ErrorDataReceived);
  27. p.OutputDataReceived += new DataReceivedEventHandler(BoltUserAssemblyCompiler.OutputDataReceived);
  28. p.Exited += delegate(object s, EventArgs ea)
  29. {
  30. evnt.Set();
  31. EditorHousekeeping.Invoke(delegate
  32. {
  33. if (p.ExitCode == 0)
  34. {
  35. BoltUserAssemblyCompiler.CompilationDone(op);
  36. }
  37. });
  38. };
  39. p.Start();
  40. p.BeginErrorReadLine();
  41. p.BeginOutputReadLine();
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement