@@ -12,6 +12,7 @@ public static void Main(string[] args)
1212 bool extract = true ;
1313 bool outputInfo = false ;
1414 string outputDirectory = string . Empty ;
15+ bool useOld = false ;
1516
1617 // If we have no args, show the help and quit
1718 if ( args == null || args . Length == 0 )
@@ -41,6 +42,10 @@ public static void Main(string[] args)
4142 {
4243 extract = false ;
4344 }
45+ else if ( arg == "-u" || arg == "--use-old" )
46+ {
47+ useOld = true ;
48+ }
4449 else if ( arg == "-o" || arg == "--output" )
4550 {
4651 if ( firstFileIndex == args . Length - 1 )
@@ -68,9 +73,9 @@ public static void Main(string[] args)
6873 {
6974 string arg = args [ i ] ;
7075 if ( arg . EndsWith ( ".cab" , StringComparison . OrdinalIgnoreCase ) )
71- ProcessCabinetPath ( arg , outputInfo , extract , outputDirectory ) ;
76+ ProcessCabinetPath ( arg , outputInfo , extract , useOld , outputDirectory ) ;
7277 else if ( arg . EndsWith ( ".hdr" , StringComparison . OrdinalIgnoreCase ) )
73- ProcessCabinetPath ( arg , outputInfo , extract , outputDirectory ) ;
78+ ProcessCabinetPath ( arg , outputInfo , extract , useOld , outputDirectory ) ;
7479 else
7580 Console . WriteLine ( $ "{ arg } is not a recognized file by extension") ;
7681 }
@@ -95,6 +100,7 @@ private static void DisplayHelp()
95100 Console . WriteLine ( " -i, --info Display cabinet information" ) ;
96101 Console . WriteLine ( " -n, --no-extract Don't extract the cabinet" ) ;
97102 Console . WriteLine ( " -o, --output <path> Set the output directory for extraction" ) ;
103+ Console . WriteLine ( " -u, --use-old Use old extraction method" ) ;
98104 Console . WriteLine ( ) ;
99105 }
100106
@@ -104,7 +110,7 @@ private static void DisplayHelp()
104110 /// <param name="file">Name of the file to process</param>
105111 /// <param name="outputInfo">True to display the cabinet information, false otherwise</param>
106112 /// <param name="outputDirectory">Output directory for extraction</param>
107- private static void ProcessCabinetPath ( string file , bool outputInfo , bool extract , string outputDirectory )
113+ private static void ProcessCabinetPath ( string file , bool outputInfo , bool extract , bool useOld , string outputDirectory )
108114 {
109115 if ( ! File . Exists ( file ) )
110116 {
@@ -178,7 +184,7 @@ private static void ProcessCabinetPath(string file, bool outputInfo, bool extrac
178184 Directory . CreateDirectory ( directoryName ) ;
179185
180186 Console . WriteLine ( $ "Outputting file at index { i } to { newfile } ...") ;
181- cab . FileSave ( i , newfile ) ;
187+ cab . FileSave ( i , newfile , useOld ) ;
182188 }
183189 }
184190 }
0 commit comments