Changeset 737


Ignore:
Timestamp:
12/6/2008 3:29:53 AM (6 years ago)
Author:
lowjoel
Message:

-Allow the --method parameter to be optional
-If a RemoteExecutorServer? instance is not running, Program should detect it and start a new Eraser instance.

Location:
branches/eraser6
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/Eraser/Program.cs

    r631 r737  
    3131using System.Globalization; 
    3232using System.Reflection; 
     33using System.Diagnostics; 
    3334 
    3435namespace Eraser 
     
    8283                using (Program.eraserClient = new RemoteExecutorClient()) 
    8384                { 
     85                    if (!((RemoteExecutorClient)Program.eraserClient).Connect()) 
     86                    { 
     87                        //The client cannot connect to the server. This probably means 
     88                        //that the server process isn't running. Start an instance. 
     89                        Process eraserInstance = Process.Start( 
     90                            Assembly.GetExecutingAssembly().Location); 
     91                        eraserInstance.WaitForInputIdle(); 
     92                    } 
     93 
    8494                    eraserClient.Run(); 
    8595                    program.Run(); 
     
    629639        private void AddTask() 
    630640        { 
    631             //Check that all our command line parameters are present. 
    632641            AddTaskCommandLine arguments = (AddTaskCommandLine)Arguments; 
    633             if (arguments.ErasureMethod == Guid.Empty) 
    634                 throw new ArgumentException("The --method parameter was not specified."); 
    635  
     642             
    636643            //Create the task, and set the method to use. 
    637644            Task task = new Task(); 
    638             ErasureMethod method = ErasureMethodManager.GetInstance(arguments.ErasureMethod); 
     645            ErasureMethod method = arguments.ErasureMethod == Guid.Empty ?  
     646                ErasureMethodManager.Default : 
     647                ErasureMethodManager.GetInstance(arguments.ErasureMethod); 
    639648            foreach (Task.ErasureTarget target in arguments.Targets) 
    640649            { 
  • branches/eraser6/Manager/RemoteExecutor.cs

    r630 r737  
    306306        } 
    307307 
     308        /// <summary> 
     309        /// Connects to the remote server. 
     310        /// </summary> 
     311        /// <returns>True if the connection to the remote server was established.</returns> 
     312        public bool Connect() 
     313        { 
     314            try 
     315            { 
     316                client.Connect(250); 
     317            } 
     318            catch (TimeoutException) 
     319            { 
     320            } 
     321 
     322            return client.IsConnected; 
     323        } 
     324 
    308325        private object SendRequest(RemoteRequest header) 
    309326        { 
Note: See TracChangeset for help on using the changeset viewer.