Skip to content

Commit

Permalink
Modernize CrashReport
Browse files Browse the repository at this point in the history
  • Loading branch information
Jklawreszuk committed May 22, 2024
1 parent e6441c0 commit 693352b
Show file tree
Hide file tree
Showing 28 changed files with 396 additions and 688 deletions.
4 changes: 2 additions & 2 deletions build/Stride.Launcher.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28803.352
Expand Down Expand Up @@ -111,4 +111,4 @@ Global
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {04241BED-1662-4690-BA56-15C99A840CFE}
EndGlobalSection
EndGlobal
EndGlobal
2 changes: 1 addition & 1 deletion build/Stride.sln
Original file line number Diff line number Diff line change
Expand Up @@ -1636,4 +1636,4 @@ Global
..\sources\engine\Stride.Shared\Refactor\Stride.Refactor.projitems*{fb06c76a-6bb7-40be-9afa-fec13b045fb5}*SharedItemsImports = 5
..\sources\assets\Stride.Core.Assets.Yaml\Stride.Core.Assets.Yaml.projitems*{fb9ed2c4-94a0-4004-a498-3f29a9d5bb5d}*SharedItemsImports = 13
EndGlobalSection
EndGlobal
EndGlobal
267 changes: 134 additions & 133 deletions sources/Directory.Packages.props

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions sources/core/Stride.Core.Design/Windows/AppHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Text;
using Stride.Core.Annotations;
using Stride.Core.Extensions;
using System.Runtime.InteropServices;

namespace Stride.Core.Windows
{
Expand All @@ -29,7 +30,7 @@ public static string BuildErrorMessage([NotNull] Exception exception, string hea
}
body.AppendLine($"Current Directory: {Environment.CurrentDirectory}");
body.AppendLine($"Command Line Args: {string.Join(" ", GetCommandLineArgs())}");
body.AppendLine($"OS Version: {Environment.OSVersion} ({(Environment.Is64BitOperatingSystem ? "x64" : "x86")})");
body.AppendLine($"OS Version: {RuntimeInformation.OSDescription} ({(Environment.Is64BitOperatingSystem ? "x64" : "x86")})");
body.AppendLine($"Processor Count: {Environment.ProcessorCount}");
body.AppendLine("Video configuration:");
WriteVideoConfig(body);
Expand Down Expand Up @@ -83,7 +84,14 @@ public static void WriteVideoConfig(StringBuilder writer)
public static Dictionary<string, string> GetVideoConfig()
{
var result = new Dictionary<string, string>();
if(OperatingSystem.IsWindows())
GetVideoConfigWindows(result);

return result;
}

private static void GetVideoConfigWindows(Dictionary<string, string> result)
{
try
{
var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_VideoController");
Expand All @@ -103,8 +111,6 @@ public static Dictionary<string, string> GetVideoConfig()
{
// ignored
}

return result;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ static EditorSettings()
DisplayName = $"{Interface}/{Tr._p("Settings", "Ask before saving new scripts")}",
Description = Tr._p("Settings", "Ask before saving new scripts"),
};
StoreCrashEmail = new SettingsKey<string>("Interface/StoreCrashEmail", SettingsContainer, "")
{
DisplayName = $"{Interface}/{Tr._p("Settings", "Crash report e-mail")}",
Description = Tr._p("Settings", "Crash report e-mail"),
};
Language = new SettingsKey<SupportedLanguage>("Interface/Language", SettingsContainer, SupportedLanguage.MachineDefault)
{
DisplayName = $"{Interface}/{Tr._p("Settings", "Language")}",
Expand Down Expand Up @@ -107,8 +102,6 @@ static EditorSettings()

public static SettingsKey<bool> AskBeforeSavingNewScripts { get; }

public static SettingsKey<string> StoreCrashEmail { get; }

public static SettingsKey<SupportedLanguage> Language { get; }

public static SettingsCommand ResetEditorLayout { get; }
Expand Down
74 changes: 37 additions & 37 deletions sources/editor/Stride.Editor.CrashReport/CrashReportData.cs
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
using System;
// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.

using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;

namespace Stride.Editor.CrashReport;

namespace Stride.Editor.CrashReport
public class CrashReportData
{
public class CrashReportData
{
public List<Tuple<string, string>> Data = new List<Tuple<string, string>>();
public List<(string, string)> Data = [];

public string this[string key]
public string this[string key]
{
get
{
get
{
return Data.Where(p => p.Item1 == key).FirstOrDefault();
}
set
{
int num = -1;
return Data.FirstOrDefault(p => p.Item1 == key).Item2;
}
set
{
int num = -1;

foreach(var current in Data)
{
if (current.Item1 == key)
{
num = Data.IndexOf(current);
break;
}
}
if (num != -1)
{
Data[num] = Tuple.Create<string, string>(key, value);
}
else
foreach(var current in Data)
{
if (current.Item1 == key)
{
Data.Add(Tuple.Create<string, string>(key, value));
num = Data.IndexOf(current);
break;
}
}
if(value == null)
return;
if (num != -1)
{
Data[num] = (key, value);
}
else
{
Data.Add((key, value));
}
}
}

public override string ToString()
public override string ToString()
{
StringBuilder val = new();
foreach (var current in Data)
{
StringBuilder val = new StringBuilder();
foreach (var current in Data)
{
val.Append(String.Concat(current.Item1, ": ", current.Item2, "\r\n"));
}
return val.ToString();
val.Append(string.Concat(current.Item1, ": ", current.Item2, "\r\n"));
}
return val.ToString();
}
}
Loading

0 comments on commit 693352b

Please sign in to comment.