Update Sentry logging

This commit is contained in:
Kamil Trzciński 2022-12-12 20:03:15 +01:00
parent 4131d972ed
commit a339037e01
3 changed files with 21 additions and 5 deletions

View file

@ -2,6 +2,7 @@ using System.Security.Principal;
using System.Security.AccessControl;
using Microsoft.Win32;
using System.Diagnostics;
using System.Reflection;
namespace CommonHelpers
{
@ -171,13 +172,18 @@ namespace CommonHelpers
}
}
public static String ApplicationName
{
get { return Assembly.GetEntryAssembly()?.GetName().Name ?? "unknown"; }
}
public static String MachineID
{
get
{
try
{
using (var registryKey = Registry.CurrentUser.OpenSubKey(@"Software\SteamDeckTools", true))
using (var registryKey = Registry.CurrentUser.CreateSubKey(@"Software\SteamDeckTools", true))
{
var machineID = registryKey?.GetValue("MachineID") as string;
if (machineID is null)
@ -221,6 +227,11 @@ namespace CommonHelpers
updateTimer.Start();
}
Sentry.SentrySdk.CaptureMessage("Updater: " + ApplicationName, scope =>
{
scope.SetTag("type", user ? "user" : "background");
});
try
{
Process.Start(new ProcessStartInfo()