From e781c72d688e3195e86c9968e656e339c10a3941 Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Fri, 17 Dec 2021 23:30:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B8=8D=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E7=9A=84=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DownKyi.Core/Settings/Models/VideoSettings.cs | 4 - .../Settings/SettingsManager.Video.cs | 120 ------------ .../ViewModels/Settings/ViewVideoViewModel.cs | 180 +++++++++--------- DownKyi/Views/Settings/ViewVideo.xaml | 63 ------ 4 files changed, 90 insertions(+), 277 deletions(-) diff --git a/DownKyi.Core/Settings/Models/VideoSettings.cs b/DownKyi.Core/Settings/Models/VideoSettings.cs index 0863423..bc0aa61 100644 --- a/DownKyi.Core/Settings/Models/VideoSettings.cs +++ b/DownKyi.Core/Settings/Models/VideoSettings.cs @@ -10,13 +10,9 @@ namespace DownKyi.Core.Settings.Models public VideoCodecs VideoCodecs { get; set; } public int Quality { get; set; } public int AudioQuality { get; set; } - public AllowStatus IsAddOrder { get; set; } public AllowStatus IsTranscodingFlvToMp4 { get; set; } public string SaveVideoRootPath { get; set; } public List HistoryVideoRootPaths { get; set; } public AllowStatus IsUseSaveVideoRootPath { get; set; } - public AllowStatus IsCreateFolderForMedia { get; set; } - public AllowStatus IsDownloadDanmaku { get; set; } - public AllowStatus IsDownloadCover { get; set; } } } diff --git a/DownKyi.Core/Settings/SettingsManager.Video.cs b/DownKyi.Core/Settings/SettingsManager.Video.cs index 1b6700c..f2f9eaf 100644 --- a/DownKyi.Core/Settings/SettingsManager.Video.cs +++ b/DownKyi.Core/Settings/SettingsManager.Video.cs @@ -15,9 +15,6 @@ namespace DownKyi.Core.Settings // 设置优先下载音质 private readonly int audioQuality = 30280; - // 是否在下载的视频前增加序号 - private readonly AllowStatus isAddOrder = AllowStatus.NO; - // 是否下载flv视频后转码为mp4 private readonly AllowStatus isTranscodingFlvToMp4 = AllowStatus.YES; @@ -30,15 +27,6 @@ namespace DownKyi.Core.Settings // 是否使用默认下载目录,如果是,则每次点击下载选中项时不再询问下载目录 private readonly AllowStatus isUseSaveVideoRootPath = AllowStatus.NO; - // 是否为不同视频分别创建文件夹 - private readonly AllowStatus isCreateFolderForMedia = AllowStatus.YES; - - // 是否在下载视频的同时下载弹幕 - private readonly AllowStatus isDownloadDanmaku = AllowStatus.YES; - - // 是否在下载视频的同时下载封面 - private readonly AllowStatus isDownloadCover = AllowStatus.YES; - /// /// 获取优先下载的视频编码 /// @@ -120,33 +108,6 @@ namespace DownKyi.Core.Settings return SetSettings(); } - /// - /// 获取是否给视频增加序号 - /// - /// - public AllowStatus IsAddOrder() - { - appSettings = GetSettings(); - if (appSettings.Video.IsAddOrder == 0) - { - // 第一次获取,先设置默认值 - IsAddOrder(isAddOrder); - return isAddOrder; - } - return appSettings.Video.IsAddOrder; - } - - /// - /// 设置是否给视频增加序号 - /// - /// - /// - public bool IsAddOrder(AllowStatus isAddOrder) - { - appSettings.Video.IsAddOrder = isAddOrder; - return SetSettings(); - } - /// /// 获取是否下载flv视频后转码为mp4 /// @@ -255,86 +216,5 @@ namespace DownKyi.Core.Settings return SetSettings(); } - /// - /// 获取是否为不同视频分别创建文件夹 - /// - /// - public AllowStatus IsCreateFolderForMedia() - { - appSettings = GetSettings(); - if (appSettings.Video.IsCreateFolderForMedia == 0) - { - // 第一次获取,先设置默认值 - IsCreateFolderForMedia(isCreateFolderForMedia); - return isCreateFolderForMedia; - } - return appSettings.Video.IsCreateFolderForMedia; - } - - /// - /// 设置是否为不同视频分别创建文件夹 - /// - /// - /// - public bool IsCreateFolderForMedia(AllowStatus isCreateFolderForMedia) - { - appSettings.Video.IsCreateFolderForMedia = isCreateFolderForMedia; - return SetSettings(); - } - - /// - /// 获取是否在下载视频的同时下载弹幕 - /// - /// - public AllowStatus IsDownloadDanmaku() - { - appSettings = GetSettings(); - if (appSettings.Video.IsDownloadDanmaku == 0) - { - // 第一次获取,先设置默认值 - IsDownloadDanmaku(isDownloadDanmaku); - return isDownloadDanmaku; - } - return appSettings.Video.IsDownloadDanmaku; - } - - /// - /// 设置是否在下载视频的同时下载弹幕 - /// - /// - /// - public bool IsDownloadDanmaku(AllowStatus isDownloadDanmaku) - { - appSettings.Video.IsDownloadDanmaku = isDownloadDanmaku; - return SetSettings(); - } - - /// - /// 获取是否在下载视频的同时下载封面 - /// - /// - public AllowStatus IsDownloadCover() - { - appSettings = GetSettings(); - if (appSettings.Video.IsDownloadCover == 0) - { - // 第一次获取,先设置默认值 - IsDownloadCover(isDownloadCover); - return isDownloadCover; - } - return appSettings.Video.IsDownloadCover; - } - - /// - /// 设置是否在下载视频的同时下载封面 - /// - /// - /// - public bool IsDownloadCover(AllowStatus isDownloadCover) - { - appSettings.Video.IsDownloadCover = isDownloadCover; - return SetSettings(); - } - } } diff --git a/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs b/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs index 46f3e62..556567c 100644 --- a/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs +++ b/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs @@ -22,78 +22,78 @@ namespace DownKyi.ViewModels.Settings private List videoCodecs; public List VideoCodecs { - get { return videoCodecs; } - set { SetProperty(ref videoCodecs, value); } + get => videoCodecs; + set => SetProperty(ref videoCodecs, value); } private string selectedVideoCodec; public string SelectedVideoCodec { - get { return selectedVideoCodec; } - set { SetProperty(ref selectedVideoCodec, value); } + get => selectedVideoCodec; + set => SetProperty(ref selectedVideoCodec, value); } private List videoQualityList; public List VideoQualityList { - get { return videoQualityList; } - set { SetProperty(ref videoQualityList, value); } + get => videoQualityList; + set => SetProperty(ref videoQualityList, value); } private Resolution selectedVideoQuality; public Resolution SelectedVideoQuality { - get { return selectedVideoQuality; } - set { SetProperty(ref selectedVideoQuality, value); } + get => selectedVideoQuality; + set => SetProperty(ref selectedVideoQuality, value); } private bool isAddVideoOrder; public bool IsAddVideoOrder { - get { return isAddVideoOrder; } - set { SetProperty(ref isAddVideoOrder, value); } + get => isAddVideoOrder; + set => SetProperty(ref isAddVideoOrder, value); } private bool isTranscodingFlvToMp4; public bool IsTranscodingFlvToMp4 { - get { return isTranscodingFlvToMp4; } - set { SetProperty(ref isTranscodingFlvToMp4, value); } + get => isTranscodingFlvToMp4; + set => SetProperty(ref isTranscodingFlvToMp4, value); } private bool isUseDefaultDirectory; public bool IsUseDefaultDirectory { - get { return isUseDefaultDirectory; } - set { SetProperty(ref isUseDefaultDirectory, value); } + get => isUseDefaultDirectory; + set => SetProperty(ref isUseDefaultDirectory, value); } private string saveVideoDirectory; public string SaveVideoDirectory { - get { return saveVideoDirectory; } - set { SetProperty(ref saveVideoDirectory, value); } + get => saveVideoDirectory; + set => SetProperty(ref saveVideoDirectory, value); } private bool isCreateFolderForMedia; public bool IsCreateFolderForMedia { - get { return isCreateFolderForMedia; } - set { SetProperty(ref isCreateFolderForMedia, value); } + get => isCreateFolderForMedia; + set => SetProperty(ref isCreateFolderForMedia, value); } private bool isDownloadDanmaku; public bool IsDownloadDanmaku { - get { return isDownloadDanmaku; } - set { SetProperty(ref isDownloadDanmaku, value); } + get => isDownloadDanmaku; + set => SetProperty(ref isDownloadDanmaku, value); } private bool isDownloadCover; public bool IsDownloadCover { - get { return isDownloadCover; } - set { SetProperty(ref isDownloadCover, value); } + get => isDownloadCover; + set => SetProperty(ref isDownloadCover, value); } #endregion @@ -135,9 +135,9 @@ namespace DownKyi.ViewModels.Settings int quality = SettingsManager.GetInstance().GetQuality(); SelectedVideoQuality = VideoQualityList.FirstOrDefault(t => { return t.Id == quality; }); - // 是否在下载的视频前增加序号 - AllowStatus isAddOrder = SettingsManager.GetInstance().IsAddOrder(); - IsAddVideoOrder = isAddOrder == AllowStatus.YES; + //// 是否在下载的视频前增加序号 + //AllowStatus isAddOrder = SettingsManager.GetInstance().IsAddOrder(); + //IsAddVideoOrder = isAddOrder == AllowStatus.YES; // 是否下载flv视频后转码为mp4 AllowStatus isTranscodingFlvToMp4 = SettingsManager.GetInstance().IsTranscodingFlvToMp4(); @@ -150,17 +150,17 @@ namespace DownKyi.ViewModels.Settings // 默认下载目录 SaveVideoDirectory = SettingsManager.GetInstance().GetSaveVideoRootPath(); - // 是否为不同视频分别创建文件夹 - AllowStatus isCreateFolderForMedia = SettingsManager.GetInstance().IsCreateFolderForMedia(); - IsCreateFolderForMedia = isCreateFolderForMedia == AllowStatus.YES; + //// 是否为不同视频分别创建文件夹 + //AllowStatus isCreateFolderForMedia = SettingsManager.GetInstance().IsCreateFolderForMedia(); + //IsCreateFolderForMedia = isCreateFolderForMedia == AllowStatus.YES; - // 是否在下载视频的同时下载弹幕 - AllowStatus isDownloadDanmaku = SettingsManager.GetInstance().IsDownloadDanmaku(); - IsDownloadDanmaku = isDownloadDanmaku == AllowStatus.YES; + //// 是否在下载视频的同时下载弹幕 + //AllowStatus isDownloadDanmaku = SettingsManager.GetInstance().IsDownloadDanmaku(); + //IsDownloadDanmaku = isDownloadDanmaku == AllowStatus.YES; - // 是否在下载视频的同时下载封面 - AllowStatus isDownloadCover = SettingsManager.GetInstance().IsDownloadCover(); - IsDownloadCover = isDownloadCover == AllowStatus.YES; + //// 是否在下载视频的同时下载封面 + //AllowStatus isDownloadCover = SettingsManager.GetInstance().IsDownloadCover(); + //IsDownloadCover = isDownloadCover == AllowStatus.YES; isOnNavigatedTo = false; } @@ -199,20 +199,20 @@ namespace DownKyi.ViewModels.Settings PublishTip(isSucceed); } - // 是否在下载的视频前增加序号事件 - private DelegateCommand IisAddVideoOrderCommand; - public DelegateCommand IsAddVideoOrderCommand => IisAddVideoOrderCommand ?? (IisAddVideoOrderCommand = new DelegateCommand(ExecuteIsAddVideoOrderCommand)); + //// 是否在下载的视频前增加序号事件 + //private DelegateCommand IisAddVideoOrderCommand; + //public DelegateCommand IsAddVideoOrderCommand => IisAddVideoOrderCommand ?? (IisAddVideoOrderCommand = new DelegateCommand(ExecuteIsAddVideoOrderCommand)); - /// - /// 是否在下载的视频前增加序号事件 - /// - private void ExecuteIsAddVideoOrderCommand() - { - AllowStatus isAddOrder = IsAddVideoOrder ? AllowStatus.YES : AllowStatus.NO; + ///// + ///// 是否在下载的视频前增加序号事件 + ///// + //private void ExecuteIsAddVideoOrderCommand() + //{ + // AllowStatus isAddOrder = IsAddVideoOrder ? AllowStatus.YES : AllowStatus.NO; - bool isSucceed = SettingsManager.GetInstance().IsAddOrder(isAddOrder); - PublishTip(isSucceed); - } + // bool isSucceed = SettingsManager.GetInstance().IsAddOrder(isAddOrder); + // PublishTip(isSucceed); + //} // 是否下载flv视频后转码为mp4事件 private DelegateCommand isTranscodingFlvToMp4Command; @@ -265,50 +265,50 @@ namespace DownKyi.ViewModels.Settings } } - // 是否为不同视频分别创建文件夹事件 - private DelegateCommand isCreateFolderForMediaCommand; - public DelegateCommand IsCreateFolderForMediaCommand => isCreateFolderForMediaCommand ?? (isCreateFolderForMediaCommand = new DelegateCommand(ExecuteIsCreateFolderForMediaCommand)); - - /// - /// 是否为不同视频分别创建文件夹事件 - /// - private void ExecuteIsCreateFolderForMediaCommand() - { - AllowStatus isCreateFolderForMedia = IsCreateFolderForMedia ? AllowStatus.YES : AllowStatus.NO; - - bool isSucceed = SettingsManager.GetInstance().IsCreateFolderForMedia(isCreateFolderForMedia); - PublishTip(isSucceed); - } - - // 是否在下载视频的同时下载弹幕事件 - private DelegateCommand isDownloadDanmakuCommand; - public DelegateCommand IsDownloadDanmakuCommand => isDownloadDanmakuCommand ?? (isDownloadDanmakuCommand = new DelegateCommand(ExecuteIsDownloadDanmakuCommand)); - - /// - /// 是否在下载视频的同时下载弹幕事件 - /// - private void ExecuteIsDownloadDanmakuCommand() - { - AllowStatus isDownloadDanmaku = IsDownloadDanmaku ? AllowStatus.YES : AllowStatus.NO; - - bool isSucceed = SettingsManager.GetInstance().IsDownloadDanmaku(isDownloadDanmaku); - PublishTip(isSucceed); - } - - // 是否在下载视频的同时下载封面事件 - private DelegateCommand isDownloadCoverCommand; - public DelegateCommand IsDownloadCoverCommand => isDownloadCoverCommand ?? (isDownloadCoverCommand = new DelegateCommand(ExecuteIsDownloadCoverCommand)); - - /// - /// 是否在下载视频的同时下载封面事件 - /// - private void ExecuteIsDownloadCoverCommand() - { - AllowStatus isDownloadCover = IsDownloadCover ? AllowStatus.YES : AllowStatus.NO; - - bool isSucceed = SettingsManager.GetInstance().IsDownloadCover(isDownloadCover); - PublishTip(isSucceed); - } + //// 是否为不同视频分别创建文件夹事件 + //private DelegateCommand isCreateFolderForMediaCommand; + //public DelegateCommand IsCreateFolderForMediaCommand => isCreateFolderForMediaCommand ?? (isCreateFolderForMediaCommand = new DelegateCommand(ExecuteIsCreateFolderForMediaCommand)); + + ///// + ///// 是否为不同视频分别创建文件夹事件 + ///// + //private void ExecuteIsCreateFolderForMediaCommand() + //{ + // AllowStatus isCreateFolderForMedia = IsCreateFolderForMedia ? AllowStatus.YES : AllowStatus.NO; + + // bool isSucceed = SettingsManager.GetInstance().IsCreateFolderForMedia(isCreateFolderForMedia); + // PublishTip(isSucceed); + //} + + //// 是否在下载视频的同时下载弹幕事件 + //private DelegateCommand isDownloadDanmakuCommand; + //public DelegateCommand IsDownloadDanmakuCommand => isDownloadDanmakuCommand ?? (isDownloadDanmakuCommand = new DelegateCommand(ExecuteIsDownloadDanmakuCommand)); + + ///// + ///// 是否在下载视频的同时下载弹幕事件 + ///// + //private void ExecuteIsDownloadDanmakuCommand() + //{ + // AllowStatus isDownloadDanmaku = IsDownloadDanmaku ? AllowStatus.YES : AllowStatus.NO; + + // bool isSucceed = SettingsManager.GetInstance().IsDownloadDanmaku(isDownloadDanmaku); + // PublishTip(isSucceed); + //} + + //// 是否在下载视频的同时下载封面事件 + //private DelegateCommand isDownloadCoverCommand; + //public DelegateCommand IsDownloadCoverCommand => isDownloadCoverCommand ?? (isDownloadCoverCommand = new DelegateCommand(ExecuteIsDownloadCoverCommand)); + + ///// + ///// 是否在下载视频的同时下载封面事件 + ///// + //private void ExecuteIsDownloadCoverCommand() + //{ + // AllowStatus isDownloadCover = IsDownloadCover ? AllowStatus.YES : AllowStatus.NO; + + // bool isSucceed = SettingsManager.GetInstance().IsDownloadCover(isDownloadCover); + // PublishTip(isSucceed); + //} #endregion diff --git a/DownKyi/Views/Settings/ViewVideo.xaml b/DownKyi/Views/Settings/ViewVideo.xaml index 6938569..4910986 100644 --- a/DownKyi/Views/Settings/ViewVideo.xaml +++ b/DownKyi/Views/Settings/ViewVideo.xaml @@ -54,31 +54,6 @@ - - - - - - - - - - - - - - - -