diff --git a/Facepunch.Steamworks/Client.cs b/Facepunch.Steamworks/Client.cs
index 3733bea..1264d4b 100644
--- a/Facepunch.Steamworks/Client.cs
+++ b/Facepunch.Steamworks/Client.cs
@@ -1,4 +1,5 @@
using System;
+using System.IO;
using System.Runtime.InteropServices;
namespace Facepunch.Steamworks
@@ -15,13 +16,29 @@ public partial class Client : BaseSteamworks
///
public ulong SteamId { get; private set; }
+ ///
+ /// If we're sharing this game, this is the owner of it.
+ ///
+ public ulong OwnerSteamId { get; private set; }
+
///
/// Current Beta name, if we're using a beta branch.
///
public string BetaName { get; private set; }
+ ///
+ /// The BuildId of the current build
+ ///
+ public int BuildId { get; private set; }
+
+ ///
+ /// The folder in which this app is installed
+ ///
+ public DirectoryInfo InstallFolder { get; private set; }
+
public Voice Voice { get; private set; }
public ServerList ServerList { get; private set; }
+ public App App { get; private set; }
public Client( uint appId )
{
@@ -47,6 +64,7 @@ public Client( uint appId )
//
Voice = new Voice( this );
ServerList = new ServerList( this );
+ App = new App( this );
Workshop.friends = Friends;
@@ -58,6 +76,9 @@ public Client( uint appId )
Username = native.friends.GetPersonaName();
SteamId = native.user.GetSteamID();
BetaName = native.apps.GetCurrentBetaName();
+ OwnerSteamId = native.apps.GetAppOwner();
+ InstallFolder = new DirectoryInfo( native.apps.GetAppInstallDir( AppId ) );
+ BuildId = native.apps.GetAppBuildId();
//
// Run update, first call does some initialization
@@ -104,6 +125,12 @@ public override void Dispose()
ServerList = null;
}
+ if ( App != null )
+ {
+ App.Dispose();
+ App = null;
+ }
+
base.Dispose();
}
@@ -129,5 +156,27 @@ public Leaderboard GetLeaderboard( string name, LeaderboardSortMethod sortMethod
native.userstats.FindOrCreateLeaderboard( name, (SteamNative.LeaderboardSortMethod)sortMethod, (SteamNative.LeaderboardDisplayType)displayType, board.OnBoardCreated );
return board;
}
+
+
+ ///
+ /// True if we're subscribed/authorised to be running this app
+ ///
+ public bool IsSubscribed => native.apps.BIsSubscribed();
+
+ ///
+ /// True if we're a cybercafe account
+ ///
+ public bool IsCybercafe => native.apps.BIsCybercafe();
+
+ ///
+ /// True if we're subscribed/authorised to be running this app, but only temporarily
+ /// due to a free weekend etc.
+ ///
+ public bool IsSubscribedFromFreeWeekend => native.apps.BIsSubscribedFromFreeWeekend();
+
+ ///
+ /// True if we're in low violence mode (germans are only allowed to see the insides of bodies in porn)
+ ///
+ public bool IsLowViolence => native.apps.BIsLowViolence();
}
}
diff --git a/Facepunch.Steamworks/Client/App.cs b/Facepunch.Steamworks/Client/App.cs
index c636b06..83a643f 100644
--- a/Facepunch.Steamworks/Client/App.cs
+++ b/Facepunch.Steamworks/Client/App.cs
@@ -5,23 +5,7 @@
namespace Facepunch.Steamworks
{
- public partial class Client : IDisposable
- {
- App _app;
-
- public App App
- {
- get
- {
- if ( _app == null )
- _app = new App( this );
-
- return _app;
- }
- }
- }
-
- public class App
+ public class App : IDisposable
{
internal Client client;
@@ -30,23 +14,63 @@ internal App( Client c )
client = c;
}
+ public void Dispose()
+ {
+ client = null;
+ }
+
+ ///
+ /// Mark the content as corrupt, so it will validate the downloaded files
+ /// once the app is closed. This is good to call when you detect a crash happening
+ /// or a file is missing that is meant to be there.
+ ///
public void MarkContentCorrupt( bool missingFilesOnly = false )
{
client.native.apps.MarkContentCorrupt( missingFilesOnly );
}
///
- /// Returns the current BuildId of the game.
- /// This is pretty useless, as it isn't guarenteed to return
- /// the build id you're playing, or the latest build id.
+ /// Tell steam to install the Dlc specified by the AppId
///
- public int BuildId
+ public void InstallDlc( uint appId )
{
- get
- {
- return client.native.apps.GetAppBuildId();
- }
+ client.native.apps.InstallDLC( appId );
}
+ ///
+ /// Tell steam to uninstall the Dlc specified by the AppId
+ ///
+ public void UninstallDlc(uint appId)
+ {
+ client.native.apps.UninstallDLC( appId );
+ }
+
+ ///
+ /// Get the purchase time for this appid. Will return DateTime.MinValue if none.
+ ///
+ public DateTime PurchaseTime(uint appId)
+ {
+ var time = client.native.apps.GetEarliestPurchaseUnixTime(appId);
+ if ( time == 0 ) return DateTime.MinValue;
+
+ return Utility.Epoch.ToDateTime( time );
+ }
+
+ ///
+ /// Returns true if this user is subscribed to the specific appid
+ /// ie. If the user owns this game specified.
+ ///
+ public bool IsSubscribed(uint appId)
+ {
+ return client.native.apps.BIsSubscribedApp(appId);
+ }
+
+ ///
+ /// Returns true if specified app is installed.
+ ///
+ public bool IsInstalled(uint appId)
+ {
+ return client.native.apps.BIsAppInstalled(appId);
+ }
}
}