|
|
@ -1,5 +1,6 @@
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.IO;
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
using Cogwheel;
|
|
|
|
using Cogwheel;
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
using DiscordChatExporter.Core.Exporting;
|
|
|
|
using DiscordChatExporter.Core.Exporting;
|
|
|
@ -8,57 +9,126 @@ using DiscordChatExporter.Gui.Models;
|
|
|
|
|
|
|
|
|
|
|
|
namespace DiscordChatExporter.Gui.Services;
|
|
|
|
namespace DiscordChatExporter.Gui.Services;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Can't use [ObservableProperty] here because System.Text.Json's source generator doesn't see
|
|
|
|
|
|
|
|
// the generated properties.
|
|
|
|
[INotifyPropertyChanged]
|
|
|
|
[INotifyPropertyChanged]
|
|
|
|
public partial class SettingsService()
|
|
|
|
public partial class SettingsService()
|
|
|
|
: SettingsBase(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Settings.dat"))
|
|
|
|
: SettingsBase(
|
|
|
|
|
|
|
|
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Settings.dat"),
|
|
|
|
|
|
|
|
SerializerContext.Default
|
|
|
|
|
|
|
|
)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
|
|
private bool _isUkraineSupportMessageEnabled = true;
|
|
|
|
private bool _isUkraineSupportMessageEnabled = true;
|
|
|
|
|
|
|
|
public bool IsUkraineSupportMessageEnabled
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => _isUkraineSupportMessageEnabled;
|
|
|
|
|
|
|
|
set => SetProperty(ref _isUkraineSupportMessageEnabled, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
|
|
private ThemeVariant _theme;
|
|
|
|
private ThemeVariant _theme;
|
|
|
|
|
|
|
|
public ThemeVariant Theme
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => _theme;
|
|
|
|
|
|
|
|
set => SetProperty(ref _theme, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
|
|
private bool _isAutoUpdateEnabled = true;
|
|
|
|
private bool _isAutoUpdateEnabled = true;
|
|
|
|
|
|
|
|
public bool IsAutoUpdateEnabled
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => _isAutoUpdateEnabled;
|
|
|
|
|
|
|
|
set => SetProperty(ref _isAutoUpdateEnabled, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
|
|
private bool _isTokenPersisted = true;
|
|
|
|
private bool _isTokenPersisted = true;
|
|
|
|
|
|
|
|
public bool IsTokenPersisted
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => _isTokenPersisted;
|
|
|
|
|
|
|
|
set => SetProperty(ref _isTokenPersisted, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
|
|
private ThreadInclusionMode _threadInclusionMode;
|
|
|
|
private ThreadInclusionMode _threadInclusionMode;
|
|
|
|
|
|
|
|
public ThreadInclusionMode ThreadInclusionMode
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => _threadInclusionMode;
|
|
|
|
|
|
|
|
set => SetProperty(ref _threadInclusionMode, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
|
|
private string? _locale;
|
|
|
|
private string? _locale;
|
|
|
|
|
|
|
|
public string? Locale
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => _locale;
|
|
|
|
|
|
|
|
set => SetProperty(ref _locale, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
|
|
private bool _isUtcNormalizationEnabled;
|
|
|
|
private bool _isUtcNormalizationEnabled;
|
|
|
|
|
|
|
|
public bool IsUtcNormalizationEnabled
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => _isUtcNormalizationEnabled;
|
|
|
|
|
|
|
|
set => SetProperty(ref _isUtcNormalizationEnabled, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
|
|
private int _parallelLimit = 1;
|
|
|
|
private int _parallelLimit = 1;
|
|
|
|
|
|
|
|
public int ParallelLimit
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => _parallelLimit;
|
|
|
|
|
|
|
|
set => SetProperty(ref _parallelLimit, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
|
|
private string? _lastToken;
|
|
|
|
private string? _lastToken;
|
|
|
|
|
|
|
|
public string? LastToken
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => _lastToken;
|
|
|
|
|
|
|
|
set => SetProperty(ref _lastToken, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
|
|
private ExportFormat _lastExportFormat = ExportFormat.HtmlDark;
|
|
|
|
private ExportFormat _lastExportFormat = ExportFormat.HtmlDark;
|
|
|
|
|
|
|
|
public ExportFormat LastExportFormat
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => _lastExportFormat;
|
|
|
|
|
|
|
|
set => SetProperty(ref _lastExportFormat, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
|
|
private string? _lastPartitionLimitValue;
|
|
|
|
private string? _lastPartitionLimitValue;
|
|
|
|
|
|
|
|
public string? LastPartitionLimitValue
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => _lastPartitionLimitValue;
|
|
|
|
|
|
|
|
set => SetProperty(ref _lastPartitionLimitValue, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
|
|
private string? _lastMessageFilterValue;
|
|
|
|
private string? _lastMessageFilterValue;
|
|
|
|
|
|
|
|
public string? LastMessageFilterValue
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => _lastMessageFilterValue;
|
|
|
|
|
|
|
|
set => SetProperty(ref _lastMessageFilterValue, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
|
|
private bool _lastShouldFormatMarkdown = true;
|
|
|
|
private bool _lastShouldFormatMarkdown = true;
|
|
|
|
|
|
|
|
public bool LastShouldFormatMarkdown
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => _lastShouldFormatMarkdown;
|
|
|
|
|
|
|
|
set => SetProperty(ref _lastShouldFormatMarkdown, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
|
|
private bool _lastShouldDownloadAssets;
|
|
|
|
private bool _lastShouldDownloadAssets;
|
|
|
|
|
|
|
|
public bool LastShouldDownloadAssets
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => _lastShouldDownloadAssets;
|
|
|
|
|
|
|
|
set => SetProperty(ref _lastShouldDownloadAssets, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
|
|
private bool _lastShouldReuseAssets;
|
|
|
|
private bool _lastShouldReuseAssets;
|
|
|
|
|
|
|
|
public bool LastShouldReuseAssets
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => _lastShouldReuseAssets;
|
|
|
|
|
|
|
|
set => SetProperty(ref _lastShouldReuseAssets, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
|
|
|
private string? _lastAssetsDirPath;
|
|
|
|
private string? _lastAssetsDirPath;
|
|
|
|
|
|
|
|
public string? LastAssetsDirPath
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
get => _lastAssetsDirPath;
|
|
|
|
|
|
|
|
set => SetProperty(ref _lastAssetsDirPath, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void Save()
|
|
|
|
public override void Save()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -72,3 +142,9 @@ public partial class SettingsService()
|
|
|
|
LastToken = lastToken;
|
|
|
|
LastToken = lastToken;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public partial class SettingsService
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
[JsonSerializable(typeof(SettingsService))]
|
|
|
|
|
|
|
|
private partial class SerializerContext : JsonSerializerContext;
|
|
|
|
|
|
|
|
}
|
|
|
|