mirror of
https://github.com/claunia/romrepomgr.git
synced 2025-12-16 11:14:45 +00:00
Add support to compress repository with zstd.
This commit is contained in:
6
RomRepoMgr/Resources/Localization.Designer.cs
generated
6
RomRepoMgr/Resources/Localization.Designer.cs
generated
@@ -770,5 +770,11 @@ namespace RomRepoMgr.Resources {
|
||||
return ResourceManager.GetString("ProgressLabel", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string CompressionType {
|
||||
get {
|
||||
return ResourceManager.GetString("CompressionType", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,4 +381,7 @@ Tardará mucho tiempo...</value>
|
||||
<data name="ProgressLabel" xml:space="preserve">
|
||||
<value>Progreso</value>
|
||||
</data>
|
||||
<data name="CompressionType" xml:space="preserve">
|
||||
<value>Compresión</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -389,4 +389,7 @@ This will take a long time...</value>
|
||||
<data name="ProgressLabel" xml:space="preserve">
|
||||
<value>Progress</value>
|
||||
</data>
|
||||
<data name="CompressionType" xml:space="preserve">
|
||||
<value>Compression</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -26,6 +26,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using Avalonia.Platform.Storage;
|
||||
@@ -39,6 +40,7 @@ using RomRepoMgr.Core.EventArgs;
|
||||
using RomRepoMgr.Core.Workers;
|
||||
using RomRepoMgr.Database;
|
||||
using RomRepoMgr.Resources;
|
||||
using RomRepoMgr.Settings;
|
||||
using RomRepoMgr.Views;
|
||||
using Serilog;
|
||||
using Serilog.Extensions.Logging;
|
||||
@@ -49,13 +51,16 @@ namespace RomRepoMgr.ViewModels;
|
||||
public sealed partial class SettingsViewModel : ViewModelBase
|
||||
{
|
||||
readonly SettingsDialog _view;
|
||||
bool _databaseChanged;
|
||||
string _databasePath;
|
||||
bool _repositoryChanged;
|
||||
string _repositoryPath;
|
||||
bool _temporaryChanged;
|
||||
string _temporaryPath;
|
||||
bool _unArChanged;
|
||||
|
||||
CompressionType _compression;
|
||||
bool _compressionChanged;
|
||||
bool _databaseChanged;
|
||||
string _databasePath;
|
||||
bool _repositoryChanged;
|
||||
string _repositoryPath;
|
||||
bool _temporaryChanged;
|
||||
string _temporaryPath;
|
||||
bool _unArChanged;
|
||||
[ObservableProperty]
|
||||
string _unArPath;
|
||||
[ObservableProperty]
|
||||
@@ -83,10 +88,14 @@ public sealed partial class SettingsViewModel : ViewModelBase
|
||||
RepositoryPath = Settings.Settings.Current.RepositoryPath;
|
||||
TemporaryPath = Settings.Settings.Current.TemporaryFolder;
|
||||
UnArPath = Settings.Settings.Current.UnArchiverPath;
|
||||
Compression = Settings.Settings.Current.Compression;
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(UnArPath)) CheckUnAr();
|
||||
}
|
||||
|
||||
public List<CompressionType> CompressionTypes { get; } =
|
||||
Enum.GetValues(typeof(CompressionType)).Cast<CompressionType>().ToList();
|
||||
|
||||
public ICommand UnArCommand { get; }
|
||||
public ICommand TemporaryCommand { get; }
|
||||
public ICommand RepositoryCommand { get; }
|
||||
@@ -126,6 +135,16 @@ public sealed partial class SettingsViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
public CompressionType Compression
|
||||
{
|
||||
get => _compression;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _compression, value);
|
||||
_compressionChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CheckUnAr()
|
||||
{
|
||||
var worker = new Compression();
|
||||
@@ -331,7 +350,9 @@ public sealed partial class SettingsViewModel : ViewModelBase
|
||||
Settings.Settings.UnArUsable = true;
|
||||
}
|
||||
|
||||
if(_databaseChanged || _repositoryChanged || _temporaryChanged || _unArChanged)
|
||||
if(_compressionChanged) Settings.Settings.Current.Compression = Compression;
|
||||
|
||||
if(_databaseChanged || _repositoryChanged || _temporaryChanged || _unArChanged || _compressionChanged)
|
||||
Settings.Settings.SaveSettings();
|
||||
|
||||
_view.Close();
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<vm:SettingsViewModel />
|
||||
</Design.DataContext>
|
||||
<Border Padding="15">
|
||||
<Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto">
|
||||
<Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto">
|
||||
<Grid Grid.Row="0"
|
||||
ColumnDefinitions="*,250,Auto">
|
||||
<TextBlock Grid.Column="0"
|
||||
@@ -135,7 +135,21 @@
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding UnArVersion, Mode=OneWay}"
|
||||
FontWeight="Bold" />
|
||||
<StackPanel Grid.Row="5"
|
||||
<Grid Grid.Row="5"
|
||||
ColumnDefinitions="Auto, *">
|
||||
<TextBlock Grid.Column="0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{x:Static resources:Localization.CompressionType}"
|
||||
FontWeight="Bold"
|
||||
Padding="5" />
|
||||
<ComboBox Grid.Column="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
SelectedItem="{Binding Compression, Mode=TwoWay}"
|
||||
ItemsSource="{Binding CompressionTypes, Mode=OneWay}"
|
||||
Padding="5" />
|
||||
</Grid>
|
||||
<StackPanel Grid.Row="6"
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Right">
|
||||
<Button HorizontalAlignment="Right"
|
||||
|
||||
Reference in New Issue
Block a user