mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-14 07:43:31 -07:00
The setting the exporter uses to handle existing export files has been made configurable in both the CLI and the GUI (instead of being hardcoded): - A prev-export option has been added to all CLI export commands, which sets the file exists handling for the respective command. - A Previous Export option has been added to the GUI settings, which sets the file exists handling that's used for exports.
93 lines
2.6 KiB
C#
93 lines
2.6 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Text.Json.Serialization;
|
|
using Cogwheel;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using DiscordChatExporter.Core.Discord;
|
|
using DiscordChatExporter.Core.Exporting;
|
|
using DiscordChatExporter.Gui.Framework;
|
|
using DiscordChatExporter.Gui.Models;
|
|
|
|
namespace DiscordChatExporter.Gui.Services;
|
|
|
|
[ObservableObject]
|
|
public partial class SettingsService()
|
|
: SettingsBase(
|
|
Path.Combine(AppContext.BaseDirectory, "Settings.dat"),
|
|
SerializerContext.Default
|
|
)
|
|
{
|
|
[ObservableProperty]
|
|
public partial bool IsUkraineSupportMessageEnabled { get; set; } = true;
|
|
|
|
[ObservableProperty]
|
|
public partial ThemeVariant Theme { get; set; }
|
|
|
|
[ObservableProperty]
|
|
public partial bool IsAutoUpdateEnabled { get; set; } = true;
|
|
|
|
[ObservableProperty]
|
|
public partial bool IsTokenPersisted { get; set; } = true;
|
|
|
|
[ObservableProperty]
|
|
public partial RateLimitPreference RateLimitPreference { get; set; } =
|
|
RateLimitPreference.RespectAll;
|
|
|
|
[ObservableProperty]
|
|
public partial ThreadInclusionMode ThreadInclusionMode { get; set; }
|
|
|
|
[ObservableProperty]
|
|
public partial FileExistsHandling FileExistsHandling { get; set; }
|
|
|
|
[ObservableProperty]
|
|
public partial string? Locale { get; set; }
|
|
|
|
[ObservableProperty]
|
|
public partial bool IsUtcNormalizationEnabled { get; set; }
|
|
|
|
[ObservableProperty]
|
|
public partial int ParallelLimit { get; set; } = 1;
|
|
|
|
[ObservableProperty]
|
|
public partial string? LastToken { get; set; }
|
|
|
|
[ObservableProperty]
|
|
public partial ExportFormat LastExportFormat { get; set; } = ExportFormat.HtmlDark;
|
|
|
|
[ObservableProperty]
|
|
public partial string? LastPartitionLimitValue { get; set; }
|
|
|
|
[ObservableProperty]
|
|
public partial string? LastMessageFilterValue { get; set; }
|
|
|
|
[ObservableProperty]
|
|
public partial bool LastShouldFormatMarkdown { get; set; } = true;
|
|
|
|
[ObservableProperty]
|
|
public partial bool LastShouldDownloadAssets { get; set; }
|
|
|
|
[ObservableProperty]
|
|
public partial bool LastShouldReuseAssets { get; set; }
|
|
|
|
[ObservableProperty]
|
|
public partial string? LastAssetsDirPath { get; set; }
|
|
|
|
public override void Save()
|
|
{
|
|
// Clear the token if it's not supposed to be persisted
|
|
var lastToken = LastToken;
|
|
if (!IsTokenPersisted)
|
|
LastToken = null;
|
|
|
|
base.Save();
|
|
|
|
LastToken = lastToken;
|
|
}
|
|
}
|
|
|
|
public partial class SettingsService
|
|
{
|
|
[JsonSerializable(typeof(SettingsService))]
|
|
private partial class SerializerContext : JsonSerializerContext;
|
|
}
|