mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-12 22:58:01 +03:00
Filled out Client.App
This commit is contained in:
parent
df9b0d3114
commit
c38f45e630
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Facepunch.Steamworks
|
namespace Facepunch.Steamworks
|
||||||
@ -15,13 +16,29 @@ namespace Facepunch.Steamworks
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ulong SteamId { get; private set; }
|
public ulong SteamId { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If we're sharing this game, this is the owner of it.
|
||||||
|
/// </summary>
|
||||||
|
public ulong OwnerSteamId { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Current Beta name, if we're using a beta branch.
|
/// Current Beta name, if we're using a beta branch.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string BetaName { get; private set; }
|
public string BetaName { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The BuildId of the current build
|
||||||
|
/// </summary>
|
||||||
|
public int BuildId { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The folder in which this app is installed
|
||||||
|
/// </summary>
|
||||||
|
public DirectoryInfo InstallFolder { get; private set; }
|
||||||
|
|
||||||
public Voice Voice { get; private set; }
|
public Voice Voice { get; private set; }
|
||||||
public ServerList ServerList { get; private set; }
|
public ServerList ServerList { get; private set; }
|
||||||
|
public App App { get; private set; }
|
||||||
|
|
||||||
public Client( uint appId )
|
public Client( uint appId )
|
||||||
{
|
{
|
||||||
@ -47,6 +64,7 @@ namespace Facepunch.Steamworks
|
|||||||
//
|
//
|
||||||
Voice = new Voice( this );
|
Voice = new Voice( this );
|
||||||
ServerList = new ServerList( this );
|
ServerList = new ServerList( this );
|
||||||
|
App = new App( this );
|
||||||
|
|
||||||
Workshop.friends = Friends;
|
Workshop.friends = Friends;
|
||||||
|
|
||||||
@ -58,6 +76,9 @@ namespace Facepunch.Steamworks
|
|||||||
Username = native.friends.GetPersonaName();
|
Username = native.friends.GetPersonaName();
|
||||||
SteamId = native.user.GetSteamID();
|
SteamId = native.user.GetSteamID();
|
||||||
BetaName = native.apps.GetCurrentBetaName();
|
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
|
// Run update, first call does some initialization
|
||||||
@ -104,6 +125,12 @@ namespace Facepunch.Steamworks
|
|||||||
ServerList = null;
|
ServerList = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( App != null )
|
||||||
|
{
|
||||||
|
App.Dispose();
|
||||||
|
App = null;
|
||||||
|
}
|
||||||
|
|
||||||
base.Dispose();
|
base.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,5 +156,27 @@ namespace Facepunch.Steamworks
|
|||||||
native.userstats.FindOrCreateLeaderboard( name, (SteamNative.LeaderboardSortMethod)sortMethod, (SteamNative.LeaderboardDisplayType)displayType, board.OnBoardCreated );
|
native.userstats.FindOrCreateLeaderboard( name, (SteamNative.LeaderboardSortMethod)sortMethod, (SteamNative.LeaderboardDisplayType)displayType, board.OnBoardCreated );
|
||||||
return board;
|
return board;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if we're subscribed/authorised to be running this app
|
||||||
|
/// </summary>
|
||||||
|
public bool IsSubscribed => native.apps.BIsSubscribed();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if we're a cybercafe account
|
||||||
|
/// </summary>
|
||||||
|
public bool IsCybercafe => native.apps.BIsCybercafe();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if we're subscribed/authorised to be running this app, but only temporarily
|
||||||
|
/// due to a free weekend etc.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsSubscribedFromFreeWeekend => native.apps.BIsSubscribedFromFreeWeekend();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if we're in low violence mode (germans are only allowed to see the insides of bodies in porn)
|
||||||
|
/// </summary>
|
||||||
|
public bool IsLowViolence => native.apps.BIsLowViolence();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,23 +5,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace Facepunch.Steamworks
|
namespace Facepunch.Steamworks
|
||||||
{
|
{
|
||||||
public partial class Client : IDisposable
|
public class App : IDisposable
|
||||||
{
|
|
||||||
App _app;
|
|
||||||
|
|
||||||
public App App
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ( _app == null )
|
|
||||||
_app = new App( this );
|
|
||||||
|
|
||||||
return _app;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class App
|
|
||||||
{
|
{
|
||||||
internal Client client;
|
internal Client client;
|
||||||
|
|
||||||
@ -30,23 +14,63 @@ namespace Facepunch.Steamworks
|
|||||||
client = c;
|
client = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
client = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
public void MarkContentCorrupt( bool missingFilesOnly = false )
|
public void MarkContentCorrupt( bool missingFilesOnly = false )
|
||||||
{
|
{
|
||||||
client.native.apps.MarkContentCorrupt( missingFilesOnly );
|
client.native.apps.MarkContentCorrupt( missingFilesOnly );
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the current BuildId of the game.
|
/// Tell steam to install the Dlc specified by the AppId
|
||||||
/// This is pretty useless, as it isn't guarenteed to return
|
|
||||||
/// the build id you're playing, or the latest build id.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int BuildId
|
public void InstallDlc( uint appId )
|
||||||
{
|
{
|
||||||
get
|
client.native.apps.InstallDLC( appId );
|
||||||
{
|
|
||||||
return client.native.apps.GetAppBuildId();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tell steam to uninstall the Dlc specified by the AppId
|
||||||
|
/// </summary>
|
||||||
|
public void UninstallDlc(uint appId)
|
||||||
|
{
|
||||||
|
client.native.apps.UninstallDLC( appId );
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the purchase time for this appid. Will return DateTime.MinValue if none.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime PurchaseTime(uint appId)
|
||||||
|
{
|
||||||
|
var time = client.native.apps.GetEarliestPurchaseUnixTime(appId);
|
||||||
|
if ( time == 0 ) return DateTime.MinValue;
|
||||||
|
|
||||||
|
return Utility.Epoch.ToDateTime( time );
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if this user is subscribed to the specific appid
|
||||||
|
/// ie. If the user owns this game specified.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsSubscribed(uint appId)
|
||||||
|
{
|
||||||
|
return client.native.apps.BIsSubscribedApp(appId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if specified app is installed.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsInstalled(uint appId)
|
||||||
|
{
|
||||||
|
return client.native.apps.BIsAppInstalled(appId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user