namespace DownKyi.Core.Settings; public partial class SettingsManager { // 默认下载完成后的操作 private readonly AfterDownloadOperation _afterDownload = AfterDownloadOperation.NONE; // 是否监听剪贴板 private readonly AllowStatus _isListenClipboard = AllowStatus.YES; // 视频详情页面是否自动解析 private readonly AllowStatus _isAutoParseVideo = AllowStatus.NO; // 默认的视频解析项 private readonly ParseScope _parseScope = ParseScope.NONE; // 解析后自动下载解析视频 private readonly AllowStatus _isAutoDownloadAll = AllowStatus.NO; // 下载完成列表排序 private readonly DownloadFinishedSort _finishedSort = DownloadFinishedSort.DownloadAsc; // 重复下载策略 private readonly RepeatDownloadStrategy _repeatDownloadStrategy = RepeatDownloadStrategy.Ask; // 重复文件自动添加数字后缀 private readonly bool _repeatFileAutoAddNumberSuffix = false; public ThemeMode GetThemeMode() { appSettings = GetSettings(); if (appSettings.Basic.ThemeMode == ThemeMode.Default) { // 第一次获取,先设置默认值 SetThemeMode(ThemeMode.Default); return ThemeMode.Default; } return appSettings.Basic.ThemeMode; } public bool SetThemeMode(ThemeMode themeMode) { appSettings.Basic.ThemeMode = themeMode; return SetSettings(); } /// /// 获取下载完成后的操作 /// /// public AfterDownloadOperation GetAfterDownloadOperation() { appSettings = GetSettings(); if (appSettings.Basic.AfterDownload == AfterDownloadOperation.NOT_SET) { // 第一次获取,先设置默认值 SetAfterDownloadOperation(_afterDownload); return _afterDownload; } return appSettings.Basic.AfterDownload; } /// /// 设置下载完成后的操作 /// /// /// public bool SetAfterDownloadOperation(AfterDownloadOperation afterDownload) { appSettings.Basic.AfterDownload = afterDownload; return SetSettings(); } /// /// 是否监听剪贴板 /// /// public AllowStatus IsListenClipboard() { appSettings = GetSettings(); if (appSettings.Basic.IsListenClipboard == AllowStatus.NONE) { // 第一次获取,先设置默认值 IsListenClipboard(_isListenClipboard); return _isListenClipboard; } return appSettings.Basic.IsListenClipboard; } /// /// 是否监听剪贴板 /// /// /// public bool IsListenClipboard(AllowStatus isListen) { appSettings.Basic.IsListenClipboard = isListen; return SetSettings(); } /// /// 视频详情页面是否自动解析 /// /// public AllowStatus IsAutoParseVideo() { appSettings = GetSettings(); if (appSettings.Basic.IsAutoParseVideo == AllowStatus.NONE) { // 第一次获取,先设置默认值 IsAutoParseVideo(_isAutoParseVideo); return _isAutoParseVideo; } return appSettings.Basic.IsAutoParseVideo; } /// /// 视频详情页面是否自动解析 /// /// /// public bool IsAutoParseVideo(AllowStatus IsAuto) { appSettings.Basic.IsAutoParseVideo = IsAuto; return SetSettings(); } /// /// 获取视频解析项 /// /// public ParseScope GetParseScope() { appSettings = GetSettings(); if (appSettings.Basic.ParseScope == ParseScope.NOT_SET) { // 第一次获取,先设置默认值 SetParseScope(_parseScope); return _parseScope; } return appSettings.Basic.ParseScope; } /// /// 设置视频解析项 /// /// /// public bool SetParseScope(ParseScope parseScope) { appSettings.Basic.ParseScope = parseScope; return SetSettings(); } /// /// 解析后是否自动下载解析视频 /// /// public AllowStatus IsAutoDownloadAll() { appSettings = GetSettings(); if (appSettings.Basic.IsAutoDownloadAll == AllowStatus.NONE) { // 第一次获取,先设置默认值 IsAutoDownloadAll(_isAutoDownloadAll); return _isAutoDownloadAll; } return appSettings.Basic.IsAutoDownloadAll; } /// /// 解析后是否自动下载解析视频 /// /// /// public bool IsAutoDownloadAll(AllowStatus isAutoDownloadAll) { appSettings.Basic.IsAutoDownloadAll = isAutoDownloadAll; return SetSettings(); } /// /// 获取下载完成列表排序 /// /// public DownloadFinishedSort GetDownloadFinishedSort() { appSettings = GetSettings(); if (appSettings.Basic.DownloadFinishedSort == DownloadFinishedSort.NotSet) { // 第一次获取,先设置默认值 SetDownloadFinishedSort(_finishedSort); return _finishedSort; } return appSettings.Basic.DownloadFinishedSort; } /// /// 设置下载完成列表排序 /// /// /// public bool SetDownloadFinishedSort(DownloadFinishedSort finishedSort) { appSettings.Basic.DownloadFinishedSort = finishedSort; return SetSettings(); } /// /// 获取重复下载策略 /// /// public RepeatDownloadStrategy GetRepeatDownloadStrategy() { appSettings = GetSettings(); if (appSettings.Basic.RepeatDownloadStrategy == RepeatDownloadStrategy.Ask) { // 第一次获取,先设置默认值 SetRepeatDownloadStrategy(_repeatDownloadStrategy); return _repeatDownloadStrategy; } return appSettings.Basic.RepeatDownloadStrategy; } /// /// 设置重复下载策略 /// /// /// public bool SetRepeatDownloadStrategy(RepeatDownloadStrategy repeatDownloadStrategy) { appSettings.Basic.RepeatDownloadStrategy = repeatDownloadStrategy; return SetSettings(); } /// /// 重复文件自动添加数字后缀 /// /// public bool IsRepeatFileAutoAddNumberSuffix() { appSettings = GetSettings(); if (appSettings.Basic.RepeatFileAutoAddNumberSuffix == false) { // 第一次获取,先设置默认值 IsRepeatFileAutoAddNumberSuffix(_repeatFileAutoAddNumberSuffix); return _repeatFileAutoAddNumberSuffix; } return appSettings.Basic.RepeatFileAutoAddNumberSuffix; } /// /// 设置重复文件自动添加数字后缀 /// /// /// /// public bool IsRepeatFileAutoAddNumberSuffix(bool repeatFileAutoAddNumberSuffix) { appSettings.Basic.RepeatFileAutoAddNumberSuffix = repeatFileAutoAddNumberSuffix; return SetSettings(); } }