Exemplo n.º 1
0
 static void Main(string[] args)
 {
     if (args.Length > 0)
     {
         DateTime startTime       = DateTime.Now;
         string[] commandSwtiches = args;
         bool     deleteFiles     = commandSwtiches.Contains("/delete");
         bool     executeScan     = commandSwtiches.Contains("/e");
         try
         {
             startTime = DateTime.Now;
             //ExecuteProcess.scanPreviousData();        // deprecated. we dont have to scan as we are not maintaining any further information for failed to delete files.
             if (executeScan)
             {
                 ExecuteProcess.scanCurrentFileSystem(deleteFiles);
             }
         }
         catch (Exception ex)
         {
             //logFFCBatch.WriteEntry( DateTime.Now.ToString() + ": Error Occured: " + ex.Message + "-OnElapsedTime()");
             File.AppendAllText(ExecuteProcess._FileName, "\r\n" + DateTime.Now.ToString() + ": Error Occured: " + ex.Message + "-OnElapsedTime()");
         }
         finally
         {
             //logFFCBatch.WriteEntry( DateTime.Now.ToString() + ": Finished job @ " + System.DateTime.Now.ToString() + " and took " + DateTime.Now.Subtract(startTime).Minutes + " min. -OnElapsedTime()");
             File.AppendAllText(ExecuteProcess._FileName, "\r\n" + DateTime.Now.ToString() + ": Finished job @ " + System.DateTime.Now.ToString() + " and took " + DateTime.Now.Subtract(startTime).Seconds + " sec(s). -OnElapsedTime()");
         }
         Application.Exit(); Application.ExitThread(); return;
     }
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new frmMain());
 }
Exemplo n.º 2
0
        private void OnElapsedTime(object source, ElapsedEventArgs e)
        {
            DateTime startTime = DateTime.Now;

            try
            {
                startTime = DateTime.Now;
                ExecuteProcess.scanPreviousData();
                ExecuteProcess.scanCurrentFileSystem();
            }
            catch (Exception ex)
            {
                StopProcesses();
                //logFFCBatch.WriteEntry( DateTime.Now.ToString() + ": Error Occured: " + ex.Message + "-OnElapsedTime()");
                File.AppendAllText(_FileName, "\r\n" + DateTime.Now.ToString() + ": Error Occured: " + ex.Message + "-OnElapsedTime()");
            }
            finally
            {
                //logFFCBatch.WriteEntry( DateTime.Now.ToString() + ": Finished job @ " + System.DateTime.Now.ToString() + " and took " + DateTime.Now.Subtract(startTime).Minutes + " min. -OnElapsedTime()");
                File.AppendAllText(_FileName, "\r\n" + DateTime.Now.ToString() + ": Finished job @ " + System.DateTime.Now.ToString() + " and took " + DateTime.Now.Subtract(startTime).Seconds + " sec(s). -OnElapsedTime()");
            }
        }