Changeset 788 for branches/eraser6/Eraser/Program.cs
- Timestamp:
- 12/11/2008 12:15:36 PM (4 years ago)
- File:
-
- 1 edited
-
branches/eraser6/Eraser/Program.cs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/Eraser/Program.cs
r786 r788 319 319 320 320 byte[] buffer = new byte[commandLineStr.Length]; 321 int count = Encoding.UTF8.GetBytes(commandLineStr.ToString(), 0,321 int count = Encoding.UTF8.GetBytes(commandLineStr.ToString(), 0, 322 322 commandLineStr.Length, buffer, 0); 323 323 client.Write(buffer, 0, buffer.Length); 324 } 325 catch (UnauthorizedAccessException) 326 { 327 //We can't connect to the pipe because the other instance of Eraser 328 //is running with higher privileges than this instance. Tell the 329 //user this is the case and show him how to resolve the issue. 330 MessageBox.Show(S._("Another instance of Eraser is already running but it is " + 331 "running with higher privileges than this instance of Eraser.\n\n" + 332 "Eraser will now exit."), S._("Eraser"), MessageBoxButtons.OK, 333 MessageBoxIcon.Information); 324 334 } 325 335 catch (TimeoutException) … … 1096 1106 1097 1107 //Send the task out. 1098 using (Program.eraserClient = new RemoteExecutorClient()) 1099 { 1100 if (!((RemoteExecutorClient)Program.eraserClient).Connect()) 1101 { 1102 //The client cannot connect to the server. This probably means 1103 //that the server process isn't running. Start an instance. 1104 Process eraserInstance = Process.Start( 1105 Assembly.GetExecutingAssembly().Location, "--quiet"); 1106 eraserInstance.WaitForInputIdle(); 1107 1108 try 1109 { 1110 using (Program.eraserClient = new RemoteExecutorClient()) 1111 { 1108 1112 if (!((RemoteExecutorClient)Program.eraserClient).Connect()) 1109 throw new Exception("Eraser cannot connect to the running " + 1110 "instance for erasures."); 1111 } 1112 1113 Program.eraserClient.Run(); 1114 Program.eraserClient.AddTask(ref task); 1113 { 1114 //The client cannot connect to the server. This probably means 1115 //that the server process isn't running. Start an instance. 1116 Process eraserInstance = Process.Start( 1117 Assembly.GetExecutingAssembly().Location, "--quiet"); 1118 eraserInstance.WaitForInputIdle(); 1119 1120 if (!((RemoteExecutorClient)Program.eraserClient).Connect()) 1121 throw new Exception("Eraser cannot connect to the running " + 1122 "instance for erasures."); 1123 } 1124 1125 Program.eraserClient.Run(); 1126 Program.eraserClient.AddTask(ref task); 1127 } 1128 } 1129 catch (UnauthorizedAccessException e) 1130 { 1131 //We can't connect to the pipe because the other instance of Eraser 1132 //is running with higher privileges than this instance. 1133 throw new UnauthorizedAccessException("Another instance of Eraser " + 1134 "is already running but it is running with higher privileges than " + 1135 "this instance of Eraser. Tasks cannot be added in this manner.\n\n" + 1136 "Close the running instance of Eraser and start it again without " + 1137 "administrator privileges, or run the command again as an administrator", 1138 e); 1115 1139 } 1116 1140 }
Note: See TracChangeset
for help on using the changeset viewer.
