I have 2 methods. 1st method starts an .exe and 2nd method looks for output file created by that .exe.
program should start looking for output X minutes(defined in app.config) after .exe is called.
it should call the method to look for an output file, after certain frequency(defined in app.config) it should invoke itself, look for an output file if found return success break out of loop go to next line if false go to sleep.
repeat step 2 up until Y minutes(defined in app.config) are reached since the .exe is called. if it exceeds then stop return failure and go to next statement.
I can use datetime.now
to get time at which .exe is started but cannot figure out how to add X and Y minutes to it and how to use those time limits.
Here is my code so far:
//Running the process .exe
DV.runprocess();
// check output file
String checkOutputFrequency=System.Configuration.ConfigurationManager.AppSettings["CheckOutputFrequency"].ToString();
decimal outfrequencyVal = (!string.IsNullOrEmpty(checkOutputFrequency)) ? Decimal.Parse(checkOutputFrequency) : 1;
bool FileFound = false;
while (true)
{
FileFound = DV.checkOutputFile();
if (FileFound == true)
break;
System.Threading.Thread.Sleep(Convert.ToInt32(outfrequencyVal * 60 * 1000));
}