public MainFRM() { InitializeComponent(); ntics_security pt = new ntics_security(); //config.Initialize(); // инициализация CommonVariables.ProgressBar = tsProgressBar; tsProgressBar.Visible = false; TraceStatus ts = new TraceStatus(StatusInfo); Trace.Listeners.Add(ts); for (int i = 0; i < 5; i++) { Trace.WriteLine(""); } Trace.WriteLine("START"); Trace.WriteLine(DateTime.Now); ShowFrame(new Welkome()); SetEnableButtons(); }
private void RaiseOnTraceCompleted(TraceStatus status) { if (OnTraceCompleted != null) { OnTraceCompleted(this, status); } }
private StatusErrorCode SetTraceStatus(TraceStatus status) { if (traceId == 0) { throw new NotInitializedProfilerException(); } StatusErrorCode code = StatusErrorCode.IsInvalid; try { SqlCommand cmd = MsSqlUtil.NewStoredProcedure("sp_trace_setstatus"); MsSqlUtil.AddInParam(cmd, "@traceid", traceId); MsSqlUtil.AddInParam(cmd, "@status", status); code = (StatusErrorCode)MsSqlUtil.ExecuteStoredProcedure(cmd, connInfo.CreateConnectionObject()); if (code == StatusErrorCode.NoError) { this.traceStatus = status; } } catch (SqlException exc) { if (exc.Message.Contains("Could not find the requested trace")) { return(StatusErrorCode.TraceIsInvalid); } //throw; } return(code); }
public async Task <IQueryable <Trace> > GetByStatus(TraceStatus traceStatus) { var traces = _context.Traces .Include(t => t.TradeStrategies) .Include(t => t.TradeAdvices); var result = new List <Trace>(); if (traces.Any()) { foreach (var trace in traces) { await _context.Entry(trace) .Reference(t => t.TraceStatus).LoadAsync(); if (trace.TraceStatus.Id == traceStatus.Id) { foreach (var strategy in trace.TradeStrategies) { await _context.Entry(strategy.TradeSignal) .Reference(s => s.TradingSignalType).LoadAsync(); await _context.Entry(strategy.Strategy) .Reference(s => s.CandlePeriod).LoadAsync(); } foreach (var advice in trace.TradeAdvices) { await _context.Entry(advice) .Reference(a => a.TradingSignalType).LoadAsync(); } result.Add(trace); } } return(result.AsQueryable()); } return(traces); }
new System.Globalization.CultureInfo("en-US", false); // override user's culture when writing to English Wikipedia; applied only as a formatter so won't affect localisation/UI public WikiTraceListener(UploadableLogSettings2 uploadSettings, TraceStatus traceStatus) : base(uploadSettings, traceStatus) { WriteBulletedLine("Logging: WikiFunctions.dll v" + Tools.VersionString, false, false); }
// Initialisation: protected TraceListenerUploadableBase(UploadableLogSettings2 uploadSettings, TraceStatus traceStatus) : base(traceStatus.FileName) { mTraceStatus = traceStatus; mUploadSettings = uploadSettings; }
/// <summary> /// Writes a trace event message to the trace listeners in the Listeners collection using the specified event type and event identifier. /// </summary> /// <param name="traceSource">The 'TraceSource' instance.</param> /// <param name="traceEventType">One of the enumeration values that specifies the event type of the trace data.</param> /// <param name="message">The informative message to write.</param> /// <param name="duration">The trace event duration.</param> /// <param name="status">One of the enumeration values that specifies the event status of the trace event.</param> /// <param name="exception">THe exception that to trace as part of the trace event.</param> /// <param name="data">The trace data.</param> /// <param name="methodName">The calling method where the log originated from</param> private static void TraceEventWithDataArrayInternal(this TraceSource traceSource, TraceEventType traceEventType, string message, TimeSpan duration, TraceStatus status, Exception exception, object[] data, string methodName) { try { if (!TraceSourceExt.ShouldTrace(traceSource, traceEventType)) { return; } ICollection <KeyValuePair <string, object> > items = RawBlobParser.ParseItems((IList <object>)data); TraceSourceExt.TraceEventInternal(traceSource, traceEventType, message, duration, status, exception, (IEnumerable <KeyValuePair <string, object> >)items, methodName); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(string.Format("An error occurred while tracing. {0}", (object)ex.Message)); } }
public static void TraceException(this TraceSource traceSource, TraceEventType traceEventType, string message, Exception exception, TimeSpan duration, TraceStatus status, [CallerMemberName] string methodName = null) { TraceSourceExt.TraceEventInternal(traceSource, traceEventType, message, duration, status, exception, (IEnumerable <KeyValuePair <string, object> >)null, methodName); }
public static void TraceException(this TraceSource traceSource, TraceEventType traceEventType, string message, Exception exception, TimeSpan duration, TraceStatus status, params object[] data) { traceSource.TraceEventWithDataArrayInternal(traceEventType, message, duration, status, exception, data, (string)null); }
/// <summary> /// Writes a trace event message to the trace listeners in the Listeners collection using the specified event type and event identifier. /// </summary> /// <param name="traceSource">The 'TraceSource' instance.</param> /// <param name="traceEventType">One of the enumeration values that specifies the event type of the trace data.</param> /// <param name="message">The informative message to write.</param> /// <param name="duration">The trace event duration.</param> /// <param name="status">One of the enumeration values that specifies the event status of the trace event.</param> /// <param name="exception">THe exception that to trace as part of the trace event.</param> /// <param name="data">The trace data.</param> /// <param name="methodName">The calling method where the log originated from</param> internal static void TraceEventInternal(this TraceSource traceSource, TraceEventType traceEventType, string message, TimeSpan duration, TraceStatus status, Exception exception, IEnumerable <KeyValuePair <string, object> > data, string methodName) { try { if (!TraceSourceExt.ShouldTrace(traceSource, traceEventType)) { return; } TraceEventEntry traceEventEntry = TraceEventEntryBuilder.IncludeEnvironmentData(new TraceEventEntry() { ApplicationName = traceSource.Name, EventData = TraceSourceExt.EventDataBuilder.CreateTraceEventData(exception, data), EventDuration = duration, EventKeys = TraceSourceExt.EventDataBuilder.CreateEventKeys(TraceSourceExt.GetKeys()), EventType = traceEventType.ToString(), Message = message, MethodName = methodName, Status = (int)status }); traceSource.TraceData(traceEventType, 0, (object)traceEventEntry); traceSource.Flush(); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(string.Format("An error occurred while tracing. {0}", (object)ex.Message)); } }
private void RaiseOnTraceCompleted(TraceStatus status) { if (OnTraceCompleted != null) OnTraceCompleted(this, status); }
public TracertEntry(int _hop, string _ip, long _time1, long _time2, long _time3) { hop = _hop; ip = _ip; try { hostname = Dns.GetHostEntry(_ip).HostName; } catch (Exception) { hostname = string.Empty; } time1 = _time1; time2 = _time2; time3 = _time3; if (_time1 == -1 || _time2 == -1 || _time3 == -1) { status = TraceStatus.PacketsLoss; } else { long avg = (_time1 + _time2 + _time3) / 3; if (avg <= 50) { status = TraceStatus.LowPing; } if (avg > 50 && avg <= 100) { status = TraceStatus.NormalPing; } if (avg > 100 && avg <= 150) { status = TraceStatus.HighPing; } if (avg > 150) { status = TraceStatus.BadPing; } } if (_ip != string.Empty) { string[] parts = _ip.Split('.'); if (parts[0] == "37" && parts[1] == "48") { location = HostLocation.Destination; } else if (parts[0] == "10" || (parts[0] == "192" && parts[1] == "168") || (parts[0] == "172" && Convert.ToInt32(parts[1]) >= 16 && Convert.ToInt32(parts[1]) <= 31)) { location = HostLocation.Local; } else { location = HostLocation.Intermediate; } } else { location = HostLocation.Unknown; } if (_ip != string.Empty || location == HostLocation.Local) { using (WebClient client = new WebClient()) { string apikey = "412b882f5f367fc2edfad0a39a1cb3329040f480"; string json = client.DownloadString(new Uri($@"http://api.db-ip.com/v2/{apikey}/{_ip}")); JToken token = JObject.Parse(json); country = (string)token.SelectToken("countryName"); city = (string)token.SelectToken("city"); } } else { country = string.Empty; city = string.Empty; } }
public XhtmlTraceListener(string FileName, LoggingSettings LS) : base(FileName, LS.Settings.LogVerbose) { mTraceStatus = new TraceStatus(LS.XHTMLLinesLabel, null, null, false, FileName, conXhtml); }
// Initialisation: protected TraceListenerUploadableBase(UploadableLogSettings2 UploadSettings, TraceStatus TraceStatus) : base(TraceStatus.FileName) { mTraceStatus = TraceStatus; mUploadSettings = UploadSettings; }
public TraceStartedDomainEvent(string traceId, CandlePeriod idealCandlePeriod, TraceStatus traceStatus, DateTime dateStarted) { TraceId = traceId ?? throw new ArgumentNullException(nameof(traceId)); IdealCandlePeriod = idealCandlePeriod ?? throw new ArgumentNullException(nameof(idealCandlePeriod)); TraceStatus = traceStatus ?? throw new ArgumentNullException(nameof(traceStatus)); this.DateStarted = dateStarted; }
/// <summary> /// Writes a exception trace event message to the trace listeners in the Listeners collection using the specified event type and event identifier. /// </summary> /// <param name="traceSource">The 'TraceSource' instance.</param> /// <param name="exception">The exception data.</param> /// <param name="traceEventType">One of the enumeration values that specifies the event type of the trace data.</param> /// <param name="message">The informative message to write.</param> /// <param name="duration">The trace event duration.</param> /// <param name="status">One of the enumeration values that specifies the event status of the trace event.</param> /// <param name="data">The trace data. If this is an anonymous object, the member properties will be treated as the Trace Data and the property name will be the label.</param> /// <param name="methodName">The calling method where the log originated from</param> public static void TraceException(this TraceSource traceSource, Exception exception, TraceEventType traceEventType, string message, TimeSpan duration, TraceStatus status, object data, [CallerMemberName] string methodName = null) { traceSource.TraceEventInternal(traceEventType, message, duration, status, exception, data, methodName); }
public XhtmlTraceListener(string fileName, LoggingSettings ls) : base(fileName, ls.Settings.LogVerbose) { mTraceStatus = new TraceStatus(ls.XHTMLLinesLabel, null, null, false, fileName, ConXhtml); }
public TraceClosedDomainEvent(string traceId, TraceStatus traceStatus, DateTime dateClosed) { TraceId = traceId ?? throw new ArgumentNullException(nameof(traceId)); TraceStatus = traceStatus ?? throw new ArgumentNullException(nameof(traceStatus)); DateClosed = dateClosed; }