public override bool EnsureUpdated(SeriesSpecifier s, bool bannersToo, bool showErrorMsgBox) { if (s.Provider != TVDoc.ProviderType.TVmaze) { throw new SourceConsistencyException($"Asked to update {s.Name} from TV Maze, but the Id is not for TV maze.", TVDoc.ProviderType.TVmaze); } lock (SERIES_LOCK) { if (Series.ContainsKey(s.TvMazeSeriesId) && !Series[s.TvMazeSeriesId].Dirty) { return(true); } } Say($"{s.Name} from TVmaze"); try { CachedSeriesInfo downloadedSi = API.GetSeriesDetails(s); if (downloadedSi.TvMazeCode != s.TvMazeSeriesId && s.TvMazeSeriesId == -1) { lock (SERIES_LOCK) { Series.TryRemove(-1, out _); } } lock (SERIES_LOCK) { AddSeriesToCache(downloadedSi); } } catch (SourceConnectivityException conex) { LastErrorMessage = conex.Message; return(true); } catch (SourceConsistencyException sce) { LOGGER.Error(sce.Message); LastErrorMessage = sce.Message; return(true); } return(true); }
private IEnumerable <string> GetPossibleShowNameStrings() { List <string> possibleShowNames = new List <string>(); foreach (string dirPath in TVSettings.Instance.DownloadFolders.ToArray()) { LOGGER.Info("Parsing {0} for new shows", dirPath); if (!Directory.Exists(dirPath)) { continue; } try { foreach (string filePath in Directory.GetFiles(dirPath, "*", System.IO.SearchOption.AllDirectories)) { if (!File.Exists(filePath)) { continue; } FileInfo fi = new FileInfo(filePath); if (fi.IgnoreFile()) { continue; } possibleShowNames.Add(fi.RemoveExtension() + "."); } } catch (UnauthorizedAccessException ex) { LOGGER.Warn(ex, $"Could not access files in {dirPath}"); } catch (System.IO.DirectoryNotFoundException ex) { LOGGER.Warn(ex, $"Could not access files in {dirPath}"); } catch (System.IO.IOException ex) { LOGGER.Warn(ex, $"Could not access files in {dirPath}"); } } return(possibleShowNames); }
private void DoCopyRename(TVRenameStats stats) { try { //we use a temp name just in case we are interrupted or some other problem occurs string tempName = TempFor(To); // If both full filenames are the same then we want to move it away and back //This deals with an issue on some systems (XP?) that case insensitive moves did not occur if (IsMoveRename() || FileHelper.Same(From, To)) { // This step could be slow, so report progress CopyMoveResult moveResult = File.Move(From.FullName, tempName, MoveOptions.CopyAllowed | MoveOptions.ReplaceExisting, CopyProgressCallback, null); if (moveResult.ErrorCode != 0) { throw new TheTVDB.TVDBException(moveResult.ErrorMessage); } } else { //we are copying Debug.Assert(Operation == Op.copy); // This step could be slow, so report progress CopyMoveResult copyResult = File.Copy(From.FullName, tempName, CopyOptions.None, true, CopyProgressCallback, null); if (copyResult.ErrorCode != 0) { throw new TheTVDB.TVDBException(copyResult.ErrorMessage); } } // Copying the temp file into the correct name is very quick, so no progress reporting File.Move(tempName, To.FullName, MoveOptions.ReplaceExisting); LOGGER.Info($"{Name} completed: {From.FullName} to {To.FullName } "); Done = true; UpdateStats(stats); } catch (Exception e) { LOGGER.Warn(e, $"Error occurred while {Name}: {From.FullName} to {To.FullName } "); Done = true; Error = true; ErrorText = e.Message; } }
private static void SwitchLoggerLevel(string msg, LOGGER l) { switch (l) { case LOGGER.Trace: { _logger.Trace(msg); break; } case LOGGER.Debug: { _logger.Debug(msg); break; } case LOGGER.Info: { _logger.Info(msg); break; } case LOGGER.Warn: { _logger.Warn(msg); break; } case LOGGER.Error: { _logger.Error(msg); break; } case LOGGER.Fatal: { _logger.Fatal(msg); break; } default: { break; } } ; }
public override bool Backup(string rootBackupDir) { if (!IsAuthorized) { LOGGER.Error("Unable to backup Github API"); return(false); } CanBackup = false; string currentRepoName = string.Empty; string serviceSubFolderDir = Path.Combine(rootBackupDir, m_serviceNameFolder); try { List <Repository> repos = m_githubApiService.GetAllRepositories(); foreach (Repository repo in repos) { BackupReposDto backupRepoConfig = m_backupRepos?.FirstOrDefault(x => x.RepositoryName == repo.Name); if (backupRepoConfig != null && !backupRepoConfig.ShouldBackup) { continue; } OnRepoStartBackup(repo.Name); currentRepoName = repo.Name; if (BackupSingleRepository(serviceSubFolderDir, repo.Name)) { OnRepoBackupSucceeded(repo.Name); } else { LOGGER.Error($"Unable to backup {repo.Name}"); OnRepoBackupFailed(repo.Name); } CompletedReposCount++; } } catch (Exception e) { LOGGER.Fatal($"Unable to backup repository {currentRepoName}"); } CanBackup = true; return(true); }
protected void BrakingOff() { LOGGER.Debug("BrakingOff"); foreach (KeyValuePair <IMyThrust, ThrustersFlag> e in thrustersAndFlags) { IMyThrust thrust = e.Key; ThrustersFlag flag = e.Value; if ((flag & ThrustersFlag.Braking) != 0) { thrust.ThrustOverridePercentage = 0.00001f; } else { thrust.ThrustOverridePercentage = 0f; } } }
private void StopSystem() { // Stop thrusters de freinage foreach (IMyThrust thisThrust in thrustersAndFlags.Keys) { thisThrust.ThrustOverridePercentage = 0f; //thisThrust.Enabled = false; } // Stop gyro override StopGyros(); // Reactive les dampeners referenceBlock.DampenersOverride = true; // Stop l'auto update LOGGER.Debug("STOP"); p.Runtime.UpdateFrequency = UpdateFrequency.None; }
// ReSharper disable once UnusedParameter.Local static void Main(string[] args) { try { var root = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", true, true).Build(); LOGGER.Initialize(root).RunsOnConsole().AddNLog().AddSampleLog().AllDone(); // LOGGER.Initialize("appsettings.json", FileTypes.Json).RunsOnConsole().AddNLog().AddSampleLog().AllDone(); var logger1 = LOGGER.GetLogger <Program>(mode: LogEventSendMode.Manually); logger1.LogWarning("hello, {$Date} {$MachineName}"); logger1.SubmitLogger(); // // var logger2 = LOGGER.GetLogger<Program>(); // logger2.LogWarning("world"); // // var logger3 = LOGGER.GetLogger<Program>().ToFuture(); // var logger4 = logger2.ToFuture(); // // var logger5 = FUTURE.GetFutureLogger<Program>(); // logger5.SetLevel(LogEventLevel.Warning) // .SetMessage("future log===> Nice {@L}") // .SetTags("Alex", "Lewis") // .SetParameter(new {L = "KK2"}) // .SetException(new ArgumentNullException(nameof(args))) // .Submit(); // // logger5.UseFields( // Fields.Level(LogEventLevel.Warning), // Fields.Message("future log===> Nice {@L}"), // Fields.Tags("Alex", "Lewis"), // Fields.Args(new {L = "KK3"}), // Fields.Exception(new ArgumentNullException(nameof(args)))).Submit(); Console.WriteLine("Hello World!"); } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.Source); Console.WriteLine(e.StackTrace); } Console.ReadLine(); }
public override TDWay getWay(long id) { if (this.wayIndexReader == null) { throw new System.InvalidOperationException("way store not accessible, call complete() first"); } try { return(TDWay.fromWay(this.wayIndexReader.get(id), this, this.preferredLanguages)); } catch (NoSuchIndexElementException) { LOGGER.finer("way cannot be found in index: " + id); return(null); } }
private void TidyUpIfNeeded() { try { if (Operation == Op.move && Tidyup != null && Tidyup.DeleteEmpty) { LOGGER.Info($"Testing {From.Directory.FullName} to see whether it should be tidied up"); DoTidyup(From.Directory); } } catch (Exception e) { Done = true; Error = true; ErrorText = e.Message; } }
private void ReviewFilesInDownloadDirectory(string dirPath, IDialogParent owner) { try { foreach (string filePath in Directory.GetFiles(dirPath, "*", SearchOption.AllDirectories).Where(File.Exists)) { if (currentSettings.Token.IsCancellationRequested) { return; } FileInfo fi = new FileInfo(filePath); if (fi.IgnoreFile()) { continue; } List <ShowConfiguration> matchingShows = showList.Where(si => si.NameMatch(fi, TVSettings.Instance.UseFullPathNameToMatchSearchFolders)).ToList(); List <ShowConfiguration> matchingShowsNoDupes = RemoveShortShows(matchingShows); if (matchingShowsNoDupes.Any()) { ReviewFileInDownloadDirectory(currentSettings.Unattended, fi, matchingShowsNoDupes, owner); } List <MovieConfiguration> matchingMovies = movieList.Where(mi => mi.NameMatch(fi, TVSettings.Instance.UseFullPathNameToMatchSearchFolders)).ToList(); List <MovieConfiguration> matchingNoDupesMovies = RemoveShortShows(matchingMovies); if (matchingNoDupesMovies.Any()) { ReviewFileInDownloadDirectory(currentSettings.Unattended, fi, matchingNoDupesMovies, owner); } } } catch (UnauthorizedAccessException ex) { LOGGER.Warn(ex, $"Could not access files in {dirPath}"); } catch (DirectoryNotFoundException ex) { LOGGER.Warn(ex, $"Could not access files in {dirPath}"); } catch (IOException ex) { LOGGER.Warn(ex, $"Could not access files in {dirPath}"); } }
public override bool Go(TVRenameStats stats) { // read NTFS permissions (if any) FileSecurity security = null; try { security = From.GetAccessControl(); } catch { // ignored } DoCopyRename(stats); if (To.IsMovieFile()) { //File is correct name LOGGER.Debug($"Just copied {To.FullName} to the right place. Marking it as 'seen'."); //Record this episode as seen TVSettings.Instance.PreviouslySeenEpisodes.EnsureAdded(Episode); if (TVSettings.Instance.IgnorePreviouslySeen) { doc.SetDirty(); } } // set NTFS permissions try { if (security != null) { To.SetAccessControl(security); } } catch { // ignored } TidyUpIfNeeded(); return(!Error); }
public static string ExpandSAFCore() { string result; try { string cipherString = SAFConfiguration.readConnectionStringCoreEncrypted(); string text = CryptorEngineTripleDES.Decrypt(cipherString, SAFSecurityKeys.getSecurityInfoFromWConfig(), true); result = text; } catch (Exception ex) { LOGGER.Write(LOGGER.LogCategory.ERROR, "SF.Expand.SAF.Core.DBConnectionString::ExpandSAFCore[]\r\n" + ex.Message, null); result = null; } return(result); }
/// <summary> /// SINA 板块概念 /// </summary> public void SyncBKGN() { var startTime = DateTime.Now;///开始运行时间 Console.Title = "SINA板块概念 更新进程 启动时间:" + startTime; var exe = StockTaskExecutor.CreateInstance(); var mongo = DataStorage.GetInstance(DBType.MongoDB); var dbName = CONST.DB.DBName_StockService; var collectionName = CONST.DB.CollectionName_BKGN; var methodName = "SyncBKGN"; while (true) { ///获取所有股票代码,遍历更新数据 var q = this.PrepareData(methodName); while (0 < q.Count) { var stockCode = q.Dequeue(); var resObj = WebDataSource.GetInstance().GetBKGN(stockCode); var resDict = (resObj is Dictionary <string, object>) ? (resObj as Dictionary <string, object>)["PageData"] : new Dictionary <string, object>(); ///保存到数据库中 二维化 var svItem = new { StockCode = stockCode, StockName = this.stockCodeDict[stockCode], Url = string.Format("http://vip.stock.finance.sina.com.cn/corp/go.php/vCI_CorpOtherInfo/stockid/{0}/menu_num/5.phtml", stockCode), CreateTime = DateTime.Now, PageData = resDict }; var filter = "{\"ContentType\":\"SINA板块概念\",\"StockCode\":\"" + stockCode + "\"}"; ///添加新数据 LOGGER.Log(string.Format("更新{0} {1}的板块概念 ", stockCode, svItem.StockName)); mongo.Save3(dbName, collectionName, svItem, filter); ThreadManager.Pause(seconds: 5); TaskStatusManager.Set(methodName, new { ID = methodName, StockCode = stockCode, StockName = svItem.StockName, Status = "已下载", CreateTime = DateTime.Now }); } TaskStatusManager.Set(methodName, new { ID = methodName, Status = "队列处理完毕", CreateTime = DateTime.Now }); LOGGER.Log(string.Format("本次板块概念更新完毕,下一次两天以后更新 {0}", DateTime.Now)); ThreadManager.Pause(days: 2); q = this.PrepareData(); } }
internal static void StartTorrentDownload(string torrentUrl, string torrentFileName, bool downloadFileFirst) { if (string.IsNullOrEmpty(TVSettings.Instance.qBitTorrentHost) || string.IsNullOrEmpty(TVSettings.Instance.qBitTorrentPort)) { LOGGER.Warn($"Could not download {torrentUrl} via qBitTorrent as settings are not entered for host and port"); return; } if (downloadFileFirst) { AddFile(torrentFileName, GetApiUrl(qBitTorrentAPIPath.addFile)); } else { DownloadUrl(torrentUrl, GetApiUrl(qBitTorrentAPIPath.addUrl)); } }
private bool EnsureMovieUpdated(int id, string name, bool showErrorMsgBox) { lock (MOVIE_LOCK) { if (Movies.ContainsKey(id) && !Movies[id].Dirty) { return(true); } } Say($"{name} from TMDB"); try { CachedMovieInfo downloadedSi = DownloadMovieNow(id, showErrorMsgBox); if (downloadedSi.TmdbCode != id && id == -1) { lock (MOVIE_LOCK) { Movies.TryRemove(-1, out _); } } lock (MOVIE_LOCK) { AddMovieToCache(downloadedSi); } } catch (SourceConnectivityException conex) { LastErrorMessage = conex.Message; return(true); } catch (SourceConsistencyException sce) { LOGGER.Error(sce.Message); LastErrorMessage = sce.Message; return(true); } finally { SayNothing(); } return(true); }
private void BTN_USE_SELECTED_DB_CLICK(object sender, EventArgs e) { LOGGER.METHOD_ENTER(); string SELECTED_DB = DGV_1.SelectedCells[0].Value.ToString(); string RESULT = CONNECTION.CONNECT_TO_DATABASE(SELECTED_DB); DATABASE_CONNECTION_SWITCH(RESULT); DGV_2.DataSource = CONNECTION.GET_TABLE_LISTING(); try { DGV_2.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } //Try to format the column to fill mode. catch (Exception EX) //If something didn't populate right, for whatever reason, capture it. { LOGGER.EXCEPTION(EX.Message); LOGGER.METHOD_EXIT_FAIL(); return; } LOGGER.METHOD_EXIT_SUCCESS(); }
/// <summary> /// START INBOUND Message Retriever /// </summary> private void StartInboundMessageRetriever() { if (this.inboundMessageRetriever != null) { return; } this.inboundMessageRetriever = new InboundMessageRetriever(); int intervalMs = Configuration.InboundMessagesRetrievingInterval; this.inboundMessageRetriever.Start(intervalMs, this); if (LOGGER.IsInfoEnabled) { LOGGER.Info("Inbound Messages Retriever is successfully started."); } }
//*************************SMSMessagingClientImpl private****************************************************************************************************************************************************** /// <summary> /// START DLR Retriever /// </summary> private void StartDeliveryReportRetriever() { if (this.deliveryReportRetriever != null) { return; } this.deliveryReportRetriever = new DeliveryReportRetriever(); int intervalMs = Configuration.DlrRetrievingInterval; this.deliveryReportRetriever.Start(intervalMs, this); if (LOGGER.IsInfoEnabled) { LOGGER.Info("Delivery Report Retriever is successfully started."); } }
private void GenerateInitUri() { if (Status.UploadAddress == null && !Status.QuotaReached) { LOGGER.Info($"Creating upload uri"); string result = InitializeUploadOnYoutube(); Status.QuotaReached = QuotaProblemHandler.IsQuotaLimitReached(result); Uri uri = null; if (!Status.QuotaReached && Uri.TryCreate(result, UriKind.Absolute, out uri)) { LOGGER.Info($"Upload uri was created: '{uri}'"); Status.UploadAddress = uri; } } }
public void SyncStockRardar() { var startTime = DateTime.Now;///开始运行时间 Console.Title = "SINA 股市雷达异动 更新进程 启动时间:" + startTime; var exe = StockTaskExecutor.CreateInstance(); var mongo = DataStorage.GetInstance(DBType.MongoDB); var dbName = CONST.DB.DBName_StockService; var collectionName = CONST.DB.CollectionName_Radar; var methodName = "SyncStockRardar"; while (true) { var filterCheck = "{\"TradingDate\":new Date('" + string.Format("{0:yyyy/MM/dd}", DateTime.Now) + "')}"; var checkRes = mongo.Count(dbName, collectionName, filterCheck); if (0 == checkRes && CONST.IsSafeUpdateTime(1)) { var listData = WebDataSource.GetInstance().GetStockRadar(); foreach (var item in listData) { var tradingTime = item["异动时间"].ToString().Replace("-", "/"); var filter = "{\"ContentType\":\"SINA 股市雷达\",\"TradingTime\":new Date('" + tradingTime + "')}"; var svItem = new { StockCode = item["股票代码"], StockName = item["股票简称"], AnomalyInfo = item["异动信息"], TradingTime = item["异动时间"], TradingDate = Convert.ToDateTime(tradingTime).Date }; mongo.Save3(dbName, collectionName, svItem, filter); } TaskStatusManager.Set(methodName, new { ID = methodName, Status = "队列处理完毕", CreateTime = DateTime.Now }); LOGGER.Log(string.Format("本次股市雷达异动更新完毕,下一次一天以后更新 {0}", DateTime.Now)); } else { LOGGER.Log(string.Format("今日股市雷达异动已经更新,下一次一天以后更新")); } ThreadManager.Pause(hours: 2); } }
private static void AddFilesFromTorrent(ICollection <TorrentEntry> ret, [NotNull] JToken torrent, string savePath) { string torrentDetailsString = string.Empty; try { (string hashCode, string torrentName) = ExtractTorrentDetails(torrent); string url = GetApiUrl(qBitTorrentAPIPath.torrentDetails) + hashCode; torrentDetailsString = JsonHelper.Obtain(url); JArray torrentDetails = JArray.Parse(torrentDetailsString); if (torrentDetails is null) { LOGGER.Warn( $"Could not get details of downloads from {url} from qBitTorrent: {torrentDetailsString}"); return; } if (!torrentDetails.Children().Any()) { string proposedFilename = TVSettings.Instance.FilenameFriendly(savePath + torrentName) + TVSettings.Instance.VideoExtensionsArray[0]; ret.Add(new TorrentEntry(torrentName, proposedFilename, 0)); return; } foreach (JToken file in torrentDetails.Children()) { (string downloadedFilename, bool isOnHold, int percentComplete) = ExtractTorrentFileDetails(file); if (!downloadedFilename.Contains(".!qB\\.unwanted\\") && !isOnHold) { ret.Add(new TorrentEntry(torrentName, savePath + downloadedFilename, percentComplete)); } } } catch (JsonReaderException ex) { LOGGER.Warn(ex, $"Could not parse data recieved from {torrentDetailsString}"); } }
private void InvokerThreadMain(Object param) { Object[] data = (Object[])param; Delegate dl = (Delegate)data[1]; Int32 index = (Int32)data[0]; try { if (LOGGER.IsDebugEnabled) { LOGGER.Debug(string.Format("RAISER, before invoke on '{0}' with method '{1}'. Invoke on control: {2}, parallel: true", dl.Target == null ? dl.Method.DeclaringType.FullName : dl.Target.GetType().FullName, dl.Method.Name, mControlInvoke.ToString())); } if (mControlInvoke && UIReflectionHelper.IsObjectWinFormsControl(dl.Target)) { mResultObjects[index] = UIReflectionHelper.InvokeOnWinFormsControl(dl.Target, dl, mParameters); //((Control)dl.Target).Invoke(dl, mParameters); } else if (mControlInvoke && UIReflectionHelper.IsObjectWPFDependency(dl.Target)) { //DependencyObject ctrl = (DependencyObject)dl.Target; //mResultObjects[index] = ctrl.Dispatcher.Invoke(dl, mParameters); mResultObjects[index] = UIReflectionHelper.InvokeOnWPFDependency(dl.Target, dl, mParameters); } else { mResultObjects[index] = dl.Method.Invoke(dl.Target, mParameters); } } catch (Exception e) { if (LOGGER.IsErrorEnabled) { LOGGER.Error(string.Format("RAISER, failed to invoke on '{0}' with method '{1}'. Invoke on control: {2}, parallel: true. Reason: {3}", dl.Target == null ? dl.Method.DeclaringType.FullName : dl.Target.GetType().FullName, dl.Method.Name, mControlInvoke.ToString(), e.Message), e); } mResultObjects[index] = e; } finally { if (LOGGER.IsDebugEnabled) { LOGGER.Debug(string.Format("RAISER, after invoke on '{0}' with method '{1}'. Invoke on control: {2}, parallel: true", dl.Target == null ? dl.Method.DeclaringType.FullName : dl.Target.GetType().FullName, dl.Method.Name, mControlInvoke.ToString())); } } mExecutorThreadSemaphore.Release(); }
public override void Run() { if (Active()) { try { //Create the directory if needed Directory.CreateDirectory(Path.GetDirectoryName(Location()) ?? ""); List <ProcessedEpisode> lpe = doc.Library.RecentEpisodes(TVSettings.Instance.WTWRecentDays); DirFilesCache dfc = new DirFilesCache(); //Write Contents to file using (StreamWriter file = new StreamWriter(Location())) { file.WriteLine(GenerateHeader()); foreach (ProcessedEpisode episode in lpe) { List <FileInfo> files = TVDoc.FindEpOnDisk(dfc, episode, false); if (!files.Any()) { continue; } string name = TVSettings.Instance.NamingStyle.NameFor(episode); int length = files.First().GetFilmLength(); file.WriteLine(GenerateRecord(episode, files.First(), name, length)); } file.WriteLine(GenerateFooter()); } LOGGER.Info("Output File to: {0}", Location()); } catch (Exception e) { LOGGER.Error(e, "Failed to Output File to: {0}", Location()); } } else { LOGGER.Trace("Skipped (Disabled) Output File to: {0}", Location()); } }
/// <summary> /// This will center a string inside a string of a longer length. Note that this has not been protected from every case. /// It is wrapped in a try-catch but be sure to test your own edge cases and such because this is a pretty basic centering tool, mostly for use on things like console table headers. /// </summary> /// <param name="VALUE">The string to center.</param> /// <param name="LENGTH">How many characters to center it in.</param> /// <param name="PAD_CHARACTER">The character to pad with, defaults to space.</param> /// <returns></returns> public static string CENTER(this string VALUE, int LENGTH, char PAD_CHARACTER) { if (LOGGER_ON) { LOGGER.METHOD_ENTER(); } try { int VALUE_HALF_COUNT = VALUE.Length / 2; int LENGTH_HALF_COUNT = LENGTH / 2; int START_LOCATION = LENGTH_HALF_COUNT - VALUE_HALF_COUNT; //Figure out where we need to start the new string. string OUTPUT = null; for (int i = 0; i < START_LOCATION; i++) { OUTPUT += PAD_CHARACTER; } //Loop through to pad the left side. OUTPUT += VALUE; //Add the original string. if (VALUE.Length % 2 != 0) { START_LOCATION -= 1; } //Determine if there is a odd amount of characters in the string. //If there are, subtract one to help keep it centered. for (int i = 0; i < START_LOCATION; i++) { OUTPUT += PAD_CHARACTER; } //Loop through to pad the right side. if (LOGGER_ON) { LOGGER.METHOD_EXIT_SUCCESS(); } return(OUTPUT); } catch (Exception EX) { if (LOGGER_ON) { LOGGER.EXCEPTION(EX.Message); } if (LOGGER_ON) { LOGGER.METHOD_EXIT_FAIL(); } return(VALUE); } }
void NewFormsTimer_Elapsed(object sender, ElapsedEventArgs e) { LOGGER.Write(LOGGER.LOGGEREventID.INFORMATION, cMODULE_NAME, new string[] { cBASE_NAME, "Processing new form notifications!" }); NewFormsTimer.Stop(); try { Forms.ProcessUserProductionUnitsForms(Properties.Settings.Default.ReferenceStartDate); } catch (Exception exp) { LOGGER.Write(LOGGER.LOGGEREventID.EXCEPTION, cMODULE_NAME, new string[] { cBASE_NAME, exp.Message }); } finally { NewFormsTimer.Start(); } }
void LateFormsTimer_Elapsed(object sender, ElapsedEventArgs e) { LOGGER.Write(LOGGER.LOGGEREventID.INFORMATION, cMODULE_NAME, new string[] { cBASE_NAME, "Processing alerts notifications!" }); LateFormsTimer.Stop(); try { LateForms.ProcessLateSubmissions(); } catch (Exception exp) { LOGGER.Write(LOGGER.LOGGEREventID.EXCEPTION, cMODULE_NAME, new string[] { cBASE_NAME, exp.Message }); } finally { LateFormsTimer.Start(); } }
public static bool HandlerRoutine(int CtrlType) { switch (CtrlType) { case 0: LOGGER.WriteLine(strings.ExitedCtrlC + "\r\n\r\nTask End: " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")); //Ctrl+C关闭 Console.SetCursorPosition(0, LOGGER.CursorIndex); break; case 2: LOGGER.WriteLine(strings.ExitedForce + "\r\n\r\nTask End: " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")); //按控制台关闭按钮关闭 Console.SetCursorPosition(0, LOGGER.CursorIndex); break; } return(false); }
public IDbCommand CreateCommand(string commandText, CommandType commandType) { IDbCommand result; try { IDbCommand dbCommand = this.Connection.CreateCommand(); dbCommand.CommandText = commandText; dbCommand.CommandType = commandType; result = dbCommand; } catch (Exception) { LOGGER.Write(LOGGER.LogCategory.ERROR, "{SqlCommand}SF.Expand.SAF.DALSqlServer::CreateCommand", null); result = null; } return(result); }
public static bool HandlerRoutine(int CtrlType) { switch (CtrlType) { case 0: LOGGER.WriteLine("Exited: Ctrl + C" + "\r\n\r\nTask End: " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")); //Ctrl+C关闭 Console.CursorVisible = true; break; case 2: LOGGER.WriteLine("Exited: Force" + "\r\n\r\nTask End: " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")); //按控制台关闭按钮关闭 Console.CursorVisible = true; break; } return(false); }
/// <summary> /// 保存日志(生产环境) /// </summary> /// <param name="message">日志信息</param> /// <param name="messageType">日志类型</param> /// <param name="ex">异常</param> /// <param name="type">写入日志介质</param> public static void DoLog(string UserId,string UserName,string ClientIP,string RequireURL, string message,string Module,string ModuleName, LogMessageType messageType, Exception ex,LOGGER logger) { switch (logger) { case LOGGER.App_Error: switch (messageType) { case LogMessageType.Debug: PlateLog.QX_Log.Debug(message, ex); break; case LogMessageType.Info: PlateLog.QX_Log.Info(UserId, UserName, ClientIP, RequireURL, message, ex); break; case LogMessageType.Warn: PlateLog.QX_Log.Warn(UserId, UserName, ClientIP, RequireURL, message, ex); break; case LogMessageType.Error: PlateLog.QX_Log.Error(UserId, UserName, ClientIP, RequireURL, message, ex); break; case LogMessageType.Fatal: PlateLog.QX_Log.Fatal(UserId, UserName, ClientIP, RequireURL, message, ex); break; } break; case LOGGER.TOFILE: switch (messageType) { case LogMessageType.Debug: PlateLog.m_log.Debug(message, ex); break; case LogMessageType.Info: PlateLog.m_log.Info(message, ex); break; case LogMessageType.Warn: PlateLog.m_log.Warn(message, ex); break; case LogMessageType.Error: PlateLog.m_log.Error(message, ex); break; case LogMessageType.Fatal: PlateLog.m_log.Fatal(message, ex); break; } break; case LOGGER.App_Op: switch (messageType) { case LogMessageType.Debug: PlateLog.QXOp_Log.Debug(message, ex); break; case LogMessageType.Info: PlateLog.QXOp_Log.Info(UserId, UserName, ClientIP, RequireURL, message,Module,ModuleName); break; case LogMessageType.Warn: PlateLog.QXOp_Log.Warn(UserId, UserName, ClientIP, RequireURL, message,Module,ModuleName); break; case LogMessageType.Error: PlateLog.QXOp_Log.Error(UserId, UserName, ClientIP, RequireURL, message,Module,ModuleName); break; case LogMessageType.Fatal: PlateLog.QXOp_Log.Fatal(UserId, UserName, ClientIP, RequireURL, message,Module,ModuleName); break; } break; default: break; } }