mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-27 06:02:11 +00:00
Replaced Unhandled exception dialog with custom one
This commit is contained in:
parent
4b9f2d886c
commit
6f23311167
9 changed files with 480 additions and 24 deletions
|
@ -777,6 +777,12 @@
|
|||
<Compile Include="GZBuilder\md3\ModelReader.cs" />
|
||||
<Compile Include="GZBuilder\GZDoom\AcsParserSE.cs" />
|
||||
<Compile Include="GZBuilder\Tools\UDMFTools.cs" />
|
||||
<Compile Include="GZBuilder\Windows\ExceptionDialog.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GZBuilder\Windows\ExceptionDialog.designer.cs">
|
||||
<DependentUpon>ExceptionDialog.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GZBuilder\Windows\TagStatisticsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -898,6 +904,9 @@
|
|||
<EmbeddedResource Include="GZBuilder\Controls\TagSelector.resx">
|
||||
<DependentUpon>TagSelector.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="GZBuilder\Windows\ExceptionDialog.resx">
|
||||
<DependentUpon>ExceptionDialog.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="GZBuilder\Windows\TagStatisticsForm.resx">
|
||||
<DependentUpon>TagStatisticsForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
@ -927,6 +936,7 @@
|
|||
<None Include="Resources\Marine.png" />
|
||||
<None Include="Resources\Link.png" />
|
||||
<EmbeddedResource Include="Resources\MissingThing.png" />
|
||||
<None Include="Resources\MCrash.png" />
|
||||
<Content Include="Resources\Model.png" />
|
||||
<Content Include="Resources\Model_selected.png" />
|
||||
<EmbeddedResource Include="Resources\UDMF_UI.cfg" />
|
||||
|
|
|
@ -101,7 +101,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
|
|||
|
||||
if (!ReadSignedFloat(token, ref scrollSpeed)) {
|
||||
// Not numeric!
|
||||
General.ErrorLogger.Add(ErrorType.Error, "Unexpected token found in '" + sourcename + "' at line " + GetCurrentLineNumber() + ": expected " + skyType + " scroll speed value, but got '" + token + "'");
|
||||
General.ErrorLogger.Add(ErrorType.Warning, "Unexpected token found in '" + sourcename + "' at line " + GetCurrentLineNumber() + ": expected " + skyType + " scroll speed value, but got '" + token + "'");
|
||||
datastream.Seek(-token.Length - 1, SeekOrigin.Current); //step back and try parsing this token again
|
||||
continue;
|
||||
}
|
||||
|
|
70
Source/Core/GZBuilder/Windows/ExceptionDialog.cs
Normal file
70
Source/Core/GZBuilder/Windows/ExceptionDialog.cs
Normal file
|
@ -0,0 +1,70 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
|
||||
namespace CodeImp.DoomBuilder.GZBuilder.Windows
|
||||
{
|
||||
public partial class ExceptionDialog : Form
|
||||
{
|
||||
private bool cannotContinue;
|
||||
private string logPath;
|
||||
|
||||
public ExceptionDialog(UnhandledExceptionEventArgs e) {
|
||||
InitializeComponent();
|
||||
|
||||
logPath = Path.Combine(General.SettingsPath, @"GZCrash.txt");
|
||||
Exception ex = (Exception)e.ExceptionObject;
|
||||
errorDescription.Text = "Error in " + ex.Source + ": " + ex.Message;
|
||||
using(StreamWriter sw = File.CreateText(logPath)) {
|
||||
sw.Write(ex.Source + ": " + ex.Message + Environment.NewLine + ex.StackTrace);
|
||||
}
|
||||
|
||||
errorMessage.Text = ex.StackTrace;
|
||||
cannotContinue = true; //cannot recover from this...
|
||||
}
|
||||
|
||||
public ExceptionDialog(ThreadExceptionEventArgs e) {
|
||||
InitializeComponent();
|
||||
|
||||
logPath = Path.Combine(General.SettingsPath, @"GZCrash.txt");
|
||||
errorDescription.Text = "Error in " + e.Exception.Source + ": " + e.Exception.Message;
|
||||
using(StreamWriter sw = File.CreateText(logPath)) {
|
||||
sw.Write(e.Exception.Source + ": " + e.Exception.Message + Environment.NewLine + e.Exception.StackTrace);
|
||||
}
|
||||
|
||||
errorMessage.Text = e.Exception.StackTrace;
|
||||
}
|
||||
|
||||
public void Setup() {
|
||||
bContinue.Enabled = !cannotContinue;
|
||||
}
|
||||
|
||||
private void reportLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
|
||||
if(!File.Exists(logPath)) return;
|
||||
System.Diagnostics.Process.Start("explorer.exe", @"/select, " + logPath);
|
||||
reportLink.LinkVisited = true;
|
||||
}
|
||||
|
||||
private void threadLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
|
||||
try {
|
||||
System.Diagnostics.Process.Start("http://forum.zdoom.org/viewtopic.php?f=3&t=32392&start=9999999");
|
||||
} catch(Exception) {
|
||||
MessageBox.Show("Unable to open URL...");
|
||||
}
|
||||
|
||||
threadLink.LinkVisited = true;
|
||||
}
|
||||
|
||||
private void bContinue_Click(object sender, EventArgs e) {
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void bToClipboard_Click(object sender, EventArgs e) {
|
||||
errorMessage.SelectAll();
|
||||
errorMessage.Copy();
|
||||
errorMessage.DeselectAll();
|
||||
}
|
||||
}
|
||||
}
|
192
Source/Core/GZBuilder/Windows/ExceptionDialog.designer.cs
generated
Normal file
192
Source/Core/GZBuilder/Windows/ExceptionDialog.designer.cs
generated
Normal file
|
@ -0,0 +1,192 @@
|
|||
namespace CodeImp.DoomBuilder.GZBuilder.Windows
|
||||
{
|
||||
partial class ExceptionDialog
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) {
|
||||
if(disposing && (components != null)) {
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
this.bQuit = new System.Windows.Forms.Button();
|
||||
this.bContinue = new System.Windows.Forms.Button();
|
||||
this.errorMessage = new System.Windows.Forms.TextBox();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.reportLink = new System.Windows.Forms.LinkLabel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.threadLink = new System.Windows.Forms.LinkLabel();
|
||||
this.bToClipboard = new System.Windows.Forms.Button();
|
||||
this.errorDescription = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// bQuit
|
||||
//
|
||||
this.bQuit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.bQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.bQuit.Location = new System.Drawing.Point(537, 195);
|
||||
this.bQuit.Name = "bQuit";
|
||||
this.bQuit.Size = new System.Drawing.Size(75, 23);
|
||||
this.bQuit.TabIndex = 0;
|
||||
this.bQuit.Text = "Quit";
|
||||
this.bQuit.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// bContinue
|
||||
//
|
||||
this.bContinue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.bContinue.Location = new System.Drawing.Point(456, 195);
|
||||
this.bContinue.Name = "bContinue";
|
||||
this.bContinue.Size = new System.Drawing.Size(75, 23);
|
||||
this.bContinue.TabIndex = 1;
|
||||
this.bContinue.Text = "Continue";
|
||||
this.bContinue.UseVisualStyleBackColor = true;
|
||||
this.bContinue.Click += new System.EventHandler(this.bContinue_Click);
|
||||
//
|
||||
// errorMessage
|
||||
//
|
||||
this.errorMessage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.errorMessage.Location = new System.Drawing.Point(77, 28);
|
||||
this.errorMessage.Multiline = true;
|
||||
this.errorMessage.Name = "errorMessage";
|
||||
this.errorMessage.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.errorMessage.Size = new System.Drawing.Size(535, 119);
|
||||
this.errorMessage.TabIndex = 3;
|
||||
this.errorMessage.Text = "Stack trace";
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.Image = global::CodeImp.DoomBuilder.Properties.Resources.MCrash;
|
||||
this.pictureBox1.Location = new System.Drawing.Point(7, 9);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(64, 64);
|
||||
this.pictureBox1.TabIndex = 2;
|
||||
this.pictureBox1.TabStop = false;
|
||||
//
|
||||
// reportLink
|
||||
//
|
||||
this.reportLink.AutoSize = true;
|
||||
this.reportLink.Location = new System.Drawing.Point(327, 157);
|
||||
this.reportLink.Name = "reportLink";
|
||||
this.reportLink.Size = new System.Drawing.Size(29, 14);
|
||||
this.reportLink.TabIndex = 5;
|
||||
this.reportLink.TabStop = true;
|
||||
this.reportLink.Text = "here";
|
||||
this.reportLink.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.reportLink_LinkClicked);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.label1.Location = new System.Drawing.Point(77, 157);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(256, 14);
|
||||
this.label1.TabIndex = 6;
|
||||
this.label1.Text = "Error report with additional information was created";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.label2.Location = new System.Drawing.Point(77, 178);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(340, 28);
|
||||
this.label2.TabIndex = 7;
|
||||
this.label2.Text = "You can help fixing this error if you provide the ways to reproduce it \r\nand the " +
|
||||
"error report at";
|
||||
//
|
||||
// threadLink
|
||||
//
|
||||
this.threadLink.AutoSize = true;
|
||||
this.threadLink.Location = new System.Drawing.Point(186, 192);
|
||||
this.threadLink.Name = "threadLink";
|
||||
this.threadLink.Size = new System.Drawing.Size(159, 14);
|
||||
this.threadLink.TabIndex = 8;
|
||||
this.threadLink.TabStop = true;
|
||||
this.threadLink.Text = "the official thread at ZDoom.org";
|
||||
this.threadLink.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.threadLink_LinkClicked);
|
||||
//
|
||||
// bToClipboard
|
||||
//
|
||||
this.bToClipboard.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.bToClipboard.Location = new System.Drawing.Point(512, 151);
|
||||
this.bToClipboard.Name = "bToClipboard";
|
||||
this.bToClipboard.Size = new System.Drawing.Size(100, 20);
|
||||
this.bToClipboard.TabIndex = 9;
|
||||
this.bToClipboard.Text = "Copy to clipboard";
|
||||
this.bToClipboard.UseVisualStyleBackColor = true;
|
||||
this.bToClipboard.Click += new System.EventHandler(this.bToClipboard_Click);
|
||||
//
|
||||
// errorDescription
|
||||
//
|
||||
this.errorDescription.AutoSize = true;
|
||||
this.errorDescription.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||
this.errorDescription.Location = new System.Drawing.Point(77, 9);
|
||||
this.errorDescription.Name = "errorDescription";
|
||||
this.errorDescription.Size = new System.Drawing.Size(172, 14);
|
||||
this.errorDescription.TabIndex = 10;
|
||||
this.errorDescription.Text = "An application error occurred:";
|
||||
//
|
||||
// ExceptionDialog
|
||||
//
|
||||
this.AcceptButton = this.bContinue;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.CancelButton = this.bQuit;
|
||||
this.ClientSize = new System.Drawing.Size(624, 224);
|
||||
this.Controls.Add(this.reportLink);
|
||||
this.Controls.Add(this.errorDescription);
|
||||
this.Controls.Add(this.bToClipboard);
|
||||
this.Controls.Add(this.threadLink);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.errorMessage);
|
||||
this.Controls.Add(this.pictureBox1);
|
||||
this.Controls.Add(this.bContinue);
|
||||
this.Controls.Add(this.bQuit);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "ExceptionDialog";
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "OH NOES! MOAR ERRORS!";
|
||||
this.TopMost = true;
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button bQuit;
|
||||
private System.Windows.Forms.Button bContinue;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.TextBox errorMessage;
|
||||
private System.Windows.Forms.LinkLabel reportLink;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.LinkLabel threadLink;
|
||||
private System.Windows.Forms.Button bToClipboard;
|
||||
private System.Windows.Forms.Label errorDescription;
|
||||
}
|
||||
}
|
120
Source/Core/GZBuilder/Windows/ExceptionDialog.resx
Normal file
120
Source/Core/GZBuilder/Windows/ExceptionDialog.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
|
@ -86,11 +86,11 @@ namespace CodeImp.DoomBuilder
|
|||
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
private static extern uint GetShortPathName([MarshalAs(UnmanagedType.LPTStr)] string longpath, [MarshalAs(UnmanagedType.LPTStr)]StringBuilder shortpath, uint buffersize);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
internal static extern int SetScrollInfo(IntPtr windowptr, int bar, IntPtr scrollinfo, bool redraw);
|
||||
//[DllImport("user32.dll")]
|
||||
//internal static extern int SetScrollInfo(IntPtr windowptr, int bar, IntPtr scrollinfo, bool redraw);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
internal static extern int GetScrollInfo(IntPtr windowptr, int bar, IntPtr scrollinfo);
|
||||
//[DllImport("user32.dll")]
|
||||
//internal static extern int GetScrollInfo(IntPtr windowptr, int bar, IntPtr scrollinfo);
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -101,18 +101,18 @@ namespace CodeImp.DoomBuilder
|
|||
internal const int WM_SYSCOMMAND = 0x112;
|
||||
internal const int SC_KEYMENU = 0xF100;
|
||||
internal const int CB_SETITEMHEIGHT = 0x153;
|
||||
internal const int CB_SHOWDROPDOWN = 0x14F;
|
||||
internal const int EM_GETSCROLLPOS = WM_USER + 221;
|
||||
internal const int EM_SETSCROLLPOS = WM_USER + 222;
|
||||
internal const int SB_HORZ = 0;
|
||||
internal const int SB_VERT = 1;
|
||||
internal const int SB_CTL = 2;
|
||||
internal const int SIF_RANGE = 0x1;
|
||||
internal const int SIF_PAGE = 0x2;
|
||||
internal const int SIF_POS = 0x4;
|
||||
internal const int SIF_DISABLENOSCROLL = 0x8;
|
||||
internal const int SIF_TRACKPOS = 0x16;
|
||||
internal const int SIF_ALL = SIF_RANGE + SIF_PAGE + SIF_POS + SIF_TRACKPOS;
|
||||
//internal const int CB_SHOWDROPDOWN = 0x14F;
|
||||
//internal const int EM_GETSCROLLPOS = WM_USER + 221;
|
||||
//internal const int EM_SETSCROLLPOS = WM_USER + 222;
|
||||
//internal const int SB_HORZ = 0;
|
||||
//internal const int SB_VERT = 1;
|
||||
//internal const int SB_CTL = 2;
|
||||
//internal const int SIF_RANGE = 0x1;
|
||||
//internal const int SIF_PAGE = 0x2;
|
||||
//internal const int SIF_POS = 0x4;
|
||||
//internal const int SIF_DISABLENOSCROLL = 0x8;
|
||||
//internal const int SIF_TRACKPOS = 0x16;
|
||||
//internal const int SIF_ALL = SIF_RANGE + SIF_PAGE + SIF_POS + SIF_TRACKPOS;
|
||||
|
||||
// Files and Folders
|
||||
private const string SETTINGS_FILE = "GZBuilder.cfg";
|
||||
|
@ -127,7 +127,7 @@ namespace CodeImp.DoomBuilder
|
|||
private const string HELP_FILE = "Refmanual.chm";
|
||||
|
||||
// SCROLLINFO structure
|
||||
internal struct ScrollInfo
|
||||
/*internal struct ScrollInfo
|
||||
{
|
||||
public int size; // size of this structure
|
||||
public uint mask; // combination of SIF_ constants
|
||||
|
@ -136,7 +136,7 @@ namespace CodeImp.DoomBuilder
|
|||
public uint page; // page size (scroll bar uses this value to determine the appropriate size of the proportional scroll box)
|
||||
public int pos; // position of the scroll box
|
||||
public int trackpos; // immediate position of a scroll box that the user is dragging
|
||||
}
|
||||
}*/
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -198,6 +198,7 @@ namespace CodeImp.DoomBuilder
|
|||
public static string AppPath { get { return apppath; } }
|
||||
public static string TempPath { get { return temppath; } }
|
||||
public static string ConfigsPath { get { return configspath; } }
|
||||
internal static string SettingsPath { get { return settingspath; } } //mxd
|
||||
public static string CompilersPath { get { return compilerspath; } }
|
||||
public static string PluginsPath { get { return pluginspath; } }
|
||||
public static string SpritesPath { get { return spritespath; } }
|
||||
|
@ -538,6 +539,10 @@ namespace CodeImp.DoomBuilder
|
|||
#else
|
||||
debugbuild = false;
|
||||
#endif
|
||||
|
||||
//mxd. Custom exception dialog.
|
||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
|
||||
Application.ThreadException += Application_ThreadException;
|
||||
|
||||
// Enable OS visual styles
|
||||
Application.EnableVisualStyles();
|
||||
|
@ -578,7 +583,7 @@ namespace CodeImp.DoomBuilder
|
|||
// Remove the previous log file and start logging
|
||||
if(File.Exists(logfile)) File.Delete(logfile);
|
||||
//mxd
|
||||
General.WriteLogLine("GZDoom Builder " + CodeImp.DoomBuilder.GZBuilder.GZGeneral.Version + CodeImp.DoomBuilder.GZBuilder.GZGeneral.Revision + " startup");
|
||||
General.WriteLogLine("GZDoom Builder " + GZBuilder.GZGeneral.Version + GZBuilder.GZGeneral.Revision + " startup");
|
||||
//General.WriteLogLine("Doom Builder " + thisversion.Major + "." + thisversion.Minor + " startup");
|
||||
General.WriteLogLine("Application path: " + apppath);
|
||||
General.WriteLogLine("Temporary path: " + temppath);
|
||||
|
@ -705,7 +710,7 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// This handles DLL linking errors
|
||||
private static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
|
||||
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
|
||||
{
|
||||
// Check if SlimDX failed loading
|
||||
if(args.Name.Contains("SlimDX")) AskDownloadDirectX();
|
||||
|
@ -725,11 +730,11 @@ namespace CodeImp.DoomBuilder
|
|||
// Ask the user to download DirectX
|
||||
if(MessageBox.Show("This application requires the latest version of Microsoft DirectX installed on your computer." + Environment.NewLine +
|
||||
"Do you want to install and/or update Microsoft DirectX now?", "DirectX Error", System.Windows.Forms.MessageBoxButtons.YesNo,
|
||||
System.Windows.Forms.MessageBoxIcon.Exclamation) == System.Windows.Forms.DialogResult.Yes)
|
||||
MessageBoxIcon.Exclamation) == DialogResult.Yes)
|
||||
{
|
||||
// Open DX web setup
|
||||
//System.Diagnostics.Process.Start("http://www.microsoft.com/downloads/details.aspx?FamilyId=2DA43D38-DB71-4C1B-BC6A-9B6652CD92A3").WaitForExit(1000);
|
||||
System.Diagnostics.Process.Start(Path.Combine(setuppath, "dxwebsetup.exe")).WaitForExit(1000);
|
||||
Process.Start(Path.Combine(setuppath, "dxwebsetup.exe")).WaitForExit(1000);
|
||||
}
|
||||
|
||||
// End program here
|
||||
|
@ -1925,7 +1930,56 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region ================== mxd. Uncaught exceptions handling
|
||||
|
||||
private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) {
|
||||
try {
|
||||
GZBuilder.Windows.ExceptionDialog dlg = new GZBuilder.Windows.ExceptionDialog(e);
|
||||
dlg.Setup();
|
||||
//dbg
|
||||
DialogResult r = dlg.ShowDialog();
|
||||
|
||||
if(r == DialogResult.Cancel)
|
||||
Application.Exit();
|
||||
} catch {
|
||||
try {
|
||||
MessageBox.Show("Fatal Windows Forms Error", "Fatal Windows Forms Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop);
|
||||
} finally {
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs e) {
|
||||
try {
|
||||
// Since we can't prevent the app from terminating, log this to the event log.
|
||||
if(!EventLog.SourceExists("ThreadException"))
|
||||
EventLog.CreateEventSource("ThreadException", "Application");
|
||||
|
||||
Exception ex = (Exception)e.ExceptionObject;
|
||||
|
||||
// Create an EventLog instance and assign its source.
|
||||
using (EventLog myLog = new EventLog()) {
|
||||
myLog.Source = "ThreadException";
|
||||
myLog.WriteEntry("An application error occurred: " + ex.Message + "\n\nStack Trace:\n" + ex.StackTrace);
|
||||
}
|
||||
|
||||
GZBuilder.Windows.ExceptionDialog dlg = new GZBuilder.Windows.ExceptionDialog(e);
|
||||
dlg.Setup();
|
||||
dlg.ShowDialog();
|
||||
} catch(Exception exc) {
|
||||
try {
|
||||
MessageBox.Show("Fatal Non-UI Error", "Fatal Non-UI Error. Could not write the error to the event log. Reason: "
|
||||
+ exc.Message, MessageBoxButtons.OK, MessageBoxIcon.Stop);
|
||||
} finally {
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/*
|
||||
[BeginAction("testaction")]
|
||||
internal static void TestAction()
|
||||
|
|
7
Source/Core/Properties/Resources.Designer.cs
generated
7
Source/Core/Properties/Resources.Designer.cs
generated
|
@ -291,6 +291,13 @@ namespace CodeImp.DoomBuilder.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
internal static System.Drawing.Bitmap MCrash {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("MCrash", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
internal static System.Drawing.Bitmap mergegeometry {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("mergegeometry", resourceCulture);
|
||||
|
|
|
@ -397,4 +397,7 @@
|
|||
<data name="MissingThing" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\MissingThing.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="MCrash" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\MCrash.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
Source/Core/Resources/MCrash.png
Normal file
BIN
Source/Core/Resources/MCrash.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
Loading…
Reference in a new issue