@@ -231,59 +231,62 @@ static async Task<ulong> GetSteam3DepotManifest(uint depotId, uint appId, string
231
231
}
232
232
233
233
var manifests = depotChild [ "manifests" ] ;
234
- var manifests_encrypted = depotChild [ "encryptedmanifests" ] ;
235
234
236
- if ( manifests . Children . Count == 0 && manifests_encrypted . Children . Count == 0 )
235
+ if ( manifests . Children . Count == 0 )
237
236
return INVALID_MANIFEST_ID ;
238
237
239
238
var node = manifests [ branch ] [ "gid" ] ;
240
239
241
- if ( node == KeyValue . Invalid && ! string . Equals ( branch , DEFAULT_BRANCH , StringComparison . OrdinalIgnoreCase ) )
242
- {
243
- var node_encrypted = manifests_encrypted [ branch ] ;
244
- if ( node_encrypted != KeyValue . Invalid )
245
- {
246
- var password = Config . BetaPassword ;
247
- while ( string . IsNullOrEmpty ( password ) )
248
- {
249
- Console . Write ( "Please enter the password for branch {0}: " , branch ) ;
250
- Config . BetaPassword = password = Console . ReadLine ( ) ;
251
- }
240
+ // Non passworded branch, found the manifest
241
+ if ( node . Value != null )
242
+ return ulong . Parse ( node . Value ) ;
252
243
253
- var encrypted_gid = node_encrypted [ "gid" ] ;
244
+ // If we requested public branch and it had no manifest, nothing to do
245
+ if ( string . Equals ( branch , DEFAULT_BRANCH , StringComparison . OrdinalIgnoreCase ) )
246
+ return INVALID_MANIFEST_ID ;
254
247
255
- if ( encrypted_gid != KeyValue . Invalid )
256
- {
257
- // Submit the password to Steam now to get encryption keys
258
- await steam3 . CheckAppBetaPassword ( appId , Config . BetaPassword ) ;
248
+ // Either the branch just doesn't exist, or it has a password
249
+ var password = Config . BetaPassword ;
259
250
260
- if ( ! steam3 . AppBetaPasswords . TryGetValue ( branch , out var appBetaPassword ) )
261
- {
262
- Console . WriteLine ( "Password was invalid for branch {0}" , branch ) ;
263
- return INVALID_MANIFEST_ID ;
264
- }
251
+ if ( string . IsNullOrEmpty ( password ) )
252
+ {
253
+ Console . WriteLine ( $ "Branch { branch } was not found, either it does not exist or it has a password.") ;
254
+ }
265
255
266
- var input = Util . DecodeHexString ( encrypted_gid . Value ) ;
267
- byte [ ] manifest_bytes ;
268
- try
269
- {
270
- manifest_bytes = Util . SymmetricDecryptECB ( input , appBetaPassword ) ;
271
- }
272
- catch ( Exception e )
273
- {
274
- Console . WriteLine ( "Failed to decrypt branch {0}: {1}" , branch , e . Message ) ;
275
- return INVALID_MANIFEST_ID ;
276
- }
256
+ while ( string . IsNullOrEmpty ( password ) )
257
+ {
258
+ Console . Write ( $ "Please enter the password for branch { branch } : ") ;
259
+ Config . BetaPassword = password = Console . ReadLine ( ) ;
260
+ }
277
261
278
- return BitConverter . ToUInt64 ( manifest_bytes , 0 ) ;
279
- }
262
+ if ( ! steam3 . AppBetaPasswords . ContainsKey ( branch ) )
263
+ {
264
+ // Submit the password to Steam now to get encryption keys
265
+ await steam3 . CheckAppBetaPassword ( appId , Config . BetaPassword ) ;
280
266
281
- Console . WriteLine ( "Unhandled depot encryption for depotId {0}" , depotId ) ;
267
+ if ( ! steam3 . AppBetaPasswords . TryGetValue ( branch , out var appBetaPassword ) )
268
+ {
269
+ Console . WriteLine ( $ "Error: Password was invalid for branch { branch } (or the branch does not exist)") ;
282
270
return INVALID_MANIFEST_ID ;
283
271
}
272
+ }
273
+
274
+ // Got the password, request private depot section
275
+ // TODO: We're probably repeating this request for every depot?
276
+ var privateDepotSection = await steam3 . GetPrivateBetaDepotSection ( appId , branch ) ;
284
277
278
+ // Now repeat the same code to get the manifest gid from depot section
279
+ depotChild = privateDepotSection [ depotId . ToString ( ) ] ;
280
+
281
+ if ( depotChild == KeyValue . Invalid )
285
282
return INVALID_MANIFEST_ID ;
286
- }
283
+
284
+ manifests = depotChild [ "manifests" ] ;
285
+
286
+ if ( manifests . Children . Count == 0 )
287
+ return INVALID_MANIFEST_ID ;
288
+
289
+ node = manifests [ branch ] [ "gid" ] ;
287
290
288
291
if ( node . Value == null )
289
292
return INVALID_MANIFEST_ID ;
0 commit comments