App.GetName + GetInstallFolder, GetBuildId

This commit is contained in:
Garry Newman 2018-02-15 11:53:49 +00:00
parent ef8234b958
commit 8d410969c3
3 changed files with 41 additions and 0 deletions

View File

@ -51,5 +51,15 @@ public void PurchaseTime()
}
}
[TestMethod]
public void AppName()
{
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
{
var name = client.App.GetName( 4000 );
Console.WriteLine( name );
}
}
}
}

View File

@ -121,8 +121,10 @@ public Client( uint appId ) : base( appId )
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

View File

@ -72,5 +72,34 @@ public bool IsInstalled(uint appId)
{
return client.native.apps.BIsAppInstalled(appId);
}
/// <summary>
/// Returns the appid's name
/// Returns error if the current app Id does not have permission to use this interface
/// </summary>
public string GetName( uint appId )
{
var str = client.native.applist.GetAppName( appId );
if ( str == null ) return "error";
return str;
}
/// <summary>
/// Returns the app's install folder
/// Returns error if the current app Id does not have permission to use this interface
/// </summary>
public string GetInstallFolder( uint appId )
{
return client.native.applist.GetAppInstallDir( appId );
}
/// <summary>
/// Returns the app's current build id
/// Returns 0 if the current app Id does not have permission to use this interface
/// </summary>
public int GetBuildId( uint appId )
{
return client.native.applist.GetAppBuildId( appId );
}
}
}