mirror of
https://github.com/leiurayer/downkyi.git
synced 2025-01-28 04:40:21 +08:00
优化SettingsManager
This commit is contained in:
parent
248c25b3a9
commit
9e6f8dee1b
@ -13,7 +13,7 @@ internal class Login : ILogin
|
|||||||
/// <returns>(url, key)</returns>
|
/// <returns>(url, key)</returns>
|
||||||
public Tuple<string, string>? GetQRCodeUrl()
|
public Tuple<string, string>? GetQRCodeUrl()
|
||||||
{
|
{
|
||||||
string userAgent = SettingsManager.GetInstance().GetUserAgent();
|
string userAgent = SettingsManager.Instance.GetUserAgent();
|
||||||
BiliManager.Instance().SetUserAgent(userAgent);
|
BiliManager.Instance().SetUserAgent(userAgent);
|
||||||
|
|
||||||
var qrcode = LoginQR.GenerateQRCode();
|
var qrcode = LoginQR.GenerateQRCode();
|
||||||
@ -28,7 +28,7 @@ internal class Login : ILogin
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public QRCodeStatus? PollQRCode(string qrcodeKey)
|
public QRCodeStatus? PollQRCode(string qrcodeKey)
|
||||||
{
|
{
|
||||||
string userAgent = SettingsManager.GetInstance().GetUserAgent();
|
string userAgent = SettingsManager.Instance.GetUserAgent();
|
||||||
BiliManager.Instance().SetUserAgent(userAgent);
|
BiliManager.Instance().SetUserAgent(userAgent);
|
||||||
|
|
||||||
var qrcode = LoginQR.PollQRCode(qrcodeKey);
|
var qrcode = LoginQR.PollQRCode(qrcodeKey);
|
||||||
@ -50,7 +50,7 @@ internal class Login : ILogin
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public NavigationInfo? GetNavigationInfo()
|
public NavigationInfo? GetNavigationInfo()
|
||||||
{
|
{
|
||||||
string userAgent = SettingsManager.GetInstance().GetUserAgent();
|
string userAgent = SettingsManager.Instance.GetUserAgent();
|
||||||
BiliManager.Instance().SetUserAgent(userAgent);
|
BiliManager.Instance().SetUserAgent(userAgent);
|
||||||
BiliManager.Instance().SetCookies(LoginHelper.GetLoginInfoCookies());
|
BiliManager.Instance().SetCookies(LoginHelper.GetLoginInfoCookies());
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ public static class LoginHelper
|
|||||||
{
|
{
|
||||||
File.Delete(LOCAL_LOGIN_INFO);
|
File.Delete(LOCAL_LOGIN_INFO);
|
||||||
|
|
||||||
SettingsManager.GetInstance().SetUserInfo(new UserInfoSettings
|
SettingsManager.Instance.SetUserInfo(new UserInfoSettings
|
||||||
{
|
{
|
||||||
Mid = -1,
|
Mid = -1,
|
||||||
Name = "",
|
Name = "",
|
||||||
|
@ -10,8 +10,6 @@ namespace Downkyi.Core.Settings;
|
|||||||
|
|
||||||
public partial class SettingsManager
|
public partial class SettingsManager
|
||||||
{
|
{
|
||||||
private static SettingsManager? instance;
|
|
||||||
|
|
||||||
// 内存中保存一份配置
|
// 内存中保存一份配置
|
||||||
private AppSettings appSettings;
|
private AppSettings appSettings;
|
||||||
|
|
||||||
@ -26,15 +24,37 @@ public partial class SettingsManager
|
|||||||
private readonly string password = "YO1J$4#p";
|
private readonly string password = "YO1J$4#p";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// 单例模式
|
||||||
|
private static SettingsManager? _instance;
|
||||||
|
private static readonly object _lock = new();
|
||||||
|
/// <summary>
|
||||||
|
/// 获取SettingsManager唯一实例
|
||||||
|
/// </summary>
|
||||||
|
public static SettingsManager Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
// 双重检查锁定
|
||||||
|
if (_instance == null)
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
_instance ??= new SettingsManager();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取SettingsManager实例
|
/// 获取SettingsManager实例
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static SettingsManager GetInstance()
|
//public static SettingsManager GetInstance()
|
||||||
{
|
//{
|
||||||
instance ??= new SettingsManager();
|
// instance ??= new SettingsManager();
|
||||||
return instance;
|
// return instance;
|
||||||
}
|
//}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 隐藏Settings()方法,必须使用单例模式
|
/// 隐藏Settings()方法,必须使用单例模式
|
||||||
|
@ -126,7 +126,7 @@ public class MainSearchService : IMainSearchService
|
|||||||
{ "value", mid },
|
{ "value", mid },
|
||||||
};
|
};
|
||||||
|
|
||||||
UserInfoSettings userInfo = SettingsManager.GetInstance().GetUserInfo();
|
UserInfoSettings userInfo = SettingsManager.Instance.GetUserInfo();
|
||||||
if (userInfo != null && userInfo.Mid == mid)
|
if (userInfo != null && userInfo.Mid == mid)
|
||||||
{
|
{
|
||||||
NavigationService.ForwardAsync(MySpaceViewModel.Key, parameter);
|
NavigationService.ForwardAsync(MySpaceViewModel.Key, parameter);
|
||||||
|
@ -70,7 +70,7 @@ public partial class IndexViewModel : ViewModelBase
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 进入用户空间
|
// 进入用户空间
|
||||||
var userInfo = SettingsManager.GetInstance().GetUserInfo();
|
var userInfo = SettingsManager.Instance.GetUserInfo();
|
||||||
if (userInfo != null && userInfo.Mid != -1)
|
if (userInfo != null && userInfo.Mid != -1)
|
||||||
{
|
{
|
||||||
Dictionary<string, object> parameter = new()
|
Dictionary<string, object> parameter = new()
|
||||||
@ -161,7 +161,7 @@ public partial class IndexViewModel : ViewModelBase
|
|||||||
var userInfo = BiliLocator.Login.GetNavigationInfo();
|
var userInfo = BiliLocator.Login.GetNavigationInfo();
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
{
|
{
|
||||||
SettingsManager.GetInstance().SetUserInfo(new UserInfoSettings
|
SettingsManager.Instance.SetUserInfo(new UserInfoSettings
|
||||||
{
|
{
|
||||||
Mid = userInfo.Mid,
|
Mid = userInfo.Mid,
|
||||||
Name = userInfo.Name,
|
Name = userInfo.Name,
|
||||||
@ -171,7 +171,7 @@ public partial class IndexViewModel : ViewModelBase
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SettingsManager.GetInstance().SetUserInfo(new UserInfoSettings
|
SettingsManager.Instance.SetUserInfo(new UserInfoSettings
|
||||||
{
|
{
|
||||||
Mid = -1,
|
Mid = -1,
|
||||||
Name = "",
|
Name = "",
|
||||||
|
@ -62,7 +62,6 @@ public partial class CookiesViewModel : ViewModelBase
|
|||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[RelayCommand(FlowExceptionsToTaskScheduler = true)]
|
[RelayCommand(FlowExceptionsToTaskScheduler = true)]
|
||||||
private Task SaveCookiesAsync()
|
private Task SaveCookiesAsync()
|
||||||
{
|
{
|
||||||
|
@ -48,11 +48,11 @@ public partial class AboutViewModel : BaseSettingsViewModel
|
|||||||
IsOnNavigatedTo = true;
|
IsOnNavigatedTo = true;
|
||||||
|
|
||||||
// 是否接收测试版更新
|
// 是否接收测试版更新
|
||||||
var isReceiveBetaVersion = SettingsManager.GetInstance().IsReceiveBetaVersion();
|
var isReceiveBetaVersion = SettingsManager.Instance.IsReceiveBetaVersion();
|
||||||
IsReceiveBetaVersion = isReceiveBetaVersion == AllowStatus.YES;
|
IsReceiveBetaVersion = isReceiveBetaVersion == AllowStatus.YES;
|
||||||
|
|
||||||
// 是否在启动时自动检查更新
|
// 是否在启动时自动检查更新
|
||||||
var isAutoUpdateWhenLaunch = SettingsManager.GetInstance().GetAutoUpdateWhenLaunch();
|
var isAutoUpdateWhenLaunch = SettingsManager.Instance.GetAutoUpdateWhenLaunch();
|
||||||
IsAutoUpdateWhenLaunch = isAutoUpdateWhenLaunch == AllowStatus.YES;
|
IsAutoUpdateWhenLaunch = isAutoUpdateWhenLaunch == AllowStatus.YES;
|
||||||
|
|
||||||
IsOnNavigatedTo = false;
|
IsOnNavigatedTo = false;
|
||||||
@ -94,7 +94,7 @@ public partial class AboutViewModel : BaseSettingsViewModel
|
|||||||
{
|
{
|
||||||
AllowStatus isReceiveBetaVersion = IsReceiveBetaVersion ? AllowStatus.YES : AllowStatus.NO;
|
AllowStatus isReceiveBetaVersion = IsReceiveBetaVersion ? AllowStatus.YES : AllowStatus.NO;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().IsReceiveBetaVersion(isReceiveBetaVersion);
|
bool isSucceed = SettingsManager.Instance.IsReceiveBetaVersion(isReceiveBetaVersion);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ public partial class AboutViewModel : BaseSettingsViewModel
|
|||||||
{
|
{
|
||||||
AllowStatus isAutoUpdateWhenLaunch = IsAutoUpdateWhenLaunch ? AllowStatus.YES : AllowStatus.NO;
|
AllowStatus isAutoUpdateWhenLaunch = IsAutoUpdateWhenLaunch ? AllowStatus.YES : AllowStatus.NO;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetAutoUpdateWhenLaunch(isAutoUpdateWhenLaunch);
|
bool isSucceed = SettingsManager.Instance.SetAutoUpdateWhenLaunch(isAutoUpdateWhenLaunch);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,23 +66,23 @@ public partial class BasicViewModel : BaseSettingsViewModel
|
|||||||
IsOnNavigatedTo = true;
|
IsOnNavigatedTo = true;
|
||||||
|
|
||||||
// 下载完成后的操作
|
// 下载完成后的操作
|
||||||
AfterDownloadOperation afterDownload = SettingsManager.GetInstance().GetAfterDownloadOperation();
|
AfterDownloadOperation afterDownload = SettingsManager.Instance.GetAfterDownloadOperation();
|
||||||
SetAfterDownloadOperation(afterDownload);
|
SetAfterDownloadOperation(afterDownload);
|
||||||
|
|
||||||
// 是否监听剪贴板
|
// 是否监听剪贴板
|
||||||
AllowStatus isListenClipboard = SettingsManager.GetInstance().IsListenClipboard();
|
AllowStatus isListenClipboard = SettingsManager.Instance.IsListenClipboard();
|
||||||
IsListenClipboard = isListenClipboard == AllowStatus.YES;
|
IsListenClipboard = isListenClipboard == AllowStatus.YES;
|
||||||
|
|
||||||
// 是否自动解析视频
|
// 是否自动解析视频
|
||||||
AllowStatus isAutoParseVideo = SettingsManager.GetInstance().IsAutoParseVideo();
|
AllowStatus isAutoParseVideo = SettingsManager.Instance.IsAutoParseVideo();
|
||||||
IsAutoParseVideo = isAutoParseVideo == AllowStatus.YES;
|
IsAutoParseVideo = isAutoParseVideo == AllowStatus.YES;
|
||||||
|
|
||||||
// 解析范围
|
// 解析范围
|
||||||
ParseScope parseScope = SettingsManager.GetInstance().GetParseScope();
|
ParseScope parseScope = SettingsManager.Instance.GetParseScope();
|
||||||
SelectedParseScope = ParseScopes.FirstOrDefault(t => { return t.ParseScope == parseScope; });
|
SelectedParseScope = ParseScopes.FirstOrDefault(t => { return t.ParseScope == parseScope; });
|
||||||
|
|
||||||
// 解析后是否自动下载解析视频
|
// 解析后是否自动下载解析视频
|
||||||
AllowStatus isAutoDownloadAll = SettingsManager.GetInstance().IsAutoDownloadAll();
|
AllowStatus isAutoDownloadAll = SettingsManager.Instance.IsAutoDownloadAll();
|
||||||
IsAutoDownloadAll = isAutoDownloadAll == AllowStatus.YES;
|
IsAutoDownloadAll = isAutoDownloadAll == AllowStatus.YES;
|
||||||
|
|
||||||
IsOnNavigatedTo = false;
|
IsOnNavigatedTo = false;
|
||||||
@ -104,7 +104,7 @@ public partial class BasicViewModel : BaseSettingsViewModel
|
|||||||
"CloseSystem" => AfterDownloadOperation.CLOSE_SYSTEM,
|
"CloseSystem" => AfterDownloadOperation.CLOSE_SYSTEM,
|
||||||
_ => AfterDownloadOperation.NONE,
|
_ => AfterDownloadOperation.NONE,
|
||||||
};
|
};
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetAfterDownloadOperation(afterDownload);
|
bool isSucceed = SettingsManager.Instance.SetAfterDownloadOperation(afterDownload);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ public partial class BasicViewModel : BaseSettingsViewModel
|
|||||||
{
|
{
|
||||||
AllowStatus isListenClipboard = IsListenClipboard ? AllowStatus.YES : AllowStatus.NO;
|
AllowStatus isListenClipboard = IsListenClipboard ? AllowStatus.YES : AllowStatus.NO;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().IsListenClipboard(isListenClipboard);
|
bool isSucceed = SettingsManager.Instance.IsListenClipboard(isListenClipboard);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ public partial class BasicViewModel : BaseSettingsViewModel
|
|||||||
{
|
{
|
||||||
AllowStatus isAutoParseVideo = IsAutoParseVideo ? AllowStatus.YES : AllowStatus.NO;
|
AllowStatus isAutoParseVideo = IsAutoParseVideo ? AllowStatus.YES : AllowStatus.NO;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().IsAutoParseVideo(isAutoParseVideo);
|
bool isSucceed = SettingsManager.Instance.IsAutoParseVideo(isAutoParseVideo);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ public partial class BasicViewModel : BaseSettingsViewModel
|
|||||||
{
|
{
|
||||||
//if (parameter is not ParseScopeDisplay parseScope) { return; }
|
//if (parameter is not ParseScopeDisplay parseScope) { return; }
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetParseScope(SelectedParseScope!.ParseScope);
|
bool isSucceed = SettingsManager.Instance.SetParseScope(SelectedParseScope!.ParseScope);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ public partial class BasicViewModel : BaseSettingsViewModel
|
|||||||
{
|
{
|
||||||
AllowStatus isAutoDownloadAll = IsAutoDownloadAll ? AllowStatus.YES : AllowStatus.NO;
|
AllowStatus isAutoDownloadAll = IsAutoDownloadAll ? AllowStatus.YES : AllowStatus.NO;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().IsAutoDownloadAll(isAutoDownloadAll);
|
bool isSucceed = SettingsManager.Instance.IsAutoDownloadAll(isAutoDownloadAll);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,25 +65,25 @@ public partial class DanmakuViewModel : BaseSettingsViewModel
|
|||||||
IsOnNavigatedTo = true;
|
IsOnNavigatedTo = true;
|
||||||
|
|
||||||
// 屏蔽顶部弹幕
|
// 屏蔽顶部弹幕
|
||||||
AllowStatus danmakuTopFilter = SettingsManager.GetInstance().GetDanmakuTopFilter();
|
AllowStatus danmakuTopFilter = SettingsManager.Instance.GetDanmakuTopFilter();
|
||||||
TopFilter = danmakuTopFilter == AllowStatus.YES;
|
TopFilter = danmakuTopFilter == AllowStatus.YES;
|
||||||
|
|
||||||
// 屏蔽底部弹幕
|
// 屏蔽底部弹幕
|
||||||
AllowStatus danmakuBottomFilter = SettingsManager.GetInstance().GetDanmakuBottomFilter();
|
AllowStatus danmakuBottomFilter = SettingsManager.Instance.GetDanmakuBottomFilter();
|
||||||
BottomFilter = danmakuBottomFilter == AllowStatus.YES;
|
BottomFilter = danmakuBottomFilter == AllowStatus.YES;
|
||||||
|
|
||||||
// 屏蔽滚动弹幕
|
// 屏蔽滚动弹幕
|
||||||
AllowStatus danmakuScrollFilter = SettingsManager.GetInstance().GetDanmakuScrollFilter();
|
AllowStatus danmakuScrollFilter = SettingsManager.Instance.GetDanmakuScrollFilter();
|
||||||
ScrollFilter = danmakuScrollFilter == AllowStatus.YES;
|
ScrollFilter = danmakuScrollFilter == AllowStatus.YES;
|
||||||
|
|
||||||
// 分辨率-宽
|
// 分辨率-宽
|
||||||
ScreenWidth = SettingsManager.GetInstance().GetDanmakuScreenWidth();
|
ScreenWidth = SettingsManager.Instance.GetDanmakuScreenWidth();
|
||||||
|
|
||||||
// 分辨率-高
|
// 分辨率-高
|
||||||
ScreenHeight = SettingsManager.GetInstance().GetDanmakuScreenHeight();
|
ScreenHeight = SettingsManager.Instance.GetDanmakuScreenHeight();
|
||||||
|
|
||||||
// 弹幕字体
|
// 弹幕字体
|
||||||
string danmakuFont = SettingsManager.GetInstance().GetDanmakuFontName();
|
string danmakuFont = SettingsManager.Instance.GetDanmakuFontName();
|
||||||
if (danmakuFont != null && Fonts.Contains(danmakuFont))
|
if (danmakuFont != null && Fonts.Contains(danmakuFont))
|
||||||
{
|
{
|
||||||
// 只有系统中存在当前设置的字体,才能显示
|
// 只有系统中存在当前设置的字体,才能显示
|
||||||
@ -91,13 +91,13 @@ public partial class DanmakuViewModel : BaseSettingsViewModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 弹幕字体大小
|
// 弹幕字体大小
|
||||||
FontSize = SettingsManager.GetInstance().GetDanmakuFontSize();
|
FontSize = SettingsManager.Instance.GetDanmakuFontSize();
|
||||||
|
|
||||||
// 弹幕限制行数
|
// 弹幕限制行数
|
||||||
LineCount = SettingsManager.GetInstance().GetDanmakuLineCount();
|
LineCount = SettingsManager.Instance.GetDanmakuLineCount();
|
||||||
|
|
||||||
// 弹幕布局算法
|
// 弹幕布局算法
|
||||||
DanmakuLayoutAlgorithm layoutAlgorithm = SettingsManager.GetInstance().GetDanmakuLayoutAlgorithm();
|
DanmakuLayoutAlgorithm layoutAlgorithm = SettingsManager.Instance.GetDanmakuLayoutAlgorithm();
|
||||||
SetLayoutAlgorithm(layoutAlgorithm);
|
SetLayoutAlgorithm(layoutAlgorithm);
|
||||||
|
|
||||||
IsOnNavigatedTo = false;
|
IsOnNavigatedTo = false;
|
||||||
@ -111,7 +111,7 @@ public partial class DanmakuViewModel : BaseSettingsViewModel
|
|||||||
{
|
{
|
||||||
AllowStatus isTopFilter = TopFilter ? AllowStatus.YES : AllowStatus.NO;
|
AllowStatus isTopFilter = TopFilter ? AllowStatus.YES : AllowStatus.NO;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetDanmakuTopFilter(isTopFilter);
|
bool isSucceed = SettingsManager.Instance.SetDanmakuTopFilter(isTopFilter);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ public partial class DanmakuViewModel : BaseSettingsViewModel
|
|||||||
{
|
{
|
||||||
AllowStatus isBottomFilter = BottomFilter ? AllowStatus.YES : AllowStatus.NO;
|
AllowStatus isBottomFilter = BottomFilter ? AllowStatus.YES : AllowStatus.NO;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetDanmakuBottomFilter(isBottomFilter);
|
bool isSucceed = SettingsManager.Instance.SetDanmakuBottomFilter(isBottomFilter);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ public partial class DanmakuViewModel : BaseSettingsViewModel
|
|||||||
{
|
{
|
||||||
AllowStatus isScrollFilter = ScrollFilter ? AllowStatus.YES : AllowStatus.NO;
|
AllowStatus isScrollFilter = ScrollFilter ? AllowStatus.YES : AllowStatus.NO;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetDanmakuScrollFilter(isScrollFilter);
|
bool isSucceed = SettingsManager.Instance.SetDanmakuScrollFilter(isScrollFilter);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ public partial class DanmakuViewModel : BaseSettingsViewModel
|
|||||||
int width = (int)Number.GetInt(parameter);
|
int width = (int)Number.GetInt(parameter);
|
||||||
ScreenWidth = width;
|
ScreenWidth = width;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetDanmakuScreenWidth(ScreenWidth);
|
bool isSucceed = SettingsManager.Instance.SetDanmakuScreenWidth(ScreenWidth);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ public partial class DanmakuViewModel : BaseSettingsViewModel
|
|||||||
int height = (int)Number.GetInt(parameter);
|
int height = (int)Number.GetInt(parameter);
|
||||||
ScreenHeight = height;
|
ScreenHeight = height;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetDanmakuScreenHeight(ScreenHeight);
|
bool isSucceed = SettingsManager.Instance.SetDanmakuScreenHeight(ScreenHeight);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ public partial class DanmakuViewModel : BaseSettingsViewModel
|
|||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void FontSelected(string parameter)
|
private void FontSelected(string parameter)
|
||||||
{
|
{
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetDanmakuFontName(parameter);
|
bool isSucceed = SettingsManager.Instance.SetDanmakuFontName(parameter);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ public partial class DanmakuViewModel : BaseSettingsViewModel
|
|||||||
int fontSize = (int)Number.GetInt(parameter);
|
int fontSize = (int)Number.GetInt(parameter);
|
||||||
FontSize = fontSize;
|
FontSize = fontSize;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetDanmakuFontSize(FontSize);
|
bool isSucceed = SettingsManager.Instance.SetDanmakuFontSize(FontSize);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ public partial class DanmakuViewModel : BaseSettingsViewModel
|
|||||||
int lineCount = (int)Number.GetInt(parameter);
|
int lineCount = (int)Number.GetInt(parameter);
|
||||||
LineCount = lineCount;
|
LineCount = lineCount;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetDanmakuLineCount(LineCount);
|
bool isSucceed = SettingsManager.Instance.SetDanmakuLineCount(LineCount);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,21 +213,13 @@ public partial class DanmakuViewModel : BaseSettingsViewModel
|
|||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void SetLayoutAlgorithm(string parameter)
|
private void SetLayoutAlgorithm(string parameter)
|
||||||
{
|
{
|
||||||
DanmakuLayoutAlgorithm layoutAlgorithm;
|
var layoutAlgorithm = parameter switch
|
||||||
switch (parameter)
|
|
||||||
{
|
{
|
||||||
case "Sync":
|
"Sync" => DanmakuLayoutAlgorithm.SYNC,
|
||||||
layoutAlgorithm = DanmakuLayoutAlgorithm.SYNC;
|
"Async" => DanmakuLayoutAlgorithm.ASYNC,
|
||||||
break;
|
_ => DanmakuLayoutAlgorithm.SYNC,
|
||||||
case "Async":
|
};
|
||||||
layoutAlgorithm = DanmakuLayoutAlgorithm.ASYNC;
|
bool isSucceed = SettingsManager.Instance.SetDanmakuLayoutAlgorithm(layoutAlgorithm);
|
||||||
break;
|
|
||||||
default:
|
|
||||||
layoutAlgorithm = DanmakuLayoutAlgorithm.SYNC;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetDanmakuLayoutAlgorithm(layoutAlgorithm);
|
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
|
|
||||||
if (isSucceed)
|
if (isSucceed)
|
||||||
|
@ -145,14 +145,14 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
IsOnNavigatedTo = true;
|
IsOnNavigatedTo = true;
|
||||||
|
|
||||||
// 启用https
|
// 启用https
|
||||||
AllowStatus useSSL = SettingsManager.GetInstance().UseSSL();
|
AllowStatus useSSL = SettingsManager.Instance.UseSSL();
|
||||||
UseSSL = useSSL == AllowStatus.YES;
|
UseSSL = useSSL == AllowStatus.YES;
|
||||||
|
|
||||||
// UserAgent
|
// UserAgent
|
||||||
UserAgent = SettingsManager.GetInstance().GetUserAgent();
|
UserAgent = SettingsManager.Instance.GetUserAgent();
|
||||||
|
|
||||||
// 选择下载器
|
// 选择下载器
|
||||||
var downloader = SettingsManager.GetInstance().GetDownloader();
|
var downloader = SettingsManager.Instance.GetDownloader();
|
||||||
switch (downloader)
|
switch (downloader)
|
||||||
{
|
{
|
||||||
case Downloader.NOT_SET:
|
case Downloader.NOT_SET:
|
||||||
@ -169,58 +169,58 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
// builtin同时下载数
|
// builtin同时下载数
|
||||||
SelectedMaxCurrentDownload = SettingsManager.GetInstance().GetMaxCurrentDownloads();
|
SelectedMaxCurrentDownload = SettingsManager.Instance.GetMaxCurrentDownloads();
|
||||||
|
|
||||||
// builtin最大线程数
|
// builtin最大线程数
|
||||||
SelectedSplit = SettingsManager.GetInstance().GetSplit();
|
SelectedSplit = SettingsManager.Instance.GetSplit();
|
||||||
|
|
||||||
// 是否开启builtin http代理
|
// 是否开启builtin http代理
|
||||||
AllowStatus isHttpProxy = SettingsManager.GetInstance().IsHttpProxy();
|
AllowStatus isHttpProxy = SettingsManager.Instance.IsHttpProxy();
|
||||||
IsHttpProxy = isHttpProxy == AllowStatus.YES;
|
IsHttpProxy = isHttpProxy == AllowStatus.YES;
|
||||||
|
|
||||||
// builtin的http代理的地址
|
// builtin的http代理的地址
|
||||||
HttpProxy = SettingsManager.GetInstance().GetHttpProxy();
|
HttpProxy = SettingsManager.Instance.GetHttpProxy();
|
||||||
|
|
||||||
// builtin的http代理的端口
|
// builtin的http代理的端口
|
||||||
HttpProxyPort = SettingsManager.GetInstance().GetHttpProxyListenPort();
|
HttpProxyPort = SettingsManager.Instance.GetHttpProxyListenPort();
|
||||||
|
|
||||||
// Aria服务器host
|
// Aria服务器host
|
||||||
AriaHost = SettingsManager.GetInstance().GetAriaHost();
|
AriaHost = SettingsManager.Instance.GetAriaHost();
|
||||||
|
|
||||||
// Aria服务器端口
|
// Aria服务器端口
|
||||||
AriaListenPort = SettingsManager.GetInstance().GetAriaListenPort();
|
AriaListenPort = SettingsManager.Instance.GetAriaListenPort();
|
||||||
|
|
||||||
// Aria服务器Token
|
// Aria服务器Token
|
||||||
AriaToken = SettingsManager.GetInstance().GetAriaToken();
|
AriaToken = SettingsManager.Instance.GetAriaToken();
|
||||||
|
|
||||||
// Aria的日志等级
|
// Aria的日志等级
|
||||||
AriaConfigLogLevel ariaLogLevel = SettingsManager.GetInstance().GetAriaLogLevel();
|
AriaConfigLogLevel ariaLogLevel = SettingsManager.Instance.GetAriaLogLevel();
|
||||||
SelectedAriaLogLevel = ariaLogLevel.ToString("G");
|
SelectedAriaLogLevel = ariaLogLevel.ToString("G");
|
||||||
|
|
||||||
// Aria同时下载数
|
// Aria同时下载数
|
||||||
SelectedAriaMaxConcurrentDownload = SettingsManager.GetInstance().GetMaxCurrentDownloads();
|
SelectedAriaMaxConcurrentDownload = SettingsManager.Instance.GetMaxCurrentDownloads();
|
||||||
|
|
||||||
// Aria最大线程数
|
// Aria最大线程数
|
||||||
SelectedAriaSplit = SettingsManager.GetInstance().GetAriaSplit();
|
SelectedAriaSplit = SettingsManager.Instance.GetAriaSplit();
|
||||||
|
|
||||||
// Aria下载速度限制
|
// Aria下载速度限制
|
||||||
AriaMaxOverallDownloadLimit = SettingsManager.GetInstance().GetAriaMaxOverallDownloadLimit();
|
AriaMaxOverallDownloadLimit = SettingsManager.Instance.GetAriaMaxOverallDownloadLimit();
|
||||||
|
|
||||||
// Aria下载单文件速度限制
|
// Aria下载单文件速度限制
|
||||||
AriaMaxDownloadLimit = SettingsManager.GetInstance().GetAriaMaxDownloadLimit();
|
AriaMaxDownloadLimit = SettingsManager.Instance.GetAriaMaxDownloadLimit();
|
||||||
|
|
||||||
// 是否开启Aria http代理
|
// 是否开启Aria http代理
|
||||||
AllowStatus isAriaHttpProxy = SettingsManager.GetInstance().IsAriaHttpProxy();
|
AllowStatus isAriaHttpProxy = SettingsManager.Instance.IsAriaHttpProxy();
|
||||||
IsAriaHttpProxy = isAriaHttpProxy == AllowStatus.YES;
|
IsAriaHttpProxy = isAriaHttpProxy == AllowStatus.YES;
|
||||||
|
|
||||||
// Aria的http代理的地址
|
// Aria的http代理的地址
|
||||||
AriaHttpProxy = SettingsManager.GetInstance().GetAriaHttpProxy();
|
AriaHttpProxy = SettingsManager.Instance.GetAriaHttpProxy();
|
||||||
|
|
||||||
// Aria的http代理的端口
|
// Aria的http代理的端口
|
||||||
AriaHttpProxyPort = SettingsManager.GetInstance().GetAriaHttpProxyListenPort();
|
AriaHttpProxyPort = SettingsManager.Instance.GetAriaHttpProxyListenPort();
|
||||||
|
|
||||||
// Aria文件预分配
|
// Aria文件预分配
|
||||||
AriaConfigFileAllocation ariaFileAllocation = SettingsManager.GetInstance().GetAriaFileAllocation();
|
AriaConfigFileAllocation ariaFileAllocation = SettingsManager.Instance.GetAriaFileAllocation();
|
||||||
SelectedAriaFileAllocation = ariaFileAllocation.ToString("G");
|
SelectedAriaFileAllocation = ariaFileAllocation.ToString("G");
|
||||||
|
|
||||||
IsOnNavigatedTo = false;
|
IsOnNavigatedTo = false;
|
||||||
@ -234,7 +234,7 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
{
|
{
|
||||||
AllowStatus useSSL = UseSSL ? AllowStatus.YES : AllowStatus.NO;
|
AllowStatus useSSL = UseSSL ? AllowStatus.YES : AllowStatus.NO;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().UseSSL(useSSL);
|
bool isSucceed = SettingsManager.Instance.UseSSL(useSSL);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,7 +244,7 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void SetUserAgent()
|
private void SetUserAgent()
|
||||||
{
|
{
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetUserAgent(UserAgent);
|
bool isSucceed = SettingsManager.Instance.SetUserAgent(UserAgent);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,9 +260,9 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
"Builtin" => Downloader.BUILT_IN,
|
"Builtin" => Downloader.BUILT_IN,
|
||||||
"Aria2c" => Downloader.ARIA,
|
"Aria2c" => Downloader.ARIA,
|
||||||
"CustomAria2c" => Downloader.CUSTOM_ARIA,
|
"CustomAria2c" => Downloader.CUSTOM_ARIA,
|
||||||
_ => SettingsManager.GetInstance().GetDownloader(),
|
_ => SettingsManager.Instance.GetDownloader(),
|
||||||
};
|
};
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetDownloader(downloader);
|
bool isSucceed = SettingsManager.Instance.SetDownloader(downloader);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
|
|
||||||
// 弹窗提示是否重启程序
|
// 弹窗提示是否重启程序
|
||||||
@ -284,7 +284,7 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void SetMaxCurrentDownloads()
|
private void SetMaxCurrentDownloads()
|
||||||
{
|
{
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetMaxCurrentDownloads(SelectedMaxCurrentDownload);
|
bool isSucceed = SettingsManager.Instance.SetMaxCurrentDownloads(SelectedMaxCurrentDownload);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void SetSplits()
|
private void SetSplits()
|
||||||
{
|
{
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetSplit(SelectedSplit);
|
bool isSucceed = SettingsManager.Instance.SetSplit(SelectedSplit);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,7 +307,7 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
{
|
{
|
||||||
AllowStatus isHttpProxy = IsHttpProxy ? AllowStatus.YES : AllowStatus.NO;
|
AllowStatus isHttpProxy = IsHttpProxy ? AllowStatus.YES : AllowStatus.NO;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().IsHttpProxy(isHttpProxy);
|
bool isSucceed = SettingsManager.Instance.IsHttpProxy(isHttpProxy);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void SetHttpProxy(string parameter)
|
private void SetHttpProxy(string parameter)
|
||||||
{
|
{
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetHttpProxy(parameter);
|
bool isSucceed = SettingsManager.Instance.SetHttpProxy(parameter);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,7 +332,7 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
int httpProxyPort = (int)Number.GetInt(parameter);
|
int httpProxyPort = (int)Number.GetInt(parameter);
|
||||||
HttpProxyPort = httpProxyPort;
|
HttpProxyPort = httpProxyPort;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetHttpProxyListenPort(HttpProxyPort);
|
bool isSucceed = SettingsManager.Instance.SetHttpProxyListenPort(HttpProxyPort);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,7 +344,7 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
private void SetAriaHost(string parameter)
|
private void SetAriaHost(string parameter)
|
||||||
{
|
{
|
||||||
AriaHost = parameter;
|
AriaHost = parameter;
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetAriaHost(AriaHost);
|
bool isSucceed = SettingsManager.Instance.SetAriaHost(AriaHost);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,7 +358,7 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
int listenPort = (int)Number.GetInt(parameter);
|
int listenPort = (int)Number.GetInt(parameter);
|
||||||
AriaListenPort = listenPort;
|
AriaListenPort = listenPort;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetAriaListenPort(AriaListenPort);
|
bool isSucceed = SettingsManager.Instance.SetAriaListenPort(AriaListenPort);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,7 +370,7 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
private void SetAriaToken(string parameter)
|
private void SetAriaToken(string parameter)
|
||||||
{
|
{
|
||||||
AriaToken = parameter;
|
AriaToken = parameter;
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetAriaToken(AriaToken);
|
bool isSucceed = SettingsManager.Instance.SetAriaToken(AriaToken);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,7 +390,7 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
"ERROR" => AriaConfigLogLevel.ERROR,
|
"ERROR" => AriaConfigLogLevel.ERROR,
|
||||||
_ => AriaConfigLogLevel.INFO,
|
_ => AriaConfigLogLevel.INFO,
|
||||||
};
|
};
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetAriaLogLevel(ariaLogLevel);
|
bool isSucceed = SettingsManager.Instance.SetAriaLogLevel(ariaLogLevel);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void SetAriaMaxConcurrentDownloads()
|
private void SetAriaMaxConcurrentDownloads()
|
||||||
{
|
{
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetMaxCurrentDownloads(SelectedAriaMaxConcurrentDownload);
|
bool isSucceed = SettingsManager.Instance.SetMaxCurrentDownloads(SelectedAriaMaxConcurrentDownload);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,7 +412,7 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void SetAriaSplits()
|
private void SetAriaSplits()
|
||||||
{
|
{
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetAriaSplit(SelectedAriaSplit);
|
bool isSucceed = SettingsManager.Instance.SetAriaSplit(SelectedAriaSplit);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,7 +426,7 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
int downloadLimit = (int)Number.GetInt(parameter);
|
int downloadLimit = (int)Number.GetInt(parameter);
|
||||||
AriaMaxOverallDownloadLimit = downloadLimit;
|
AriaMaxOverallDownloadLimit = downloadLimit;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetAriaMaxOverallDownloadLimit(AriaMaxOverallDownloadLimit);
|
bool isSucceed = SettingsManager.Instance.SetAriaMaxOverallDownloadLimit(AriaMaxOverallDownloadLimit);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,7 +440,7 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
int downloadLimit = (int)Number.GetInt(parameter);
|
int downloadLimit = (int)Number.GetInt(parameter);
|
||||||
AriaMaxDownloadLimit = downloadLimit;
|
AriaMaxDownloadLimit = downloadLimit;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetAriaMaxDownloadLimit(AriaMaxDownloadLimit);
|
bool isSucceed = SettingsManager.Instance.SetAriaMaxDownloadLimit(AriaMaxDownloadLimit);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,7 +452,7 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
{
|
{
|
||||||
AllowStatus isAriaHttpProxy = IsAriaHttpProxy ? AllowStatus.YES : AllowStatus.NO;
|
AllowStatus isAriaHttpProxy = IsAriaHttpProxy ? AllowStatus.YES : AllowStatus.NO;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().IsAriaHttpProxy(isAriaHttpProxy);
|
bool isSucceed = SettingsManager.Instance.IsAriaHttpProxy(isAriaHttpProxy);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,7 +463,7 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void SetAriaHttpProxy(string parameter)
|
private void SetAriaHttpProxy(string parameter)
|
||||||
{
|
{
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetAriaHttpProxy(parameter);
|
bool isSucceed = SettingsManager.Instance.SetAriaHttpProxy(parameter);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,7 +477,7 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
int httpProxyPort = (int)Number.GetInt(parameter);
|
int httpProxyPort = (int)Number.GetInt(parameter);
|
||||||
AriaHttpProxyPort = httpProxyPort;
|
AriaHttpProxyPort = httpProxyPort;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetAriaHttpProxyListenPort(AriaHttpProxyPort);
|
bool isSucceed = SettingsManager.Instance.SetAriaHttpProxyListenPort(AriaHttpProxyPort);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,7 +494,7 @@ public partial class NetworkViewModel : BaseSettingsViewModel
|
|||||||
"FALLOC" => AriaConfigFileAllocation.FALLOC,
|
"FALLOC" => AriaConfigFileAllocation.FALLOC,
|
||||||
_ => AriaConfigFileAllocation.PREALLOC,
|
_ => AriaConfigFileAllocation.PREALLOC,
|
||||||
};
|
};
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetAriaFileAllocation(ariaFileAllocation);
|
bool isSucceed = SettingsManager.Instance.SetAriaFileAllocation(ariaFileAllocation);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ public partial class VideoViewModel : BaseSettingsViewModel
|
|||||||
fileName.Add(item.Id);
|
fileName.Add(item.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetFileNameParts(fileName);
|
bool isSucceed = SettingsManager.Instance.SetFileNameParts(fileName);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -149,30 +149,30 @@ public partial class VideoViewModel : BaseSettingsViewModel
|
|||||||
IsOnNavigatedTo = true;
|
IsOnNavigatedTo = true;
|
||||||
|
|
||||||
// 优先下载的视频编码
|
// 优先下载的视频编码
|
||||||
int videoCodecs = SettingsManager.GetInstance().GetVideoCodecs();
|
int videoCodecs = SettingsManager.Instance.GetVideoCodecs();
|
||||||
SelectedVideoCodec = VideoCodecs.FirstOrDefault(t => { return t.Id == videoCodecs; });
|
SelectedVideoCodec = VideoCodecs.FirstOrDefault(t => { return t.Id == videoCodecs; });
|
||||||
|
|
||||||
// 优先下载画质
|
// 优先下载画质
|
||||||
int quality = SettingsManager.GetInstance().GetQuality();
|
int quality = SettingsManager.Instance.GetQuality();
|
||||||
SelectedVideoQuality = VideoQualityList.FirstOrDefault(t => { return t.Id == quality; });
|
SelectedVideoQuality = VideoQualityList.FirstOrDefault(t => { return t.Id == quality; });
|
||||||
|
|
||||||
// 优先下载音质
|
// 优先下载音质
|
||||||
int audioQuality = SettingsManager.GetInstance().GetAudioQuality();
|
int audioQuality = SettingsManager.Instance.GetAudioQuality();
|
||||||
SelectedAudioQuality = AudioQualityList.FirstOrDefault(t => { return t.Id == audioQuality; });
|
SelectedAudioQuality = AudioQualityList.FirstOrDefault(t => { return t.Id == audioQuality; });
|
||||||
|
|
||||||
// 是否下载flv视频后转码为mp4
|
// 是否下载flv视频后转码为mp4
|
||||||
AllowStatus isTranscodingFlvToMp4 = SettingsManager.GetInstance().IsTranscodingFlvToMp4();
|
AllowStatus isTranscodingFlvToMp4 = SettingsManager.Instance.IsTranscodingFlvToMp4();
|
||||||
IsTranscodingFlvToMp4 = isTranscodingFlvToMp4 == AllowStatus.YES;
|
IsTranscodingFlvToMp4 = isTranscodingFlvToMp4 == AllowStatus.YES;
|
||||||
|
|
||||||
// 是否使用默认下载目录
|
// 是否使用默认下载目录
|
||||||
AllowStatus isUseSaveVideoRootPath = SettingsManager.GetInstance().IsUseSaveVideoRootPath();
|
AllowStatus isUseSaveVideoRootPath = SettingsManager.Instance.IsUseSaveVideoRootPath();
|
||||||
IsUseDefaultDirectory = isUseSaveVideoRootPath == AllowStatus.YES;
|
IsUseDefaultDirectory = isUseSaveVideoRootPath == AllowStatus.YES;
|
||||||
|
|
||||||
// 默认下载目录
|
// 默认下载目录
|
||||||
SaveVideoDirectory = SettingsManager.GetInstance().GetSaveVideoRootPath();
|
SaveVideoDirectory = SettingsManager.Instance.GetSaveVideoRootPath();
|
||||||
|
|
||||||
// 下载内容
|
// 下载内容
|
||||||
VideoContentSettings videoContent = SettingsManager.GetInstance().GetVideoContent();
|
VideoContentSettings videoContent = SettingsManager.Instance.GetVideoContent();
|
||||||
|
|
||||||
DownloadAudio = videoContent.DownloadAudio;
|
DownloadAudio = videoContent.DownloadAudio;
|
||||||
DownloadVideo = videoContent.DownloadVideo;
|
DownloadVideo = videoContent.DownloadVideo;
|
||||||
@ -190,7 +190,7 @@ public partial class VideoViewModel : BaseSettingsViewModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 文件命名格式
|
// 文件命名格式
|
||||||
List<FileNamePart> fileNameParts = SettingsManager.GetInstance().GetFileNameParts();
|
List<FileNamePart> fileNameParts = SettingsManager.Instance.GetFileNameParts();
|
||||||
SelectedFileName.Clear();
|
SelectedFileName.Clear();
|
||||||
foreach (FileNamePart item in fileNameParts)
|
foreach (FileNamePart item in fileNameParts)
|
||||||
{
|
{
|
||||||
@ -208,10 +208,10 @@ public partial class VideoViewModel : BaseSettingsViewModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 文件命名中的时间格式
|
// 文件命名中的时间格式
|
||||||
SelectedTimeFormat = SettingsManager.GetInstance().GetFileNamePartTimeFormat();
|
SelectedTimeFormat = SettingsManager.Instance.GetFileNamePartTimeFormat();
|
||||||
|
|
||||||
// 文件命名中的序号格式
|
// 文件命名中的序号格式
|
||||||
OrderFormat orderFormat = SettingsManager.GetInstance().GetOrderFormat();
|
OrderFormat orderFormat = SettingsManager.Instance.GetOrderFormat();
|
||||||
SelectedOrderFormat = OrderFormatList.FirstOrDefault(t => { return t.Id == orderFormat; });
|
SelectedOrderFormat = OrderFormatList.FirstOrDefault(t => { return t.Id == orderFormat; });
|
||||||
|
|
||||||
IsOnNavigatedTo = false;
|
IsOnNavigatedTo = false;
|
||||||
@ -224,7 +224,7 @@ public partial class VideoViewModel : BaseSettingsViewModel
|
|||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void SetVideoCodecs()
|
private void SetVideoCodecs()
|
||||||
{
|
{
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetVideoCodecs(SelectedVideoCodec!.Id);
|
bool isSucceed = SettingsManager.Instance.SetVideoCodecs(SelectedVideoCodec!.Id);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ public partial class VideoViewModel : BaseSettingsViewModel
|
|||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void SetVideoQuality()
|
private void SetVideoQuality()
|
||||||
{
|
{
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetQuality(SelectedVideoQuality!.Id);
|
bool isSucceed = SettingsManager.Instance.SetQuality(SelectedVideoQuality!.Id);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ public partial class VideoViewModel : BaseSettingsViewModel
|
|||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void SetAudioQuality()
|
private void SetAudioQuality()
|
||||||
{
|
{
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetAudioQuality(SelectedAudioQuality!.Id);
|
bool isSucceed = SettingsManager.Instance.SetAudioQuality(SelectedAudioQuality!.Id);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ public partial class VideoViewModel : BaseSettingsViewModel
|
|||||||
{
|
{
|
||||||
AllowStatus isTranscodingFlvToMp4 = IsTranscodingFlvToMp4 ? AllowStatus.YES : AllowStatus.NO;
|
AllowStatus isTranscodingFlvToMp4 = IsTranscodingFlvToMp4 ? AllowStatus.YES : AllowStatus.NO;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().IsTranscodingFlvToMp4(isTranscodingFlvToMp4);
|
bool isSucceed = SettingsManager.Instance.IsTranscodingFlvToMp4(isTranscodingFlvToMp4);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ public partial class VideoViewModel : BaseSettingsViewModel
|
|||||||
{
|
{
|
||||||
AllowStatus isUseDefaultDirectory = IsUseDefaultDirectory ? AllowStatus.YES : AllowStatus.NO;
|
AllowStatus isUseDefaultDirectory = IsUseDefaultDirectory ? AllowStatus.YES : AllowStatus.NO;
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().IsUseSaveVideoRootPath(isUseDefaultDirectory);
|
bool isSucceed = SettingsManager.Instance.IsUseSaveVideoRootPath(isUseDefaultDirectory);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +283,7 @@ public partial class VideoViewModel : BaseSettingsViewModel
|
|||||||
string directory = await StoragePicker.FolderPicker(SaveVideoDirectory);
|
string directory = await StoragePicker.FolderPicker(SaveVideoDirectory);
|
||||||
if (directory == "") { return; }
|
if (directory == "") { return; }
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetSaveVideoRootPath(directory);
|
bool isSucceed = SettingsManager.Instance.SetSaveVideoRootPath(directory);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
|
|
||||||
if (isSucceed)
|
if (isSucceed)
|
||||||
@ -420,7 +420,7 @@ public partial class VideoViewModel : BaseSettingsViewModel
|
|||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void TimeFormat()
|
private void TimeFormat()
|
||||||
{
|
{
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetFileNamePartTimeFormat(SelectedTimeFormat);
|
bool isSucceed = SettingsManager.Instance.SetFileNamePartTimeFormat(SelectedTimeFormat);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,7 +431,7 @@ public partial class VideoViewModel : BaseSettingsViewModel
|
|||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void OrderFormat()
|
private void OrderFormat()
|
||||||
{
|
{
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetOrderFormat(SelectedOrderFormat!.Id);
|
bool isSucceed = SettingsManager.Instance.SetOrderFormat(SelectedOrderFormat!.Id);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,10 +441,10 @@ public partial class VideoViewModel : BaseSettingsViewModel
|
|||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void Reset()
|
private void Reset()
|
||||||
{
|
{
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetFileNameParts(null);
|
bool isSucceed = SettingsManager.Instance.SetFileNameParts(null);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
|
|
||||||
List<FileNamePart> fileNameParts = SettingsManager.GetInstance().GetFileNameParts();
|
List<FileNamePart> fileNameParts = SettingsManager.Instance.GetFileNameParts();
|
||||||
SelectedFileName.Clear();
|
SelectedFileName.Clear();
|
||||||
foreach (FileNamePart item in fileNameParts)
|
foreach (FileNamePart item in fileNameParts)
|
||||||
{
|
{
|
||||||
@ -480,7 +480,7 @@ public partial class VideoViewModel : BaseSettingsViewModel
|
|||||||
DownloadCover = DownloadCover
|
DownloadCover = DownloadCover
|
||||||
};
|
};
|
||||||
|
|
||||||
bool isSucceed = SettingsManager.GetInstance().SetVideoContent(videoContent);
|
bool isSucceed = SettingsManager.Instance.SetVideoContent(videoContent);
|
||||||
PublishTip(Key, isSucceed);
|
PublishTip(Key, isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ public partial class VideoDetailViewModel : ViewModelBase
|
|||||||
var tryVideoInfoView = service.GetVideoView(_input);
|
var tryVideoInfoView = service.GetVideoView(_input);
|
||||||
|
|
||||||
// 是否自动解析视频
|
// 是否自动解析视频
|
||||||
if (SettingsManager.GetInstance().IsAutoParseVideo() == AllowStatus.YES)
|
if (SettingsManager.Instance.IsAutoParseVideo() == AllowStatus.YES)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ public partial class VideoDetailViewModel : ViewModelBase
|
|||||||
{ "value", mid },
|
{ "value", mid },
|
||||||
};
|
};
|
||||||
|
|
||||||
UserInfoSettings userInfo = SettingsManager.GetInstance().GetUserInfo();
|
UserInfoSettings userInfo = SettingsManager.Instance.GetUserInfo();
|
||||||
if (userInfo != null && userInfo.Mid == mid)
|
if (userInfo != null && userInfo.Mid == mid)
|
||||||
{
|
{
|
||||||
await NavigationService.ForwardAsync(MySpaceViewModel.Key, parameter);
|
await NavigationService.ForwardAsync(MySpaceViewModel.Key, parameter);
|
||||||
|
@ -78,7 +78,7 @@ public partial class MainWindowViewModel : ViewModelBase
|
|||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
AllowStatus isListenClipboard = SettingsManager.GetInstance().IsListenClipboard();
|
AllowStatus isListenClipboard = SettingsManager.Instance.IsListenClipboard();
|
||||||
if (isListenClipboard != AllowStatus.YES)
|
if (isListenClipboard != AllowStatus.YES)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user