Stop redundantly downloading media when re-exporting (#395)

This commit is contained in:
Andrew Kolos 2020-10-23 09:38:15 -04:00 committed by GitHub
parent 949c9d3f1e
commit 520e023aff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 70 additions and 8 deletions

View file

@ -16,6 +16,8 @@ namespace DiscordChatExporter.Gui.Services
public int ParallelLimit { get; set; } = 1;
public bool ShouldReuseMedia { get; set; } = false;
public AuthToken? LastToken { get; set; }
public ExportFormat LastExportFormat { get; set; } = ExportFormat.HtmlDark;

View file

@ -37,6 +37,12 @@ namespace DiscordChatExporter.Gui.ViewModels.Dialogs
get => _settingsService.ParallelLimit;
set => _settingsService.ParallelLimit = value.Clamp(1, 10);
}
public bool ShouldReuseMedia
{
get => _settingsService.ShouldReuseMedia;
set => _settingsService.ShouldReuseMedia = value;
}
public SettingsViewModel(SettingsService settingsService)
{

View file

@ -204,6 +204,7 @@ namespace DiscordChatExporter.Gui.ViewModels
dialog.Before,
dialog.PartitionLimit,
dialog.ShouldDownloadMedia,
_settingsService.ShouldReuseMedia,
_settingsService.DateFormat
);

View file

@ -7,7 +7,7 @@
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:s="https://github.com/canton7/Stylet"
Width="300"
Width="310"
d:DataContext="{d:DesignInstance Type=dialogs:SettingsViewModel}"
Style="{DynamicResource MaterialDesignRoot}"
mc:Ignorable="d">
@ -65,6 +65,21 @@
IsChecked="{Binding IsTokenPersisted}" />
</DockPanel>
<!-- Reuse Media -->
<DockPanel
Background="Transparent"
LastChildFill="False"
ToolTip="If the media folder already exists, reuse media inside it to skip downloads">
<TextBlock
Margin="16,8"
DockPanel.Dock="Left"
Text="Reuse previously downloaded media" />
<ToggleButton
Margin="16,8"
DockPanel.Dock="Right"
IsChecked="{Binding ShouldReuseMedia}" />
</DockPanel>
<!-- Date format -->
<TextBox
Margin="16,8"