mirror of
https://github.com/claunia/romrepomgr.git
synced 2025-12-16 11:14:45 +00:00
Add support for internal decompressor.
This commit is contained in:
6
RomRepoMgr/Resources/Localization.Designer.cs
generated
6
RomRepoMgr/Resources/Localization.Designer.cs
generated
@@ -776,5 +776,11 @@ namespace RomRepoMgr.Resources {
|
||||
return ResourceManager.GetString("CompressionType", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string UseInternalDecompressorLabel {
|
||||
get {
|
||||
return ResourceManager.GetString("UseInternalDecompressorLabel", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,4 +384,7 @@ Tardará mucho tiempo...</value>
|
||||
<data name="CompressionType" xml:space="preserve">
|
||||
<value>Compresión</value>
|
||||
</data>
|
||||
<data name="UseInternalDecompressorLabel" xml:space="preserve">
|
||||
<value>Usar decompresor interno (soporta menos formatos)</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -392,4 +392,7 @@ This will take a long time...</value>
|
||||
<data name="CompressionType" xml:space="preserve">
|
||||
<value>Compression</value>
|
||||
</data>
|
||||
<data name="UseInternalDecompressorLabel" xml:space="preserve">
|
||||
<value>Use internal decompressor (supports less formats)</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -184,7 +184,11 @@ public sealed partial class ImportRomFolderViewModel : ViewModelBase
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
_stopwatch.Restart();
|
||||
_rootImporter.SeparateFilesAndArchives();
|
||||
|
||||
if(Settings.Settings.Current.UseInternalDecompressor)
|
||||
_rootImporter.SeparateFilesAndArchivesManaged();
|
||||
else
|
||||
_rootImporter.SeparateFilesAndArchives();
|
||||
});
|
||||
}
|
||||
else
|
||||
@@ -291,7 +295,9 @@ public sealed partial class ImportRomFolderViewModel : ViewModelBase
|
||||
RemoveFilesChecked);
|
||||
|
||||
// Extract archive
|
||||
bool ret = archiveImporter.ExtractArchive(archive);
|
||||
bool ret = Settings.Settings.Current.UseInternalDecompressor
|
||||
? archiveImporter.ExtractArchiveManaged(archive)
|
||||
: archiveImporter.ExtractArchive(archive);
|
||||
|
||||
if(!ret) return;
|
||||
|
||||
|
||||
@@ -65,6 +65,8 @@ public sealed partial class SettingsViewModel : ViewModelBase
|
||||
string _unArPath;
|
||||
[ObservableProperty]
|
||||
string _unArVersion;
|
||||
bool _useInternalDecompressor;
|
||||
bool _useInternalDecompressorChanged;
|
||||
|
||||
// Mock
|
||||
public SettingsViewModel() {}
|
||||
@@ -84,11 +86,12 @@ public sealed partial class SettingsViewModel : ViewModelBase
|
||||
DatabaseCommand = new AsyncRelayCommand(ExecuteDatabaseCommandAsync);
|
||||
SaveCommand = new RelayCommand(ExecuteSaveCommand);
|
||||
|
||||
DatabasePath = Settings.Settings.Current.DatabasePath;
|
||||
RepositoryPath = Settings.Settings.Current.RepositoryPath;
|
||||
TemporaryPath = Settings.Settings.Current.TemporaryFolder;
|
||||
UnArPath = Settings.Settings.Current.UnArchiverPath;
|
||||
Compression = Settings.Settings.Current.Compression;
|
||||
DatabasePath = Settings.Settings.Current.DatabasePath;
|
||||
RepositoryPath = Settings.Settings.Current.RepositoryPath;
|
||||
TemporaryPath = Settings.Settings.Current.TemporaryFolder;
|
||||
UnArPath = Settings.Settings.Current.UnArchiverPath;
|
||||
Compression = Settings.Settings.Current.Compression;
|
||||
UseInternalDecompressor = Settings.Settings.Current.UseInternalDecompressor;
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(UnArPath)) CheckUnAr();
|
||||
}
|
||||
@@ -145,6 +148,16 @@ public sealed partial class SettingsViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
public bool UseInternalDecompressor
|
||||
{
|
||||
get => _useInternalDecompressor;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _useInternalDecompressor, value);
|
||||
_useInternalDecompressorChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CheckUnAr()
|
||||
{
|
||||
var worker = new Compression();
|
||||
@@ -352,7 +365,14 @@ public sealed partial class SettingsViewModel : ViewModelBase
|
||||
|
||||
if(_compressionChanged) Settings.Settings.Current.Compression = Compression;
|
||||
|
||||
if(_databaseChanged || _repositoryChanged || _temporaryChanged || _unArChanged || _compressionChanged)
|
||||
if(_useInternalDecompressorChanged) Settings.Settings.Current.UseInternalDecompressor = UseInternalDecompressor;
|
||||
|
||||
if(_databaseChanged ||
|
||||
_repositoryChanged ||
|
||||
_temporaryChanged ||
|
||||
_unArChanged ||
|
||||
_compressionChanged ||
|
||||
_useInternalDecompressorChanged)
|
||||
Settings.Settings.SaveSettings();
|
||||
|
||||
_view.Close();
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<vm:SettingsViewModel />
|
||||
</Design.DataContext>
|
||||
<Border Padding="15">
|
||||
<Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto">
|
||||
<Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto">
|
||||
<Grid Grid.Row="0"
|
||||
ColumnDefinitions="*,250,Auto">
|
||||
<TextBlock Grid.Column="0"
|
||||
@@ -108,8 +108,15 @@
|
||||
<TextBlock Text="{x:Static resources:Localization.ChooseLabel}" />
|
||||
</Button>
|
||||
</Grid>
|
||||
<Grid Grid.Row="3"
|
||||
ColumnDefinitions="*,250,Auto">
|
||||
<CheckBox Grid.Row="2"
|
||||
IsChecked="{Binding UseInternalDecompressor, Mode=TwoWay}">
|
||||
<CheckBox.Content>
|
||||
<TextBlock Text="{x:Static resources:Localization.UseInternalDecompressorLabel}" />
|
||||
</CheckBox.Content>
|
||||
</CheckBox>
|
||||
<Grid Grid.Row="4"
|
||||
ColumnDefinitions="*,250,Auto"
|
||||
IsVisible="{Binding !UseInternalDecompressor}">
|
||||
<TextBlock Grid.Column="0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
@@ -130,12 +137,13 @@
|
||||
<TextBlock Text="{x:Static resources:Localization.ChooseLabel}" />
|
||||
</Button>
|
||||
</Grid>
|
||||
<TextBlock Grid.Row="4"
|
||||
<TextBlock Grid.Row="5"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding UnArVersion, Mode=OneWay}"
|
||||
FontWeight="Bold" />
|
||||
<Grid Grid.Row="5"
|
||||
FontWeight="Bold"
|
||||
IsVisible="{Binding !UseInternalDecompressor}" />
|
||||
<Grid Grid.Row="6"
|
||||
ColumnDefinitions="Auto, *">
|
||||
<TextBlock Grid.Column="0"
|
||||
VerticalAlignment="Center"
|
||||
@@ -149,7 +157,7 @@
|
||||
ItemsSource="{Binding CompressionTypes, Mode=OneWay}"
|
||||
Padding="5" />
|
||||
</Grid>
|
||||
<StackPanel Grid.Row="6"
|
||||
<StackPanel Grid.Row="7"
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Right">
|
||||
<Button HorizontalAlignment="Right"
|
||||
|
||||
Reference in New Issue
Block a user