Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to System.CommandLine #234

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

js6pak
Copy link
Contributor

@js6pak js6pak commented Jul 14, 2021

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

@yaakov-h yaakov-h requested a review from azuisleet July 14, 2021 00:15
@js6pak js6pak changed the title Migrate System.CommandLine Migrate to System.CommandLine Jul 14, 2021
@azuisleet
Copy link
Member

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

@js6pak js6pak marked this pull request as ready for review July 16, 2021 23:35
@xPaw
Copy link
Member

xPaw commented Jul 17, 2021

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

DepotDownloader/Program.cs Outdated Show resolved Hide resolved
@R4to0
Copy link

R4to0 commented Jan 28, 2023

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

@xPaw
Copy link
Member

xPaw commented Apr 26, 2023

Are there any remaining issues with this PR?

# Conflicts:
#	DepotDownloader/ContentDownloader.cs
#	DepotDownloader/DepotDownloader.csproj
#	DepotDownloader/Program.cs
@js6pak
Copy link
Contributor Author

js6pak commented Jul 17, 2023

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)

@R4to0
Copy link

R4to0 commented Jul 19, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants