Skip to content

Commit

Permalink
add support for automatically retrying uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
tunip3 committed Sep 28, 2022
1 parent f313269 commit 043d573
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 73 deletions.
9 changes: 7 additions & 2 deletions Scarlett-Sideloader/Classes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class CommandArguments
public string? groups { get; set; }
public bool original { get; set; }
public bool force { get; set; }

public int attempts { get ;set; }
}

public class CommandArgumentsBinder : BinderBase<CommandArguments>
Expand All @@ -38,8 +40,9 @@ public class CommandArgumentsBinder : BinderBase<CommandArguments>
private readonly Option<string?> _groupsOption;
private readonly Option<bool> _originalOption;
private readonly Option<bool> _forceOption;
private readonly Option<int> _retryOption;

public CommandArgumentsBinder(Argument<string> cookieArgument, Argument<FileInfo> fileArgument, Option<string> nameOption, Option<string> descriptionOption, Option<string> screenshotOption, Option<bool> appOption, Option<bool> publicOption, Option<string> emailsOption, Option<string> groupsOption, Option<bool> originalOption, Option<bool> forceOption)
public CommandArgumentsBinder(Argument<string> cookieArgument, Argument<FileInfo> fileArgument, Option<string> nameOption, Option<string> descriptionOption, Option<string> screenshotOption, Option<bool> appOption, Option<bool> publicOption, Option<string> emailsOption, Option<string> groupsOption, Option<bool> originalOption, Option<bool> forceOption, Option<int> retryOption)
{
_cookieArgument = cookieArgument;
_fileArgument = fileArgument;
Expand All @@ -52,6 +55,7 @@ public CommandArgumentsBinder(Argument<string> cookieArgument, Argument<FileInfo
_groupsOption = groupsOption;
_originalOption = originalOption;
_forceOption = forceOption;
_retryOption = retryOption;
}

protected override CommandArguments GetBoundValue(BindingContext bindingContext) =>
Expand All @@ -67,7 +71,8 @@ protected override CommandArguments GetBoundValue(BindingContext bindingContext)
emails = bindingContext.ParseResult.GetValueForOption(_emailsOption),
groups = bindingContext.ParseResult.GetValueForOption(_groupsOption),
original = bindingContext.ParseResult.GetValueForOption(_originalOption),
force = bindingContext.ParseResult.GetValueForOption(_forceOption)
force = bindingContext.ParseResult.GetValueForOption(_forceOption),
attempts = bindingContext.ParseResult.GetValueForOption(_retryOption)
};
}

Expand Down
Loading

0 comments on commit 043d573

Please sign in to comment.