public static void RegisterApplicationDispatcherUnhandledExceptionHandler(this ExceptionlessClient client) { if (client == null) throw new ArgumentNullException(nameof(client)); if (System.Windows.Application.Current == null) return; if (_onApplicationDispatcherUnhandledException == null) _onApplicationDispatcherUnhandledException = (sender, args) => { var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod("DispatcherUnhandledException"); args.Exception.ToExceptionless(contextData, client).Submit(); // process queue immediately since the app is about to exit. client.ProcessQueue(); }; try { System.Windows.Application.Current.DispatcherUnhandledException -= _onApplicationDispatcherUnhandledException; System.Windows.Application.Current.DispatcherUnhandledException += _onApplicationDispatcherUnhandledException; } catch (Exception ex) { client.Configuration.Resolver.GetLog().Error(typeof(ExceptionlessClientExtensions), ex, "An error occurred while wiring up to the application dispatcher exception event."); } }
public static EventBuilder CreateFromLogEvent(this ExceptionlessClient client, LogEventInfo ev) { var contextData = new ContextData(ev.GetContextData()); if (ev.Exception != null) contextData.SetException(ev.Exception); var builder = client.CreateEvent(contextData); if (ev.Exception == null) { builder.SetSource(ev.LoggerName); builder.SetProperty(Event.KnownDataKeys.Level, ev.Level.Name); } builder.Target.Date = ev.TimeStamp; if (!String.IsNullOrWhiteSpace(ev.FormattedMessage)) builder.SetMessage(ev.FormattedMessage); if (ev.Exception != null) builder.SetSource(ev.LoggerName); var tagList = ev.GetTags(); if (tagList.Count > 0) builder.AddTags(tagList.ToArray()); foreach (var p in ev.Properties.Where(kvp => !_ignoredEventProperties.Contains(kvp.Key.ToString(), StringComparer.OrdinalIgnoreCase))) builder.SetProperty(p.Key.ToString(), p.Value); return builder; }
public void OnDiagnosticHandledException(HttpContext httpContext, Exception exception) { var contextData = new ContextData(); contextData.SetSubmissionMethod("Microsoft.AspNetCore.Diagnostics.UnhandledException"); contextData.Add(nameof(HttpContext), httpContext); exception.ToExceptionless(contextData, _client).Submit(); }
public ContextData(ContextData original) : this() { foreach (var e in original.Elements) { Set(e.Name, e.Data); } }
public static void RegisterAppDomainUnhandledExceptionHandler(this ExceptionlessClient client, AppDomain appDomain = null) { if (appDomain == null) appDomain = AppDomain.CurrentDomain; if (_onAppDomainUnhandledException == null) _onAppDomainUnhandledException = (sender, args) => { var exception = args.ExceptionObject as Exception; if (exception == null) return; var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod("AppDomainUnhandledException"); exception.ToExceptionless(contextData, client).Submit(); // process queue immediately since the app is about to exit. client.ProcessQueue(); }; try { appDomain.UnhandledException -= _onAppDomainUnhandledException; appDomain.UnhandledException += _onAppDomainUnhandledException; } catch (Exception ex) { client.Configuration.Resolver.GetLog().Error(typeof(ExceptionlessClientExtensions), ex, "An error occurred while wiring up to the unhandled exception event. This will happen when you are not running under full trust."); } }
public void OnMiddlewareException(HttpContext httpContext, Exception exception, string name) { var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod(name ?? "Microsoft.AspNetCore.MiddlewareAnalysis.MiddlewareException"); contextData.Add(nameof(HttpContext), httpContext); exception.ToExceptionless(contextData, _client).Submit(); }
public void OnException(ExceptionContext filterContext) { var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod("SendErrorsAttribute"); contextData.Add("HttpContext", filterContext.HttpContext); filterContext.Exception.ToExceptionless(contextData).Submit(); }
public void CanCheckForSingletonExistence() { var data = new ContextData(new DictionaryContextProvider()); data.ContainsSingleton<Sample>().Should().Be(false); var sample1 = data.Singleton<Sample>(() => new Sample(1)); data.ContainsSingleton<Sample>().Should().Be(true); }
public override void Log(ExceptionLoggerContext context) { var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod("ExceptionLogger"); contextData.Add("HttpActionContext", context.ExceptionContext.ActionContext); context.Exception.ToExceptionless(contextData).Submit(); }
public void CanCheckForKeyExistance() { var dic = new Dictionary<object, object>(); var data = new ContextData(new GenericContextProvider(() => dic)); data.Contains("test").Should().Be.False(); data.Set("test", 123); data.Contains("test").Should().Be.True(); }
internal static Transaction GetContextTransaction(ContextData contextData) { if (EnterpriseServicesOk) { ThrowNotSupported(); } return null; }
public void CanEnsureSingletonForTypeWithDifferentConstructor() { var data = new ContextData(new DictionaryContextProvider()); var sample1 = data.Singleton<Sample>(() => new Sample(1)); var sample2 = data.Singleton<Sample>(() => new Sample(1)); sample1.Should().Be.SameInstanceAs(sample2); }
private static Response OnError(NancyContext context, Exception exception) { var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod("NancyPipelineException"); contextData.Add(NANCY_CONTEXT, context); exception.ToExceptionless(contextData).Submit(); return context.Response; }
public virtual void OnHttpException(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken) { if (HasWrappedFilter) WrappedFilter.ExecuteExceptionFilterAsync(actionExecutedContext, cancellationToken); var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod("ExceptionHttpFilter"); contextData.Add("HttpActionContext", actionExecutedContext.ActionContext); actionExecutedContext.Exception.ToExceptionless(contextData, _client).Submit(); }
/// <summary> /// Creates a builder object for constructing error reports in a fluent api. /// </summary> /// <param name="exception">The exception.</param> /// <param name="pluginContextData"> /// Any contextual data objects to be used by Exceptionless plugins to gather default /// information for inclusion in the report information. /// </param> /// <param name="client"> /// The ExceptionlessClient instance used for configuration. If a client is not specified, it will use /// ExceptionlessClient.Default. /// </param> /// <returns></returns> public static EventBuilder ToExceptionless(this Exception exception, ContextData pluginContextData = null, ExceptionlessClient client = null) { if (client == null) client = ExceptionlessClient.Default; if (pluginContextData == null) pluginContextData = new ContextData(); pluginContextData.SetException(exception); return client.CreateEvent(pluginContextData); }
public ContextData OverrideWith(ContextData context) { var newContext = new ContextData(this); if (context == null) { return newContext; } foreach (var k in context.Elements) { newContext.Set(k.Name, k.Data); } return newContext; }
public virtual bool HandleError(Exception exception) { var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod("WCFServiceError"); if (HttpContext.Current != null) contextData.Add("HttpContext", HttpContext.Current.ToWrapped()); exception.ToExceptionless(contextData).Submit(); return true; }
public void LargeEventsFromFiles() { foreach (var ev in _events) { var pluginContextData = new ContextData(); for (int index = 0; index < 2; index++) { var context = new EventPluginContext(_client, ev, pluginContextData); _errorPlugin.Run(context); _duplicateCheckerPlugin.Run(context); } } }
public void TestPrimeGeneration () { Random r = new Random (); for (int i = 0; i < 5; i++) { ContextData ctx = new ContextData (128, (uint)r.Next (int.MinValue, int.MaxValue)); BigInteger p = GenerateNewPrime (128, ctx); Assert.IsTrue (p.TestBit (1)); uint d = ctx.testData; for (uint j = 128 - 2; d > 0; j--, d >>= 1) Assertion.AssertEquals ((d&1) == 1, p.TestBit (j)); } }
public async Task Invoke(HttpContext context) { try { await _next(context); } catch (Exception ex) { var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod(nameof(ExceptionlessMiddleware)); contextData.Add(nameof(HttpContext), context); ex.ToExceptionless(contextData, _client).Submit(); throw; } }
public static EventBuilder CreateFromLogEvent(this ExceptionlessClient client, LogEventInfo ev) { if (client == null) throw new ArgumentNullException(nameof(client)); var contextData = new ContextData(ev.GetContextData()); if (ev.Exception != null) contextData.SetException(ev.Exception); var builder = client.CreateEvent(contextData); builder.Target.Date = ev.TimeStamp; builder.SetSource(ev.LoggerName); var properties = ev.Properties .Where(kvp => !_ignoredEventProperties.Contains(kvp.Key.ToString(), StringComparer.OrdinalIgnoreCase)) .ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value, StringComparer.OrdinalIgnoreCase); object value; if (properties.TryGetValue("@value", out value)) { try { builder.SetValue(Convert.ToDecimal(value)); properties.Remove("@value"); } catch (Exception) {} } object stackingKey; if (properties.TryGetValue(Event.KnownDataKeys.ManualStackingInfo, out stackingKey)) { try { builder.SetManualStackingKey(stackingKey.ToString()); properties.Remove(Event.KnownDataKeys.ManualStackingInfo); } catch (Exception) { } } if (ev.Exception == null) builder.SetProperty(Event.KnownDataKeys.Level, ev.Level.Name); if (!String.IsNullOrWhiteSpace(ev.FormattedMessage)) builder.SetMessage(ev.FormattedMessage); var tagList = ev.GetTags(); if (tagList.Count > 0) builder.AddTags(tagList.ToArray()); foreach (var p in properties) builder.SetProperty(p.Key, p.Value); return builder; }
public void CanFeedGenericProviderWithDictionaryConstructor() { var dic = new Dictionary<object, object>(); var data = new ContextData(new GenericContextProvider(() => dic)); data.Set("test", 123); data.Get("test").Should().Be(123); data.Set("test2", 124); data.Get("test2").Should().Be(124); dic.Count.Should().Be(1); dic = new Dictionary<object, object>(); data.Get("test").Should().Be(null); }
public static void RegisterApplicationThreadExceptionHandler(this ExceptionlessClient client) { if (_onApplicationThreadException == null) _onApplicationThreadException = (sender, args) => { var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod("ApplicationThreadException"); args.Exception.ToExceptionless(contextData, client).Submit(); }; try { System.Windows.Forms.Application.ThreadException -= _onApplicationThreadException; System.Windows.Forms.Application.ThreadException += _onApplicationThreadException; } catch (Exception ex) { client.Configuration.Resolver.GetLog().Error(typeof(ExceptionlessClientExtensions), ex, "An error occurred while wiring up to the application thread exception event."); } }
public static void RegisterTaskSchedulerUnobservedTaskExceptionHandler(this ExceptionlessClient client) { if (_onTaskSchedulerOnUnobservedTaskException == null) _onTaskSchedulerOnUnobservedTaskException = (sender, args) => { var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod("UnobservedTaskException"); args.Exception.ToExceptionless(contextData, client).Submit(); }; try { TaskScheduler.UnobservedTaskException -= _onTaskSchedulerOnUnobservedTaskException; TaskScheduler.UnobservedTaskException += _onTaskSchedulerOnUnobservedTaskException; } catch (Exception ex) { client.Configuration.Resolver.GetLog().Error(typeof(ExceptionlessClientExtensions), ex, "An error occurred while wiring up to the unobserved task exception event."); } }
public void WillThrowStackOverflowExceptionDuringOnSubmitting() { var client = CreateClient(); var list = new List<EventSubmittingEventArgs>(); client.SubmittingEvent += (sender, e) => { list.Add(e); if (e.IsUnhandledError) { new EventBuilder(e.Event, e.Client, e.PluginContextData).AddTags("Unhandled").Submit(); e.Cancel = true; } }; var contextData = new ContextData(); contextData.MarkAsUnhandledError(); new Exception("Test").ToExceptionless(contextData, client).Submit(); Assert.Equal(2, list.Count); }
public static void RegisterApplicationThreadExceptionHandler(this ExceptionlessClient client) { if (client == null) throw new ArgumentNullException(nameof(client)); if (_onApplicationThreadException == null) _onApplicationThreadException = (sender, args) => { var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod("ApplicationThreadException"); args.Exception.ToExceptionless(contextData, client).Submit(); }; try { Application.ThreadException -= _onApplicationThreadException; Application.ThreadException += _onApplicationThreadException; } catch (Exception ex) { client.Configuration.Resolver.GetLog().Error(typeof(ExceptionlessClientExtensions), ex, "An error occurred while wiring up to the unobserved task exception event."); } }
public void Run(EventPluginContext context) { var aggregateException = context.ContextData.GetException() as AggregateException; if (aggregateException == null) return; var exception = aggregateException.Flatten(); if (exception.InnerExceptions.Count == 1) { context.ContextData.SetException(exception.InnerException); return; } foreach (var ex in exception.InnerExceptions) { var ctx = new ContextData(context.ContextData); ctx.SetException(ex); var serializer = context.Resolver.GetJsonSerializer(); context.Client.SubmitEvent(serializer.Deserialize(serializer.Serialize(context.Event), typeof(Event)) as Event, ctx); } context.Cancel = true; }
private void OnEditableChildChanged() { CleanTemplateContextByValue(Constants.EditableChild); foreach (var entity in EditableChildEntities) { if (ContextData.Get(entity.EntityKeyName) != null) { ContextData.Remove(entity.EntityKeyName); } DynamicRootEntities.Remove(entity); EditableRootEntities.Remove(entity); SwitchableObjectEntities.Remove(entity); ContextData.Add(entity.EntityKeyName, Constants.EditableChild); if (State == TemplateState.RestoringProperties) { continue; } //Many-To-One foreach (var childEntity in GetChildAssociations(entity.Associations)) { foreach (AssociationProperty property in childEntity.Properties) { AddChildEntity(property.Property.Entity, false, true); } } //One-To-Many & Many-To-Many foreach (var childList in GetChildListAssociations(entity.Associations)) { foreach (AssociationProperty property in childList.Properties) { AddChildList(property.Property.Entity, false, true); } } } }
public void ContextData_Properties() { ContextData d = new ContextData() { IsClientAccessEnabled = true, IsODataEndpointEnabled = true, Name = "foo", ID = 1 }; Assert.IsTrue(d.IsClientAccessEnabled, "ClientAccessEnable failed"); Assert.IsTrue(d.IsODataEndpointEnabled, "OData failed"); Assert.AreEqual("foo", d.Name, "Name failed"); Assert.AreEqual(1, d.ID); // Flip the bools just in case d.IsClientAccessEnabled = false; Assert.IsFalse(d.IsClientAccessEnabled, "ClientAccessEnable did not flip"); d.IsODataEndpointEnabled = false; Assert.IsFalse(d.IsODataEndpointEnabled, "OData did not flip"); }
public static void RegisterAppDomainUnhandledExceptionHandler(this ExceptionlessClient client) { if (client == null) { throw new ArgumentNullException(nameof(client)); } if (_onAppDomainUnhandledException == null) { _onAppDomainUnhandledException = (sender, args) => { var exception = args.ExceptionObject as Exception; if (exception == null) { return; } var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod("AppDomainUnhandledException"); exception.ToExceptionless(contextData, client).Submit(); // process queue immediately since the app is about to exit. client.ProcessQueue(); if (client.Configuration.SessionsEnabled) { client.SubmitSessionEnd(); } }; } try { AppDomain.CurrentDomain.UnhandledException -= _onAppDomainUnhandledException; AppDomain.CurrentDomain.UnhandledException += _onAppDomainUnhandledException; } catch (Exception ex) { client.Configuration.Resolver.GetLog().Error(typeof(ExceptionlessClientExtensions), ex, "An error occurred while wiring up to the unhandled exception event. This will happen when you are not running under full trust."); } }
public bool IsChildBusinessObject(string suffix) { string key = String.Format("{0}{1}", Entity.EntityKeyName, suffix); if (ContextData.Get(key) == null) { return(false); } var value = ContextData[key]; switch (value) { case Constants.EditableChild: case Constants.ReadOnlyChild: case Constants.EditableChildList: case Constants.ReadOnlyChildList: return(true); } return(false); }
public void CanEnsureSingletonUsingThreadProvider() { var data = new ContextData(new ThreadDataProvider()); var sample1 = data.Singleton<SampleDefault>(); var thread = new Thread(() => { var inside1 = data.Singleton<SampleDefault>(); var inside2 = data.Singleton<SampleDefault>(); inside1.Should().Not.Be.SameInstanceAs(sample1); inside2.Should().Be.SameInstanceAs(inside2); }); thread.Start(); thread.Join(1000); var sample2 = data.Singleton<SampleDefault>(); sample1.Should().Be.SameInstanceAs(sample2); }
public static EventBuilder CreateFromLogEvent(this ExceptionlessClient client, LogEventInfo ev) { var contextData = new ContextData(ev.GetContextData()); if (ev.Exception != null) { contextData.SetException(ev.Exception); } var builder = client.CreateEvent(contextData); builder.Target.Date = ev.TimeStamp; builder.SetSource(ev.LoggerName); if (ev.Exception == null) { builder.SetProperty(Event.KnownDataKeys.Level, ev.Level.Name); } if (!String.IsNullOrWhiteSpace(ev.FormattedMessage)) { builder.SetMessage(ev.FormattedMessage); } var tagList = ev.GetTags(); if (tagList.Count > 0) { builder.AddTags(tagList.ToArray()); } foreach (var p in ev.Properties.Where(kvp => !_ignoredEventProperties.Contains(kvp.Key.ToString(), StringComparer.OrdinalIgnoreCase))) { builder.SetProperty(p.Key.ToString(), p.Value); } return(builder); }
public static void RegisterHttpApplicationErrorHandler(this ExceptionlessClient client, HttpApplication app) { if (client == null) { throw new ArgumentNullException(nameof(client)); } if (_onHttpApplicationError == null) { _onHttpApplicationError = (sender, args) => { if (HttpContext.Current == null) { return; } Exception exception = HttpContext.Current.Server.GetLastError(); if (exception == null) { return; } var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod("HttpApplicationError"); contextData.Add("HttpContext", HttpContext.Current.ToWrapped()); exception.ToExceptionless(contextData, client).Submit(); } } ; try { app.Error -= _onHttpApplicationError; app.Error += _onHttpApplicationError; } catch (Exception ex) { client.Configuration.Resolver.GetLog().Error(typeof(ExceptionlessClientExtensions), ex, "An error occurred while wiring up to the unobserved task exception event."); } }
private void addNewActorItem(ActorItemTrack itemTrack) { GenericMenu createMenu = new GenericMenu(); Type actorActionType = typeof(CinemaActorAction); foreach (Type type in DirectorHelper.GetAllSubTypes(actorActionType)) { ContextData userData = getContextDataFromType(type); string text = string.Format("{0}/{1}", userData.Category, userData.Label); createMenu.AddItem(new GUIContent(text), false, new GenericMenu.MenuFunction2(AddActorAction), userData); } Type actorEventType = typeof(CinemaActorEvent); foreach (Type type in DirectorHelper.GetAllSubTypes(actorEventType)) { ContextData userData = getContextDataFromType(type); string text = string.Format("{0}/{1}", userData.Category, userData.Label); createMenu.AddItem(new GUIContent(text), false, new GenericMenu.MenuFunction2(AddActorEvent), userData); } createMenu.ShowAsContext(); }
public ScriptResponse Execute(ContextData context, Entity document, Dictionary <string, object> parameters) { ApiClient client = new ApiClient(context.Api.Endpoint, context.Tenant); client.Authenticate(context.Api.Email, context.Api.Password); string contents = $"Connector accessed from company {context.ExternalSystems.Values.FirstOrDefault().Code} in tenant {context.Tenant}"; string fileLocation = null; using (MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(contents))) { fileLocation = client.BinaryData.UploadFile(ms, "test.txt"); } var actions = new Dictionary <string, object>(); actions.Add("URL", fileLocation); return(new ScriptResponse { Actions = actions }); }
public override ContextData Convert(ContextData contentData) { var matches = RegexPatten.Matches(contentData.ContentText); List <object> captured = new List <object>(); for (int i = 0; i < matches.Count; i++) { try { string val = matches[i].Groups[GroupIndex].Value; captured.Add(val); } catch (Exception) { //TODO: Log Required } } return(new ContextData() { Listing = captured, }); }
private void SetUpExceptionless() { #if !DEBUG var client = ExceptionlessClient.Default; client.Configuration.ServerUrl = "http://120.238.131.27:8087"; client.Configuration.ApiKey = "rV7o6UWV6yYS1AKSOg6lqMFBF3K6n203fT1We4BX"; UnhandledException += (sender, args) => { var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod("App_UnhandledException"); args.Exception.ToExceptionless(contextData, ExceptionlessClient.Default).Submit(); client.ProcessQueue(); }; AppDomain.CurrentDomain.UnhandledException += (sender, args) => { var exception = args.ExceptionObject as Exception; if (exception == null) { return; } var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod("AppDomain_UnhandledException"); exception.ToExceptionless(contextData, ExceptionlessClient.Default).Submit(); client.ProcessQueue(); }; client.Startup(); #endif }
public void TestGlobalContextData() { var claims = new ContextData { ClaimValues = new List <ClaimValue> { new ClaimValue { Uri = "x.y.z", Type = ClaimValueType.STRING, Value = "test" } } }; // these claims get added by default claims.ClaimValues.Add(GraphQLRequests.CreateClaim(DataModelType.R2)); claims.ClaimValues.Add(GraphQLRequests.CreateClaim(ContentType.MODEL)); claims.ClaimValues.Add(GraphQLRequests.CreateClaim(TcdlLinkRendering.Relative)); claims.ClaimValues.Add(GraphQLRequests.CreateClaim(ModelServiceLinkRendering.Relative)); var expected = new Dictionary <string, object> { { "namespaceId", ContentNamespace.Sites }, { "publicationId", 1 }, { "url", "/" }, { "contextData", claims.ClaimValues } }; var client = CreateClient(new MockGraphQLClient(expected)); client.GetBinaryComponent(ContentNamespace.Sites, 1, "/", null, claims); client.GlobalContextData = claims; client.GetBinaryComponent(ContentNamespace.Sites, 1, "/", null, null); }
public async Task Invoke(HttpContext context) { try { await _next(context); } catch (Exception ex) { if (context.RequestAborted.IsCancellationRequested) { throw; } var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod(nameof(ExceptionlessMiddleware)); ex.ToExceptionless(contextData, _client).SetHttpContext(context).Submit(); throw; } if (context.Response?.StatusCode == 404) { string path = context.Request.Path.HasValue ? context.Request.Path.Value : "/"; _client.CreateNotFound(path).SetHttpContext(context).Submit(); } }
public ScriptResponse Execute(ContextData context, Entity document, Dictionary <string, object> parameters) { var externalSystem = context.ExternalSystems.FirstOrDefault().Value; ApiClient api = new ApiClient(context.Api.Endpoint, context.Tenant); api.Authenticate(externalSystem.Parameters["omniaEmail"].ToString(), externalSystem.Parameters["omniaPassword"].ToString()); var documentToCopy = api.ProcessInteraction.GetByID("PurchasesManagement", "PurchaseOrder", Convert.ToInt64(document["ID"])); var fields = $"CompanyCode:{documentToCopy.CompanyCode}"; var response = new ScriptResponse(); response.Actions = new Dictionary <string, object>(); var urlAction = new Dictionary <string, string>(); urlAction.Add("Location", $"../../ProcessInteraction/Create/?ProcessTypeCode=PurchasesManagement&InteractionTypeCode=PurchaseOrder&Attributes={HttpUtility.UrlEncode(HttpUtility.UrlEncode(fields))}"); urlAction.Add("Target", "CURRENT"); response.Actions.Add("URL", urlAction); return(response); }
static SelfAssignment() { stackVariable0 = new Assignment(); stackVariable1 = new SelfAssignment.SelfIncrementExpression(); stackVariable1.set_Bind(new Func<Expression, MatchData>(SelfAssignment.u003cu003ec.u003cu003e9.u003cu002ecctoru003eb__17_0)); stackVariable0.set_Target(stackVariable1); stackVariable5 = new Binary(); stackVariable5.set_Bind(new Func<BinaryExpression, MatchData>(SelfAssignment.u003cu003ec.u003cu003e9.u003cu002ecctoru003eb__17_1)); stackVariable9 = new ContextData(); stackVariable9.set_Name("Target"); stackVariable9.set_Comparer(new ExpressionComparer()); stackVariable5.set_Left(stackVariable9); stackVariable12 = new Literal(); stackVariable12.set_Value(1); stackVariable5.set_Right(stackVariable12); stackVariable5.set_IsChecked(new bool?(false)); stackVariable0.set_Expression(stackVariable5); SelfAssignment.IncrementPattern = stackVariable0; stackVariable17 = new Assignment(); stackVariable18 = new SelfAssignment.SelfAssignmentExpression(); stackVariable18.set_Bind(new Func<Expression, MatchData>(SelfAssignment.u003cu003ec.u003cu003e9.u003cu002ecctoru003eb__17_2)); stackVariable17.set_Target(stackVariable18); stackVariable22 = new Binary(); stackVariable22.set_Bind(new Func<BinaryExpression, MatchData>(SelfAssignment.u003cu003ec.u003cu003e9.u003cu002ecctoru003eb__17_3)); stackVariable26 = new ContextData(); stackVariable26.set_Name("Target"); stackVariable26.set_Comparer(new ExpressionComparer()); stackVariable22.set_Left(stackVariable26); stackVariable29 = new SelfAssignment.SelfAssignmentValue(); stackVariable29.set_Bind(new Func<Expression, MatchData>(SelfAssignment.u003cu003ec.u003cu003e9.u003cu002ecctoru003eb__17_4)); stackVariable22.set_Right(stackVariable29); stackVariable22.set_IsChecked(new bool?(false)); stackVariable17.set_Expression(stackVariable22); SelfAssignment.AssignmentOperatorPattern = stackVariable17; return; }
public async Task SetContextAsync(LoadedReplay loadedReplay) { if (loadedReplay == null) { throw new ArgumentNullException(nameof(loadedReplay)); } Previous = Current; Replay replay = loadedReplay.Replay; var players = replayAnalyzer.GetPlayers(replay); var panels = replayAnalyzer.GetPanels(replay); var end = replayAnalyzer.GetEnd(replay); var isCarried = replayAnalyzer.GetIsCarriedObjective(replay); var start = replayAnalyzer.GetStart(replay); var payloads = replayAnalyzer.GetPayloads(replay); var teamBans = replayAnalyzer.GetTeamBans(replay); var directory = Directory.CreateDirectory(settings.ContextsDirectory).CreateSubdirectory($"{loadedReplay.ReplayId}"); Current = new ContextData { LoadedReplay = loadedReplay, Payloads = payloads, Players = players, Panels = panels, GatesOpen = start, CoreKilled = end, IsCarriedObjectiveMap = isCarried, Timeloaded = DateTime.Now, Directory = directory, TeamBans = teamBans }; await contextFileManager.WriteContextFilesAsync(Current); }
public bool IsNameValueListBusinessObject(IAssociation association, string suffix) { if (association.Properties.Count <= 0) { return(false); } string key = String.Format("{0}{1}", association.ForeignEntity.EntityKeyName, suffix); if (ContextData.Get(key) == null) { return(false); } var value = ContextData[key]; switch (value) { case Constants.NameValueList: return(true); } return(false); }
public ScriptResponse Execute(ContextData context, Entity document, Dictionary <string, object> parameters) { var externalSystem = context.ExternalSystems.Where(e => e.Key == (string)document["Agent:#Company.Code"]).FirstOrDefault().Value; var fileToExecute = context.Files.Where(f => f.ExecutionType == "Remote").FirstOrDefault(); if (fileToExecute == null) { throw new Exception("File not found"); } ConnectorClient client = new ConnectorClient(context.Api.Endpoint, externalSystem.ConnectorCode); var connectorResponse = client.Execute(context.Tenant, new MyMis.Scripting.Core.Contracts.Script() { Code = fileToExecute.Name, Version = fileToExecute.Version }, context, document, parameters ); return(new ScriptResponse { RedirectUrl = connectorResponse.Result.FirstOrDefault().Actions["URL"] }); }
/// <summary> /// Create a new instance of <see cref="LogEventContext"/> /// </summary> public LogEventContext() { _additionalOperations = new List <IAdditionalOperation>(); _contextData = new ContextData(); }
public static EventBuilder CreateFromLogEvent(this ExceptionlessClient client, LogEventInfo ev) { if (client == null) { throw new ArgumentNullException(nameof(client)); } var contextData = new ContextData(ev.GetContextData()); if (ev.Exception != null) { contextData.SetException(ev.Exception); } var builder = client.CreateEvent(contextData); builder.Target.Date = ev.TimeStamp; builder.SetSource(ev.LoggerName); var properties = ev.Properties .Where(kvp => !_ignoredEventProperties.Contains(kvp.Key.ToString(), StringComparer.OrdinalIgnoreCase)) .ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value, StringComparer.OrdinalIgnoreCase); object value; if (properties.TryGetValue("@value", out value)) { try { builder.SetValue(Convert.ToDecimal(value)); properties.Remove("@value"); } catch (Exception) {} } object stackingKey; if (properties.TryGetValue(Event.KnownDataKeys.ManualStackingInfo, out stackingKey)) { try { builder.SetManualStackingKey(stackingKey.ToString()); properties.Remove(Event.KnownDataKeys.ManualStackingInfo); } catch (Exception) { } } if (ev.Exception == null) { builder.SetProperty(Event.KnownDataKeys.Level, ev.Level.Name); } if (!String.IsNullOrWhiteSpace(ev.FormattedMessage)) { builder.SetMessage(ev.FormattedMessage); } var tagList = ev.GetTags(); if (tagList.Count > 0) { builder.AddTags(tagList.ToArray()); } foreach (var p in properties) { builder.SetProperty(p.Key, p.Value); } return(builder); }
/// <summary> /// Has NancyFX Context /// </summary> /// <param name="context"></param> /// <returns></returns> public static bool HasNancyContext(this ContextData context) { return(context?.ContainsKey(Constants.NancyContextName) ?? false); }
/// <summary>Creates a new instance of <see cref="Event" />.</summary> /// <param name="pluginContextData"> /// Any contextual data objects to be used by Exceptionless plugins to gather default /// information to add to the event data. /// </param> /// <returns>A new instance of <see cref="EventBuilder" />.</returns> public EventBuilder CreateEvent(ContextData pluginContextData = null) { return(new EventBuilder(new Event { Date = DateTimeOffset.Now }, this, pluginContextData)); }
public TrackAudioFeaturesBuilder(ContextData contextData, string id) : base(contextData, "audio-features", id) { }
protected void P_ErrorDataReceived(object sender, DataReceivedEventArgs e) { bool flag = e.Data != null; if (flag) { Data = e.Data; ContextData.Add(e.Data); bool flag2 = e.Data.IndexOf("configuration") != -1; if (flag2) { try { Configuration = e.Data.Substring(e.Data.IndexOf("configuration") + 14); } catch { } } bool flag3 = e.Data.IndexOf("Duration") != -1; if (flag3) { try { Duration = TimeSpan.Parse(e.Data.Substring(e.Data.IndexOf("Duration") + 10, 11)); } catch { } } bool flag4 = e.Data.IndexOf("start") != -1; if (flag4) { try { StartTime = e.Data.Substring(e.Data.IndexOf("start") + 7, 8); } catch { } } bool flag5 = e.Data.IndexOf("Duration") != -1 && e.Data.IndexOf("start") != -1; if (flag5) { try { PrimaryBitrate = e.Data.Substring(e.Data.IndexOf("bitrate") + 8, e.Data.IndexOf("kb/s") - (e.Data.IndexOf("bitrate") + 8 - 4)).Trim().Replace(" ", ""); } catch { } try { PrimaryFileSize = ((double)(int.Parse(PrimaryBitrate.Substring(0, PrimaryBitrate.Length - 4)) / 1024) * Duration.TotalSeconds / 8.0).ToString() + "M"; } catch { } } bool flag6 = e.Data.IndexOf("Stream") != -1 && e.Data.IndexOf("mapping") == -1 && e.Data.IndexOf("->") == -1; if (flag6) { try { StreamInfo.Add(e.Data.Substring(e.Data.IndexOf("Stream") + 6)); } catch { } try { PrimaryFPS = double.Parse(e.Data.Substring(e.Data.IndexOf("fps") - 6, 5)); } catch { } try { bool flag7 = e.Data.IndexOf("Video") != -1; if (flag7) { HasVideo = true; } } catch { } try { bool flag8 = e.Data.IndexOf("Audio") != -1; if (flag8) { HasAudio = true; } } catch { } } bool flag9 = e.Data.IndexOf("encoder") != -1; if (flag9) { try { StreamEncoder.Add(e.Data.Substring(e.Data.IndexOf("encoder") + 18)); } catch { } } bool flag10 = e.Data.IndexOf("->") != -1; if (flag10) { try { StreamMapping.Add(e.Data); } catch { } } bool flag11 = e.Data.IndexOf("frame") != -1 && e.Data.IndexOf("fps") != -1; if (flag11) { try { Frame = Convert.ToInt32(e.Data.Substring(e.Data.IndexOf("frame") + 6, e.Data.IndexOf("fps") - (e.Data.IndexOf("frame") + 6)).Trim()); } catch { } } bool flag12 = e.Data.IndexOf("fps") != -1 && e.Data.IndexOf("q") != -1; if (flag12) { try { FPS = Convert.ToInt32(e.Data.Substring(e.Data.IndexOf("fps") + 4, e.Data.IndexOf("q") - (e.Data.IndexOf("fps") + 4)).Trim()); } catch { } } bool flag13 = e.Data.IndexOf("q") != -1 && e.Data.IndexOf("size") != -1; if (flag13) { try { Quality = Convert.ToInt32(e.Data.Substring(e.Data.IndexOf("q") + 2, e.Data.IndexOf("size") - (e.Data.IndexOf("q") + 5)).Trim()); } catch { } } bool flag14 = e.Data.IndexOf("size") != -1 && e.Data.IndexOf("time") != -1; if (flag14) { try { CompiledSize = e.Data.Substring(e.Data.IndexOf("size") + 5, e.Data.IndexOf("time") - (e.Data.IndexOf("size") + 5)).Trim(); } catch { } } bool flag15 = e.Data.IndexOf("time") != -1 && e.Data.IndexOf("bitrate") != -1; if (flag15) { try { CompiledTime = TimeSpan.Parse(e.Data.Substring(e.Data.IndexOf("time") + 5, e.Data.IndexOf("bitrate") - (e.Data.IndexOf("time") + 5)).Trim()); } catch { } } bool flag16 = e.Data.IndexOf("bitrate") != -1 && e.Data.IndexOf("speed") != -1; if (flag16) { try { Bitrate = e.Data.Substring(e.Data.IndexOf("bitrate") + 8, Data.IndexOf("speed") - (e.Data.IndexOf("bitrate") + 8)).Trim(); } catch { } } bool flag17 = e.Data.IndexOf("speed") != -1; if (flag17) { try { Speed = e.Data.Substring(e.Data.IndexOf("speed") + 6).Trim(); } catch { } } bool flag18 = Speed != "" && Speed != "0.00x" && Duration != TimeSpan.Zero && CompiledTime != TimeSpan.Zero; if (flag18) { try { ForecastTime = TimeSpan.FromSeconds((Duration.TotalSeconds - CompiledTime.TotalSeconds) / double.Parse(Speed.Replace("x", ""))); } catch { } } else { ForecastTime = TimeSpan.Zero; } } }
public ArtistTopTracksBuilder(ContextData contextData, IEnumerable <object> routeValuesPrefix) : base(contextData, routeValuesPrefix, "top-tracks") { }
/// <summary> /// Update and Draw the inspector /// </summary> public override void OnInspectorGUI() { eventTrack.Update(); ActorItemTrack track = base.serializedObject.targetObject as ActorItemTrack; CinemaActorAction[] actions = track.ActorActions; CinemaActorEvent[] actorEvents = track.ActorEvents; if (actions.Length > 0 || actorEvents.Length > 0) { actionFoldout = EditorGUILayout.Foldout(actionFoldout, actionContent); if (actionFoldout) { EditorGUI.indentLevel++; foreach (CinemaActorAction action in actions) { EditorGUILayout.ObjectField(action.name, action, typeof(CinemaActorAction), true); } foreach (CinemaActorEvent actorEvent in actorEvents) { EditorGUILayout.ObjectField(actorEvent.name, actorEvent, typeof(CinemaActorEvent), true); } EditorGUI.indentLevel--; } } if (GUILayout.Button(addActionContent)) { GenericMenu createMenu = new GenericMenu(); Type actorActionType = typeof(CinemaActorAction); foreach (Type type in DirectorHelper.GetAllSubTypes(actorActionType)) { string text = string.Empty; string category = string.Empty; string label = string.Empty; foreach (CutsceneItemAttribute attribute in type.GetCustomAttributes(typeof(CutsceneItemAttribute), true)) { if (attribute != null) { category = attribute.Category; label = attribute.Label; text = string.Format("{0}/{1}", category, label); break; } } ContextData userData = new ContextData { type = type, label = label, category = category }; createMenu.AddItem(new GUIContent(text), false, new GenericMenu.MenuFunction2(AddEvent), userData); } Type actorEventType = typeof(CinemaActorEvent); foreach (Type type in DirectorHelper.GetAllSubTypes(actorEventType)) { string text = string.Empty; string category = string.Empty; string label = string.Empty; foreach (CutsceneItemAttribute attribute in type.GetCustomAttributes(typeof(CutsceneItemAttribute), true)) { if (attribute != null) { category = attribute.Category; label = attribute.Label; text = string.Format("{0}/{1}", attribute.Category, attribute.Label); break; } } ContextData userData = new ContextData { type = type, label = label, category = category }; createMenu.AddItem(new GUIContent(text), false, new GenericMenu.MenuFunction2(AddEvent), userData); } createMenu.ShowAsContext(); } eventTrack.ApplyModifiedProperties(); }
private void addCutsceneItem(ContextData data, UnityEngine.Object pickedObject) { GameObject item = CutsceneItemFactory.CreateCutsceneItem(data.Track, data.Type, data.Label, pickedObject, data.Firetime).gameObject; Undo.RegisterCreatedObjectUndo(item, string.Format("Create {0}", item.name)); }
/// <summary> /// Header Control 4 is typically the "Add" control. /// </summary> /// <param name="position">The position that this control is drawn at.</param> protected override void updateHeaderControl4(UnityEngine.Rect position) { TimelineTrack track = TargetTrack.Behaviour as TimelineTrack; if (track == null) { return; } Color temp = GUI.color; GUI.color = (track.GetTimelineItems().Length > 0) ? Color.green : Color.red; controlID = GUIUtility.GetControlID(track.GetInstanceID(), FocusType.Passive); if (GUI.Button(position, string.Empty, TrackGroupControl.styles.AddIcon)) { // Get the possible items that this track can contain. List <Type> trackTypes = track.GetAllowedCutsceneItems(); if (trackTypes.Count == 1) { // Only one option, so just create it. ContextData data = getContextData(trackTypes[0]); if (data.PairedType == null) { addCutsceneItem(data); } else { showObjectPicker(data); } } else if (trackTypes.Count > 1) { // Present context menu for selection. GenericMenu createMenu = new GenericMenu(); for (int i = 0; i < trackTypes.Count; i++) { ContextData data = getContextData(trackTypes[i]); createMenu.AddItem(new GUIContent(string.Format("{0}/{1}", data.Category, data.Label)), false, addCutsceneItem, data); } createMenu.ShowAsContext(); } } // Handle the case where the object picker has a value selected. if (Event.current.type == EventType.ExecuteCommand && Event.current.commandName == "ObjectSelectorClosed") { if (EditorGUIUtility.GetObjectPickerControlID() == controlID) { UnityEngine.Object pickedObject = EditorGUIUtility.GetObjectPickerObject(); if (pickedObject != null) { addCutsceneItem(savedData, pickedObject); } Event.current.Use(); } } GUI.color = temp; }
/// <summary> /// Create a new instance of <see cref="FutureLogEventDescriptor"/> /// </summary> /// <param name="callerInfo"></param> /// <param name="loggerLifetimeContextData"></param> public FutureLogEventDescriptor(ILogCallerInfo callerInfo, ContextData loggerLifetimeContextData) { _callerInfo = callerInfo ?? NullLogCallerInfo.Instance; _ownLifetimeContextData = new ContextData(); _loggerLifetimeContextData = loggerLifetimeContextData; }
public EventBuilder(Event ev, ExceptionlessClient client = null, ContextData enrichmentContextData = null) { Client = client ?? ExceptionlessClient.Default; Target = ev; EnrichmentContextData = enrichmentContextData; }
public static void RegisterHttpApplicationErrorHandler(this ExceptionlessClient client, HttpApplication app) { if (client == null) throw new ArgumentNullException(nameof(client)); if (_onHttpApplicationError == null) _onHttpApplicationError = (sender, args) => { if (HttpContext.Current == null) return; Exception exception = HttpContext.Current.Server.GetLastError(); if (exception == null) return; var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod("HttpApplicationError"); contextData.Add("HttpContext", HttpContext.Current.ToWrapped()); exception.ToExceptionless(contextData, client).Submit(); }; try { app.Error -= _onHttpApplicationError; app.Error += _onHttpApplicationError; } catch (Exception ex) { client.Configuration.Resolver.GetLog().Error(typeof(ExceptionlessClientExtensions), ex, "An error occurred while wiring up to the unobserved task exception event."); } }