@@ -6,15 +6,19 @@ namespace FEZRepacker.Interface.Actions
66{
77 internal class PackAction : CommandLineAction
88 {
9+ private const string InputDirectoryPath = "input-directory-path" ;
10+ private const string DestinationPakPath = "destination-pak-path" ;
11+ private const string IncludePakPath = "include-pak-path" ;
12+
913 public string Name => "--pack" ;
1014 public string [ ] Aliases => new [ ] { "-p" } ;
1115 public string Description =>
1216 "Loads files from given input directory path, tries to deconvert them and pack into a destination " +
1317 ".PAK file with given path. If include .PAK path is provided, it'll add its content into the new .PAK package." ;
1418 public CommandLineArgument [ ] Arguments => new [ ] {
15- new CommandLineArgument ( "input-directory-path" ) ,
16- new CommandLineArgument ( "destination-pak-path" ) ,
17- new CommandLineArgument ( "include-pak-path" , true )
19+ new CommandLineArgument ( InputDirectoryPath ) ,
20+ new CommandLineArgument ( DestinationPakPath ) ,
21+ new CommandLineArgument ( IncludePakPath , ArgumentType . OptionalPositional )
1822 } ;
1923
2024 private class TemporaryPak : IDisposable
@@ -84,10 +88,10 @@ private void SortBundlesToPreventInvalidOrdering(ref List<FileBundle> fileBundle
8488 } ) ;
8589 }
8690
87- public void Execute ( string [ ] args )
91+ public void Execute ( Dictionary < string , string > args )
8892 {
89- string inputPath = args [ 0 ] ;
90- string outputPackagePath = args [ 1 ] ;
93+ var inputPath = args [ InputDirectoryPath ] ;
94+ var outputPackagePath = args [ DestinationPakPath ] ;
9195
9296 var fileBundlesToAdd = FileBundle . BundleFilesAtPath ( inputPath ) ;
9397 SortBundlesToPreventInvalidOrdering ( ref fileBundlesToAdd ) ;
@@ -104,9 +108,9 @@ public void Execute(string[] args)
104108 } ) ;
105109
106110
107- if ( args . Length > 2 )
111+ if ( args . TryGetValue ( IncludePakPath , out var includePackagePath ) )
108112 {
109- IncludePackageIntoWriter ( args [ 2 ] , tempPak . Writer ) ;
113+ IncludePackageIntoWriter ( includePackagePath , tempPak . Writer ) ;
110114 }
111115
112116 Console . WriteLine ( $ "Packed { tempPak . Writer . FileCount } assets into { outputPackagePath } ...") ;
0 commit comments