// Update is called once per frame
void Update () {
if (flag)
{
svnVersion = ExecuteCommand(commond);
Debug.Log(svnVersion);
flag = false;
}
}
private string ExecuteCommand(string command)
{
try
{
Debug.Log("Running command: " + command);
// create the ProcessStartInfo using "cmd" as the program to be run,
// and "/c " as the parameters.
// Incidentally, /c tells cmd that we want it to execute the command that follows,
// and then exit.
System.Diagnostics.ProcessStartInfo procStartInfo =new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);
// The following commands are needed to redirect the standard output.
// This means that it will be redirected to the Process.StandardOutput StreamReader.
procStartInfo.RedirectStandardOutput = true;
procStartInfo.RedirectStandardError = true;
procStartInfo.UseShellExecute = false;
// Do not create the black window.
procStartInfo.CreateNoWindow = true;
// Now we create a process, assign its ProcessStartInfo and start it
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
proc.Start();
// Get the output into a string
proc.WaitForExit();
string result = proc.StandardOutput.ReadToEnd();
string error = proc.StandardError.ReadToEnd();
// Display the command output.
//Debug.Log(result + "
" + error);
//result = Encoding.UTF32.GetString(Encoding.UTF32.GetBytes(result));
//result=UnicodeEncoding.
//byte[] bytes = Encoding.BigEndianUnicode.GetBytes(result);
//string res = Encoding.BigEndianUnicode.GetString(bytes);
result = "FUCK" + result;
return result;
}
catch (System.Exception e)
{
// Log the exception
//Debug.Log("Got exception: " + e.Message);
}
return "";
}
i try to change the encoding ,however it does not work, i wanna to cry…