From bde2a48144fe29b4e76ed6506c50ae14c8fb5517 Mon Sep 17 00:00:00 2001 From: James Botting Date: Wed, 23 Sep 2015 17:41:45 +0100 Subject: [PATCH] Fixed window title, small debug information error. --- ARKUpdater/Classes/SteamKit.cs | 2 -- ARKUpdater/Interfaces/ServerInterface.cs | 17 ++++++++++++----- ARKUpdater/Program.cs | 2 +- ARKUpdater/Properties/AssemblyInfo.cs | 4 ++-- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/ARKUpdater/Classes/SteamKit.cs b/ARKUpdater/Classes/SteamKit.cs index ae51d75..e88e6dc 100644 --- a/ARKUpdater/Classes/SteamKit.cs +++ b/ARKUpdater/Classes/SteamKit.cs @@ -158,7 +158,6 @@ private void LogOnCallback(SteamUser.LoggedOnCallback loggedOn) } #endregion Steam3 Callbacks - #region Fetch App Information public delegate void AppCallback(SteamApps.PICSProductInfoCallback.PICSProductInfo returnData); public void RequestAppInfo(uint appid, AppCallback callback) { @@ -196,6 +195,5 @@ public void RequestAppInfo(uint appid, AppCallback callback) // Fire Token Callback _CManager.Subscribe(_Apps.PICSGetAccessTokens(new List() {appid}, new List()), TokenCallback); } - #endregion Fetch App Information } } diff --git a/ARKUpdater/Interfaces/ServerInterface.cs b/ARKUpdater/Interfaces/ServerInterface.cs index 6edcb3e..64266b1 100644 --- a/ARKUpdater/Interfaces/ServerInterface.cs +++ b/ARKUpdater/Interfaces/ServerInterface.cs @@ -5,6 +5,7 @@ using ARKUpdater.Classes; using System.Diagnostics; using System.Collections; +using System.Threading.Tasks; using System.Collections.Generic; using System.Runtime.InteropServices; @@ -27,13 +28,19 @@ public ServerInterface(ARKUpdater Parent) class ServerInterfaceWindows : ServerInterface { - #region W32API Imports + #region Window Text Code static class NativeMethods { [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern bool SetWindowText(IntPtr hWnd, string text); } - #endregion W32API Imports + + private async Task _UpdateWindow(Process Proc, string Text) + { + await Task.Delay(5000); + NativeMethods.SetWindowText(Proc.MainWindowHandle, Text); + } + #endregion Window Text Code public ServerInterfaceWindows(ARKUpdater parent) : base(parent) {} public override bool StopServer(SettingsLoader.ServerChild ServerData, AutoResetEvent ResetEvent) @@ -117,13 +124,13 @@ public override int StartServer(SettingsLoader.ServerChild ServerData) // Listener for Exit Event _ProcessDict.Add(Proc, ServerData); + Proc.EnableRaisingEvents = true; Proc.Exited += new EventHandler(_ProcessExited); // Set Window Title - //System.Threading.Thread.Sleep(2000); - //NativeMethods.SetWindowText(Proc.MainWindowHandle, string.Format("ARK: {0} (Managed by ARKUpdater)", ServerData.GameServerName)); - + Task tResult = this._UpdateWindow(Proc, string.Format("ARK: {0} (Managed by ARKUpdater)", ServerData.GameServerName)); + // Return with Process ID _Parent.Log.ConsolePrint(LogLevel.Debug, "Spawned new Server Process with ID {0}", Proc.Id); return Proc.Id; diff --git a/ARKUpdater/Program.cs b/ARKUpdater/Program.cs index 06e0141..5fd7af6 100644 --- a/ARKUpdater/Program.cs +++ b/ARKUpdater/Program.cs @@ -249,7 +249,7 @@ public void Run() if( BuildNumber != -1 ) { LastUpdatePollTime = Helpers.CurrentUnixStamp; - if( BuildNumber > PreviousBuild ) Log.ConsolePrint(LogLevel.Info, "A new build of `ARK: Survival Evolved` is available. Build number: {0}", BuildNumber); + if( ( BuildNumber > PreviousBuild ) && ( PreviousBuild != -1 ) ) Log.ConsolePrint(LogLevel.Info, "A new build of `ARK: Survival Evolved` is available. Build number: {0}", BuildNumber); } } diff --git a/ARKUpdater/Properties/AssemblyInfo.cs b/ARKUpdater/Properties/AssemblyInfo.cs index d9ba83b..e666f95 100644 --- a/ARKUpdater/Properties/AssemblyInfo.cs +++ b/ARKUpdater/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.1.0")] -[assembly: AssemblyFileVersion("1.0.1.0")] +[assembly: AssemblyVersion("1.0.2.0")] +[assembly: AssemblyFileVersion("1.0.2.0")]