Skip to content
This repository has been archived by the owner on Apr 2, 2020. It is now read-only.

Commit

Permalink
Fixed window title, small debug information error.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bottswana committed Sep 23, 2015
1 parent 4d6c533 commit bde2a48
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
2 changes: 0 additions & 2 deletions ARKUpdater/Classes/SteamKit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -196,6 +195,5 @@ public void RequestAppInfo(uint appid, AppCallback callback)
// Fire Token Callback
_CManager.Subscribe(_Apps.PICSGetAccessTokens(new List<uint>() {appid}, new List<uint>()), TokenCallback);
}
#endregion Fetch App Information
}
}
17 changes: 12 additions & 5 deletions ARKUpdater/Interfaces/ServerInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ARKUpdater/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions ARKUpdater/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]

0 comments on commit bde2a48

Please sign in to comment.