public void Start()
{
if (ProcessAlreadyExist() == true)
{
System.Environment.Exit(-1);
}
lastExecTime = DateTime.Now.AddMinutes(-120);
maxExecTime = DateTime.Now;
do
{
iFilters = new Hashtable();
eFilters = new Hashtable();
LoadConfiguration();
StartThread();
WaitHandle.WaitAll(doneEvents);
iFilters = null;
eFilters = null;
nextCheck = maxExecTime.AddMinutes(refreshIntervalle);
DateTime dtNow = DateTime.Now;
int now = dtNow.Hour * 3600 + dtNow.Minute * 60 + dtNow.Second;
int sleep = ((nextCheck.Hour * 3600 + nextCheck.Minute * 60 + nextCheck.Second) - now);
deb.Write("Main program", "Sleep for " + sleep + " seconds\n\n", DateTime.Now, 2);
do
{
Thread.Sleep(1000);
if (isActive == false)
break;
sleep--;
}
while (sleep > 0);
lastExecTime = maxExecTime;
maxExecTime = DateTime.Now;
}
while (isActive);
deb.Write("Main program", "Program stop", DateTime.Now, 2);
System.Environment.Exit(0);
}