private void KeepAlive() { _logger.Log(NLog.LogLevel.Debug, "KeepAlive Elapsed"); lock (_restartLock) if (_pioneerController?.Port != null && _pioneerController.FirstUnconfirmedSendTime != null && _pioneerController.FirstUnconfirmedSendTime.Value.AddSeconds(10) < DateTime.Now) { _logger.Debug("suspect not receiving anything. Resetting Device..."); var hostname = _pioneerController.Hostname; var port = _pioneerController.Port.Value; _pioneerController.Dispose(); _pioneerController = new PioneerAmp(hostname, port); OnStart(); } var sendTime = DateTime.Now; do { System.Threading.Thread.Sleep(100); } while (!(sendTime.AddMilliseconds(new[] { _keepAliveTimer.Interval, 10000 }.Min()) > DateTime.Now || (_pioneerController?.LastReceiveTime.GetValueOrDefault(DateTime.MinValue) > sendTime && _pioneerController.PowerOn != null))); if (_pioneerController?.PowerOn != null) { _pioneerController.SetPowerState(_pioneerController.PowerOn.Value); } else { _pioneerController?.RequestPowerState(); } }
public static void Main(string[] args) { Logger.Log(NLog.LogLevel.Info, "--------------------------------------------"); Logger.Log(NLog.LogLevel.Info, "Running Feud.Server..."); CreateHostBuilder(args).Build().Run(); }
/// <summary> /// summary /// </summary> /// <param name="level"></param> /// <param name="message"></param> /// <param name="exception"></param> public override void Log(LogLevel level, string message, Exception exception) { if (!this.IsEnabled(level)) { return; } if (level == LogLevel.Information) { _log.Info(message); } else if (level == LogLevel.Debug) { _log.Debug(message); } else if (level == LogLevel.Error) { _log.Log(NLog.LogLevel.Error, message, exception); } else if (level == LogLevel.Warning) { _log.Log(NLog.LogLevel.Warn, message, exception); } else if (level == LogLevel.Fatal) { _log.Log(NLog.LogLevel.Fatal, message, exception); } else if (level == LogLevel.Trace) { _log.Log(NLog.LogLevel.Trace, message, exception); } }
// 重载需要的方法。 public override void DispatchProtocol(Zeze.Net.Protocol p, ProtocolFactoryHandle factoryHandle) { if (null != factoryHandle.Handle) { if (p.TypeId == gnet.Provider.Bind.TypeId_) { // Bind 的处理需要同步等待ServiceManager的订阅成功,时间比较长, // 不要直接在io-thread里面执行。 global::Zeze.Util.Task.Run(() => factoryHandle.Handle(p), p); } else { // 不启用新的Task,直接在io-thread里面执行。因为其他协议都是立即处理的, // 直接执行,少一次线程切换。 try { var isReqeustSaved = p.IsRequest; int result = factoryHandle.Handle(p); global::Zeze.Util.Task.LogAndStatistics(result, p, isReqeustSaved); } catch (System.Exception ex) { logger.Log(SocketOptions.SocketLogLevel, ex, "Protocol.Handle. {0}", p); } } } else { logger.Log(SocketOptions.SocketLogLevel, "Protocol Handle Not Found. {0}", p); } }
static async Task ProcessMessagesAsync(IVityaBot bot, IEnumerable <IUpdatesHandler <IIncomingMessage> > handlers) { try { if (Processing) { return; } _logger.Log(NLog.LogLevel.Info, "ProcessMessagesStart"); Processing = true; var updatesResult = await bot.GetUpdatesAsync(); foreach (var message in updatesResult.Updates) { foreach (var handler in handlers) { if (handler.CanHandle(message, bot)) { await handler.HandleAsync(message, bot); } } } Processing = false; } catch (Exception e) { Processing = false; _logger.Log(NLog.LogLevel.Error, e); } }
private void Button3_Click(object sender, EventArgs e) { FlexMessageBox fmsg = new FlexMessageBox(); fmsg.TopMost = true; fmsg.ShowIcon = false; fmsg.ShowDialog(); if (fmsg.Result == DialogResult.Yes) { if (ConfigurationManager.AppSettings["Mode"] == "Diagnostic") { logger.Log(NLog.LogLevel.Info, "Inside Finish function. Closing forms"); } List <Form> openForms = new List <Form>(); foreach (Form f in Application.OpenForms) { openForms.Add(f); } foreach (Form f in openForms) { if (f.Name != "Main") { f.Close(); } } } }
public DebuggerContext() { Instance = this; this._IsDebuggerAttached = false; this._IsPaused = false; this.DebuggerInstance = App.GetPlugins <IDebuggerPlugin>().FirstOrDefault(); Logger.Info(this.DebuggerInstance == null ? "Could not locate debugger plugin." : $"Using '{this.DebuggerInstance.Name}' as debugger."); if (this.DebuggerInstance == null) { this.CmdRunDebuggerClick = new RelayCommand((p) => MessageBox.Show(Properties.Localization.DebuggerContext_NoDebuggerAvailable_Body, Properties.Localization.DebuggerContext_NoDebuggerAvailable_Title, MessageBoxButton.OK, MessageBoxImage.Information)); } else { this.DebuggerInstance.OnHalt += this.DebuggerInstance_OnHalt; this.DebuggerInstance.OnConnectionClosed += this.DebuggerInstance_OnConnectionClosed; this.DebuggerInstance.OnError += this.DebuggerInstance_OnError; this.DebuggerInstance.OnException += this.DebuggerInstance_OnException; this.DebuggerInstance.OnContinue += this.DebuggerInstance_OnContinue; this.CmdRunDebuggerClick = new RelayCommandAsync(async(p) => { if (!this.IsDebuggerAttached) { Logger.Log(NLog.LogLevel.Info, "Attaching debugger..."); this.IsDebuggerAttached = await Task.Run(() => this.DebuggerInstance.Attach()); if (this.IsDebuggerAttached) { Logger.Log(NLog.LogLevel.Info, "Debugger got attached."); this.AddAllBreakpointsToDebugger(); } else { var reason = this.DebuggerInstance.GetLastError(); Logger.Log(NLog.LogLevel.Info, string.Format("Failed to attach debugger: {0}.", reason)); MessageBox.Show(string.Format(Properties.Localization.DebuggerContext_AttachFailed_Body, reason), Properties.Localization.DebuggerContext_AttachFailed_Title, MessageBoxButton.OK, MessageBoxImage.Warning); } } else if (this.IsPaused) { this.IsPaused = false; await this.ExecuteOperationAsync(EOperation.Continue); } }); this.CmdStopDebugger = new RelayCommandAsync(async(p) => { Logger.Log(NLog.LogLevel.Info, "Detaching debugger..."); await Task.Run(() => this.DebuggerInstance.Detach()); }); this.CmdPauseDebugger = new RelayCommandAsync((p) => this.ExecuteOperationAsync(EOperation.Pause)); this.CmdStepInto = new RelayCommandAsync((p) => this.ExecuteOperationAsync(EOperation.StepInto)); this.CmdStepOver = new RelayCommandAsync((p) => this.ExecuteOperationAsync(EOperation.StepOver)); this.CmdStepOut = new RelayCommandAsync((p) => this.ExecuteOperationAsync(EOperation.StepOut)); Workspace.Instance.BreakpointManager.OnBreakPointsChanged += this.BreakpointManager_OnBreakPointsChanged; } }
/// <summary> /// ASocket 关闭的时候总是回调。 /// </summary> /// <param name="so"></param> /// <param name="e"></param> public virtual void OnSocketClose(AsyncSocket so, Exception e) { _asocketMap.TryRemove(so.SessionId, out var _); if (null != e) { logger.Log(SocketOptions.SocketLogLevel, e, "OnSocketClose"); } }
public override void Log <T>(LogLevel level, T message) { NLog.LogLevel nlogLevel = GetNLogLevel(level); var ei = new NLog.LogEventInfo(nlogLevel, _logger.Name, JsonConvert.SerializeObject(message)); ei.Properties["AppID"] = _appID; ei.Properties["InstanceID"] = _instanceID; _logger.Log(ei); }
public MainForm() { InitializeComponent(); comboInstanceStatic.SelectedIndex = 0; comboVisibility.SelectedIndex = 0; logger.Log(NLog.LogLevel.Info, "Main form has run."); }
public Task <IActionResult> Post() { string messageBody = Util.getRawBody(HttpContext.Request.Body); _logger.Log(NLog.LogLevel.Info, $"Start bot process {messageBody}"); var process = ProcessMessagesAsync(_bot, messageBody); _logger.Log(NLog.LogLevel.Info, $"End bot process {process}"); return(process); }
public Task <IActionResult> Post() { var message = Newtonsoft.Json.JsonConvert.DeserializeObject <UpdateMessage>(Util.getRawBody(HttpContext.Request.Body)); _logger.Log(NLog.LogLevel.Info, $"Start bot process {message.text}"); var process = ProcessMessagesAsync(bot, message); _logger.Log(NLog.LogLevel.Info, $"End bot process {process}"); return(process); }
public async Task <IRegisterResponse> AuthorizeAsync() { try { _logger.Log(NLog.LogLevel.Info, "registerStart"); var urlBuilder = new UriBuilder(_url) { Path = "method/groups.getLongPollServer", Query = $"group_id={_groupId}&access_token={_token}&v={_apiVersion}" }; var response = await _httpClient.GetStringAsync(urlBuilder.Uri); var result = Newtonsoft.Json.JsonConvert.DeserializeObject <RegisterResponse>(response); _key = result.response.key; _ts = result.response.ts; _server = result.response.server; result.Success = !string.IsNullOrEmpty(_key); _logger.Log(NLog.LogLevel.Info, "registerEnd"); return(result); } catch (Exception e) { _logger.Log(NLog.LogLevel.Error, e, "registerErr"); return(new RegisterResponse() { Success = false }); } }
private static void OnTimedEvent(Object source, System.Timers.ElapsedEventArgs e) { NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); logger.Log(NLog.LogLevel.Info, $"The Elapsed event was raised at {e.SignalTime}"); var urlBuilder = new UriBuilder(url); logger.Log(NLog.LogLevel.Info, urlBuilder); var response = _httpClient.GetStringAsync(urlBuilder.Uri); logger.Log(NLog.LogLevel.Info, $"response {response}"); }
/// <summary> /// oxd-local Get Claims Gathering Url /// </summary> /// <param name="host">Oxd Host</param> /// <param name="port">Oxd Port</param> /// <param name="umaRpGetClaimsGatheringUrlParams">Input params for UMA Claims Gathering URL command</param> /// <returns></returns> public UmaRpGetClaimsGatheringUrlResponse GetClaimsGatheringUrl(string host, int port, UmaRpGetClaimsGatheringUrlParams umaRpGetClaimsGatheringUrlParams) { Logger.Info("Verifying input parameters."); if (string.IsNullOrEmpty(host)) { throw new ArgumentNullException("Oxd Host should not be NULL."); } if (port <= 0) { throw new ArgumentNullException("Oxd Port should be a valid port number."); } if (umaRpGetClaimsGatheringUrlParams == null) { throw new ArgumentNullException("The UMA RS Check Access command params should not be NULL."); } if (string.IsNullOrEmpty(umaRpGetClaimsGatheringUrlParams.OxdId)) { throw new MissingFieldException("Oxd ID is required for checking access of UMA resources."); } try { Logger.Info("Preparing and sending command."); var cmdUmaRpGetClaimsGatheringUrl = new Command { CommandType = CommandType.uma_rp_get_claims_gathering_url, CommandParams = umaRpGetClaimsGatheringUrlParams }; var commandClient = new CommandClient(host, port); string commandResponse = commandClient.send(cmdUmaRpGetClaimsGatheringUrl); var response = JsonConvert.DeserializeObject <UmaRpGetClaimsGatheringUrlResponse>(commandResponse); if (response.Status.ToLower().Equals("error")) { Logger.Info(string.Format("Got response status as {0}. The error is {1} with description {2}", response.Status, response.Data.Error, response.Data.ErrorDescription)); } else { Logger.Info(string.Format("Got response status as {0} ", response.Status)); } return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when Getting UMA Claims Gathering URL."); return(null); } }
/// <summary> /// Gets different type of tokens by Code using Oxd Server /// </summary> /// <param name="host">Oxd Host</param> /// <param name="port">Oxd Port</param> /// <param name="getTokensByCodeParams">Input params for Get Tokens by Code command</param> /// <returns></returns> public GetTokensByCodeResponse GetTokensByCode(string host, int port, GetTokensByCodeParams getTokensByCodeParams) { Logger.Info("Verifying input parameters."); if (string.IsNullOrEmpty(host)) { throw new ArgumentNullException("Oxd Host should not be NULL."); } if (port <= 0) { throw new ArgumentNullException("Oxd Port should be a valid port number."); } if (getTokensByCodeParams == null) { throw new ArgumentNullException("The get tokens by code command params should not be NULL."); } if (string.IsNullOrEmpty(getTokensByCodeParams.OxdId)) { throw new MissingFieldException("Oxd ID is required for getting tokens."); } if (string.IsNullOrEmpty(getTokensByCodeParams.Code)) { throw new MissingFieldException("Auth Code is required for getting tokens."); } if (string.IsNullOrEmpty(getTokensByCodeParams.State)) { throw new MissingFieldException("Auth State is required for getting tokens."); } try { Logger.Info("Preparing and sending command."); var cmdGetTokensByCode = new Command { CommandType = CommandType.get_tokens_by_code, CommandParams = getTokensByCodeParams }; var commandClient = new CommandClient(host, port); string commandResponse = commandClient.send(cmdGetTokensByCode); var response = JsonConvert.DeserializeObject <GetTokensByCodeResponse>(commandResponse); Logger.Info(string.Format("Got response status as {0} and access token is {1}", response.Status, response.Data.AccessToken)); return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when getting tokens of site."); return(null); } }
/// <summary> /// Log a message to the logger. /// </summary> /// <param name="level">Log level.</param> /// <param name="msg">Log message (format string).</param> /// <param name="args">Log message arguments.</param> public override void Log(LogLevel level, string msg, params object[] args) { var ordinalFormattedMessage = NameFormatToPositionalFormat(msg); var nlogLevel = GetNLogLevel(level); if (args.Length >= 1 && args[0] is Exception exception) { logger.Log(nlogLevel, exception, ordinalFormattedMessage, args); } else { logger.Log(nlogLevel, ordinalFormattedMessage, args); } }
public async Task <string> sendMessageAsync(IOutgoingMessage message) { try { var tmessage = (OutgoingMessage)message; return(await vkService.sendRequest(tmessage, "messages.send", _options)); } catch (Exception e) { _logger.Log(NLog.LogLevel.Error, e, "SendMessageAsync error"); return(null); } }
/// <summary> /// oxd-local Protects set of UMA resources in Resource Server /// </summary> /// <param name="host">Oxd Host</param> /// <param name="port">Oxd Port</param> /// <param name="umaRsProtectParams">Input params for UMA RS Protect command</param> /// <returns></returns> public UmaRsProtectResponse ProtectResources(string host, int port, UmaRsProtectParams umaRsProtectParams) { Logger.Info("Verifying input parameters."); if (string.IsNullOrEmpty(host)) { throw new ArgumentNullException("Oxd Host should not be NULL."); } if (port <= 0) { throw new ArgumentNullException("Oxd Port should be a valid port number."); } if (umaRsProtectParams == null) { throw new ArgumentNullException("The UMA RS Protect command params should not be NULL."); } if (string.IsNullOrEmpty(umaRsProtectParams.OxdId)) { throw new MissingFieldException("Oxd ID is required for protecting UMA resources."); } if (umaRsProtectParams.ProtectResources == null || umaRsProtectParams.ProtectResources.Count == 0) { throw new MissingFieldException("Valid resources are required for protecting UMA resource in RS."); } try { Logger.Info("Preparing and sending command."); var cmdUmaRsProtect = new Command { CommandType = CommandType.uma_rs_protect, CommandParams = umaRsProtectParams }; var commandClient = new CommandClient(host, port); string commandResponse = commandClient.send(cmdUmaRsProtect); var response = JsonConvert.DeserializeObject <UmaRsProtectResponse>(commandResponse); Logger.Info(string.Format("Got response status as {0}", response.Status)); return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when protecting UMA resource."); return(null); } }
/// <summary> /// Gets User Info by access token using Oxd Server /// </summary> /// <param name="host">Oxd Host</param> /// <param name="port">Oxd Port</param> /// <param name="getUserInfoParams">Input params for Get User Info command.</param> /// <returns></returns> public GetUserInfoResponse GetUserInfo(string host, int port, GetUserInfoParams getUserInfoParams) { Logger.Info("Verifying input parameters."); if (string.IsNullOrEmpty(host)) { throw new ArgumentNullException("Oxd Host should not be NULL."); } if (port <= 0) { throw new ArgumentNullException("Oxd Port should be a valid port number."); } if (getUserInfoParams == null) { throw new ArgumentNullException("The get user info command params should not be NULL."); } if (string.IsNullOrEmpty(getUserInfoParams.OxdId)) { throw new MissingFieldException("Oxd ID is required for getting user info."); } if (string.IsNullOrEmpty(getUserInfoParams.AccessToken)) { throw new MissingFieldException("Access Token is required for getting user info."); } try { Logger.Info("Preparing and sending command."); var cmdGetUserInfo = new Command { CommandType = CommandType.get_user_info, CommandParams = getUserInfoParams }; var commandClient = new CommandClient(host, port); string commandResponse = commandClient.send(cmdGetUserInfo); var response = JsonConvert.DeserializeObject <GetUserInfoResponse>(commandResponse); Logger.Info(string.Format("Got response status as {0} and name is {1}", response.Status, response.Data.UserClaims["name"].FirstOrDefault())); return(response); } catch (Exception ex) { Logger.Log(NLog.LogLevel.Error, ex, "Exception when getting user info of site."); return(null); } }
public static string ExecuteTryCatch( ConfBot config, bool answer, Func <string> action, Action <string> errorHandler) { try { return(action()); } catch (CommandException ex) { NLog.LogLevel commandErrorLevel = answer ? NLog.LogLevel.Debug : NLog.LogLevel.Warn; Log.Log(commandErrorLevel, ex, "Command Error ({0})", ex.Message); if (answer) { errorHandler(TextMod.Format(config.Commands.Color, "Error: {0}".Mod().Color(Color.Red).Bold(), ex.Message)); } } catch (Exception ex) { Log.Error(ex, "Unexpected command error: {0}", ex.UnrollException()); if (answer) { errorHandler(TextMod.Format(config.Commands.Color, "An unexpected error occured: {0}".Mod().Color(Color.Red).Bold(), ex.Message)); } } return(null); }
public static void GenerateLibraryList() { try { // If local.xml exists if (File.Exists(Definitions.Global.Origin.ConfigFilePath)) { var OriginConfigKeys = XDocument.Load(Definitions.Global.Origin.ConfigFilePath).Root?.Elements().ToDictionary(a => (string)a.Attribute("key"), a => (string)a.Attribute("value")); if (OriginConfigKeys.Count(x => x.Key == "DownloadInPlaceDir") == 0) { logger.Log(NLog.LogLevel.Error, Framework.StringFormat.Format(SLM.Translate(nameof(Properties.Resources.Origin_MissingKey)), new { OriginConfigFilePath = Definitions.Global.Origin.ConfigFilePath })); } else { if (Directory.Exists(OriginConfigKeys["DownloadInPlaceDir"])) { AddNewAsync(OriginConfigKeys["DownloadInPlaceDir"], true); } else { logger.Info(Framework.StringFormat.Format(SLM.Translate(nameof(Properties.Resources.Origin_DirectoryNotExists)), new { NotFoundDirectoryFullPath = OriginConfigKeys["DownloadInPlaceDir"] })); } } } else /* Could not locate local.xml */ } { }
public static void Main(string[] args) { int k = 42; int l = 100; _logger.Trace("Sample trace message, k={0}, l={1}", k, l); _logger.Debug("Sample debug message, k={0}, l={1}", k, l); _logger.Info("Sample informational message, k={0}, l={1}", k, l); _logger.Warn("Sample warning message, k={0}, l={1}", k, l); _logger.Error("Sample error message, k={0}, l={1}", k, l); _logger.Fatal("Sample fatal error message, k={0}, l={1}", k, l); _logger.Log(LogLevel.Info, "Sample fatal error message, k={0}, l={1}", k, l); _logger.Info() .Message("Sample informational message, k={0}, l={1}", k, l) .Property("Test", "Tesing properties") .Write(); /*string path = "blah.txt"; * try * { * string text = File.ReadAllText(path); * } * catch (Exception ex) * { * _logger.Error() * .Message("Error reading file '{0}'.", path) * .Exception(ex) * .Property("Test", "ErrorWrite") * .Write(); * }*/ Console.ReadLine(); }
public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) { NLog.LogLevel level = NLog.LogLevel.Off; switch (logLevel) { case LogLevel.Trace: level = NLog.LogLevel.Trace; break; case LogLevel.Debug: level = NLog.LogLevel.Debug; break; case LogLevel.Information: level = NLog.LogLevel.Info; break; case LogLevel.Warning: level = NLog.LogLevel.Warn; break; case LogLevel.Error: level = NLog.LogLevel.Error; break; case LogLevel.Critical: level = NLog.LogLevel.Fatal; break; case LogLevel.None: level = NLog.LogLevel.Off; break; } logger.Log(level, formatter(state, exception)); }
/// <summary> /// Shows sleected images, first convert images to a collection. then remove extra controls from form and' /// show only images selcted. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Next_Click(object sender, EventArgs e) { if (ConfigurationManager.AppSettings["Mode"] == "Diagnostic") { logger.Log(NLog.LogLevel.Info, "Inside Next button click function."); } if (SelectedImageKeys.Count > 0) { //gallery preview is page where all final pics are shown before print if (!OnGalleryPreviewPage) { PrepareFormForGalleryPreview(); ShowSelectedImages(SelectedImageKeys); } else { PrepareForPrinting(); } } else { //TODO: show error, no image selected } }
public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter) { if (!IsEnabled(logLevel)) { return; } var s = _serviceProvider.GetRequiredService <IServerCallContextProvider>(); var grpcContext = s.ServerCallContext; if (grpcContext != null) { var logEvent = grpcContext.UserState["logcontext"] as ServerCallContextHttpContextLogEvent; if (logEvent == null) { return; } logger.SetProperty("host", grpcContext.Host); logger.SetProperty("url", logEvent.Url); logger.SetProperty("method", grpcContext.Method); logger.SetProperty("requestId", logEvent.RequestId); logger.SetProperty("userflag", logEvent.UserFlag); logger.SetProperty("platformId", logEvent.PlatformId); logger.SetProperty("duration", logEvent.End() + " ms"); } logger.Log(NLog.LogEventInfo.Create(NLog.LogLevel.FromOrdinal((int)logLevel), logName, null, state)); }
public OperationResult(string message, NLog.LogLevel severity, NLog.Logger logger, Exception e = null) { this.Message = message; this.Severity = severity; this.Exception = e; logger.Log(severity, e, message); }
private void LogMessage(int level, string message = "", [CallerMemberName] string method = "") { NLog.LogLevel logLevel; switch (level) { case 0: logLevel = NLog.LogLevel.Trace; break; case 1: logLevel = NLog.LogLevel.Debug; break; case 2: logLevel = NLog.LogLevel.Info; break; case 3: logLevel = NLog.LogLevel.Warn; break; case 4: logLevel = NLog.LogLevel.Error; break; default: logLevel = NLog.LogLevel.Fatal; break; } var logMessage = $"{_className}.{method}{((string.IsNullOrEmpty(message)) ? ("") : (": "))}{message??""}"; var lInfo = new NLog.LogEventInfo(logLevel, _className, logMessage); _logger.Log(lInfo); }
public void Draw(TextView textView, DrawingContext drawingContext) { textView.EnsureVisualLines(); var color = new SolidColorBrush(ConfigHost.Coloring.BreakPoint.TextHighlightColor); color.Freeze(); var invalidBps = new List <DataContext.BreakpointsPaneUtil.Breakpoint>(); foreach (var bp in this.SolutionFileRef.BreakPoints) { if (bp.Line < 0) { Logger.Log(NLog.LogLevel.Warn, $"Removed invalid breakpoint in file '{this.SolutionFileRef.FileName}'."); invalidBps.Add(bp); continue; } var line = this.Document.GetLineByNumber(bp.Line); var segment = new TextSegment { StartOffset = line.Offset, EndOffset = line.EndOffset }; foreach (var rect in BackgroundGeometryBuilder.GetRectsForSegment(textView, segment)) { drawingContext.DrawRectangle(color, null, new Rect(rect.Location, new Size(textView.ActualWidth, rect.Height))); } } foreach (var bp in invalidBps) { this.SolutionFileRef.BreakPoints.Remove(bp); } }
public static void GenerateLibraryList() { try { // If local.xml exists if (File.Exists(Definitions.Global.Origin.ConfigFilePath)) { var OriginConfigKeys = XDocument.Load(Definitions.Global.Origin.ConfigFilePath).Root.Elements().ToDictionary(a => (string)a.Attribute("key"), a => (string)a.Attribute("value")); if (OriginConfigKeys.Count(x => x.Key == "DownloadInPlaceDir") == 0) { logger.Log(NLog.LogLevel.Error, $"Origin config file doesn't contains DownloadInPlaceDir config\n\n{Definitions.Global.Origin.ConfigFilePath}"); } else { if (Directory.Exists(OriginConfigKeys["DownloadInPlaceDir"])) { AddNewAsync(OriginConfigKeys["DownloadInPlaceDir"], true); } else { MessageBox.Show($"Origin directory is not exists.\n\n{OriginConfigKeys["DownloadInPlaceDir"]}"); } } } else /* Could not locate local.xml */ } { }