mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-12 11:04:38 +01:00
refactor: new code style in Troubleshooting.cs
This commit is contained in:
parent
876993e620
commit
6085952f26
1 changed files with 39 additions and 17 deletions
|
|
@ -1,30 +1,32 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Dalamud.Configuration;
|
||||
using Dalamud.Plugin;
|
||||
using Newtonsoft.Json;
|
||||
using Serilog;
|
||||
|
||||
using Encoding = System.Text.Encoding;
|
||||
|
||||
namespace Dalamud
|
||||
{
|
||||
/// <summary>
|
||||
/// Class responsible for printing troubleshooting information to the log.
|
||||
/// </summary>
|
||||
internal static class Troubleshooting
|
||||
{
|
||||
private class TroubleshootingPayload {
|
||||
public PluginDefinition[] LoadedPlugins { get; set; }
|
||||
public string DalamudVersion { get; set; }
|
||||
public string GameVersion { get; set; }
|
||||
public string Language { get; set; }
|
||||
public bool DoDalamudTest { get; set; }
|
||||
public bool DoPluginTest { get; set; }
|
||||
public bool InterfaceLoaded { get; set; }
|
||||
public List<ThirdRepoSetting> ThirdRepo { get; set; }
|
||||
}
|
||||
|
||||
public static void LogTroubleshooting(Dalamud dalamud, bool isInterfaceLoaded) {
|
||||
try {
|
||||
var payload = new TroubleshootingPayload {
|
||||
/// <summary>
|
||||
/// Log troubleshooting information to Serilog.
|
||||
/// </summary>
|
||||
/// <param name="dalamud">The <see cref="Dalamud"/> instance to read information from.</param>
|
||||
/// <param name="isInterfaceLoaded">Whether or not the interface was loaded.</param>
|
||||
public static void LogTroubleshooting(Dalamud dalamud, bool isInterfaceLoaded)
|
||||
{
|
||||
try
|
||||
{
|
||||
var payload = new TroubleshootingPayload
|
||||
{
|
||||
LoadedPlugins = dalamud.PluginManager.Plugins.Select(x => x.Definition).ToArray(),
|
||||
DalamudVersion = Util.AssemblyVersion,
|
||||
GameVersion = dalamud.StartInfo.GameVersion,
|
||||
|
|
@ -32,16 +34,36 @@ namespace Dalamud
|
|||
DoDalamudTest = dalamud.Configuration.DoDalamudTest,
|
||||
DoPluginTest = dalamud.Configuration.DoPluginTest,
|
||||
InterfaceLoaded = isInterfaceLoaded,
|
||||
ThirdRepo = dalamud.Configuration.ThirdRepoList
|
||||
ThirdRepo = dalamud.Configuration.ThirdRepoList,
|
||||
};
|
||||
|
||||
|
||||
Log.Information("TROUBLESHOOTING:" +
|
||||
System.Convert.ToBase64String(
|
||||
Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(payload))));
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, "Could not print troubleshooting.");
|
||||
}
|
||||
}
|
||||
|
||||
private class TroubleshootingPayload
|
||||
{
|
||||
public PluginDefinition[] LoadedPlugins { get; set; }
|
||||
|
||||
public string DalamudVersion { get; set; }
|
||||
|
||||
public string GameVersion { get; set; }
|
||||
|
||||
public string Language { get; set; }
|
||||
|
||||
public bool DoDalamudTest { get; set; }
|
||||
|
||||
public bool DoPluginTest { get; set; }
|
||||
|
||||
public bool InterfaceLoaded { get; set; }
|
||||
|
||||
public List<ThirdRepoSetting> ThirdRepo { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue