01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | private static void processCommand( string command, string argument){ ProcessStartInfo start = new ProcessStartInfo(command); start.Arguments = argument; start.CreateNoWindow = false ; start.ErrorDialog = true ; start.UseShellExecute = true ; if (start.UseShellExecute){ start.RedirectStandardOutput = false ; start.RedirectStandardError = false ; start.RedirectStandardInput = false ; } else { start.RedirectStandardOutput = true ; start.RedirectStandardError = true ; start.RedirectStandardInput = true ; start.StandardOutputEncoding = System.Text.UTF8Encoding.UTF8; start.StandardErrorEncoding = System.Text.UTF8Encoding.UTF8; } Process p = Process.Start(start); if (!start.UseShellExecute){ printOutPut(p.StandardOutput); printOutPut(p.StandardError); } p.WaitForExit(); p.Close(); } |
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | public class SvnForUnity{ static string SVN_BASE = "F:\\Project\\Game" ; [MenuItem( "SVN/Update" , false , 1)] public static void SvnUpdate(){ processCommand( "svn" , "update \"" +SVN_BASE+ "\"" ); } private static void processCommand( string command, string argument){ ProcessStartInfo start = new ProcessStartInfo(command); start.Arguments = argument; start.CreateNoWindow = false ; start.ErrorDialog = true ; start.UseShellExecute = true ; if (start.UseShellExecute){ start.RedirectStandardOutput = false ; start.RedirectStandardError = false ; start.RedirectStandardInput = false ; } else { start.RedirectStandardOutput = true ; start.RedirectStandardError = true ; start.RedirectStandardInput = true ; start.StandardOutputEncoding = System.Text.UTF8Encoding.UTF8; start.StandardErrorEncoding = System.Text.UTF8Encoding.UTF8; } Process p = Process.Start(start); if (!start.UseShellExecute){ printOutPut(p.StandardOutput); printOutPut(p.StandardError); } p.WaitForExit(); p.Close(); } } |
原文地址:http://blog.csdn.net/kakashi8841/article/details/44998241