-
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: a new
xo
command added to CLI to perform extraction while ove…
…rwriting duplicates and preserving the original folder structure (#212) * Added the ability to remove duplicate files using the xo parameter * Added test methods and expected results files for overwrite extraction while maintaining folder structure * Improved the logic for deleting duplicate files * Moved ExtractionMode file from CLI project to Core project * updated extraction logic to match new duplicate files design * Updated test files to match the new order of the new duplicate files design * Amended the code according to Codecy comment about optional param * change default extraction name to "Default" instead of "None" for better description and readability * chore: suggested simplification proposal * Fixed code typos in getExtractionMode method * Fixed Codecy code comment --------- Co-authored-by: Scott Willeke <[email protected]>
- Loading branch information
1 parent
c3b568b
commit c5944b4
Showing
12 changed files
with
805 additions
and
29 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
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 |
---|---|---|
|
@@ -23,12 +23,10 @@ | |
// Scott Willeke ([email protected]) | ||
// | ||
#region Using directives | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using LessMsi.Msi; | ||
|
||
#endregion | ||
|
||
namespace LessMsi.Cli | ||
|
@@ -63,6 +61,7 @@ public static int Main(string[] args) | |
var subcommands = new Dictionary<string, LessMsiCommand> { | ||
{"o", new OpenGuiCommand()}, | ||
{"x", extractCommand}, | ||
{"xo", extractCommand}, | ||
{"xfo", extractCommand}, | ||
{"xfr", extractCommand}, | ||
{"/x", extractCommand}, | ||
|
@@ -107,7 +106,7 @@ public static int Main(string[] args) | |
/// <param name="msiFileName">The path of the specified MSI file.</param> | ||
/// <param name="outDirName">The directory to extract to. If empty it will use the current directory.</param> | ||
/// <param name="filesToExtract">The files to be extracted from the msi. If empty all files will be extracted.</param> | ||
/// /// <param name="extractionMode">Enum value for files extraction without folder structure</param> | ||
/// <param name="extractionMode">Enum value for files extraction without folder structure</param> | ||
public static void DoExtraction(string msiFileName, string outDirName, List<string> filesToExtract, ExtractionMode extractionMode) | ||
{ | ||
msiFileName = EnsureAbsolutePath(msiFileName); | ||
|
@@ -127,7 +126,7 @@ public static void DoExtraction(string msiFileName, string outDirName, List<stri | |
if (isExtractionModeFlat(extractionMode)) | ||
{ | ||
string tempOutDirName = $"{outDirName}{TempFolderSuffix}"; | ||
Wixtracts.ExtractFiles(msiFile, tempOutDirName, filesToExtract.ToArray(), PrintProgress); | ||
Wixtracts.ExtractFiles(msiFile, tempOutDirName, filesToExtract.ToArray(), PrintProgress, extractionMode); | ||
|
||
var fileNameCountingDict = new Dictionary<string, int>(); | ||
|
||
|
@@ -138,7 +137,7 @@ public static void DoExtraction(string msiFileName, string outDirName, List<stri | |
} | ||
else | ||
{ | ||
Wixtracts.ExtractFiles(msiFile, outDirName, filesToExtract.ToArray(), PrintProgress); | ||
Wixtracts.ExtractFiles(msiFile, outDirName, filesToExtract.ToArray(), PrintProgress, extractionMode); | ||
} | ||
} | ||
|
||
|
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 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
Oops, something went wrong.