Make UnhandledError message more helpful. (Thanks ironnoyes)

This commit is contained in:
UnknownShadow200 2016-04-19 10:07:15 +10:00
parent 7115728547
commit 976aab75ab
4 changed files with 13 additions and 10 deletions

View File

@ -7,10 +7,10 @@ namespace ClassicalSharp.Gui {
public sealed partial class AltTextInputWidget : Widget {
public AltTextInputWidget( Game game, Font font, TextInputWidget parent ) : base( game ) {
public AltTextInputWidget( Game game, TextInputWidget parent ) : base( game ) {
HorizontalAnchor = Anchor.LeftOrTop;
VerticalAnchor = Anchor.BottomOrRight;
this.font = font;
font = new Font( game.FontName, 16 );
this.parent = parent;
Active = false;
}

View File

@ -29,8 +29,11 @@ namespace ClassicalSharp.Gui {
PlaceholderHeight = new bool[ElementsCount];
lines = new string[ElementsCount];
linkData = new LinkData[ElementsCount];
DrawTextArgs args = new DrawTextArgs( "I", font, true );
defaultHeight = game.Drawer2D.MeasureChatSize( ref args ).Height;
int height = game.Drawer2D.MeasureChatSize( ref args ).Height;
game.Drawer2D.ReducePadding( ref height, Utils.Floor( font.Size ) );
defaultHeight = height;
for( int i = 0; i < Textures.Length; i++ ) {
Textures[i].Height = defaultHeight;

View File

@ -25,7 +25,7 @@ namespace ClassicalSharp.Gui {
defaultHeight = Height = defSize.Height;
this.font = font;
altText = new AltTextInputWidget( game, font, this );
altText = new AltTextInputWidget( game, this );
altText.Init();
}

View File

@ -47,15 +47,15 @@ namespace ClassicalSharp {
}
string message = wroteToCrashLog ?
"The cause of the crash has been logged to \"" + logFile + "\". Please consider reporting the crash " +
"(and the circumstances that caused it) to github.com/UnknownShadow200/ClassicalSharp/issues" :
"The cause of the error has been logged to \"client.log\". Please consider reporting the error to " +
"github.com/UnknownShadow200/ClassicalSharp/issues so we can fix it." :
"Failed to write the cause of the crash to \"" + logFile + "\". Please consider reporting the crash " +
"(and the circumstances that caused it) to github.com/UnknownShadow200/ClassicalSharp/issues" +
"Failed to log the cause of the the error. Please consider reporting the circumstances " +
"of the error to github.com/UnknownShadow200/ClassicalSharp/issues so we can fix it." +
Environment.NewLine + Environment.NewLine + error;
MessageBox.Show( "Oh dear. ClassicalSharp has crashed." + Environment.NewLine +
Environment.NewLine + message, "ClassicalSharp has crashed" );
MessageBox.Show( "An error occured and ClassicalSharp was forced to close." + Environment.NewLine +
Environment.NewLine + message, "We're sorry" );
Environment.Exit( 1 );
}