|
|
@ -24,15 +24,15 @@ namespace DownKyi.ViewModels.Settings
|
|
|
|
|
|
|
|
|
|
|
|
#region 页面属性申明
|
|
|
|
#region 页面属性申明
|
|
|
|
|
|
|
|
|
|
|
|
private List<string> videoCodecs;
|
|
|
|
private List<Quality> videoCodecs;
|
|
|
|
public List<string> VideoCodecs
|
|
|
|
public List<Quality> VideoCodecs
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get => videoCodecs;
|
|
|
|
get => videoCodecs;
|
|
|
|
set => SetProperty(ref videoCodecs, value);
|
|
|
|
set => SetProperty(ref videoCodecs, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private string selectedVideoCodec;
|
|
|
|
private Quality selectedVideoCodec;
|
|
|
|
public string SelectedVideoCodec
|
|
|
|
public Quality SelectedVideoCodec
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get => selectedVideoCodec;
|
|
|
|
get => selectedVideoCodec;
|
|
|
|
set => SetProperty(ref selectedVideoCodec, value);
|
|
|
|
set => SetProperty(ref selectedVideoCodec, value);
|
|
|
@ -186,11 +186,12 @@ namespace DownKyi.ViewModels.Settings
|
|
|
|
#region 属性初始化
|
|
|
|
#region 属性初始化
|
|
|
|
|
|
|
|
|
|
|
|
// 优先下载的视频编码
|
|
|
|
// 优先下载的视频编码
|
|
|
|
VideoCodecs = new List<string>
|
|
|
|
VideoCodecs = Constant.GetCodecIds();
|
|
|
|
{
|
|
|
|
//VideoCodecs = new List<string>
|
|
|
|
"H.264/AVC",
|
|
|
|
//{
|
|
|
|
"H.265/HEVC",
|
|
|
|
// "H.264/AVC",
|
|
|
|
};
|
|
|
|
// "H.265/HEVC",
|
|
|
|
|
|
|
|
//};
|
|
|
|
|
|
|
|
|
|
|
|
// 优先下载画质
|
|
|
|
// 优先下载画质
|
|
|
|
VideoQualityList = Constant.GetResolutions();
|
|
|
|
VideoQualityList = Constant.GetResolutions();
|
|
|
@ -255,8 +256,9 @@ namespace DownKyi.ViewModels.Settings
|
|
|
|
isOnNavigatedTo = true;
|
|
|
|
isOnNavigatedTo = true;
|
|
|
|
|
|
|
|
|
|
|
|
// 优先下载的视频编码
|
|
|
|
// 优先下载的视频编码
|
|
|
|
VideoCodecs videoCodecs = SettingsManager.GetInstance().GetVideoCodecs();
|
|
|
|
int videoCodecs = SettingsManager.GetInstance().GetVideoCodecs();
|
|
|
|
SelectedVideoCodec = GetVideoCodecsString(videoCodecs);
|
|
|
|
//SelectedVideoCodec = GetVideoCodecsString(videoCodecs);
|
|
|
|
|
|
|
|
SelectedVideoCodec = VideoCodecs.FirstOrDefault(t => { return t.Id == videoCodecs; });
|
|
|
|
|
|
|
|
|
|
|
|
// 优先下载画质
|
|
|
|
// 优先下载画质
|
|
|
|
int quality = SettingsManager.GetInstance().GetQuality();
|
|
|
|
int quality = SettingsManager.GetInstance().GetQuality();
|
|
|
@ -317,18 +319,20 @@ namespace DownKyi.ViewModels.Settings
|
|
|
|
#region 命令申明
|
|
|
|
#region 命令申明
|
|
|
|
|
|
|
|
|
|
|
|
// 优先下载的视频编码事件
|
|
|
|
// 优先下载的视频编码事件
|
|
|
|
private DelegateCommand<string> videoCodecsCommand;
|
|
|
|
private DelegateCommand<object> videoCodecsCommand;
|
|
|
|
public DelegateCommand<string> VideoCodecsCommand => videoCodecsCommand ?? (videoCodecsCommand = new DelegateCommand<string>(ExecuteVideoCodecsCommand));
|
|
|
|
public DelegateCommand<object> VideoCodecsCommand => videoCodecsCommand ?? (videoCodecsCommand = new DelegateCommand<object>(ExecuteVideoCodecsCommand));
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 优先下载的视频编码事件
|
|
|
|
/// 优先下载的视频编码事件
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="parameter"></param>
|
|
|
|
/// <param name="parameter"></param>
|
|
|
|
private void ExecuteVideoCodecsCommand(string parameter)
|
|
|
|
private void ExecuteVideoCodecsCommand(object parameter)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
VideoCodecs videoCodecs = GetVideoCodecs(parameter);
|
|
|
|
//VideoCodecs videoCodecs = GetVideoCodecs(parameter);
|
|
|
|
|
|
|
|
|
|
|
|
bool isSucceed = SettingsManager.GetInstance().SetVideoCodecs(videoCodecs);
|
|
|
|
if (!(parameter is Quality videoCodecs)) { return; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool isSucceed = SettingsManager.GetInstance().SetVideoCodecs(videoCodecs.Id);
|
|
|
|
PublishTip(isSucceed);
|
|
|
|
PublishTip(isSucceed);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -676,49 +680,49 @@ namespace DownKyi.ViewModels.Settings
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="videoCodecs"></param>
|
|
|
|
/// <param name="videoCodecs"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
private string GetVideoCodecsString(VideoCodecs videoCodecs)
|
|
|
|
//private string GetVideoCodecsString(VideoCodecs videoCodecs)
|
|
|
|
{
|
|
|
|
//{
|
|
|
|
string codec;
|
|
|
|
// string codec;
|
|
|
|
switch (videoCodecs)
|
|
|
|
// switch (videoCodecs)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
case Core.Settings.VideoCodecs.NONE:
|
|
|
|
// case Core.Settings.VideoCodecs.NONE:
|
|
|
|
codec = "";
|
|
|
|
// codec = "";
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
case Core.Settings.VideoCodecs.AVC:
|
|
|
|
// case Core.Settings.VideoCodecs.AVC:
|
|
|
|
codec = "H.264/AVC";
|
|
|
|
// codec = "H.264/AVC";
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
case Core.Settings.VideoCodecs.HEVC:
|
|
|
|
// case Core.Settings.VideoCodecs.HEVC:
|
|
|
|
codec = "H.265/HEVC";
|
|
|
|
// codec = "H.265/HEVC";
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
default:
|
|
|
|
// default:
|
|
|
|
codec = "";
|
|
|
|
// codec = "";
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
return codec;
|
|
|
|
// return codec;
|
|
|
|
}
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 返回VideoCodecs
|
|
|
|
/// 返回VideoCodecs
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="str"></param>
|
|
|
|
/// <param name="str"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
private VideoCodecs GetVideoCodecs(string str)
|
|
|
|
//private VideoCodecs GetVideoCodecs(string str)
|
|
|
|
{
|
|
|
|
//{
|
|
|
|
VideoCodecs videoCodecs;
|
|
|
|
// VideoCodecs videoCodecs;
|
|
|
|
switch (str)
|
|
|
|
// switch (str)
|
|
|
|
{
|
|
|
|
// {
|
|
|
|
case "H.264/AVC":
|
|
|
|
// case "H.264/AVC":
|
|
|
|
videoCodecs = Core.Settings.VideoCodecs.AVC;
|
|
|
|
// videoCodecs = Core.Settings.VideoCodecs.AVC;
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
case "H.265/HEVC":
|
|
|
|
// case "H.265/HEVC":
|
|
|
|
videoCodecs = Core.Settings.VideoCodecs.HEVC;
|
|
|
|
// videoCodecs = Core.Settings.VideoCodecs.HEVC;
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
default:
|
|
|
|
// default:
|
|
|
|
videoCodecs = Core.Settings.VideoCodecs.NONE;
|
|
|
|
// videoCodecs = Core.Settings.VideoCodecs.NONE;
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
return videoCodecs;
|
|
|
|
// return videoCodecs;
|
|
|
|
}
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 保存下载视频内容到设置
|
|
|
|
/// 保存下载视频内容到设置
|
|
|
|