public static StatsDisplayer StartNew() { var displayer = new StatsDisplayer(); displayer.Start(); return(displayer); }
static void Main(string[] args) { if (args.Length > 0) { //this first item is a path to config file ServerConfig.Config.FILE_PATH = args[0]; } JOBS_PATH = ServerConfig.Config.Self.JobRepoPath; InitPath(); //ImportJob j = new ImportJob() //{ // GroupingField = "SesstionId", // InputFileName = "in.csv", // TmpFolder = "tmp" //}; //File.WriteAllText("X:\\test.job", JsonConvert.SerializeObject(j, Formatting.Indented)); Logger.LogHello(); //Logger.LogNewJobFound(Guid.NewGuid().ToString(),JobType.LogImport.ToString()); //Logger.LogInvalidNewJob("Invalid json", Guid.NewGuid().ToString()); CheckDirectoriesExists(); //check if there is not executed active job if (Directory.GetFiles(ACTIVE_JOBS_PATH).Length > 0) { Logger.LogDebug("Non completed active job detected, removing everything from active folder"); foreach (var fi in new DirectoryInfo(ACTIVE_JOBS_PATH).GetFileSystemInfos()) { fi.Delete(); } } newJobWaiter = NewJobWaiter.StartNew(); jobExecutor = JobExecutor.StartNew(); statsDisplayer = StatsDisplayer.StartNew(); Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs eventArgs) { eventArgs.Cancel = true; Console.WriteLine("Stopping, wait"); newJobWaiter.Stop(); jobExecutor.Stop(); statsDisplayer.Stop(); }; //Console.ReadLine(); }