static void Main() { log.Info("Start"); Stopwatch timer = Stopwatch.StartNew(); XLogger.Application = String.Format("CheckPrices||{0}||{1}", ConfigurationManager.AppSettings["ExeVersion"], DateTime.Now.ToString("yyyyMMddHHmmss")); XLogger.Info("BEGIN:\t Scheduled Task Execution"); try { var prices = ReadPrices(); SendReport(prices); /* * //OLD * ComputePrices_OLD(); * SendReport_OLD(); */ } catch (Exception ex) { log.Error("Exception occured: ", ex); } log.Info("End"); TimeSpan ts = timer.Elapsed; var elapsed = String.Format("{0:00}:{1:00}:{2:00}.{3:000}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds); XLogger.Info($"END:{elapsed}\t Scheduled Task Execution"); }
private void DoProcess() { try { var config = myUI.BuildConfig(); if (!File.Exists(REF.envelopFile)) { throw new ApplicationException($"Missing envelop template file: {REF.envelopFile}"); } Engine.Variables.ExecutionTime.Start(); Stopwatch timer = Stopwatch.StartNew(); XLogger.Info("BEGIN:\t Task Execution"); Engine.DoTask(config); var elapsed = timer.Elapsed.ToStandardElapsedFormat(); XLogger.Info($"END:{elapsed}\t Task Execution"); } catch (Exception x) { Engine.ExecutionStatus.Result = Engine.ExecutionResult.ErrorOccured; if (x is ApplicationException) { Engine.ExecutionStatus.Message = x.Message; } else { Engine.ExecutionStatus.Message = MSG.UnknownError; } XLogger.Error(x); } }
private void Awake() { //netReachAbility = gameObject.AddComponent<NetReachAbility>(); //var status = netReachAbility.NetState; //ShowState(status); NetWorkService.Instance.Init(); XLogger.Info("Game Start`````````````````"); XLogger.Info("Game Start22`````````````````"); Application.quitting += AppQuit; }
// /// <summary> /// <code> /// _dbContext.Database.Log = XLogger.EF; /// _dbContext.SaveChanges(); /// </code> /// used to Log messages sent by EF to the database /// </summary> /// <param name="message"></param> public static void EF(string message) { var toSkip = new List <string>() { "connection", "transaction", "Executing" }; if (!toSkip.Any(s => message.Contains(s))) { XLogger.Info("EF mes: " + message); } }
public static bool ScanFile(string inputFile, string outputFile) { XLogger.Info($"input file path: {Path.GetFullPath(inputFile)}"); XLogger.Info($"output file path: {Path.GetFullPath(outputFile)}"); #region health checks if (!File.Exists(inputFile)) { throw new ArgumentException("File not found: " + inputFile, "inputFile"); } #endregion health checks string fullCommand = "", commandOutput = ""; StringBuilder sb = new StringBuilder(Environment.NewLine); var exePath = Path.Combine(RootFolder, "Bin", "ICUconsole.exe"); try { string tempBatch = Path.Combine(RootFolder, "scanFile.bat"); tempBatch.DeleteFile(); fullCommand = string.Format( @"{0} ""{1}"" ""{2}"" @echo off echo %ERRORLEVEL% ", exePath, inputFile, outputFile); File.WriteAllText(tempBatch, fullCommand); string arguments = ""; bool res = ExecuteCommand(tempBatch, Environment.CurrentDirectory, arguments, out commandOutput); sb.AppendLine("commandOutput: " + commandOutput); var outputLines = commandOutput.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList(); var lastLine = outputLines.Last(); XLogger.Info(sb.ToString()); //res &= !String.IsNullOrWhiteSpace(fileCommandOutput); return(lastLine.Trim() == "0"); } catch (Exception x) { x.Data.Add("fullCommand", fullCommand); x.Data.Add("fileCommandOutput", commandOutput); XLogger.Error(x); return(false); } }
private void UpdateProgress(String Message) { if (this.txtResult.InvokeRequired) { SetTextCallback d = new SetTextCallback(UpdateProgress); this.Invoke(d, new object[] { Message }); } else { this.txtResult.Text = Message; XLogger.Info(Message); } }
private static void TestTime() { Stopwatch timer = Stopwatch.StartNew(); XLogger.Info("BEGIN:\t Scheduled Task Execution"); Thread.Sleep(2500); TimeSpan timespan = timer.Elapsed; var current = String.Format("{0:00}:{1:00}:{2:00}", timespan.Minutes, timespan.Seconds, timespan.Milliseconds / 10); //var proposed = String.Format("HH:mm:ss.SSS"); //java, ignore var proposed = String.Format("{0:00}:{1:00}:{2:00}.{3:000}", timespan.Hours, timespan.Minutes, timespan.Seconds, timespan.Milliseconds); var proposed2 = timespan.ToStandardElapsedFormat(); }
private async Task DoProcess() { try { Engine.Variables.ExecutionTime.Start(); Stopwatch timer = Stopwatch.StartNew(); XLogger.Info("BEGIN:\t Task Execution"); //Engine.Variables.OutputSheetPath = Path.Combine(Engine.EngineConfig.Outputs.OutputFolder, Engine.Variables.OutputSheetPath); //UpdateOutputSheetPath(Engine.Variables.OutputSheetPath); Engine.EngineConfig = myUI.BuildConfig(); if (rbCityPlan.Checked) { if (!Engine.DoTaskCml()) { throw new ApplicationException("Some error occurred"); } } else if (rbRedland.Checked) { if (!Engine.DoTaskRedland()) { throw new ApplicationException("Some error occurred"); } } //MarkCompleted("done.please check results"); var elapsed = timer.Elapsed.ToStandardElapsedFormat(); XLogger.Info($"END:{elapsed}\t Task Execution"); } catch (Exception x) { if (x is ApplicationException) { MarkCompleted(x.Message); } else { MarkCompleted(MSG.OperationFailed); } XLogger.Error(x); } }
private void OnApplicationQuit() { Debug.Log("OnApplicationQuit ending after " + Time.time + " seconds"); XLogger.Info("Game Exit````````````````````"); }