From 8d410969c301b219c88e38e6b5ab7e7357b2cec5 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Thu, 15 Feb 2018 11:53:49 +0000 Subject: [PATCH] App.GetName + GetInstallFolder, GetBuildId --- Facepunch.Steamworks.Test/Client/AppTest.cs | 10 +++++++ Facepunch.Steamworks/Client.cs | 2 ++ Facepunch.Steamworks/Client/App.cs | 29 +++++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/Facepunch.Steamworks.Test/Client/AppTest.cs b/Facepunch.Steamworks.Test/Client/AppTest.cs index f24f6a4..fb3e71f 100644 --- a/Facepunch.Steamworks.Test/Client/AppTest.cs +++ b/Facepunch.Steamworks.Test/Client/AppTest.cs @@ -51,5 +51,15 @@ namespace Facepunch.Steamworks.Test } } + [TestMethod] + public void AppName() + { + using ( var client = new Facepunch.Steamworks.Client( 252490 ) ) + { + var name = client.App.GetName( 4000 ); + Console.WriteLine( name ); + } + } + } } diff --git a/Facepunch.Steamworks/Client.cs b/Facepunch.Steamworks/Client.cs index d4c7ee0..6ffee97 100644 --- a/Facepunch.Steamworks/Client.cs +++ b/Facepunch.Steamworks/Client.cs @@ -121,8 +121,10 @@ namespace Facepunch.Steamworks BetaName = native.apps.GetCurrentBetaName(); OwnerSteamId = native.apps.GetAppOwner(); var appInstallDir = native.apps.GetAppInstallDir(AppId); + if (!String.IsNullOrEmpty(appInstallDir) && Directory.Exists(appInstallDir)) InstallFolder = new DirectoryInfo(appInstallDir); + BuildId = native.apps.GetAppBuildId(); CurrentLanguage = native.apps.GetCurrentGameLanguage(); AvailableLanguages = native.apps.GetAvailableGameLanguages().Split( new[] {';'}, StringSplitOptions.RemoveEmptyEntries ); // TODO: Assumed colon separated diff --git a/Facepunch.Steamworks/Client/App.cs b/Facepunch.Steamworks/Client/App.cs index 8fc959a..8cd6b82 100644 --- a/Facepunch.Steamworks/Client/App.cs +++ b/Facepunch.Steamworks/Client/App.cs @@ -72,5 +72,34 @@ namespace Facepunch.Steamworks { return client.native.apps.BIsAppInstalled(appId); } + + /// + /// Returns the appid's name + /// Returns error if the current app Id does not have permission to use this interface + /// + public string GetName( uint appId ) + { + var str = client.native.applist.GetAppName( appId ); + if ( str == null ) return "error"; + return str; + } + + /// + /// Returns the app's install folder + /// Returns error if the current app Id does not have permission to use this interface + /// + public string GetInstallFolder( uint appId ) + { + return client.native.applist.GetAppInstallDir( appId ); + } + + /// + /// Returns the app's current build id + /// Returns 0 if the current app Id does not have permission to use this interface + /// + public int GetBuildId( uint appId ) + { + return client.native.applist.GetAppBuildId( appId ); + } } }