public void Start() { _ = Task.Run(async() => { FileAndFolderExtention.DeleteFileIfExist(Form1.FILE_UPDATE); if (!File.Exists(Form1.FILE_RUN)) { File.Create(Form1.FILE_RUN).Close(); } while (AppIsRunning?.Invoke() != false) { var d = DateTime.Now.Second % 10; MethodHelper.UseTryCatch(() => { if (d == 5) { if (!IsUpdate) { if (!File.Exists(Form1.FILE_RUN)) { File.Create(Form1.FILE_RUN).Close(); } } FileAndFolderExtention.DeleteFileIfExist(Form1.FILE_UPDATE); } }); await Task.Delay(900); } }); }
public virtual void _log(object message, bool error = false) { BaseLog?.WriteLog(message, error); if (error) { FileAndFolderExtention.CreateDirectory(Path.GetDirectoryName(PathFileLog)); message.LogToFile(PathFileLog); } }