From a1749098f442a17906b7e1978b0fce833045d64b Mon Sep 17 00:00:00 2001 From: ReinforceZwei <39955851+ReinforceZwei@users.noreply.github.com> Date: Sun, 9 Apr 2023 14:27:03 +0800 Subject: [PATCH] Add Sentry integration --- MinecraftClient/MinecraftClient.csproj | 1 + MinecraftClient/Program.cs | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/MinecraftClient/MinecraftClient.csproj b/MinecraftClient/MinecraftClient.csproj index b0faada9..f57dfa5f 100644 --- a/MinecraftClient/MinecraftClient.csproj +++ b/MinecraftClient/MinecraftClient.csproj @@ -39,6 +39,7 @@ + NU1701 diff --git a/MinecraftClient/Program.cs b/MinecraftClient/Program.cs index 06265949..1ff135d8 100644 --- a/MinecraftClient/Program.cs +++ b/MinecraftClient/Program.cs @@ -17,6 +17,7 @@ using MinecraftClient.Protocol.Session; using MinecraftClient.Scripting; using MinecraftClient.WinAPI; using Tomlet; +using Sentry; using static MinecraftClient.Settings; using static MinecraftClient.Settings.ConsoleConfigHealper.ConsoleConfig; using static MinecraftClient.Settings.MainConfigHealper.MainConfig.AdvancedConfig; @@ -287,6 +288,23 @@ namespace MinecraftClient } } + // Sentry integration + if (BuildInfo != null) + { + if (Config.Logging.DebugMessages) // TODO: Add setting to let user disable telemetry + { + ConsoleIO.WriteLine("Telemetry is enabled. Crash report will be sent to Sentry"); + using (SentrySdk.Init(o => + { + // Maybe don't hardcode the url? Add it during building? + o.Dsn = "https://41fdd209ee704cda8f0e8deb37ce48da@o4504977948672000.ingest.sentry.io/4504977964335104"; + o.Release = BuildInfo ?? "Development Build"; + o.TracesSampleRate = 1.0; + o.IsGlobalModeEnabled = true; + })) { } + } + } + if (OperatingSystem.IsWindows() && !string.IsNullOrWhiteSpace(Config.Main.Advanced.ConsoleTitle)) { InternalConfig.Username = "New Window";