Skip to content

Commit a470f3b

Browse files
committed
Add PICSGetPrivateBeta
1 parent eb9a18e commit a470f3b

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

SteamKit2/SteamKit2/Steam/Handlers/SteamApps/Callbacks.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,5 +794,39 @@ internal CheckAppBetaPasswordCallback( IPacketMsg packetMsg )
794794
}
795795
}
796796
}
797+
798+
/// <summary>
799+
/// This callback is received when a private beta request has been completed
800+
/// </summary>
801+
public sealed class PrivateBetaCallback : CallbackMsg
802+
{
803+
/// <summary>
804+
/// Result of the operation
805+
/// </summary>
806+
public EResult Result { get; set; }
807+
/// <summary>
808+
/// Gets the keyvalue info to be merged into main appinfo
809+
/// </summary>
810+
public KeyValue DepotSection { get; private set; }
811+
812+
internal PrivateBetaCallback( IPacketMsg packetMsg )
813+
{
814+
var response = new ClientMsgProtobuf<CMsgClientPICSPrivateBetaResponse>( packetMsg );
815+
var msg = response.Body;
816+
817+
JobID = response.TargetJobID;
818+
819+
Result = ( EResult )msg.eresult;
820+
821+
this.DepotSection = new KeyValue();
822+
823+
if ( msg.depot_section != null && msg.depot_section.Length > 0 )
824+
{
825+
// we don't want to read the trailing null byte
826+
using var ms = new MemoryStream( msg.depot_section, 0, msg.depot_section.Length - 1 );
827+
this.DepotSection.ReadAsText( ms );
828+
}
829+
}
830+
}
797831
}
798832
}

SteamKit2/SteamKit2/Steam/Handlers/SteamApps/SteamApps.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public PICSRequest( uint id = 0, ulong access_token = 0 )
5959
EMsg.ClientPICSProductInfoResponse => new PICSProductInfoCallback( packetMsg ),
6060
EMsg.ClientUpdateGuestPassesList => new GuestPassListCallback( packetMsg ),
6161
EMsg.ClientCheckAppBetaPasswordResponse => new CheckAppBetaPasswordCallback( packetMsg ),
62+
EMsg.ClientPICSPrivateBetaResponse => new PrivateBetaCallback( packetMsg ),
6263
_ => null,
6364
};
6465

@@ -298,6 +299,31 @@ public AsyncJob<LegacyGameKeyCallback> GetLegacyGameKey( uint appid )
298299
return new AsyncJob<LegacyGameKeyCallback>( this.Client, request.SourceJobID );
299300
}
300301

302+
/// <summary>
303+
/// Submit a beta password for a given app to retrieve any betas and their encryption keys.
304+
/// Results are returned in a <see cref="CheckAppBetaPasswordCallback"/> callback.
305+
/// The returned <see cref="AsyncJob{T}"/> can also be awaited to retrieve the callback result.
306+
/// </summary>
307+
/// <param name="app">App id requested.</param>
308+
/// <param name="accessToken">Access token associated with the app.</param>
309+
/// <param name="branch">The branch name.</param>
310+
/// <param name="branchPasswordHash">The branch password from <see cref="CheckAppBetaPasswordCallback"/></param>
311+
/// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="CheckAppBetaPasswordCallback"/>.</returns>
312+
public AsyncJob<PrivateBetaCallback> PICSGetPrivateBeta( uint app, ulong accessToken, string branch, byte[] branchPasswordHash )
313+
{
314+
var request = new ClientMsgProtobuf<CMsgClientPICSPrivateBetaRequest>( EMsg.ClientPICSPrivateBetaRequest );
315+
request.SourceJobID = Client.GetNextJobID();
316+
317+
request.Body.appid = app;
318+
request.Body.access_token = accessToken;
319+
request.Body.beta_name = branch;
320+
request.Body.password_hash = branchPasswordHash;
321+
322+
this.Client.Send( request );
323+
324+
return new AsyncJob<PrivateBetaCallback>( this.Client, request.SourceJobID );
325+
}
326+
301327
/// <summary>
302328
/// Handles a client message. This should not be called directly.
303329
/// </summary>

0 commit comments

Comments
 (0)