mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +01:00
feat: add log upload command
This commit is contained in:
parent
50b9c029d0
commit
c8d4d063bb
1 changed files with 27 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
@ -464,6 +465,13 @@ namespace Dalamud {
|
||||||
ShowInHelp = false // Not quite ready yet
|
ShowInHelp = false // Not quite ready yet
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.CommandManager.AddHandler("/xlbugreport", new CommandInfo(OnBugReportCommand)
|
||||||
|
{
|
||||||
|
HelpMessage = Loc.Localize("DalamudBugReport", "Upload a log to be analyzed by our professional development team."),
|
||||||
|
ShowInHelp = false // Not quite ready yet
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
this.CommandManager.AddHandler("/imdebug", new CommandInfo(OnDebugImInfoCommand)
|
this.CommandManager.AddHandler("/imdebug", new CommandInfo(OnDebugImInfoCommand)
|
||||||
{
|
{
|
||||||
HelpMessage = "ImGui DEBUG",
|
HelpMessage = "ImGui DEBUG",
|
||||||
|
|
@ -708,6 +716,25 @@ namespace Dalamud {
|
||||||
this.isImguiDrawSettingsWindow = true;
|
this.isImguiDrawSettingsWindow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnBugReportCommand(string command, string arguments) {
|
||||||
|
Task.Run(() => {
|
||||||
|
try {
|
||||||
|
using var file = new FileStream(Path.Combine(this.StartInfo.WorkingDirectory, "dalamud.txt"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||||
|
using var reader = new StreamReader(file, Encoding.UTF8);
|
||||||
|
|
||||||
|
using var client = new WebClient();
|
||||||
|
var response = client.UploadString("https://dalamud-bugbait.herokuapp.com/catch", reader.ReadToEnd());
|
||||||
|
|
||||||
|
this.Framework.Gui.Chat.PrintError(
|
||||||
|
"Your bug report was submitted. A certified technical support specialist will be with you shortly. Please tell them this number: " +
|
||||||
|
response);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Log.Error(ex, "Bug report failed.");
|
||||||
|
this.Framework.Gui.Chat.PrintError("Could not submit bug report");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private int RouletteSlugToKey(string slug) => slug.ToLower() switch {
|
private int RouletteSlugToKey(string slug) => slug.ToLower() switch {
|
||||||
"leveling" => 1,
|
"leveling" => 1,
|
||||||
"506070" => 2,
|
"506070" => 2,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue