private static void Vote() { string username = Crittercism.Username(); if (username == null) { username = "******"; } string response = ""; Console.WriteLine("Do you love Crittercism?"); Console.Write(">"); string result = Console.ReadLine(); if (result.Length == 0) { result = "y"; } switch (Char.ToLower(result[0])) { case 'n': response = "doesn't love Crittercism."; break; default: response = "loves Crittercism."; break; } string breadcrumb = username + " " + response; Console.WriteLine("LeaveBreadcrumb: \"" + breadcrumb + "\""); Crittercism.LeaveBreadcrumb(breadcrumb); }
// Work will be called when a worker thread is started via // Thread thread = new Thread(new ThreadStart(Worker.Work)); // thread.Start(); public static void Work() { Console.WriteLine("Worker.Work running in its own thread."); Random random = new Random(); while (true) { // Wait around 2 second. Thread.Sleep(random.Next(4000)); if (random.Next(10) == 0) { try { string[] names = { "Breadcrumb", "Strawberry", "Seed", "Grape", "Lettuce" }; string name = names[random.Next(0, names.Length)]; Crittercism.LeaveBreadcrumb(name); } catch (Exception e) { Console.WriteLine("UNEXPECTED ERROR!!! " + e.Message); }; } else { int i = 0; int j = 5; try { int k = j / i; } catch (Exception ex) { Crittercism.LogHandledException(ex); } } } }
public void TruncatedBreadcrumbTest() { TestHelpers.StartApp(); string breadcrumb; { StringBuilder builder = new StringBuilder(); // start breadcrumb with sentinel to ensure we don't left-truncate builder.Append("r"); for (int i = 1; i < Breadcrumbs.MAX_TEXT_LENGTH; i++) { builder.Append("a"); } ; // end breadcrumb with "illegal" chars and check for their presence builder.Append("zzzzzzzzzz"); breadcrumb = builder.ToString(); }; Crittercism.LeaveBreadcrumb(breadcrumb); TestHelpers.LogHandledException(); MessageReport messageReport = TestHelpers.DequeueMessageType(typeof(HandledException)); Assert.IsNotNull(messageReport, "Expected a HandledException message"); String asJson = JsonConvert.SerializeObject(messageReport); Assert.IsTrue(asJson.Contains("\"breadcrumbs\":")); Assert.IsTrue(asJson.Contains("\"raaaaaa")); Assert.IsFalse(asJson.Contains("aaaaz")); Assert.IsFalse(asJson.Contains("zzz")); }
private void leaveBreadcrumb_Click(object sender, EventArgs e) { string[] names = { "Breadcrumb", "Strawberry", "Seed", "Grape", "Lettuce" }; string name = names[random.Next(0, names.Length)]; Crittercism.LeaveBreadcrumb(name); }
public void LogHandledExceptionTest() { TestHelpers.StartApp(); Crittercism.LeaveBreadcrumb("HandledExceptionBreadcrumb"); Crittercism.SetValue("favoriteFood", "Texas Sheet Cake"); TestHelpers.Cleanup(); // drop all previous messages TestHelpers.LogHandledException(); MessageReport messageReport = TestHelpers.DequeueMessageType(typeof(HandledException)); Assert.IsNotNull(messageReport, "Expected a HandledException message"); String asJson = JsonConvert.SerializeObject(messageReport); Trace.WriteLine("asJson == " + asJson); TestHelpers.CheckJsonLegacy(asJson); string[] jsonStrings = new string[] { "\"breadcrumbs\":", "\"current_session\":", "\"message\":\"session_start\"", "\"metadata\":{", "\"favoriteFood\":\"Texas Sheet Cake\"" }; foreach (String jsonFragment in jsonStrings) { Trace.WriteLine("jsonFragment == " + jsonFragment); Trace.WriteLine("asJson.Contains(jsonFragment) == " + asJson.Contains(jsonFragment)); Assert.IsTrue(asJson.Contains(jsonFragment)); } ; }
private void Application_Startup(object sender, StartupEventArgs e) { //// Call the Init of the unhandled managed class library "Crittercism" Crittercism.Init("YOUR APP ID GOES HERE"); //CRFilter filter=CRFilter.FilterWithString("doYouLoveCrittercism"); //Crittercism.AddFilter(filter); Crittercism.LeaveBreadcrumb("Application_Startup"); }
private void Application_Startup(object sender, StartupEventArgs e) { //// Call the Init of the unhandled managed class library "Crittercism" Crittercism.Init("537a4e738039805d82000002"); //CRFilter filter=CRFilter.FilterWithString("doYouLoveCrittercism"); //Crittercism.AddFilter(filter); Crittercism.LeaveBreadcrumb("Application_Startup"); Crittercism.UserflowTimeOut += UserflowTimeOutHandler; }
private void Window_Closed(object sender,EventArgs e) { Crittercism.LeaveBreadcrumb("Closed"); App.UserflowEvent -= UserflowEventHandler; if (Application.Current.Windows.Count == 0) { // Last window is closing. Crittercism.Shutdown(); Application.Current.Shutdown(); } }
private static void CommandBreadcrumb(string arg) { if (arg.Length == 0) { arg = "My Breadcrumb"; } Console.WriteLine("LeaveBreadcrumb: \"" + arg + "\""); Crittercism.LeaveBreadcrumb(arg); }
private void Form1_FormClosed(object sender, FormClosedEventArgs e) { Crittercism.LeaveBreadcrumb("FormClosed"); ApplicationOpenFormsCount--; if (ApplicationOpenFormsCount == 0) { // Last window is closing. Crittercism.Shutdown(); Application.Exit(); } }
private void MainWindow_FormClosed(object sender, FormClosedEventArgs e) { Crittercism.LeaveBreadcrumb("FormClosed"); Program.UserflowEvent -= UserflowEventHandler; ApplicationOpenFormsCount--; if (ApplicationOpenFormsCount == 0) { // Last window is closing. Crittercism.Shutdown(); Application.Exit(); } }
private void critterClick(object sender,RoutedEventArgs e) { string username = Crittercism.Username(); if (username == null) { username = "******"; } string response = ""; MessageBoxResult result = MessageBox.Show(this,"Do you love Crittercism?","WPFApp",MessageBoxButton.YesNo); switch (result) { case MessageBoxResult.Yes: response = "loves Crittercism."; break; case MessageBoxResult.No: response = "doesn't love Crittercism."; break; } Crittercism.LeaveBreadcrumb(username + " " + response); }
private void checkIfZoneTransitionComplete() { if (!IsTransitioning && !IsConnecting) { TransitionState = ZoneTransitionEvents.ZoneTransition.States.Done; Crittercism.SetValue("previousZone", PreviousZone.SceneName); Crittercism.SetValue("currentZone", CurrentZone.SceneName); Crittercism.LeaveBreadcrumb($"Transitioned zone from '{PreviousZone.SceneName}' to '{CurrentZone.SceneName}'"); if (CurrentZone.Type == ZoneDefinition.ZoneType.Igloo) { checkIglooSceneStateDataExists(); } dispatcher.DispatchEvent(new ZoneTransitionEvents.ZoneTransition(PreviousZone.SceneName, CurrentZone.SceneName, ZoneTransitionEvents.ZoneTransition.States.Done)); Service.Get <LoadingController>().RemoveLoadingSystem(this); isCancelled = false; } }
private void loadAvailableScene(string sceneName, bool allowActivation, LoadSceneMode loadingMode) { if (Content.ContainsKey(sceneName)) { Content.TryPinBundle(sceneName); sceneAssetKeys.Add(sceneName); } Crittercism.LeaveBreadcrumb($"Begin load scene '{sceneName}' loadingMode= '{loadingMode}'"); if (enableAsyncSceneLoad) { AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(sceneName, loadingMode); asyncOperation.allowSceneActivation = allowActivation || overrideSceneActivation; asyncLoadingScenes.AddLast(new AsyncSceneLoadRequest(sceneName, asyncOperation)); } else { SceneManager.LoadScene(sceneName, loadingMode); Crittercism.LeaveBreadcrumb($"Finished loading scene '{sceneName}' loadingMode= '{loadingMode}'"); } }
private IEnumerator loadScene(string scene, string transitionScene, Dictionary <string, object> sceneArgs, bool allowActivation) { stopCurrentRoomTimer(); startJoinRoomBI(scene); yield return(splashScreenController.LoadSplashScreen(scene, sceneArgs)); prepareForSceneTransition(scene, transitionScene, sceneArgs); yield return(loadTransitionScene(transitionScene)); yield return(cleanupPreviousScene()); scene = checkTransitionCancelled(scene); yield return(loadSceneAudioPrefab(scene)); if (!isCancelRequested) { yield return(loadTargetScene(scene, allowActivation)); } if (isCancelRequested) { IsTransitioning = false; dispatcher.DispatchEvent(new SceneTransitionEvents.SetIsTransitioningFlag(isTransitioning: false)); stopJoinRoomBI(scene, "failure"); LoadScene(cancellationScene, "Loading"); } else if (isHardCancelRequested) { IsTransitioning = false; dispatcher.DispatchEvent(new SceneTransitionEvents.SetIsTransitioningFlag(isTransitioning: false)); stopJoinRoomBI(scene, "failure"); } else { Crittercism.SetValue("previousScene", currentScene); Crittercism.SetValue("currentScene", scene); Crittercism.LeaveBreadcrumb($"Transitioned scene from '{currentScene}' to '{scene}'"); currentScene = scene; startLoggingTargetScene(); stopJoinRoomBI(scene, "success"); } }
private void pictureBox1_Click(object sender, EventArgs e) { string username = Crittercism.Username(); if (username == null) { username = "******"; } string response = ""; DialogResult result = MessageBox.Show(this, "Do you love Crittercism?", "WindowsFormsApp", MessageBoxButtons.YesNo); switch (result) { case DialogResult.Yes: response = "loves Crittercism."; break; case DialogResult.No: response = "doesn't love Crittercism."; break; } Crittercism.LeaveBreadcrumb(username + " " + response); }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="sender"> /// The source of the event; typically <see cref="NavigationHelper"/> /// </param> /// <param name="e">Event data that provides both the navigation parameter passed to /// <see cref="Frame.Navigate(Type, object)"/> when this page was initially requested and /// a dictionary of state preserved by this page during an earlier /// session. The state will be null the first time a page is visited.</param> private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { var item = await SampleDataSource.GetItemAsync((string)e.NavigationParameter); this.DefaultViewModel["Item"] = item; Debug.WriteLine("UniqueId == " + item.UniqueId); Crittercism.LeaveBreadcrumb("UniqueId == " + item.UniqueId); if (item.UniqueId.Equals("SetUsername")) { Random random = new Random(); string[] names = { "Blue Jay", "Chinchilla", "Chipmunk", "Gerbil", "Hamster", "Parrot", "Robin", "Squirrel", "Turtle" }; string name = names[random.Next(0, names.Length)]; Crittercism.SetUsername("Critter " + name); } else if (item.UniqueId.Equals("LeaveBreadcrumb")) { Random random = new Random(); string[] names = { "Breadcrumb", "Strawberry", "Seed", "Grape", "Lettuce" }; string name = names[random.Next(0, names.Length)]; Crittercism.LeaveBreadcrumb(name); } else if (item.UniqueId.Equals("LogHandledException")) { { try { ThrowException(); } catch (Exception ex) { Crittercism.LogHandledException(ex); } } } else if (item.UniqueId.Equals("LogUnhandledException")) { ThrowException(); } }
protected override void OnLoad(EventArgs e) { Crittercism.LeaveBreadcrumb("OnLoad"); }
public override void LogEvent(string eventName, Hashtable parameters) { Crittercism.LeaveBreadcrumb(eventName + Core.Utils.JSON.JsonEncode(parameters)); }
public override void LogErrorEvent(string eventName, string errorDescription) { Crittercism.LeaveBreadcrumb(eventName + " " + errorDescription); }
private void nextButtonClicked(object sender, RoutedEventArgs e) { Crittercism.LeaveBreadcrumb("Navigating forward to CrashSim from Crashes"); NavigationService.Navigate(new Uri("/CrashSim.xaml", UriKind.Relative)); }
partial void HelloWorldButton_TouchUpInside(UIButton sender) { Crittercism.LeaveBreadcrumb("Hello world"); }
public EatResponse OnEvent(EventId id, object cookie) { switch (id) { case EventId.ScreenClosing: if (cookie != null && cookie is ScreenBase) { string str = (cookie as ScreenBase).GetType().Name; Crittercism.LeaveBreadcrumb("Screen closed: " + str); } return(EatResponse.NotEaten); case EventId.ScreenClosed: IL_1C: switch (id) { case EventId.PlayerFactionChanged: case EventId.PlayerIdSet: case EventId.PlayerLoginSuccess: goto IL_6D; case EventId.PvpRatingChanged: case EventId.PvpNewBattleOccured: IL_3C: if (id == EventId.MetaDataLoadEnd) { goto IL_6D; } if (id == EventId.GameStateChanged) { string name = Service.GameStateMachine.CurrentState.GetType().Name; Crittercism.LeaveBreadcrumb("Game state changed to: " + name); return(EatResponse.NotEaten); } if (id != EventId.TargetedBundleContentPrepared && id != EventId.SquadUpdated) { return(EatResponse.NotEaten); } goto IL_6D; } goto IL_3C; IL_6D: this.RefreshData(Service.CurrentPlayer); return(EatResponse.NotEaten); case EventId.ScreenOverlayClosing: if (cookie != null) { string str = (string)cookie; Crittercism.LeaveBreadcrumb("Screen overlay closed: " + str); } return(EatResponse.NotEaten); case EventId.ScreenLoaded: if (cookie != null && cookie is ScreenBase) { string str = (cookie as ScreenBase).GetType().Name; Crittercism.LeaveBreadcrumb("Screen opened: " + str); } return(EatResponse.NotEaten); } goto IL_1C; }
private IEnumerator loadTargetScene(string sceneName, IEnumerable <string> additiveScenes, LoadSceneMode mainSceneLoadingMode, bool allowActivation) { int targetFrameRate = -1; float fixedDeltaTime = 0f; if (sceneDefinitions.TryGetValue(sceneName, out var mainSceneDefinition)) { targetFrameRate = mainSceneDefinition.TargetFrameRate; fixedDeltaTime = mainSceneDefinition.FixedDeltaTime; } if (targetFrameRate == -1) { targetFrameRate = 30; } if (Mathf.Approximately(0f, fixedDeltaTime)) { fixedDeltaTime = 0.0333333f; } Application.targetFrameRate = targetFrameRate; Time.fixedDeltaTime = fixedDeltaTime; Queue <string> loadableScenes = new Queue <string>(); List <SceneLoadingRequest> assetRequests = new List <SceneLoadingRequest>(); AssetRequest <Object> mainSceneAssetRequest = null; sceneAssetKeys = new List <string>(); if (false) { foreach (string additiveScene2 in additiveScenes) { loadableScenes.Enqueue(additiveScene2); } } else { if (Content.ContainsKey(sceneName)) { mainSceneAssetRequest = Content.LoadAsync <Object>(sceneName); } foreach (string additiveScene3 in additiveScenes) { if (Content.ContainsKey(additiveScene3)) { assetRequests.Add(new SceneLoadingRequest(additiveScene3, Content.LoadAsync <Object>(additiveScene3))); } else { loadableScenes.Enqueue(additiveScene3); } } } if (mainSceneAssetRequest != null) { while (!mainSceneAssetRequest.Finished) { yield return(null); } } loadAvailableScene(sceneName, allowActivation, mainSceneLoadingMode); while (assetRequests.Count > 0 || loadableScenes.Count > 0) { while (loadableScenes.Count > 0) { string additiveScene = loadableScenes.Dequeue(); if (sceneDefinitions.TryGetValue(additiveScene, out var sceneDefinition) && !(sceneDefinition == null)) { yield return(loadPrerequisiteContent(sceneDefinition)); } loadAvailableScene(additiveScene, allowActivation, LoadSceneMode.Additive); } int i; for (i = 0; i < assetRequests.Count && !assetRequests[i].Request.Finished; i++) { } if (i < assetRequests.Count) { loadableScenes.Enqueue(assetRequests[i].SceneName); assetRequests.RemoveAt(i); } else { yield return(null); } } while (asyncLoadingScenes.Count > 0) { yield return(asyncLoadingScenes.First.Value.Operation); Crittercism.LeaveBreadcrumb($"Finished loading scene '{asyncLoadingScenes.First.Value.Name}'"); asyncLoadingScenes.RemoveFirst(); } overrideSceneActivation = false; }
// Code to execute when the application is launching (eg, from Start) // This code will not execute when the application is reactivated private void Application_Launching(object sender, LaunchingEventArgs e) { //// Call the Init of the unhandled managed class library "Crittercism" Crittercism.Init("537a4e738039805d82000002"); Crittercism.LeaveBreadcrumb("Start the application"); }
private IEnumerator waitForBundleToLoad <TAsset>(AssetBundleWwwWrapper bundleRequestWrapper, uint crc, AssetLoadedHandler <TAsset> handler) where TAsset : class { CPipeManifestResponse cpipeManifestResponse = new CPipeManifestResponse(); yield return(cpipeManifestService.LookupAssetUrl(cpipeManifestResponse, bundleRequestWrapper.BundlePath)); if (string.IsNullOrEmpty(cpipeManifestResponse.FullAssetUrl)) { throw new Exception($"Bundle \"{bundleRequestWrapper.BundlePath}\" NOT FOUND in CPipe manifest."); } while (!Caching.ready) { yield return(null); } bundleRequestWrapper.LoadFromCacheOrDownload(cpipeManifestResponse.FullAssetUrl, crc); Service.Get <LoadingController>().RegisterDownload(bundleRequestWrapper.WebRequest); yield return(bundleRequestWrapper.Send()); Service.Get <LoadingController>().UnRegisterDownload(bundleRequestWrapper.WebRequest); if (DelayLoading) { yield return(null); yield return(null); } for (int i = 0; i < 3; i++) { if (bundleRequestWrapper.WebRequest.isNetworkError) { Log.LogErrorFormatted(this, "Retry count {0}. Failed to download bundle {1} with error: {2}", i + 1, bundleRequestWrapper.BundlePath, bundleRequestWrapper.WebRequest.error); } else { if (!(bundleRequestWrapper.AssetBundle == null)) { break; } Log.LogErrorFormatted(this, "Retry count {0}. Downloaded bundle was null", i + 1); } bundleRequestWrapper.LoadFromCacheOrDownload(cpipeManifestResponse.FullAssetUrl, crc); string message = $"Retry bundle load with expected CRC {crc}: {bundleRequestWrapper.BundlePath}"; Crittercism.LeaveBreadcrumb(message); Service.Get <LoadingController>().RegisterDownload(bundleRequestWrapper.WebRequest); yield return(bundleRequestWrapper.Send()); Service.Get <LoadingController>().UnRegisterDownload(bundleRequestWrapper.WebRequest); } if (bundleRequestWrapper.AssetBundle != null) { string breadcrumb = $"Loaded bundle with expected CRC {crc}: {bundleRequestWrapper.BundlePath}"; Crittercism.LeaveBreadcrumb(breadcrumb); } else { string breadcrumb = $"Failed to load bundle with expected CRC {crc}: {bundleRequestWrapper.BundlePath}"; Crittercism.LeaveBreadcrumb(breadcrumb); } if (handler != null) { TAsset asset = null; if (bundleRequestWrapper.AssetBundle != null) { asset = (TAsset)(object)bundleRequestWrapper.AssetBundle; } handler(bundleRequestWrapper.BundlePath, asset); } bundleRequestWrapper.IsComplete = true; bundleRequestWrapper.CacheAndDispose(); }
private void model_OutfitSet(IEnumerable <AvatarModel.ApplyResult> obj) { Crittercism.LeaveBreadcrumb(base.gameObject.name + " set an outfit"); }
private void nextButtonClicked(object sender, RoutedEventArgs e) { Crittercism.LeaveBreadcrumb("Navigating from MainPage to Customers"); NavigationService.Navigate(new Uri("/Customers.xaml", UriKind.Relative)); }
partial void GoodbyeWorldButton_TouchUpInside(UIButton sender) { Crittercism.LeaveBreadcrumb("Goodbye world"); }
private void backButtonClicked(object sender, RoutedEventArgs e) { Crittercism.LeaveBreadcrumb("Navigating back to customers from Crashes"); NavigationService.Navigate(new Uri("/Customers.xaml", UriKind.Relative)); }