This repository has been archived by the owner on May 10, 2019. It is now read-only.
forked from Hartie95/NTRClient
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a BugReporter | Not yet finished
- Loading branch information
Showing
9 changed files
with
181 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using ntrclient.Prog.CS; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
|
||
namespace ntrclient.Extra | ||
{ | ||
public class BugReporter | ||
{ | ||
private Exception e; | ||
private String additionalInformation; | ||
private String NtrVersion; | ||
private bool showMessagebox; | ||
|
||
|
||
public BugReporter(Exception e, String additionalInformation, bool showMessagebox = true) | ||
{ | ||
this.e = e; | ||
this.additionalInformation = additionalInformation; | ||
NtrVersion = @"**todo**"; | ||
this.showMessagebox = showMessagebox; | ||
|
||
saveLog(); | ||
} | ||
|
||
private void saveLog() | ||
{ | ||
String log = @"--- NTR Debugger Bug report ---" + Environment.NewLine + | ||
@"Please upload this bugreport to pastebin or similar and send it to imthe666st" + Environment.NewLine + Environment.NewLine + | ||
@"------------------------------" + Environment.NewLine + Environment.NewLine; | ||
|
||
log += @"Additional Information: " + additionalInformation + Environment.NewLine; | ||
log += @"Version of NTR: " + NtrVersion + Environment.NewLine + Environment.NewLine; | ||
log += @"------------------------------" + Environment.NewLine + Environment.NewLine; | ||
log += @"Exception stacktrace: " + Environment.NewLine + e.ToString(); | ||
log += @"------------------------------" + Environment.NewLine + Environment.NewLine; | ||
log += Program.GCmdWindow.GetLog() + Environment.NewLine + Environment.NewLine; | ||
log += @"------------------------------" + Environment.NewLine + Environment.NewLine; | ||
log += @"System information: [PROCESSES]" + Environment.NewLine; | ||
foreach (NtrProcess process in Program.GCmdWindow.Processes) | ||
{ | ||
log += string.Format("{0} | {1:X} : {2} [{3:X}]", Program.GCmdWindow.FillString(Program.GCmdWindow.CheckSystem(process.Name), 6), process.Pid, process.Name, process.Tid) + Environment.NewLine; | ||
} | ||
log += Environment.NewLine + @"------------------------------" + Environment.NewLine + Environment.NewLine; | ||
log += @"Current process: " + Program.GCmdWindow.comboBox_processes.Text + Environment.NewLine + Environment.NewLine; | ||
log += @"------------------------------" + Environment.NewLine + Environment.NewLine; | ||
|
||
log += @"This is the end of the bugreport. ^_^"; | ||
|
||
Directory.CreateDirectory("bugreports"); | ||
String name = @"bugreports/bugreport-" + GetTimestamp(DateTime.Now) + @".txt"; | ||
File.WriteAllText(name, log); | ||
|
||
if (showMessagebox) | ||
MessageBox.Show(@"Saved bugreport to " + name); | ||
} | ||
|
||
|
||
public static String GetTimestamp(DateTime value) | ||
{ | ||
return value.ToString("yyyyMMddHHmmssffff"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.