-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
61 changed files
with
2,650 additions
and
509 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System.CommandLine; | ||
using System.CommandLine.Hosting; | ||
using System.CommandLine.Invocation; | ||
using System.CommandLine.NamingConventionBinder; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace RFGM.Archiver.Commandline; | ||
|
||
public class AppRootCommand : RootCommand | ||
{ | ||
public override string Description => ArchiverUtils.Banner; | ||
private readonly Argument<List<string>> inputArg = new("input", "Any supported file to unpack, or a directory to pack") | ||
{ | ||
IsHidden = true, | ||
Arity = ArgumentArity.OneOrMore | ||
}; | ||
|
||
private readonly Option<bool> forceArg = new([ | ||
"-f", | ||
"--force" | ||
], | ||
"Overwrite output if exists") | ||
{ | ||
IsHidden = true | ||
}; | ||
|
||
public AppRootCommand() | ||
{ | ||
AddArgument(inputArg); | ||
AddOption(forceArg); | ||
AddCommand(new Unpack()); | ||
AddCommand(new Metadata()); | ||
AddCommand(new AppTest()); | ||
AddCommand(new Pack()); | ||
|
||
Handler = CommandHandler.Create(Handle); | ||
} | ||
|
||
/// <summary> | ||
/// Simplified scenario where user drops files on the .exe | ||
/// </summary> | ||
private async Task<int> Handle(InvocationContext context, CancellationToken token) | ||
{ | ||
var input = context.ParseResult.GetValueForArgument(inputArg); | ||
var force = context.ParseResult.GetValueForOption(forceArg); | ||
var archiver = context.GetHost().Services.GetRequiredService<Services.Archiver>(); | ||
return (int)await archiver.CommandDefault(input, force, token); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace RFGM.Formats; | ||
namespace RFGM.Archiver; | ||
|
||
public static class Constants | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace RFGM.Archiver; | ||
|
||
public enum ExitCode | ||
{ | ||
Ok, | ||
UnhandledException, | ||
FailedTasks, | ||
NoOutput, | ||
Rick = 42, | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
using RFGM.Formats.Abstractions; | ||
|
||
namespace RFGM.Archiver.Models.Messages; | ||
|
||
public record CollectMetadataMessage(EntryInfo EntryInfo, Breadcrumbs Breadcrumbs, Stream Primary) : IMessage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace RFGM.Archiver.Models.Messages; | ||
|
||
public record DecideMessage(string Input, string? Output, PackSettings? PackSettings, UnpackSettings? UnpackSettings) : IMessage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
using System.IO.Abstractions; | ||
using RFGM.Formats.Abstractions; | ||
|
||
namespace RFGM.Archiver.Models.Messages; | ||
|
||
public record DecodeFileMessage(EntryInfo EntryInfo, Stream Primary, Breadcrumbs Breadcrumbs, IDirectoryInfo Destination, UnpackSettings Settings) : IMessage; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.