DepotDownloader icon indicating copy to clipboard operation
DepotDownloader copied to clipboard

Migrate to System.CommandLine

Open js6pak opened this issue 3 years ago • 6 comments

Currently input handling is really... unconventional, this PR uses the commandline parser library to make input more standardized (and flexible).

Closes #86, closes #88, closes #221

  • [ ] Update README
  • [ ] Test every single use case

image

js6pak avatar Jul 14 '21 00:07 js6pak

The general standardization here seems fine. I will double check and make sure specifying multiple --depots (and now --os as well) works reasonably.

azuisleet avatar Jul 16 '21 22:07 azuisleet

Since this PR already adds extra array support to some options, #221 could be handled as well.

xPaw avatar Jul 17 '21 09:07 xPaw

Tried this branch but I'm getting Download failed to due to an unhandled exception: Config already loaded when using two --pubfile to download two workshop items (since this PR handles #221 ).

Depot 108600 - Downloaded 0 bytes (0 bytes uncompressed)
Total downloaded: 0 bytes (0 bytes uncompressed) from 1 depots
Download failed to due to an unhandled exception: Config already loaded
Disconnected from Steam
Unhandled exception: System.Exception: Config already loaded
   at DepotDownloader.DepotConfigStore.LoadFromFile(String filename) in D:\Repositories\DepotDownloader\DepotDownloader\DepotConfigStore.cs:line 32
   at DepotDownloader.ContentDownloader.DownloadAppAsync(UInt32 appId, List`1 depotManifestIds, String branch, String[] os, String[] arch, String[] language, Boolean lv, Boolean isUgc) in D:\Repositories\DepotDownloader\DepotDownloader\ContentDownloader.cs:line 479
   at DepotDownloader.ContentDownloader.DownloadPubfileAsync(UInt32 appId, UInt64[] publishedFileIds) in D:\Repositories\DepotDownloader\DepotDownloader\ContentDownloader.cs:line 403
   at DepotDownloader.Program.DownloadAsync(InputModel input) in D:\Repositories\DepotDownloader\DepotDownloader\Program.cs:line 200
   at System.CommandLine.NamingConventionBinder.CommandHandler.GetExitCodeAsync(Object returnValue, InvocationContext context)
   at System.CommandLine.NamingConventionBinder.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass15_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass26_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass24_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__23_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass21_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseDebugDirective>b__8_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__7_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass11_0.<<UseExceptionHandler>b__0>d.MoveNext()
[d2eb2e1eb0984d04a52f125d3adebc50/TcpConnection] Socket exception occurred while reading packet: System.IO.IOException: Connection lost while reading packet header.
 ---> System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
   at System.IO.BinaryReader.InternalRead(Int32 numBytes)
   at System.IO.BinaryReader.ReadUInt32()
   at SteamKit2.TcpConnection.ReadPacket()
   --- End of inner exception stack trace ---
   at SteamKit2.TcpConnection.ReadPacket()
   at SteamKit2.TcpConnection.NetLoop()
Press any key to continue . . .

Files were successfully downloaded unlike the message says 0 bytes.

Full log with --debug switch: https://gist.github.com/R4to0/20151c87e659fe2d2e0eef9b7b66ad5c Command line used: %depotdl% --debug --app 108600 --pubfile 1516836158 --pubfile 2196102849

R4to0 avatar Jan 28 '23 21:01 R4to0

Are there any remaining issues with this PR?

xPaw avatar Apr 26 '23 09:04 xPaw

Tried this branch but I'm getting Download failed to due to an unhandled exception: Config already loaded when using two --pubfile to download two workshop items (since this PR handles #221 ).

That should be fixed by 5567b1a (#234)

js6pak avatar Jul 17 '23 23:07 js6pak

That should be fixed by 5567b1a (#234)

Worked nicely! Only downside is that the downloaded files goes to the same directory now mixing content of both IDs (depots/<appid>/<buildid>), but that's for a different topic as the original with single pubid also did that when you ran depotdownloader twice with different pubfile ids.

R4to0 avatar Jul 19 '23 22:07 R4to0