2014-12-03 23:15:26 +00:00
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
|
|
using System;
|
2013-08-29 10:05:50 +00:00
|
|
|
|
using System.IO;
|
2015-09-17 12:02:39 +00:00
|
|
|
|
using System.Management;
|
2013-08-29 10:05:50 +00:00
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
2013-08-29 10:05:50 +00:00
|
|
|
|
namespace CodeImp.DoomBuilder.GZBuilder.Windows
|
|
|
|
|
{
|
|
|
|
|
public partial class ExceptionDialog : Form
|
|
|
|
|
{
|
2014-10-22 13:07:17 +00:00
|
|
|
|
private readonly bool cannotContinue;
|
|
|
|
|
private readonly string logPath;
|
2013-08-29 10:05:50 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public ExceptionDialog(UnhandledExceptionEventArgs e)
|
|
|
|
|
{
|
2013-08-29 10:05:50 +00:00
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
logPath = Path.Combine(General.SettingsPath, @"GZCrash.txt");
|
|
|
|
|
Exception ex = (Exception)e.ExceptionObject;
|
2013-09-09 14:03:02 +00:00
|
|
|
|
errorDescription.Text = "Error in " + ex.Source + ":";
|
2016-02-01 22:04:00 +00:00
|
|
|
|
string sysinfo = GetSystemInfo();
|
2014-12-03 23:15:26 +00:00
|
|
|
|
using(StreamWriter sw = File.CreateText(logPath))
|
|
|
|
|
{
|
2016-02-01 22:04:00 +00:00
|
|
|
|
sw.Write(sysinfo + GetExceptionDescription(ex));
|
2013-08-29 10:05:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-09 14:03:02 +00:00
|
|
|
|
errorMessage.Text = ex.Message + Environment.NewLine + ex.StackTrace;
|
2013-08-29 10:05:50 +00:00
|
|
|
|
cannotContinue = true; //cannot recover from this...
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public ExceptionDialog(ThreadExceptionEventArgs e)
|
|
|
|
|
{
|
2013-08-29 10:05:50 +00:00
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
logPath = Path.Combine(General.SettingsPath, @"GZCrash.txt");
|
2013-09-09 14:03:02 +00:00
|
|
|
|
errorDescription.Text = "Error in " + e.Exception.Source + ":";
|
2015-09-17 12:02:39 +00:00
|
|
|
|
string sysinfo = GetSystemInfo();
|
2014-12-03 23:15:26 +00:00
|
|
|
|
using(StreamWriter sw = File.CreateText(logPath))
|
|
|
|
|
{
|
2015-09-17 12:02:39 +00:00
|
|
|
|
sw.Write(sysinfo + GetExceptionDescription(e.Exception));
|
2013-08-29 10:05:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-09-17 12:02:39 +00:00
|
|
|
|
errorMessage.Text = sysinfo + "********EXCEPTION DETAILS********" + Environment.NewLine
|
|
|
|
|
+ e.Exception.Message + Environment.NewLine + e.Exception.StackTrace;
|
2013-08-29 10:05:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public void Setup()
|
|
|
|
|
{
|
2013-08-29 10:05:50 +00:00
|
|
|
|
bContinue.Enabled = !cannotContinue;
|
2013-08-30 15:00:44 +00:00
|
|
|
|
|
|
|
|
|
string[] titles = {
|
2013-09-11 09:47:53 +00:00
|
|
|
|
"0x000000 at 0xFFFFFF. That's probaby bad",
|
|
|
|
|
"Here we go again...",
|
|
|
|
|
"Uh oh, you're screwed",
|
|
|
|
|
"All is lost!",
|
|
|
|
|
"Achievement unlocked: CRASH TIME!",
|
|
|
|
|
"OH NOES! TEH ERROR!",
|
|
|
|
|
"0001000001111011000000000011001101011110110111",
|
|
|
|
|
"Nuclear launch detected!",
|
|
|
|
|
"Don't send this to Microsoft",
|
|
|
|
|
"You. Shall. Not. Pass!!!",
|
|
|
|
|
"Yep, we have bugs",
|
|
|
|
|
"It's dangerous to go alone. Take this!",
|
|
|
|
|
"The operation completed successfully",
|
|
|
|
|
"Security Alert – Moving cursor is not as safe as you thought",
|
|
|
|
|
"Random error appears from north",
|
|
|
|
|
"ERROR: NO_ERROR",
|
|
|
|
|
"Epic fail",
|
|
|
|
|
"At least it's not BSoD...",
|
|
|
|
|
"User Error. Please Replace User",
|
|
|
|
|
"Brought to you by MaxED!",
|
|
|
|
|
"GZDoom Builder proudly presents:",
|
|
|
|
|
"You aren't expected to understand this",
|
|
|
|
|
"Back to the drawing board...",
|
|
|
|
|
"I'm sorry... :(",
|
|
|
|
|
"This is a horrbble day for you, and of course, the world",
|
|
|
|
|
"Abort, Retry, Fail?",
|
2015-01-03 18:43:37 +00:00
|
|
|
|
"You are making progress. I'm afraid that's something I can't allow to happen",
|
2013-09-11 09:47:53 +00:00
|
|
|
|
"You are making progress. That's not OK",
|
2013-08-30 15:00:44 +00:00
|
|
|
|
"No errors found, restarting computer",
|
2013-09-11 09:47:53 +00:00
|
|
|
|
"Does Not Compute!",
|
|
|
|
|
"I’m sorry, Dave, I’m afraid I can’t do that",
|
|
|
|
|
"What's that? Chicken?",
|
|
|
|
|
"It can only be attributable to human error",
|
|
|
|
|
"It's now safe to turn off your computer",
|
|
|
|
|
"I've got a bad feeling about this",
|
|
|
|
|
"YOU CAN’T DO THAT!",
|
|
|
|
|
"Man the Lifeboats! Women and children first!",
|
|
|
|
|
"IMPOSSIBURU!!!",
|
|
|
|
|
"Now deleting all files. Goodbye",
|
|
|
|
|
"General Failure",
|
|
|
|
|
"Invalid Error",
|
|
|
|
|
"Beam me up Scotty, there’s no life out here",
|
|
|
|
|
"Well, you ran into something and the game is over",
|
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
|
|
|
|
"I'm good at writing bad code",
|
2013-09-11 09:47:53 +00:00
|
|
|
|
"$FUNNY_ERROR_CAPTION",
|
2013-09-13 14:54:43 +00:00
|
|
|
|
"In Soviet Russia, exception throws YOU!",
|
|
|
|
|
"...and then GZDB was the demons!",
|
|
|
|
|
"B U S T E D",
|
2014-08-08 11:00:49 +00:00
|
|
|
|
"Freeze mode enabled",
|
2013-09-13 14:54:43 +00:00
|
|
|
|
"You feel strange...",
|
|
|
|
|
"That doesn't seem to work",
|
|
|
|
|
"This function is only available in the retail version of GZDoom Builder",
|
|
|
|
|
"You picked up the Random Exception.",
|
|
|
|
|
"Pinky says that you're the new hope. Bear that in mind.",
|
2014-08-08 11:00:49 +00:00
|
|
|
|
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
|
|
|
|
|
"Deal with it",
|
|
|
|
|
"Error 47",
|
|
|
|
|
"YOU DIED",
|
2014-08-25 11:15:19 +00:00
|
|
|
|
"Thanks, Obama",
|
2014-09-02 18:52:26 +00:00
|
|
|
|
"The God Of Exceptions Demands MORE Exceptions!",
|
2014-09-02 20:44:58 +00:00
|
|
|
|
"Good. It's boring here anyway.",
|
2014-10-28 14:35:59 +00:00
|
|
|
|
"Shameful display!",
|
|
|
|
|
"It's CRASHENING!",
|
2015-01-03 18:43:37 +00:00
|
|
|
|
"W-W-W-WIPEOUT!",
|
|
|
|
|
"EVERYTHING IS LOST!",
|
2015-09-17 12:02:39 +00:00
|
|
|
|
"Your empty is full!",
|
|
|
|
|
"Let's see how far this infinite loop goes...",
|
2013-09-11 09:47:53 +00:00
|
|
|
|
};
|
2013-08-30 15:00:44 +00:00
|
|
|
|
this.Text = titles[new Random().Next(0, titles.Length - 1)];
|
2013-08-29 10:05:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-09-17 12:02:39 +00:00
|
|
|
|
private static string GetSystemInfo()
|
|
|
|
|
{
|
|
|
|
|
string result = "***********SYSTEM INFO***********" + Environment.NewLine;
|
|
|
|
|
|
|
|
|
|
// Get OS name
|
|
|
|
|
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT Caption FROM Win32_OperatingSystem");
|
|
|
|
|
foreach(ManagementObject mo in searcher.Get())
|
|
|
|
|
{
|
|
|
|
|
result += "OS: " + mo["Caption"] + Environment.NewLine;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get GPU name
|
|
|
|
|
searcher = new ManagementObjectSearcher("SELECT * FROM Win32_VideoController");
|
|
|
|
|
foreach(ManagementObject mo in searcher.Get())
|
|
|
|
|
{
|
|
|
|
|
PropertyData bpp = mo.Properties["CurrentBitsPerPixel"];
|
|
|
|
|
PropertyData description = mo.Properties["Description"];
|
|
|
|
|
if(bpp != null && description != null && bpp.Value != null)
|
|
|
|
|
{
|
|
|
|
|
result += "GPU: " + description.Value + Environment.NewLine;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get GZDB version
|
|
|
|
|
result += "GZDB: R" + General.ThisAssembly.GetName().Version.Revision + Environment.NewLine + Environment.NewLine;
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private static string GetExceptionDescription(Exception ex)
|
|
|
|
|
{
|
2016-01-27 14:08:15 +00:00
|
|
|
|
// Add to error logger
|
|
|
|
|
General.WriteLogLine("***********************************************************");
|
|
|
|
|
General.ErrorLogger.Add(ErrorType.Error, ex.Source + ": " + ex.Message);
|
|
|
|
|
General.WriteLogLine("***********************************************************");
|
2013-12-05 09:24:55 +00:00
|
|
|
|
|
2013-12-02 09:26:09 +00:00
|
|
|
|
string message = "********EXCEPTION DETAILS********"
|
|
|
|
|
+ Environment.NewLine + ex.Source + ": " + ex.Message + Environment.NewLine + ex.StackTrace;
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
if(File.Exists(General.LogFile))
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2013-12-02 09:26:09 +00:00
|
|
|
|
string[] lines = File.ReadAllLines(General.LogFile);
|
2014-09-12 12:19:58 +00:00
|
|
|
|
message += Environment.NewLine + Environment.NewLine + "***********ACTIONS LOG***********";
|
2014-12-03 23:15:26 +00:00
|
|
|
|
for(int i = lines.Length - 1; i > -1; i--)
|
2013-12-02 09:26:09 +00:00
|
|
|
|
message += Environment.NewLine + lines[i];
|
|
|
|
|
} catch(Exception) { }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return message;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void reportLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
|
|
|
{
|
2013-08-29 10:05:50 +00:00
|
|
|
|
if(!File.Exists(logPath)) return;
|
|
|
|
|
System.Diagnostics.Process.Start("explorer.exe", @"/select, " + logPath);
|
|
|
|
|
reportLink.LinkVisited = true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void threadLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2013-08-29 10:05:50 +00:00
|
|
|
|
System.Diagnostics.Process.Start("http://forum.zdoom.org/viewtopic.php?f=3&t=32392&start=9999999");
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
catch(Exception)
|
|
|
|
|
{
|
2013-08-29 10:05:50 +00:00
|
|
|
|
MessageBox.Show("Unable to open URL...");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
threadLink.LinkVisited = true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void bContinue_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2013-08-29 10:05:50 +00:00
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-25 13:20:53 +00:00
|
|
|
|
private void bQuit_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if(General.Map != null) General.Map.SaveMapBackup();
|
|
|
|
|
this.DialogResult = DialogResult.Cancel;
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void bToClipboard_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2013-08-29 10:05:50 +00:00
|
|
|
|
errorMessage.SelectAll();
|
|
|
|
|
errorMessage.Copy();
|
|
|
|
|
errorMessage.DeselectAll();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|