@@ -229,7 +229,8 @@ public SteamID? SteamID
229229 /// <param name="details">The details to use for logging on.</param>
230230 /// <exception cref="ArgumentNullException">No logon details were provided.</exception>
231231 /// <exception cref="ArgumentException">Username or password are not set within <paramref name="details"/>.</exception>
232- public void LogOn ( LogOnDetails details )
232+ /// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="LoggedOnCallback"/>.</returns>
233+ public AsyncJob < LoggedOnCallback > LogOn ( LogOnDetails details )
233234 {
234235 ArgumentNullException . ThrowIfNull ( details ) ;
235236
@@ -238,14 +239,14 @@ public void LogOn( LogOnDetails details )
238239 throw new ArgumentException ( "LogOn requires a username and password or access token to be set in 'details'." ) ;
239240 }
240241
242+ var logon = new ClientMsgProtobuf < CMsgClientLogon > ( EMsg . ClientLogon ) ;
243+
241244 if ( ! this . Client . IsConnected )
242245 {
243- this . Client . PostCallback ( new LoggedOnCallback ( EResult . NoConnection ) ) ;
244- return ;
246+ this . Client . PostCallback ( new LoggedOnCallback ( EResult . NoConnection , logon . SourceJobID ) ) ;
247+ return new AsyncJob < LoggedOnCallback > ( this . Client , logon . SourceJobID ) ;
245248 }
246249
247- var logon = new ClientMsgProtobuf < CMsgClientLogon > ( EMsg . ClientLogon ) ;
248-
249250 SteamID steamId = new SteamID ( details . AccountID , details . AccountInstance , Client . Universe , EAccountType . Individual ) ;
250251
251252 if ( details . LoginID . HasValue )
@@ -316,35 +317,39 @@ public void LogOn( LogOnDetails details )
316317 logon . Body . access_token = details . AccessToken ;
317318
318319 this . Client . Send ( logon ) ;
320+
321+ return new AsyncJob < LoggedOnCallback > ( this . Client , logon . SourceJobID ) ;
319322 }
320323
321324 /// <summary>
322325 /// Logs the client into the Steam3 network as an anonymous user.
323326 /// The client should already have been connected at this point.
324327 /// Results are returned in a <see cref="LoggedOnCallback"/>.
325328 /// </summary>
326- public void LogOnAnonymous ( )
329+ /// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="LoggedOnCallback"/>.</returns>
330+ public AsyncJob < LoggedOnCallback > LogOnAnonymous ( )
327331 {
328- LogOnAnonymous ( new AnonymousLogOnDetails ( ) ) ;
332+ return LogOnAnonymous ( new AnonymousLogOnDetails ( ) ) ;
329333 }
330334 /// <summary>
331335 /// Logs the client into the Steam3 network as an anonymous user.
332336 /// The client should already have been connected at this point.
333337 /// Results are returned in a <see cref="LoggedOnCallback"/>.
334338 /// </summary>
335339 /// <param name="details">The details to use for logging on.</param>
336- public void LogOnAnonymous ( AnonymousLogOnDetails details )
340+ /// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="LoggedOnCallback"/>.</returns>
341+ public AsyncJob < LoggedOnCallback > LogOnAnonymous ( AnonymousLogOnDetails details )
337342 {
338343 ArgumentNullException . ThrowIfNull ( details ) ;
339344
345+ var logon = new ClientMsgProtobuf < CMsgClientLogon > ( EMsg . ClientLogon ) ;
346+
340347 if ( ! this . Client . IsConnected )
341348 {
342- this . Client . PostCallback ( new LoggedOnCallback ( EResult . NoConnection ) ) ;
343- return ;
349+ this . Client . PostCallback ( new LoggedOnCallback ( EResult . NoConnection , logon . SourceJobID ) ) ;
350+ return new AsyncJob < LoggedOnCallback > ( this . Client , logon . SourceJobID ) ;
344351 }
345352
346- var logon = new ClientMsgProtobuf < CMsgClientLogon > ( EMsg . ClientLogon ) ;
347-
348353 SteamID auId = new SteamID ( 0 , 0 , Client . Universe , EAccountType . AnonUser ) ;
349354
350355 logon . ProtoHeader . client_sessionid = 0 ;
@@ -358,6 +363,8 @@ public void LogOnAnonymous( AnonymousLogOnDetails details )
358363 logon . Body . machine_id = HardwareUtils . GetMachineID ( Client . Configuration . MachineInfoProvider ) ;
359364
360365 this . Client . Send ( logon ) ;
366+
367+ return new AsyncJob < LoggedOnCallback > ( this . Client , logon . SourceJobID ) ;
361368 }
362369
363370 /// <summary>
0 commit comments