From b9ab4df8209adfd8456dd48de1a8f8effa8fa76a Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 7 Nov 2015 12:25:09 +1100 Subject: [PATCH] Fix up key in chat, fix table being resized to 20 pixels when minimising then reopening. --- ClassicalSharp/Game/ChatLog.cs | 2 ++ ClassicalSharp/Network/Utils/AsyncDownloader.cs | 1 + Launcher2/Gui/TableWidget/LauncherTableWidget.Input.cs | 1 + Launcher2/Gui/TableWidget/LauncherTableWidget.cs | 3 +++ Launcher2/Launcher2.csproj | 2 +- 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ClassicalSharp/Game/ChatLog.cs b/ClassicalSharp/Game/ChatLog.cs index c3b677fb6..00f2d8502 100644 --- a/ClassicalSharp/Game/ChatLog.cs +++ b/ClassicalSharp/Game/ChatLog.cs @@ -25,6 +25,7 @@ namespace ClassicalSharp { public int FontSize = 12; public void Send( string text, bool partial ) { + text = text.TrimEnd( trimChars ); if( String.IsNullOrEmpty( text ) ) return; InputLog.Add( text ); @@ -35,6 +36,7 @@ namespace ClassicalSharp { game.Network.SendChat( text, partial ); } + static char[] trimChars = new [] { ' ', '\0' }; public void Add( string text ) { Log.Add( text ); LogChatToFile( text ); diff --git a/ClassicalSharp/Network/Utils/AsyncDownloader.cs b/ClassicalSharp/Network/Utils/AsyncDownloader.cs index 4a9bb0675..092c81c63 100644 --- a/ClassicalSharp/Network/Utils/AsyncDownloader.cs +++ b/ClassicalSharp/Network/Utils/AsyncDownloader.cs @@ -215,6 +215,7 @@ namespace ClassicalSharp.Network { req.ReadWriteTimeout = 15 * 1000; req.Timeout = 15 * 1000; req.Proxy = null; + req.UserAgent = Program.AppName; if( request.LastModified != DateTime.MinValue ) req.IfModifiedSince = request.LastModified; diff --git a/Launcher2/Gui/TableWidget/LauncherTableWidget.Input.cs b/Launcher2/Gui/TableWidget/LauncherTableWidget.Input.cs index f750fc01a..b07efe0de 100644 --- a/Launcher2/Gui/TableWidget/LauncherTableWidget.Input.cs +++ b/Launcher2/Gui/TableWidget/LauncherTableWidget.Input.cs @@ -57,6 +57,7 @@ namespace Launcher2 { if( DraggingWidth ) { ColumnWidths[0] += deltaX; Utils.Clamp( ref ColumnWidths[0], 20, Window.Width - 20 ); + DesiredColumnWidths[0] = ColumnWidths[0]; NeedRedraw(); } } diff --git a/Launcher2/Gui/TableWidget/LauncherTableWidget.cs b/Launcher2/Gui/TableWidget/LauncherTableWidget.cs index 092e9087d..d245fef9d 100644 --- a/Launcher2/Gui/TableWidget/LauncherTableWidget.cs +++ b/Launcher2/Gui/TableWidget/LauncherTableWidget.cs @@ -53,6 +53,7 @@ namespace Launcher2 { public int CurrentIndex, Count; public int[] ColumnWidths = { 350, 100 }; + public int[] DesiredColumnWidths = { 350, 100 }; struct TableEntry { public string Hash, Name, Players; @@ -68,8 +69,10 @@ namespace Launcher2 { static FastColour backCol = new FastColour( 120, 85, 151 ), foreCol = new FastColour( 160, 133, 186 ); static FastColour scrollCol = new FastColour( 200, 184, 216 ); public void Redraw( IDrawer2D drawer, Font font, Font titleFont, Font boldFont ) { + ColumnWidths[0] = DesiredColumnWidths[0]; Utils.Clamp( ref ColumnWidths[0], 20, Window.Width - 20 ); int x = X + 5; + DrawGrid( drawer, font, titleFont ); x += DrawColumn( drawer, true, font, titleFont, boldFont, "Name", ColumnWidths[0], x, e => e.Name ) + 5; x += DrawColumn( drawer, false, font, titleFont, boldFont, "Players", ColumnWidths[1], x, e => e.Players ) + 5; diff --git a/Launcher2/Launcher2.csproj b/Launcher2/Launcher2.csproj index ccb09b833..7349b7fde 100644 --- a/Launcher2/Launcher2.csproj +++ b/Launcher2/Launcher2.csproj @@ -4,7 +4,7 @@ {3E84ACC1-27B4-401B-A359-6AAE4DF6C9B5} Debug AnyCPU - WinExe + Exe Launcher2 Launcher2 v2.0