Skip to content

Commit 2dadfb4

Browse files
feat: add command-line input folder support and update SharpCompress to 0.47.4
- Added `SetInputFolder` method to handle command-line arguments for setting the conversion input folder. - Updated `App.xaml.cs` to process startup arguments and set the folder after window rendering. - Bumped SharpCompress package version for latest fixes.
1 parent 4496175 commit 2dadfb4

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

BatchConvertToCHD/App.xaml.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ protected override void OnStartup(StartupEventArgs e)
3939

4040
base.OnStartup(e);
4141

42+
// Apply command-line argument for system ROM path
43+
if (e.Args.Length > 0 && MainWindow is MainWindow mainWindow)
44+
{
45+
var romPath = e.Args[0];
46+
mainWindow.ContentRendered += (_, _) => mainWindow.SetInputFolder(romPath);
47+
}
48+
4249
// Record usage statistics on a background thread
4350
_ = _statsService?.RecordUsageAsync();
4451

BatchConvertToCHD/BatchConvertToCHD.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
</ItemGroup>
4141

4242
<ItemGroup>
43-
<PackageReference Include="SharpCompress" Version="0.47.3" />
43+
<PackageReference Include="SharpCompress" Version="0.47.4" />
4444
</ItemGroup>
4545

4646
<ItemGroup>

BatchConvertToCHD/MainWindow.xaml.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,20 @@ private void LogMessage(string message)
439439
}));
440440
}
441441

442+
public void SetInputFolder(string path)
443+
{
444+
if (Directory.Exists(path))
445+
{
446+
ConversionInputFolderTextBox.Text = path;
447+
LogMessage($"Input folder set from command line: {path}");
448+
_ = LoadFilesForConversionAsync();
449+
}
450+
else
451+
{
452+
LogMessage($"Warning: Command line path does not exist: {path}");
453+
}
454+
}
455+
442456
private void BrowseConversionInputButton_Click(object sender, RoutedEventArgs e)
443457
{
444458
HandleFolderBrowse(ConversionInputFolderTextBox, "Conversion input");

0 commit comments

Comments
 (0)