RoboCommand - PCAssistSoftware/RoboSharp GitHub Wiki
Implemented Interfaces:
Properties:
Property Name | Property Type | Description |
---|---|---|
Name | string | Custom Name for the object to refer to it by - Has no effect on functionality. |
Events:
See IRoboCommand for Event Details
Methods:
Overriding Methods
- Methods can be overridden in derived classes to provide custom functionality, while still allowing usage of RoboQueue.
Start()
- All methods that start the RoboCopy process call this method, so overriding it will affect all other Start* calls.
- Below is an example of an override for this method:
public override Task Start(string domain = "", string username = "", string password = "")
{
if (!IsValidForSync) return Task.Delay(0); //IsValidForSync is a property of the derived class
System.IO.File.AppendAllLines(MyApplication.LogFilePath, $"Starting RobotCopy Command: \n{this.GetCommandText()}");
return base.Start(domain,username,password);
}
StartAsync()
- The base method simply awaits Start(), then returns the result of GetResults() method.
- Below is an example of an override for this method:
public override async Task<RoboCopyResults> StartAsync(string domain = "", string username = "", string password = "")
{
if (!IsValidForSync) return null; //IsValidForSync is a property of the derived class
return await base.StartAsync(domain,username,password);
}
If using the both above overrides, StartAsync will:
- Evalaute IsValidForSync
- If TRUE: call base.StartAsync
- base.StartAsync calls the overridden Start() method
- IsValidForSync is checked a second time and passes the check.
- the line is appended to the log file at MyApplication.LogFilePath
- The RoboCopy process is started
- RoboCopy process finishes
- base.StartAsync calls the GetResults() method
- results are passed from base.StartAsync, to its override, and finally to the original caller.