diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 2630988..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,238 +0,0 @@ -# 更新日志 - -## `2023/12/10` v1.6.1 - -* [优化] 如果存在下载完成列表,弹出选择框是否再次下载。 -* [修复] 更新wbi签名算法,解决无法解析下载视频的问题。 - -## `2023/12/09` v1.6.0 - -* [优化] 下载列表弹出框。 -* [优化] 添加任务栏图标。 -* [优化] 视频流API、视频详细信息API。 -* [修复] 文件名导致的闪退问题。 -* [修复] 程序反复读取设置文件的问题。 -* [修复] 修复扫码登录的问题。 -* [修复] 在下载设置窗口界面取消或关闭窗口之后导致的DownKyi闪退问题 #907。 - -## `2023/05/24` v1.5.9 - -* [新增] 下载完成系统提示。 -* [修复] UP主个人空间访问。 - -## `2023/04/30` v1.5.8 - -* [新增] 视频详情页搜索功能。 -* [优化] 确认下载路径之前检查盘符是否存在。 -* [优化] 弹出框的UI。 -* [优化] 音质描述【普通音质有3档质量,但不是固定的320K或192K,因此仅用高中低表述,以免产生误解】。 -* [修复] 下载管理在只下载音频的情况下点击打开文件夹无响应。 -* [修复] 解决tabId溢出的问题。 - -## `2023/02/18` v1.5.7 - -* [新增] 自定义UserAgent。 -* [新增] 程序检查更新。 -* [优化] 下载前检测无效的下载目录。 -* [优化] 更新依赖版本。 -* [优化] 输出Aria2错误信息到UI。 -* [修复] 默认编码为AVC,但画质为杜比视界时,不会自动选中HEVC编码的问题。 -* [修复] 删除下载项时内建下载器崩溃的问题。 - -## `2023/01/06` v1.5.6 - -* [修复] 文件名包含非法字符。 -* [修复] 多线程下载的bug。 -* [修复] 弹幕无法下载的bug。 - -## `2022/11/06` v1.5.5 - -* [优化] 更新分区列表。 -* [优化] 更新依赖包。 -* [新增] 关注和粉丝页面。 -* [修复] 命名格式无AV1编码的问题。 -* [修复] 优先解析视频编码顺序为AV1、HEVC、AVC。 -* [修复] 自定义aria服务器监听端口设置无效的问题。 - -## `2022/10/16` v1.5.4 - -* [新增] 支持AV1编码视频。 -* [新增] 支持Hi-Res无损音频格式。 -* [新增] 支持UP主用户空间的合集和列表。 -* [新增] 支持自定义aria服务器。 -* [新增] 音视频分离支持多选。 -* [修复] 视频无杜比视界时支持杜比全景声。 - -## `2022/06/05` v1.5.3 - -* [优化] 封面命名。 -* [新增] 启用https控制。 -* [新增] 支持出行分区。 -* [新增] 下载管理页面入口。 -* [修复] 批量操作时偶尔崩溃的问题。 -* [修复] 监听剪贴板失效的问题。 - -## `2022/05/09` v1.5.2 - -* [优化] 更新依赖版本。 -* [新增] 内建下载器。 -* [新增] 下载器切换设置。 -* [修复] 问题 SSL/TLS handshake failure。 - ---- - -* `2022/05/09` v1.5.1 - 1. [优化] 当复制视频详情页的输入框中的字符时,不读取剪贴板内容。 - 2. [优化] Aria下载器添加header。 - 3. [新增] 向下载管理页面添加弹窗提示。 - 4. [新增] 文件命名模块中序号格式设置。 - 5. [新增] 支持WebP图像。 - 6. [修复] 未获取到杜比全景声却仍然显示出此选项的问题。 - 7. [修复] 运动分区无法显示的问题。 - 8. [修复] 文件名异常导致的下载失败。 - 9. [修复] 偶尔VideoSection重复的问题。 - -* `2022/04/04` v1.5.0 - 1. [优化] 跳过数据库中的不完整数据。 - 2. [优化] 文件命名格式设置支持拖拽。 - 3. [修复] 下载完成后的动作设置无效的问题。 - 4. [修复] 视频BV1rr4y1i74o无法加载的问题。 - 5. [修复] 下载内容设置偶尔不生效的问题。 - -* `2022/03/26` v1.5.0-alpha7 - 1. [优化] 批量下载时过滤UGC、其他季或花絮内容。 - 2. [优化] 保存下载视频内容到设置。 - 3. [优化] 更新ffmpeg为gpl版本。 - 4. [优化] 默认的aria的文件预分配改为NONE。 - 5. [新增] “解析后自动下载已解析视频”设置。 - 6. [修复] 只下载音频失败的问题。 - 7. [修复] Settings被占用无法读取的问题。 - 8. [修复] 因路径导致无法下载的问题。 - 9. [修复] 无法正确关闭数据库的问题。 - -* `2022/03/20` v1.5.0-alpha6 - 1. [修复] 一些已知问题。 - -* `2022/03/19` v1.5.0-alpha5 - 1. [优化] 文件命名格式中,时间格式可设置。 - 2. [修复] 数据库异常锁定的问题。 - 3. [修复] 视频标题和分P标题相同时找不到下载文件的问题。 - 4. [修复] 150%缩放下的窗口不超出屏幕。 - 5. [修复] 其他已知问题。 - -* `2022/03/13` v1.5.0-alpha4 - 1. [优化] 配置文件目录改为当前程序目录。 - 2. [修复] 部分UI显示。 - 3. [修复] 因数据库中的重复内容导致的闪退问题。 - 4. [修复] 其他已知问题。 - -* `2022/03/12` v1.5.0-alpha3 - 1. [修复] 当用户性别为保密时,程序闪退的问题。 - 2. [修复] 批量下载UP主视频时,程序偶尔闪退的问题。 - 3. [修复] 其他已知问题。 - -* `2022/03/07` v1.5.0-alpha2 - 1. [优化] 重构程序架构,解决一些已知问题。 - 2. [优化] 界面UI的显示与操作。 - 3. [新增] 文件命名格式:avid、bvid、cid、UP主信息、视频发布时间。 - 4. [修复] 视频音质列表导致的闪退问题。 - 5. [修复] 图片下载导致的闪退问题。 - -* `2022/03/05` v1.5.0-alpha1 - 1. [优化] 重构程序架构,解决一些已知问题。 - 2. [新增] 最高支持8K视频。 - 3. [新增] 支持杜比全景声和杜比视界。 - 4. [新增] 支持字幕下载。 - 5. [新增] 支持部分短链接(如 )。 - 6. [新增] 下载内容可选,可根据需要选择下载视频、音频、弹幕、字幕、封面。 - 7. [新增] 下载文件命名模块,可自主设置文件名。 - -* `2021/06/12` v1.4.0 - 1. [修复] 视频无封面时崩溃的问题。 - 2. [优化] 视频分区代码与图标。 - 3. [优化] 屏蔽频道中的失效视频。 - 4. [优化] 二维码登录逻辑。 - 5. [新增] 弹幕下载(借鉴并重写于项目 [niconvert](https://github.com/muzuiget/niconvert))。 - 6. [新增] 弹幕样式设置。 - 7. [新增] 下载弹幕、下载封面的选项。 - -* `2021/04/27` v1.3.8 - 1. [修复] FLV视频只有1个分段时下载失败的问题。 - 2. [修复] UP主视频页面闪退的问题。 - 3. [修复] 电视剧图标丢失的问题。 - 4. [新增] UP主视频页面下载全部视频的按钮。 - -* `2021/03/28` v1.3.7 - 1. [修复] 播放数为空白的视频存在时,整页视频列表无法加载的问题。 - 2. [修复] 特殊字符(控制字符、末尾空格等)导致的下载失败。 - 3. [修复] 由于某些封面图片metadata损坏导致的程序崩溃。 - 4. [修复] 监听剪贴板数据异常报错的问题。 - 5. [优化] 部分界面显示。 - 6. [优化] 程序逻辑。 - 7. [新增] 监听剪贴板和自动解析的设置持久化。 - 8. [新增] 列表支持shift&ctrl多选。 - 9. [新增] 下载中列表重试按钮。 - -* `2021/03/04` v1.3.6 - 1. [修复] 下载FLV时失败的问题。 - 2. [修复] 主页的登录信息更新不及时的问题。 - 3. [优化] 主页下方按钮居中。 - 4. [优化] 首页搜索框添加搜索按钮,点击可进行搜索。 - 5. [新增] 监听剪贴板。 - 6. [新增] 已下载视频列表排序。 - 7. [新增] 下载管理页面增加全部暂停、全部开始、全部删除。 - -* `2021/02/21` v1.3.5 - 1. [修复] 分P标题相同时会下载失败的问题。 - 2. [修复] 个人空间中的头像可能显示不全的问题。 - 3. [优化] 订阅页面采用分页显示。 - 4. [优化] 增强程序健壮性。 - 5. [优化] 部分界面UI。 - 6. [优化] 视频详情页获取视频后不自动解析下载链接。 - 7. [新增] 视频详情页“自动解析”选项,“解析视频”按钮,列表右键菜单“解析”。 - 8. [新增] 视频详情页支持输入av号和BV号。 - 9. [新增] 视频详情页的UP主头像增加进入用户空间的入口。 - 10. [新增] 历史记录和稍后再看的up主头像增加进入用户空间的入口。 - -* `2021/02/10` v1.3.4 - 1. [修复] 修复在未登录时进入UP主用户空间,程序崩溃的问题。 - 2. [优化] 更新视频分区。 - 3. [优化] 视频数为0的频道不显示。 - 4. [优化] 部分界面UI。 - -* `2021/01/30` v1.3.3 - 1. [修复] 输入avid和bvid可能无法解析的问题。 - 2. [优化] 程序的一些显示。 - 3. [优化] 程序核心代码结构。 - 4. [新增] 访问用户空间。 - 5. [新增] UP主投稿视频列表展示。 - 6. [新增] UP主频道列表展示。 - 7. [新增] 意见反馈入口,将进入github的issue页。 - -* `2021/01/05` v1.3.2 beta - 1. [修复] 向Aria添加下载时参数错误问题。 - 2. [修复] 分P标题为空时,标题为总标题+数字。 - 3. [优化] 更新视频分区。 - 4. [优化] 文件夹、订阅、稍后再看的健壮性。 - -* `2021/01/01` v1.3.1 beta - 1. [修复] Aria2c下载时出现503错误的问题。 - 2. [修复] 选择文件夹时,若取消选择仍然会添加到下载的问题。 - 3. [修复] 标题中含有转义字符时的问题。 - 4. [修复] 其他已知问题。 - 5. [优化] 启动时先杀死以开启的Aria2c进程。 - 6. [优化] 关于页面添加github链接。 - -* `2020/12/26` v1.3.0 beta - 1. [新增] 使用Aria下载器。 - 2. [新增] 暂停、继续、删除下载项功能。 - 3. [新增] 下载时自动下载视频封面。 - 4. [新增] B站助手工具,包括av与bv互转,弹幕发送者查询。 - 5. [优化] 工具箱页面的按钮的样式。 - 6. [优化] 更新QRCoder版本到1.4.1。 - 7. [新增] 在视频详情页添加解析后自动下载所有选项。 - 8. [新增] 支持avid和bvid输入。 - 9. [修复] 在没有解析完网址的时候粘贴新的网址会出现闪退的问题。 - 10. [优化] 下载管理上方控制面板是否显示根据已下载视频数量动态变化。 - 11. [新增] 下载列表的历史记录,重启程序后恢复下载。 - 12. [新增] 视频详情页的封面增加右键菜单:复制封面图片、复制封面url。 diff --git a/README.md b/README.md index dbd78f7..972b3a0 100644 --- a/README.md +++ b/README.md @@ -1,75 +1 @@ # 哔哩下载姬 - -

- - GitHub Repo stars - - - GitHub forks - - - GitHub issues - - - GitHub - -

- -![index.png](https://s2.loli.net/2022/06/04/dOsqtfBXceRgrj2.png) - -哔哩下载姬(DownKyi)是一个简单易用的哔哩哔哩视频下载工具,具有简洁的界面,流畅的操作逻辑。哔哩下载姬可以下载几乎所有的B站视频,并输出mp4格式的文件;采用Aria下载器多线程下载,采用FFmpeg对视频进行混流、提取音视频等操作。 - -[更多详情](src/README.md) - -## 下载 - -

- - GitHub release (latest by date) - - - GitHub Release Date - - - GitHub all releases - -

- -[更新日志](CHANGELOG.md) - -## 问题 - -- Aria下载失败:检查aria2c.exe是否可以正常工作和是否允许通过防火墙;或者尝试切换端口号。 -- 内建下载器失败:请提issue,也欢迎pr。 -- 下载时卡在“混流中”:检查ffmpeg.exe是否可以正常工作。 -- 去水印:宽/高为水印的尺寸,X/Y为水印在图像中的位置(以左上角为原点),这四个数据可通过Photoshop获得。 - -## 赞助 - -如果这个项目对您有很大帮助,并且您希望支持该项目的开发和维护,请随时扫描一下二维码进行捐赠。非常感谢您的捐款,谢谢! - -![Alipay.png](https://s2.loli.net/2022/06/04/6LpfinSa5FoZmNB.png)![WeChat.png](https://s2.loli.net/2022/06/04/2yotOSvwmahPdXU.png) - -## 开发 - -### x86 & x64 - -发布的压缩包中aria2c.exe和ffmpeg.exe均为32位,如果需要请用下面链接中的文件替换。 - -- [aria2-1.36.0-win-32bit](third_party/aria2-1.36.0-win-32bit-build1.zip) -- [aria2-1.36.0-win-64bit](third_party/aria2-1.36.0-win-64bit-build1.zip) -- [FFmpeg](https://github.com/leiurayer/FFmpeg-Builds/releases/tag/latest) - -### 相关项目 - -- [哔哩哔哩-API收集整理](https://github.com/SocialSisterYi/bilibili-API-collect):B站API归档 -- [Prism](https://github.com/PrismLibrary/Prism):MVVM框架 -- [WebPSharp](https://github.com/leiurayer/WebPSharp):WebP格式图片支持,[NuGet程序包](third_party/WebPSharp.0.5.1.nupkg) - -## 免责申明 - -1. 本软件只提供视频解析,不提供任何资源上传、存储到服务器的功能。 -2. 本软件仅解析来自B站的内容,不会对解析到的音视频进行二次编码,部分视频会进行有限的格式转换、拼接等操作。 -3. 本软件解析得到的所有内容均来自B站UP主上传、分享,其版权均归原作者所有。内容提供者、上传者(UP主)应对其提供、上传的内容承担全部责任。 -4. **本软件提供的所有内容,仅可用作学习交流使用,未经原作者授权,禁止用于其他用途。请在下载24小时内删除。为尊重作者版权,请前往资源的原始发布网站观看,支持原创,谢谢。** -5. 因使用本软件产生的版权问题,软件作者概不负责。 diff --git a/images/Alipay.png b/images/Alipay.png deleted file mode 100644 index f33b7db..0000000 Binary files a/images/Alipay.png and /dev/null differ diff --git a/images/WeChat.png b/images/WeChat.png deleted file mode 100644 index 8ef8a02..0000000 Binary files a/images/WeChat.png and /dev/null differ diff --git a/images/app/index.png b/images/app/index.png deleted file mode 100644 index a950b9a..0000000 Binary files a/images/app/index.png and /dev/null differ diff --git a/src/.gitattributes b/src/.gitattributes deleted file mode 100644 index 1ff0c42..0000000 --- a/src/.gitattributes +++ /dev/null @@ -1,63 +0,0 @@ -############################################################################### -# Set default behavior to automatically normalize line endings. -############################################################################### -* text=auto - -############################################################################### -# Set default behavior for command prompt diff. -# -# This is need for earlier builds of msysgit that does not have it on by -# default for csharp files. -# Note: This is only used by command line -############################################################################### -#*.cs diff=csharp - -############################################################################### -# Set the merge driver for project and solution files -# -# Merging from the command prompt will add diff markers to the files if there -# are conflicts (Merging from VS is not affected by the settings below, in VS -# the diff markers are never inserted). Diff markers may cause the following -# file extensions to fail to load in VS. An alternative would be to treat -# these files as binary and thus will always conflict and require user -# intervention with every merge. To do so, just uncomment the entries below -############################################################################### -#*.sln merge=binary -#*.csproj merge=binary -#*.vbproj merge=binary -#*.vcxproj merge=binary -#*.vcproj merge=binary -#*.dbproj merge=binary -#*.fsproj merge=binary -#*.lsproj merge=binary -#*.wixproj merge=binary -#*.modelproj merge=binary -#*.sqlproj merge=binary -#*.wwaproj merge=binary - -############################################################################### -# behavior for image files -# -# image files are treated as binary by default. -############################################################################### -#*.jpg binary -#*.png binary -#*.gif binary - -############################################################################### -# diff behavior for common document formats -# -# Convert binary document formats to text before diffing them. This feature -# is only available from the command line. Turn it on by uncommenting the -# entries below. -############################################################################### -#*.doc diff=astextplain -#*.DOC diff=astextplain -#*.docx diff=astextplain -#*.DOCX diff=astextplain -#*.dot diff=astextplain -#*.DOT diff=astextplain -#*.pdf diff=astextplain -#*.PDF diff=astextplain -#*.rtf diff=astextplain -#*.RTF diff=astextplain diff --git a/src/.gitignore b/src/.gitignore deleted file mode 100644 index 9491a2f..0000000 --- a/src/.gitignore +++ /dev/null @@ -1,363 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - -# User-specific files -*.rsuser -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Mono auto generated files -mono_crash.* - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -[Ww][Ii][Nn]32/ -[Aa][Rr][Mm]/ -[Aa][Rr][Mm]64/ -bld/ -[Bb]in/ -[Oo]bj/ -[Oo]ut/ -[Ll]og/ -[Ll]ogs/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUnit -*.VisualState.xml -TestResult.xml -nunit-*.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - -# ASP.NET Scaffolding -ScaffoldingReadMe.txt - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_h.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*_wpftmp.csproj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Coverlet is a free, cross platform Code Coverage Tool -coverage*.json -coverage*.xml -coverage*.info - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# NuGet Symbol Packages -*.snupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx -*.appxbundle -*.appxupload - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!?*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser -*- [Bb]ackup.rdl -*- [Bb]ackup ([0-9]).rdl -*- [Bb]ackup ([0-9][0-9]).rdl - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# CodeRush personal settings -.cr/personal - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - -# BeatPulse healthcheck temp database -healthchecksdb - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 -MigrationBackup/ - -# Ionide (cross platform F# VS Code tools) working folder -.ionide/ - -# Fody - auto-generated XML schema -FodyWeavers.xsd \ No newline at end of file diff --git a/src/DownKyi.Core/Aria2cNet/AriaManager.cs b/src/DownKyi.Core/Aria2cNet/AriaManager.cs deleted file mode 100644 index da2b555..0000000 --- a/src/DownKyi.Core/Aria2cNet/AriaManager.cs +++ /dev/null @@ -1,140 +0,0 @@ -using DownKyi.Core.Aria2cNet.Client; -using DownKyi.Core.Aria2cNet.Client.Entity; -using DownKyi.Core.Logging; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace DownKyi.Core.Aria2cNet -{ - public class AriaManager - { - // gid对应项目的状态 - public delegate void TellStatusHandler(long totalLength, long completedLength, long speed, string gid); - public event TellStatusHandler TellStatus; - protected virtual void OnTellStatus(long totalLength, long completedLength, long speed, string gid) - { - TellStatus?.Invoke(totalLength, completedLength, speed, gid); - } - - // 下载结果回调 - public delegate void DownloadFinishHandler(bool isSuccess, string downloadPath, string gid, string msg = null); - public event DownloadFinishHandler DownloadFinish; - protected virtual void OnDownloadFinish(bool isSuccess, string downloadPath, string gid, string msg = null) - { - DownloadFinish?.Invoke(isSuccess, downloadPath, gid, msg); - } - - // 全局下载状态 - public delegate void GetGlobalStatusHandler(long speed); - public event GetGlobalStatusHandler GlobalStatus; - protected virtual void OnGlobalStatus(long speed) - { - GlobalStatus?.Invoke(speed); - } - - /// - /// 获取gid下载项的状态 - /// - /// TODO - /// 对于下载的不同状态的返回值的测试 - /// - /// - /// - /// - public DownloadResult GetDownloadStatus(string gid, Action action = null) - { - string filePath = ""; - while (true) - { - Task status = AriaClient.TellStatus(gid); - if (status == null || status.Result == null) { continue; } - - if (status.Result.Result == null && status.Result.Error != null) - { - if (status.Result.Error.Message.Contains("is not found")) - { - OnDownloadFinish(false, null, gid, status.Result.Error.Message); - return DownloadResult.ABORT; - } - } - - if (status.Result.Result.Files != null && status.Result.Result.Files.Count >= 1) - { - filePath = status.Result.Result.Files[0].Path; - } - - long totalLength = long.Parse(status.Result.Result.TotalLength); - long completedLength = long.Parse(status.Result.Result.CompletedLength); - long speed = long.Parse(status.Result.Result.DownloadSpeed); - - // 回调 - OnTellStatus(totalLength, completedLength, speed, gid); - - // 在外部执行 - if (action != null) - { - action.Invoke(); - } - - if (status.Result.Result.Status == "complete") - { - break; - } - if (status.Result.Result.ErrorCode != null && status.Result.Result.ErrorCode != "0") - { - if (status.Result != null) - { - Utils.Debugging.Console.PrintLine("ErrorMessage: " + status.Result.Result.ErrorMessage); - LogManager.Error("AriaManager", status.Result.Result.ErrorMessage); - } - - //// 如果返回状态码不是200,则继续 - //if (status.Result.Result.ErrorMessage.Contains("The response status is not successful")) - //{ - // Thread.Sleep(1000); - // continue; - //} - - // aira中删除记录 - Task ariaRemove1 = AriaClient.RemoveDownloadResultAsync(gid); - Utils.Debugging.Console.PrintLine(ariaRemove1); - if (ariaRemove1.Result != null) - { - LogManager.Debug("AriaManager", ariaRemove1.Result.Result); - } - - // 返回回调信息,退出函数 - OnDownloadFinish(false, null, gid, status.Result.Result.ErrorMessage); - return DownloadResult.FAILED; - } - - // 降低CPU占用 - Thread.Sleep(100); - } - OnDownloadFinish(true, filePath, gid, null); - return DownloadResult.SUCCESS; - } - - /// - /// 获取全局下载速度 - /// - public async void GetGlobalStatus() - { - while (true) - { - // 查询全局status - AriaGetGlobalStat globalStatus = await AriaClient.GetGlobalStatAsync(); - if (globalStatus == null || globalStatus.Result == null) { continue; } - - long globalSpeed = long.Parse(globalStatus.Result.DownloadSpeed); - // 回调 - OnGlobalStatus(globalSpeed); - - // 降低CPU占用 - Thread.Sleep(100); - } - } - - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/AriaClient.cs b/src/DownKyi.Core/Aria2cNet/Client/AriaClient.cs deleted file mode 100644 index 86bf74a..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/AriaClient.cs +++ /dev/null @@ -1,1159 +0,0 @@ -using DownKyi.Core.Aria2cNet.Client.Entity; -using DownKyi.Core.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.IO; -using System.Net; -using System.Text; -using System.Threading.Tasks; - -namespace DownKyi.Core.Aria2cNet.Client -{ - /// - /// http://aria2.github.io/manual/en/html/aria2c.html#methods - /// - public static class AriaClient - { - private static readonly string JSONRPC = "2.0"; - private const string LOCAL_HOST = "http://localhost"; - private const string TOKEN = "downkyi"; - private const int LISTEN_PORT = 6800; - private static string host = LOCAL_HOST; - private static string token = TOKEN; - private static int listenPort = LISTEN_PORT; - - /// - /// This method adds a new download. - /// uris is an array of HTTP/FTP/SFTP/BitTorrent URIs (strings) pointing to the same resource. - /// If you mix URIs pointing to different resources, - /// then the download may fail or be corrupted without aria2 complaining. - /// When adding BitTorrent Magnet URIs, - /// uris must have only one element and it should be BitTorrent Magnet URI. - /// options is a struct and its members are pairs of option name and value. - /// See Options below for more details. - /// If position is given, it must be an integer starting from 0. - /// The new download will be inserted at position in the waiting queue. - /// If position is omitted or position is larger than the current size of the queue, - /// the new download is appended to the end of the queue. - /// This method returns the GID of the newly registered download. - /// - /// - /// - /// - /// - public static async Task AddUriAsync(List uris, AriaSendOption option, int position = -1) - { - List ariaParams = new List - { - "token:" + token, - uris, - option - }; - if (position > -1) - { - ariaParams.Add(position); - } - - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.addUri", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method adds a BitTorrent download by uploading a ".torrent" file. - /// If you want to add a BitTorrent Magnet URI, use the aria2.addUri() method instead. - /// torrent must be a base64-encoded string containing the contents of the ".torrent" file. - /// uris is an array of URIs (string). - /// uris is used for Web-seeding. - /// For single file torrents, the URI can be a complete URI pointing to the resource; - /// if URI ends with /, name in torrent file is added. - /// For multi-file torrents, name and path in torrent are added to form a URI for each file. - /// options is a struct and its members are pairs of option name and value. - /// See Options below for more details. - /// If position is given, it must be an integer starting from 0. - /// The new download will be inserted at position in the waiting queue. - /// If position is omitted or position is larger than the current size of the queue, - /// the new download is appended to the end of the queue. - /// This method returns the GID of the newly registered download. - /// If --rpc-save-upload-metadata is true, - /// the uploaded data is saved as a file named as the hex string of SHA-1 hash of data plus ".torrent" in the directory specified by --dir option. - /// E.g. a file name might be 0a3893293e27ac0490424c06de4d09242215f0a6.torrent. - /// If a file with the same name already exists, it is overwritten! - /// If the file cannot be saved successfully or --rpc-save-upload-metadata is false, - /// the downloads added by this method are not saved by --save-session. - /// - /// - /// - /// - /// - public static async Task AddTorrentAsync(string torrent, List uris, AriaSendOption option, int position = -1) - { - List ariaParams = new List - { - "token:" + token, - torrent, - uris, - option - }; - if (position > -1) - { - ariaParams.Add(position); - } - - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.addTorrent", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method adds a Metalink download by uploading a ".metalink" file. - /// metalink is a base64-encoded string which contains the contents of the ".metalink" file. - /// options is a struct and its members are pairs of option name and value. - /// See Options below for more details. - /// If position is given, it must be an integer starting from 0. - /// The new download will be inserted at position in the waiting queue. - /// If position is omitted or position is larger than the current size of the queue, - /// the new download is appended to the end of the queue. - /// This method returns an array of GIDs of newly registered downloads. - /// If --rpc-save-upload-metadata is true, - /// the uploaded data is saved as a file named hex string of SHA-1 hash of data plus ".metalink" in the directory specified by --dir option. - /// E.g. a file name might be 0a3893293e27ac0490424c06de4d09242215f0a6.metalink. - /// If a file with the same name already exists, it is overwritten! - /// If the file cannot be saved successfully or --rpc-save-upload-metadata is false, - /// the downloads added by this method are not saved by --save-session. - /// - /// - /// - /// - /// - public static async Task AddMetalinkAsync(string metalink, List uris, AriaSendOption option, int position = -1) - { - List ariaParams = new List - { - "token:" + token, - metalink, - uris, - option - }; - if (position > -1) - { - ariaParams.Add(position); - } - - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.addMetalink", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method removes the download denoted by gid (string). - /// If the specified download is in progress, it is first stopped. - /// The status of the removed download becomes removed. - /// This method returns GID of removed download. - /// - /// - /// - public static async Task RemoveAsync(string gid) - { - List ariaParams = new List - { - "token:" + token, - gid - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.remove", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method removes the download denoted by gid. - /// This method behaves just like aria2.remove() - /// except that this method removes the download without performing any actions which take time, - /// such as contacting BitTorrent trackers to unregister the download first. - /// - /// - /// - public static async Task ForceRemoveAsync(string gid) - { - List ariaParams = new List - { - "token:" + token, - gid - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.forceRemove", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method pauses the download denoted by gid (string). - /// The status of paused download becomes paused. - /// If the download was active, the download is placed in the front of waiting queue. - /// While the status is paused, the download is not started. - /// To change status to waiting, use the aria2.unpause() method. - /// This method returns GID of paused download. - /// - /// - /// - public static async Task PauseAsync(string gid) - { - List ariaParams = new List - { - "token:" + token, - gid - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.pause", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method is equal to calling aria2.pause() for every active/waiting download. - /// This methods returns OK. - /// - /// - public static async Task PauseAllAsync() - { - List ariaParams = new List - { - "token:" + token, - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.pauseAll", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method pauses the download denoted by gid. - /// This method behaves just like aria2.pause() - /// except that this method pauses downloads without performing any actions which take time, - /// such as contacting BitTorrent trackers to unregister the download first. - /// - /// - /// - public static async Task ForcePauseAsync(string gid) - { - List ariaParams = new List - { - "token:" + token, - gid - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.forcePause", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method is equal to calling aria2.forcePause() for every active/waiting download. - /// This methods returns OK. - /// - /// - public static async Task ForcePauseAllAsync() - { - List ariaParams = new List - { - "token:" + token, - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.forcePauseAll", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method changes the status of the download denoted by gid (string) from paused to waiting, - /// making the download eligible to be restarted. - /// This method returns the GID of the unpaused download. - /// - /// - /// - public static async Task UnpauseAsync(string gid) - { - List ariaParams = new List - { - "token:" + token, - gid - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.unpause", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method is equal to calling aria2.unpause() for every paused download. - /// This methods returns OK. - /// - /// - public static async Task UnpauseAllAsync() - { - List ariaParams = new List - { - "token:" + token, - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.unpauseAll", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method returns the progress of the download denoted by gid (string). - /// keys is an array of strings. - /// If specified, the response contains only keys in the keys array. - /// If keys is empty or omitted, the response contains all keys. - /// This is useful when you just want specific keys and avoid unnecessary transfers. - /// For example, aria2.tellStatus("2089b05ecca3d829", ["gid", "status"]) returns the gid and status keys only. - /// The response is a struct and contains following keys. Values are strings. - /// - /// - /// - public static async Task TellStatus(string gid) - { - List ariaParams = new List - { - "token:" + token, - gid - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.tellStatus", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method returns the URIs used in the download denoted by gid (string). - /// The response is an array of structs and it contains following keys. - /// Values are string. - /// - /// - /// - public static async Task GetUrisAsync(string gid) - { - List ariaParams = new List - { - "token:" + token, - gid - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.getUris", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method returns the file list of the download denoted by gid (string). - /// The response is an array of structs which contain following keys. - /// Values are strings. - /// - /// - /// - public static async Task GetFilesAsync(string gid) - { - List ariaParams = new List - { - "token:" + token, - gid - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.getFiles", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method returns a list peers of the download denoted by gid (string). - /// This method is for BitTorrent only. - /// The response is an array of structs and contains the following keys. - /// Values are strings. - /// - /// - /// - public static async Task GetPeersAsync(string gid) - { - List ariaParams = new List - { - "token:" + token, - gid - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.getPeers", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method returns currently connected HTTP(S)/FTP/SFTP servers of the download denoted by gid (string). - /// The response is an array of structs and contains the following keys. - /// Values are strings. - /// - /// - /// - public static async Task GetServersAsync(string gid) - { - List ariaParams = new List - { - "token:" + token, - gid - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.getServers", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method returns a list of active downloads. - /// The response is an array of the same structs as returned by the aria2.tellStatus() method. - /// For the keys parameter, please refer to the aria2.tellStatus() method. - /// - /// - public static async Task TellActiveAsync() - { - List ariaParams = new List - { - "token:" + token, - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.tellActive", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method returns a list of waiting downloads, including paused ones. - /// offset is an integer and specifies the offset from the download waiting at the front. - /// num is an integer and specifies the max. - /// number of downloads to be returned. - /// For the keys parameter, please refer to the aria2.tellStatus() method. - ///

- /// If offset is a positive integer, - /// this method returns downloads in the range of [offset, offset + num). - ///

- /// offset can be a negative integer. - /// offset == -1 points last download in the waiting queue and offset == -2 points the download before the last download, and so on. - /// Downloads in the response are in reversed order then. - ///

- /// For example, imagine three downloads "A","B" and "C" are waiting in this order. - /// aria2.tellWaiting(0, 1) returns ["A"]. - /// aria2.tellWaiting(1, 2) returns ["B", "C"]. - /// aria2.tellWaiting(-1, 2) returns ["C", "B"]. - ///

- /// The response is an array of the same structs as returned by aria2.tellStatus() method. - ///
- /// - /// - /// - public static async Task TellWaitingAsync(int offset, int num) - { - List ariaParams = new List - { - "token:" + token, - offset, - num - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.tellWaiting", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method returns a list of stopped downloads. - /// offset is an integer and specifies the offset from the least recently stopped download. - /// num is an integer and specifies the max. - /// number of downloads to be returned. - /// For the keys parameter, please refer to the aria2.tellStatus() method. - ///

- /// offset and num have the same semantics as described in the aria2.tellWaiting() method. - ///

- /// The response is an array of the same structs as returned by the aria2.tellStatus() method. - ///
- /// - /// - /// - public static async Task TellStoppedAsync(int offset, int num) - { - List ariaParams = new List - { - "token:" + token, - offset, - num - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.tellStopped", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method changes the position of the download denoted by gid in the queue. - /// pos is an integer. - /// how is a string. - /// If how is POS_SET, it moves the download to a position relative to the beginning of the queue. - /// If how is POS_CUR, it moves the download to a position relative to the current position. - /// If how is POS_END, it moves the download to a position relative to the end of the queue. - /// If the destination position is less than 0 or beyond the end of the queue, - /// it moves the download to the beginning or the end of the queue respectively. - /// The response is an integer denoting the resulting position. - /// - /// For example, if GID#2089b05ecca3d829 is currently in position 3, - /// aria2.changePosition('2089b05ecca3d829', -1, 'POS_CUR') will change its position to 2. - /// Additionally aria2.changePosition('2089b05ecca3d829', 0, 'POS_SET') will change its position to 0 (the beginning of the queue). - /// - /// The following examples move the download GID#2089b05ecca3d829 to the front of the queue. - /// - /// - /// - /// - /// - public static async Task ChangePositionAsync(string gid, int pos, HowChangePosition how) - { - List ariaParams = new List - { - "token:" + token, - gid, - pos, - how.ToString("G") - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.changePosition", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method removes the URIs in delUris from and appends the URIs in addUris to download denoted by gid. - /// delUris and addUris are lists of strings. - /// A download can contain multiple files and URIs are attached to each file. - /// fileIndex is used to select which file to remove/attach given URIs. - /// fileIndex is 1-based. - /// position is used to specify where URIs are inserted in the existing waiting URI list. - /// position is 0-based. - /// When position is omitted, URIs are appended to the back of the list. - /// This method first executes the removal and then the addition. - /// position is the position after URIs are removed, not the position when this method is called. - /// When removing an URI, if the same URIs exist in download, - /// only one of them is removed for each URI in delUris. - /// In other words, - /// if there are three URIs http://example.org/aria2 and you want remove them all, - /// you have to specify (at least) 3 http://example.org/aria2 in delUris. - /// This method returns a list which contains two integers. - /// The first integer is the number of URIs deleted. The second integer is the number of URIs added. - /// - /// - /// - /// - /// - /// - /// - public static async Task ChangeUriAsync(string gid, int fileIndex, List delUris, List addUris, int position = -1) - { - List ariaParams = new List - { - "token:" + token, - gid, - fileIndex, - delUris, - addUris - }; - if (position > -1) - { - ariaParams.Add(position); - } - - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.changePosition", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method returns options of the download denoted by gid. - /// The response is a struct where keys are the names of options. - /// The values are strings. - /// Note that this method does not return options which have no default value and have not been set on the command-line, - /// in configuration files or RPC methods. - /// - /// - /// - public static async Task GetOptionAsync(string gid) - { - List ariaParams = new List - { - "token:" + token, - gid - }; - - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.getOption", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method changes options of the download denoted by gid (string) dynamically. - /// options is a struct. - /// The options listed in Input File subsection are available, except for following options: - ///
- /// dry-run metalink-base-uri parameterized-uri pause piece-length rpc-save-upload-metadata - ///
- /// Except for the following options, - /// changing the other options of active download makes it restart - /// (restart itself is managed by aria2, and no user intervention is required): - ///
- /// bt-max-peers bt-request-peer-speed-limit bt-remove-unselected-file force-save max-download-limit max-upload-limit - ///
- /// This method returns OK for success. - ///
- /// - /// - /// - public static async Task ChangeOptionAsync(string gid, object option) - { - List ariaParams = new List - { - "token:" + token, - gid, - option - }; - - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.changeOption", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method returns the global options. - /// The response is a struct. - /// Its keys are the names of options. - /// Values are strings. - /// Note that this method does not return options which have no default value and have not been set on the command-line, - /// in configuration files or RPC methods. - /// Because global options are used as a template for the options of newly added downloads, - /// the response contains keys returned by the aria2.getOption() method. - /// - /// - public static async Task GetGlobalOptionAsync() - { - List ariaParams = new List - { - "token:" + token, - }; - - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.getGlobalOption", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method changes global options dynamically. - /// options is a struct. - /// The following options are available: - ///
- /// bt-max-open-files download-result keep-unfinished-download-result log log-level - /// max-concurrent-downloads max-download-result max-overall-download-limit max-overall-upload-limit - /// optimize-concurrent-downloads save-cookies save-session server-stat-of - ///
- /// In addition, options listed in the Input File subsection are available, - /// except for following options: checksum, index-out, out, pause and select-file. - /// With the log option, you can dynamically start logging or change log file. - /// To stop logging, specify an empty string("") as the parameter value. - /// Note that log file is always opened in append mode. - /// This method returns OK for success. - ///
- /// - /// - public static async Task ChangeGlobalOptionAsync(object option) - { - List ariaParams = new List - { - "token:" + token, - option - }; - - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.changeGlobalOption", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method returns global statistics such as the overall download and upload speeds. - /// The response is a struct and contains the following keys. Values are strings. - /// - /// - public static async Task GetGlobalStatAsync() - { - List ariaParams = new List - { - "token:" + token, - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.getGlobalStat", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method purges completed/error/removed downloads to free memory. - /// This method returns OK. - /// - /// - public static async Task PurgeDownloadResultAsync() - { - List ariaParams = new List - { - "token:" + token, - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.purgeDownloadResult", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method removes a completed/error/removed download denoted by gid from memory. - /// This method returns OK for success. - /// - /// - /// - public static async Task RemoveDownloadResultAsync(string gid) - { - List ariaParams = new List - { - "token:" + token, - gid - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.removeDownloadResult", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method returns the version of aria2 and the list of enabled features. - /// The response is a struct and contains following keys. - /// - /// - public static async Task GetAriaVersionAsync() - { - List ariaParams = new List - { - "token:" + token, - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.getVersion", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method returns session information. - /// The response is a struct and contains following key. - ///

- /// Session ID, which is generated each time when aria2 is invoked. - ///
- /// - public static async Task GetSessionInfoAsync() - { - List ariaParams = new List - { - "token:" + token, - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.getSessionInfo", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method shuts down aria2. - /// This method returns OK. - /// - /// - public static async Task ShutdownAsync() - { - List ariaParams = new List - { - "token:" + token, - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.shutdown", - Params = ariaParams - }; - var re = await GetRpcResponseAsync(ariaSend); - return re; - } - - /// - /// This method shuts down aria2(). - /// This method behaves like :func:'aria2.shutdown` without performing any actions which take time, - /// such as contacting BitTorrent trackers to unregister downloads first. - /// This method returns OK. - /// - /// - public static async Task ForceShutdownAsync() - { - List ariaParams = new List - { - "token:" + token, - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.forceShutdown", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method saves the current session to a file specified by the --save-session option. - /// This method returns OK if it succeeds. - /// - /// - public static async Task SaveSessionAsync() - { - List ariaParams = new List - { - "token:" + token, - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "aria2.saveSession", - Params = ariaParams - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This methods encapsulates multiple method calls in a single request. - /// methods is an array of structs. The structs contain two keys: methodName and params. - /// methodName is the method name to call and params is array containing parameters to the method call. - /// This method returns an array of responses. - /// The elements will be either a one-item array containing the return value of the method call or a struct of fault element if an encapsulated method call fails. - /// - /// - /// - public static async Task> MulticallAsync(List systemMulticallMathods) - { - List ariaParams = new List - { - systemMulticallMathods - }; - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "system.multicall", - Params = ariaParams - }; - return await GetRpcResponseAsync>(ariaSend); - } - - /// - /// This method returns all the available RPC methods in an array of string. - /// Unlike other methods, this method does not require secret token. - /// This is safe because this method just returns the available method names. - /// - /// - public static async Task ListMethodsAsync() - { - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "system.listMethods" - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// This method returns all the available RPC notifications in an array of string. - /// Unlike other methods, this method does not require secret token. - /// This is safe because this method just returns the available notifications names. - /// - /// - public static async Task ListNotificationsAsync() - { - AriaSendData ariaSend = new AriaSendData - { - Id = Guid.NewGuid().ToString("N"), - Jsonrpc = JSONRPC, - Method = "system.listNotifications" - }; - return await GetRpcResponseAsync(ariaSend); - } - - /// - /// 设置aria token - /// - /// - public static void SetToken(string token = TOKEN) - { - AriaClient.token = token; - } - - /// - /// 设置aria host - /// - /// - public static void SetHost(string host = LOCAL_HOST) - { - AriaClient.host = host; - } - - public static void SetListenPort(int listenPort = LISTEN_PORT) - { - AriaClient.listenPort = listenPort; - } - - /// - /// 获取jsonrpc的地址 - /// - /// - private static string GetRpcUri() - { - return $"{host}:{AriaClient.listenPort}/jsonrpc"; - } - - /// - /// 发送http请求,并将返回的json反序列化 - /// - /// - /// - /// - private async static Task GetRpcResponseAsync(AriaSendData ariaSend) - { - // 去掉null - var jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; - // 转换为json字符串 - string sendJson = JsonConvert.SerializeObject(ariaSend, Formatting.Indented, jsonSetting); - // 向服务器请求数据 - string result = string.Empty; - await Task.Run(() => - { - result = Request(GetRpcUri(), sendJson); - }); - if (result == null) { return default; } - - // 反序列化 - var aria = JsonConvert.DeserializeObject(result); - return aria; - } - - /// - /// http请求 - /// - /// - /// - /// - /// - private static string Request(string url, string parameters, int retry = 3) - { - // 重试次数 - if (retry <= 0) { return null; } - - try - { - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); - request.Method = "POST"; - request.Timeout = 5 * 1000; - request.ContentType = "application/json"; - byte[] postData = Encoding.UTF8.GetBytes(parameters); - request.ContentLength = postData.Length; - using (Stream reqStream = request.GetRequestStream()) - { - reqStream.Write(postData, 0, postData.Length); - reqStream.Close(); - } - - string html = string.Empty; - using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) - { - using (Stream stream = response.GetResponseStream()) - { - using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) - { - html = reader.ReadToEnd(); - } - } - } - return html; - } - catch (WebException e) - { - //Utils.Debugging.Console.PrintLine("Request()发生Web异常: {0}", e); - //LogManager.Error("AriaClient", e); - - //return Request(url, parameters, retry - 1); - - string html = string.Empty; - var response = (HttpWebResponse)e.Response; - if (response == null) { return null; } - using (Stream stream = response.GetResponseStream()) - { - using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) - { - html = reader.ReadToEnd(); - } - } - - //Console.WriteLine($"本次请求使用的参数:{parameters}"); - //Console.WriteLine($"返回的web数据:{html}"); - return html; - } - catch (IOException e) - { - Utils.Debugging.Console.PrintLine("Request()发生IO异常: {0}", e); - LogManager.Error("AriaClient", e); - return Request(url, parameters, retry - 1); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("Request()发生其他异常: {0}", e); - LogManager.Error("AriaClient", e); - return Request(url, parameters, retry - 1); - } - } - - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaAddMetalink.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaAddMetalink.cs deleted file mode 100644 index 4101680..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaAddMetalink.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaAddMetalink - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public string Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaAddTorrent.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaAddTorrent.cs deleted file mode 100644 index 80503ec..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaAddTorrent.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaAddTorrent - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public string Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaAddUri.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaAddUri.cs deleted file mode 100644 index fca6526..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaAddUri.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - //{ - //"id": "downkyi", - //"jsonrpc": "2.0", - //"result": "1aac102a4875c8cd" - //} - [JsonObject] - public class AriaAddUri - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public string Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaChangeOption.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaChangeOption.cs deleted file mode 100644 index b91a0e2..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaChangeOption.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaChangeOption - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public string Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaChangePosition.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaChangePosition.cs deleted file mode 100644 index 1405e56..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaChangePosition.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaChangePosition - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public int Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaChangeUri.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaChangeUri.cs deleted file mode 100644 index b9af10a..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaChangeUri.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaChangeUri - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public List Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaError.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaError.cs deleted file mode 100644 index 4b967a3..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaError.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - //"error": { - // "code": 1, - // "message": "Unauthorized" - //} - [JsonObject] - public class AriaError - { - [JsonProperty("code")] - public int Code { get; set; } - - [JsonProperty("message")] - public string Message { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetFiles.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetFiles.cs deleted file mode 100644 index 34765e1..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetFiles.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaGetFiles - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public List Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } - - [JsonObject] - public class AriaGetFilesResult - { - [JsonProperty("completedLength")] - public string CompletedLength { get; set; } - - [JsonProperty("index")] - public string Index { get; set; } - - [JsonProperty("length")] - public string Length { get; set; } - - [JsonProperty("path")] - public string Path { get; set; } - - [JsonProperty("selected")] - public string Selected { get; set; } - - [JsonProperty("uris")] - public List Uris { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetGlobalStat.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetGlobalStat.cs deleted file mode 100644 index 1dc6591..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetGlobalStat.cs +++ /dev/null @@ -1,66 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - /* - { - "id": "qwer", - "jsonrpc": "2.0", - "result": { - "downloadSpeed": "0", - "numActive": "0", - "numStopped": "0", - "numStoppedTotal": "0", - "numWaiting": "0", - "uploadSpeed": "0" - } - } - */ - [JsonObject] - public class AriaGetGlobalStat - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public AriaGetGlobalStatResult Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } - - [JsonObject] - public class AriaGetGlobalStatResult - { - [JsonProperty("downloadSpeed")] - public string DownloadSpeed { get; set; } - - [JsonProperty("numActive")] - public string NumActive { get; set; } - - [JsonProperty("numStopped")] - public string NumStopped { get; set; } - - [JsonProperty("numStoppedTotal")] - public string NumStoppedTotal { get; set; } - - [JsonProperty("numWaiting")] - public string NumWaiting { get; set; } - - [JsonProperty("uploadSpeed")] - public string UploadSpeed { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetOption.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetOption.cs deleted file mode 100644 index 3e7e6e1..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetOption.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaGetOption - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public AriaOption Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetPeers.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetPeers.cs deleted file mode 100644 index fa08242..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetPeers.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaGetPeers - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public List Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } - - [JsonObject] - public class AriaPeer - { - [JsonProperty("amChoking")] - public string AmChoking { get; set; } - - [JsonProperty("bitfield")] - public string Bitfield { get; set; } - - [JsonProperty("downloadSpeed")] - public string DownloadSpeed { get; set; } - - [JsonProperty("ip")] - public string Ip { get; set; } - - [JsonProperty("peerChoking")] - public string PeerChoking { get; set; } - - [JsonProperty("peerId")] - public string PeerId { get; set; } - - [JsonProperty("port")] - public string Port { get; set; } - - [JsonProperty("seeder")] - public string Seeder { get; set; } - - [JsonProperty("uploadSpeed")] - public string UploadSpeed { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetServers.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetServers.cs deleted file mode 100644 index 7b6d8f2..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetServers.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaGetServers - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public List Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } - - [JsonObject] - public class AriaGetServersResult - { - [JsonProperty("index")] - public string Index { get; set; } - - [JsonProperty("servers")] - public List Servers { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } - - [JsonObject] - public class AriaResultServer - { - [JsonProperty("currentUri")] - public string CurrentUri { get; set; } - - [JsonProperty("downloadSpeed")] - public string DownloadSpeed { get; set; } - - [JsonProperty("uri")] - public string Uri { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetSessionInfo.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetSessionInfo.cs deleted file mode 100644 index 76c9c6e..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetSessionInfo.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaGetSessionInfo - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public AriaGetSessionInfoResult Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } - - [JsonObject] - public class AriaGetSessionInfoResult - { - [JsonProperty("sessionId")] - public string SessionId { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetUris.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetUris.cs deleted file mode 100644 index 61b42ac..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaGetUris.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaGetUris - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public List Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaOption.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaOption.cs deleted file mode 100644 index 4a3e6aa..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaOption.cs +++ /dev/null @@ -1,244 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaOption - { - [JsonProperty("all-proxy")] - public string AllProxy { get; set; } - - [JsonProperty("allow-overwrite")] - public string AllowOverwrite { get; set; } - - [JsonProperty("allow-piece-length-change")] - public string AllowPieceLengthChange { get; set; } - - [JsonProperty("always-resume")] - public string AlwaysResume { get; set; } - - [JsonProperty("async-dns")] - public string AsyncDns { get; set; } - - [JsonProperty("auto-file-renaming")] - public string AutoFileRenaming { get; set; } - - [JsonProperty("bt-enable-hook-after-hash-check")] - public string BtEnableHookAfterHashCheck { get; set; } - - [JsonProperty("bt-enable-lpd")] - public string BtEnableLpd { get; set; } - - [JsonProperty("bt-force-encryption")] - public string BtForceEncryption { get; set; } - - [JsonProperty("bt-hash-check-seed")] - public string BtHashCheckSeed { get; set; } - - [JsonProperty("bt-load-saved-metadata")] - public string BtLoadSavedMetadata { get; set; } - - [JsonProperty("bt-max-peers")] - public string BtMaxPeers { get; set; } - - [JsonProperty("bt-metadata-only")] - public string BtMetadataOnly { get; set; } - - [JsonProperty("bt-min-crypto-level")] - public string BtMinCryptoLevel { get; set; } - - [JsonProperty("bt-remove-unselected-file")] - public string BtRemoveUnselectedFile { get; set; } - - [JsonProperty("bt-request-peer-speed-limit")] - public string BtRequestPeerSpeedLimit { get; set; } - - [JsonProperty("bt-require-crypto")] - public string BtRequireCrypto { get; set; } - - [JsonProperty("bt-save-metadata")] - public string BtSaveMetadata { get; set; } - - [JsonProperty("bt-seed-unverified")] - public string BtSeedUnverified { get; set; } - - [JsonProperty("bt-stop-timeout")] - public string BtStopTimeout { get; set; } - - [JsonProperty("bt-tracker-connect-timeout")] - public string BtTrackerConnectTimeout { get; set; } - - [JsonProperty("bt-tracker-interval")] - public string BtTrackerInterval { get; set; } - - [JsonProperty("bt-tracker-timeout")] - public string BtTrackerTimeout { get; set; } - - [JsonProperty("check-integrity")] - public string CheckIntegrity { get; set; } - - [JsonProperty("conditional-get")] - public string ConditionalGet { get; set; } - - [JsonProperty("connect-timeout")] - public string ConnectTimeout { get; set; } - - [JsonProperty("content-disposition-default-utf8")] - public string ContentDispositionDefaultUtf8 { get; set; } - - [JsonProperty("continue")] - public string Continue { get; set; } - - [JsonProperty("dir")] - public string Dir { get; set; } - - [JsonProperty("dry-run")] - public string DryRun { get; set; } - - [JsonProperty("enable-http-keep-alive")] - public string EnableHttpKeepAlive { get; set; } - - [JsonProperty("enable-http-pipelining")] - public string EnableHttpPipelining { get; set; } - - [JsonProperty("enable-mmap")] - public string EnableMmap { get; set; } - - [JsonProperty("enable-peer-exchange")] - public string EnablePeerExchange { get; set; } - - [JsonProperty("file-allocation")] - public string FileAllocation { get; set; } - - [JsonProperty("follow-metalink")] - public string FollowMetalink { get; set; } - - [JsonProperty("follow-torrent")] - public string FollowTorrent { get; set; } - - [JsonProperty("force-save")] - public string ForceSave { get; set; } - - [JsonProperty("ftp-pasv")] - public string FtpPasv { get; set; } - - [JsonProperty("ftp-reuse-connection")] - public string FtpReuseConnection { get; set; } - - [JsonProperty("ftp-type")] - public string FtpType { get; set; } - - [JsonProperty("hash-check-only")] - public string HashCheckOnly { get; set; } - - [JsonProperty("http-accept-gzip")] - public string HttpAcceptGzip { get; set; } - - [JsonProperty("http-auth-challenge")] - public string HttpAuthChallenge { get; set; } - - [JsonProperty("http-no-cache")] - public string HttpNoCache { get; set; } - - [JsonProperty("lowest-speed-limit")] - public string LowestSpeedLimit { get; set; } - - [JsonProperty("max-connection-per-server")] - public string MaxConnectionPerServer { get; set; } - - [JsonProperty("max-download-limit")] - public string MaxDownloadLimit { get; set; } - - [JsonProperty("max-file-not-found")] - public string MaxFileNotFound { get; set; } - - [JsonProperty("max-mmap-limit")] - public string MaxMmapLimit { get; set; } - - [JsonProperty("max-resume-failure-tries")] - public string MaxResumeFailureTries { get; set; } - - [JsonProperty("max-tries")] - public string MaxTries { get; set; } - - [JsonProperty("max-upload-limit")] - public string MaxUploadLimit { get; set; } - - [JsonProperty("metalink-enable-unique-protocol")] - public string MetalinkEnableUniqueProtocol { get; set; } - - [JsonProperty("metalink-preferred-protocol")] - public string MetalinkPreferredProtocol { get; set; } - - [JsonProperty("min-split-size")] - public string MinSplitSize { get; set; } - - [JsonProperty("no-file-allocation-limit")] - public string NoFileAllocationLimit { get; set; } - - [JsonProperty("no-netrc")] - public string NoNetrc { get; set; } - - [JsonProperty("out")] - public string Out { get; set; } - - [JsonProperty("parameterized-uri")] - public string ParameterizedUri { get; set; } - - [JsonProperty("pause-metadata")] - public string PauseMetadata { get; set; } - - [JsonProperty("piece-length")] - public string PieceLength { get; set; } - - [JsonProperty("proxy-method")] - public string ProxyMethod { get; set; } - - [JsonProperty("realtime-chunk-checksum")] - public string RealtimeChunkChecksum { get; set; } - - [JsonProperty("remote-time")] - public string RemoteTime { get; set; } - - [JsonProperty("remove-control-file")] - public string RemoveControlFile { get; set; } - - [JsonProperty("retry-wait")] - public string RetryWait { get; set; } - - [JsonProperty("reuse-uri")] - public string ReuseUri { get; set; } - - [JsonProperty("rpc-save-upload-metadata")] - public string RpcSaveUploadMetadata { get; set; } - - [JsonProperty("save-not-found")] - public string SaveNotFound { get; set; } - - [JsonProperty("seed-ratio")] - public string SeedRatio { get; set; } - - [JsonProperty("split")] - public string Split { get; set; } - - [JsonProperty("stream-piece-selector")] - public string StreamPieceSelector { get; set; } - - [JsonProperty("timeout")] - public string Timeout { get; set; } - - [JsonProperty("uri-selector")] - public string UriSelector { get; set; } - - [JsonProperty("use-head")] - public string UseHead { get; set; } - - [JsonProperty("user-agent")] - public string UserAgent { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaPause.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaPause.cs deleted file mode 100644 index 3aa20fc..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaPause.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaPause - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public string Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaRemove.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaRemove.cs deleted file mode 100644 index 5950c4d..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaRemove.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaRemove - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public string Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaSaveSession.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaSaveSession.cs deleted file mode 100644 index 11f654e..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaSaveSession.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaSaveSession - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public string Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaSendData.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaSendData.cs deleted file mode 100644 index 0bcc88f..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaSendData.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaSendData - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("method")] - public string Method { get; set; } - - [JsonProperty("params")] - public List Params { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } - - [JsonObject] - public class AriaSendOption - { - [JsonProperty("all-proxy")] - public string HttpProxy { get; set; } - - [JsonProperty("out")] - public string Out { get; set; } - - [JsonProperty("dir")] - public string Dir { get; set; } - - //[JsonProperty("header")] - //public string Header { get; set; } - - //[JsonProperty("use-head")] - //public string UseHead { get; set; } - - [JsonProperty("user-agent")] - public string UserAgent { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaShutdown.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaShutdown.cs deleted file mode 100644 index 45a688d..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaShutdown.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaShutdown - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public string Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaTellStatus.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaTellStatus.cs deleted file mode 100644 index fa2c41f..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaTellStatus.cs +++ /dev/null @@ -1,128 +0,0 @@ -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaTellStatus - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public AriaTellStatusResult Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } - - [JsonObject] - public class AriaTellStatusList - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public List Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } - - [JsonObject] - public class AriaTellStatusResult - { - [JsonProperty("bitfield")] - public string Bitfield { get; set; } - - [JsonProperty("completedLength")] - public string CompletedLength { get; set; } - - [JsonProperty("connections")] - public string Connections { get; set; } - - [JsonProperty("dir")] - public string Dir { get; set; } - - [JsonProperty("downloadSpeed")] - public string DownloadSpeed { get; set; } - - [JsonProperty("errorCode")] - public string ErrorCode { get; set; } - - [JsonProperty("errorMessage")] - public string ErrorMessage { get; set; } - - [JsonProperty("files")] - public List Files { get; set; } - - [JsonProperty("gid")] - public string Gid { get; set; } - - [JsonProperty("numPieces")] - public string NumPieces { get; set; } - - [JsonProperty("pieceLength")] - public string PieceLength { get; set; } - - [JsonProperty("status")] - public string Status { get; set; } - - [JsonProperty("totalLength")] - public string TotalLength { get; set; } - - [JsonProperty("uploadLength")] - public string UploadLength { get; set; } - - [JsonProperty("uploadSpeed")] - public string UploadSpeed { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } - - [JsonObject] - public class AriaTellStatusResultFile - { - [JsonProperty("completedLength")] - public string CompletedLength { get; set; } - - [JsonProperty("index")] - public string Index { get; set; } - - [JsonProperty("length")] - public string Length { get; set; } - - [JsonProperty("path")] - public string Path { get; set; } - - [JsonProperty("selected")] - public string Selected { get; set; } - - [JsonProperty("uris")] - public List Uris { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaUri.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaUri.cs deleted file mode 100644 index 28001bc..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaUri.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaUri - { - [JsonProperty("status")] - public string Status { get; set; } - - [JsonProperty("uri")] - public string Uri { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaVersion.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaVersion.cs deleted file mode 100644 index d7ab742..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/AriaVersion.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class AriaVersion - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public AriaVersionResult Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } - - [JsonObject] - public class AriaVersionResult - { - [JsonProperty("enabledFeatures")] - public List EnabledFeatures { get; set; } - - [JsonProperty("version")] - public string Version { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/SystemListMethods.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/SystemListMethods.cs deleted file mode 100644 index 96ce9da..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/SystemListMethods.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class SystemListMethods - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public List Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/SystemListNotifications.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/SystemListNotifications.cs deleted file mode 100644 index 68be4be..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/SystemListNotifications.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class SystemListNotifications - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public List Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/SystemMulticall.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/SystemMulticall.cs deleted file mode 100644 index b0da67d..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/SystemMulticall.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class SystemMulticall - { - [JsonProperty("id")] - public string Id { get; set; } - - [JsonProperty("jsonrpc")] - public string Jsonrpc { get; set; } - - [JsonProperty("result")] - public string Result { get; set; } - - [JsonProperty("error")] - public AriaError Error { get; set; } - - public override string ToString() - { - return JsonConvert.SerializeObject(this); - } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/Entity/SystemMulticallMathod.cs b/src/DownKyi.Core/Aria2cNet/Client/Entity/SystemMulticallMathod.cs deleted file mode 100644 index 3c8a71e..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/Entity/SystemMulticallMathod.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.Aria2cNet.Client.Entity -{ - [JsonObject] - public class SystemMulticallMathod - { - [JsonProperty("method")] - public string Method { get; set; } - - [JsonProperty("params")] - public List Params { get; set; } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Client/HowChangePosition.cs b/src/DownKyi.Core/Aria2cNet/Client/HowChangePosition.cs deleted file mode 100644 index f6246a2..0000000 --- a/src/DownKyi.Core/Aria2cNet/Client/HowChangePosition.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace DownKyi.Core.Aria2cNet.Client -{ - /// - /// changePosition函数的how参数 - /// - public enum HowChangePosition - { - POS_SET = 1, - POS_CUR, - POS_END - } -} diff --git a/src/DownKyi.Core/Aria2cNet/DownloadResult.cs b/src/DownKyi.Core/Aria2cNet/DownloadResult.cs deleted file mode 100644 index 17f6ab2..0000000 --- a/src/DownKyi.Core/Aria2cNet/DownloadResult.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace DownKyi.Core.Aria2cNet -{ - /// - /// 下载状态 - /// - public enum DownloadResult - { - SUCCESS = 1, - FAILED, - ABORT - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Server/AriaConfig.cs b/src/DownKyi.Core/Aria2cNet/Server/AriaConfig.cs deleted file mode 100644 index 8afa39d..0000000 --- a/src/DownKyi.Core/Aria2cNet/Server/AriaConfig.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Collections.Generic; - -namespace DownKyi.Core.Aria2cNet.Server -{ - /// - /// Aria服务器的启动配置 - /// - public class AriaConfig - { - public int ListenPort { get; set; } // 服务器端口号,取值:1024-65535 - public string Token { get; set; } // 连接服务器的token - public AriaConfigLogLevel LogLevel { get; set; } // 日志等级,debug info notice warn error - public int MaxConcurrentDownloads { get; set; } // 最大同时下载数(任务数),取值:1-* - public int MaxConnectionPerServer { get; set; } // 同服务器连接数,取值:1-16 - public int Split { get; set; } // 单文件最大线程数,取值:1-* - //public int MaxTries { get; set; } //当服务器返回503错误时,尝试重连;尝试重连次数,0代表无限,默认:5 - public int MinSplitSize { get; set; } // 最小文件分片大小, 下载线程数上限取决于能分出多少片, 对于小文件重要,单位MB - public long MaxOverallDownloadLimit { get; set; } // 下载速度限制,取值:1-* - public long MaxDownloadLimit { get; set; } // 下载单文件速度限制,取值:1-* - public long MaxOverallUploadLimit { get; set; } // 上传速度限制,取值:1-* - public long MaxUploadLimit { get; set; } // 上传单文件速度限制,取值:1-* - public bool ContinueDownload { get; set; } // 断点续传 - public AriaConfigFileAllocation FileAllocation { get; set; } // 文件预分配, none prealloc - - public List Headers { get; set; } - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Server/AriaConfigFileAllocation.cs b/src/DownKyi.Core/Aria2cNet/Server/AriaConfigFileAllocation.cs deleted file mode 100644 index 38bf62f..0000000 --- a/src/DownKyi.Core/Aria2cNet/Server/AriaConfigFileAllocation.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace DownKyi.Core.Aria2cNet.Server -{ - /// - /// 文件预分配 - /// - public enum AriaConfigFileAllocation - { - NOT_SET = 0, - NONE = 1, // 没有预分配 - PREALLOC, // 预分配,默认 - FALLOC // NTFS建议使用 - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Server/AriaConfigLogLevel.cs b/src/DownKyi.Core/Aria2cNet/Server/AriaConfigLogLevel.cs deleted file mode 100644 index ac27188..0000000 --- a/src/DownKyi.Core/Aria2cNet/Server/AriaConfigLogLevel.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace DownKyi.Core.Aria2cNet.Server -{ - /// - /// 日志等级 - /// - public enum AriaConfigLogLevel - { - NOT_SET = 0, - DEBUG = 1, - INFO, - NOTICE, - WARN, - ERROR - } -} diff --git a/src/DownKyi.Core/Aria2cNet/Server/AriaServer.cs b/src/DownKyi.Core/Aria2cNet/Server/AriaServer.cs deleted file mode 100644 index e4d5b34..0000000 --- a/src/DownKyi.Core/Aria2cNet/Server/AriaServer.cs +++ /dev/null @@ -1,259 +0,0 @@ -using DownKyi.Core.Aria2cNet.Client; -using DownKyi.Core.Logging; -using System; -using System.Diagnostics; -using System.IO; -using System.Text; -using System.Threading.Tasks; - -namespace DownKyi.Core.Aria2cNet.Server -{ - public static class AriaServer - { - public static int ListenPort; // 服务器端口 - private static Process Server; - - /// - /// 启动aria2c服务器 - /// - /// - /// - /// - /// - public static async Task StartServerAsync(AriaConfig config, Action action) - { - // aria端口 - ListenPort = config.ListenPort; - // aria目录 - string ariaDir = Environment.CurrentDirectory + "\\aria\\"; - //string ariaDir = StorageManager.GetAriaDir(); - // 会话文件 -#if DEBUG - string sessionFile = Path.Combine(ariaDir, "aira.session"); - -#else - string sessionFile =Path.Combine(ariaDir, "aira.session.gz"); -#endif - // 日志文件 - string logFile = Path.Combine(ariaDir, "aira.log"); - // 自动保存会话文件的时间间隔 - int saveSessionInterval = 30; - - // --enable-rpc --rpc-listen-all=true --rpc-allow-origin-all=true --continue=true - await Task.Run(() => - { - // 创建目录和文件 - if (!Directory.Exists(ariaDir)) - { - Directory.CreateDirectory(ariaDir); - } - if (!File.Exists(sessionFile)) - { - var stream = File.Create(sessionFile); - stream.Close(); - } - if (!File.Exists(logFile)) - { - var stream = File.Create(logFile); - stream.Close(); - } - else - { - // 日志文件存在,如果大于100M,则删除 - try - { - var stream = File.Open(logFile, FileMode.Open); - if (stream.Length >= 10 * 1024 * 1024L) - { - stream.SetLength(0); - } - stream.Close(); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("StartServerAsync()发生其他异常: {0}", e); - LogManager.Error("AriaServer", e); - } - } - - // header 解析 - string headers = string.Empty; - if (config.Headers != null) - { - foreach (var header in config.Headers) - { - headers += $"--header=\"{header}\" "; - } - } - - ExcuteProcess("aria2c.exe", - $"--enable-rpc --rpc-listen-all=true --rpc-allow-origin-all=true " + - $"--check-certificate=false " + // 解决问题 SSL/TLS handshake failure - $"--rpc-listen-port={config.ListenPort} " + - $"--rpc-secret={config.Token} " + - $"--input-file=\"{sessionFile}\" --save-session=\"{sessionFile}\" " + - $"--save-session-interval={saveSessionInterval} " + - $"--log=\"{logFile}\" --log-level={config.LogLevel.ToString("G").ToLower()} " + // log-level: 'debug' 'info' 'notice' 'warn' 'error' - $"--max-concurrent-downloads={config.MaxConcurrentDownloads} " + // 最大同时下载数(任务数) - $"--max-connection-per-server={config.MaxConnectionPerServer} " + // 同服务器连接数 - $"--split={config.Split} " + // 单文件最大线程数 - //$"--max-tries={config.MaxTries} retry-wait=3 " + // 尝试重连次数 - $"--min-split-size={config.MinSplitSize}M " + // 最小文件分片大小, 下载线程数上限取决于能分出多少片, 对于小文件重要 - $"--max-overall-download-limit={config.MaxOverallDownloadLimit} " + // 下载速度限制 - $"--max-download-limit={config.MaxDownloadLimit} " + // 下载单文件速度限制 - $"--max-overall-upload-limit={config.MaxOverallUploadLimit} " + // 上传速度限制 - $"--max-upload-limit={config.MaxUploadLimit} " + // 上传单文件速度限制 - $"--continue={config.ContinueDownload.ToString().ToLower()} " + // 断点续传 - $"--allow-overwrite=true " + // 允许复写文件 - $"--auto-file-renaming=false " + - $"--file-allocation={config.FileAllocation.ToString("G").ToLower()} " + // 文件预分配, none prealloc - $"{headers}" + // header - "", - null, (s, e) => - { - if (e.Data == null || e.Data == "" || e.Data.Replace(" ", "") == "") { return; } - - Utils.Debugging.Console.PrintLine(e.Data); - LogManager.Debug("AriaServer", e.Data); - - action.Invoke(e.Data); - }); - }); - - return true; - } - - /// - /// 关闭aria2c服务器,异步方法 - /// - /// - public static async Task CloseServerAsync() - { - await AriaClient.ShutdownAsync(); - // 等待进程结束 - await Task.Run(() => - { - Server.WaitForExit(30000); - try - { - Server.Kill(); - } - catch (Exception) - { - } - }); - return true; - } - - /// - /// 强制关闭aria2c服务器,异步方法 - /// - /// - public static async Task ForceCloseServerAsync() - { - //await Task.Run(() => - //{ - // if (Server == null) { return; } - - // Server.Kill(); - // Server = null; // 将Server指向null - //}); - //return true; - await AriaClient.ForceShutdownAsync(); - return true; - } - - /// - /// 关闭aria2c服务器 - /// - /// - public static bool CloseServer() - { - var task = AriaClient.ShutdownAsync(); - if (task.Result != null && task.Result.Result != null && task.Result.Result == "OK") - { - // 等待进程结束 - Server.WaitForExit(30000); - try - { - Server.Kill(); - } - catch (Exception) - { - } - return true; - } - return false; - } - - /// - /// 强制关闭aria2c服务器 - /// - /// - public static bool ForceCloseServer() - { - var task = AriaClient.ForceShutdownAsync(); - if (task.Result != null && task.Result.Result != null && task.Result.Result == "OK") - { return true; } - return false; - } - - /// - /// 杀死Aria进程 - /// - /// - /// - public static bool KillServer(string processName = "aria2c") - { - Process[] processes = Process.GetProcessesByName(processName); - foreach (var process in processes) - { - try - { - process.Kill(); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("KillServer()发生异常: {0}", e); - LogManager.Error("AriaServer", e); - } - } - return true; - } - - - private static void ExcuteProcess(string exe, string arg, string workingDirectory, DataReceivedEventHandler output) - { - var p = new Process(); - Server = p; - - p.StartInfo.FileName = exe; - p.StartInfo.Arguments = arg; - - // 工作目录 - if (workingDirectory != null) - { - p.StartInfo.WorkingDirectory = workingDirectory; - } - - // 输出信息重定向 - p.StartInfo.UseShellExecute = false; - p.StartInfo.CreateNoWindow = true; - p.StartInfo.RedirectStandardError = true; - p.StartInfo.RedirectStandardOutput = true; - - // 将 StandardErrorEncoding 改为 UTF-8 才不会出现中文乱码 - p.StartInfo.StandardOutputEncoding = Encoding.UTF8; - p.StartInfo.StandardErrorEncoding = Encoding.UTF8; - - p.OutputDataReceived += output; - p.ErrorDataReceived += output; - - // 启动线程 - p.Start(); - p.BeginOutputReadLine(); - p.BeginErrorReadLine(); - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/Bangumi/BangumiInfo.cs b/src/DownKyi.Core/BiliApi/Bangumi/BangumiInfo.cs deleted file mode 100644 index 634a70e..0000000 --- a/src/DownKyi.Core/BiliApi/Bangumi/BangumiInfo.cs +++ /dev/null @@ -1,68 +0,0 @@ -using DownKyi.Core.BiliApi.Bangumi.Models; -using DownKyi.Core.Logging; -using Newtonsoft.Json; -using System; - -namespace DownKyi.Core.BiliApi.Bangumi -{ - public static class BangumiInfo - { - - /// - /// 剧集基本信息(mediaId方式) - /// - /// - /// - public static BangumiMedia BangumiMediaInfo(long mediaId) - { - string url = $"https://api.bilibili.com/pgc/review/user?media_id={mediaId}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - var media = JsonConvert.DeserializeObject(response); - if (media != null && media.Result != null) { return media.Result.Media; } - else { return null; } - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("BangumiMediaInfo()发生异常: {0}", e); - LogManager.Error("BangumiInfo", e); - return null; - } - } - - /// - /// 获取剧集明细(web端)(seasonId/episodeId方式) - /// - /// - /// - /// - public static BangumiSeason BangumiSeasonInfo(long seasonId = -1, long episodeId = -1) - { - string baseUrl = "https://api.bilibili.com/pgc/view/web/season"; - string referer = "https://www.bilibili.com"; - string url; - if (seasonId > -1) { url = $"{baseUrl}?season_id={seasonId}"; } - else if (episodeId > -1) { url = $"{baseUrl}?ep_id={episodeId}"; } - else { return null; } - - string response = WebClient.RequestWeb(url, referer); - - try - { - var bangumiSeason = JsonConvert.DeserializeObject(response); - if (bangumiSeason != null) { return bangumiSeason.Result; } - else { return null; } - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("BangumiSeasonInfo()发生异常: {0}", e); - LogManager.Error("BangumiInfo", e); - return null; - } - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/Bangumi/BangumiType.cs b/src/DownKyi.Core/BiliApi/Bangumi/BangumiType.cs deleted file mode 100644 index 16558bf..0000000 --- a/src/DownKyi.Core/BiliApi/Bangumi/BangumiType.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Bangumi -{ - public static class BangumiType - { - public static Dictionary Type = new Dictionary() - { - { 1, "Anime" }, - { 2, "Movie" }, - { 3, "Documentary" }, - { 4, "Guochuang" }, - { 5, "TV" }, - { 6, "Unknown" }, - { 7, "Entertainment" }, - { 8, "Unknown" }, - { 9, "Unknown" }, - { 10, "Unknown" } - }; - - public static Dictionary TypeId = new Dictionary() - { - { 1, 13 }, - { 2, 23 }, - { 3, 177 }, - { 4, 167 }, - { 5, 11 }, - { 6, -1 }, - { 7, -1 }, - { 8, -1 }, - { 9, -1 }, - { 10, -1 } - }; - - } -} diff --git a/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiArea.cs b/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiArea.cs deleted file mode 100644 index 4ce21b6..0000000 --- a/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiArea.cs +++ /dev/null @@ -1,13 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Bangumi.Models -{ - public class BangumiArea : BaseModel - { - [JsonProperty("id")] - public int Id { get; set; } - [JsonProperty("name")] - public string Name { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiEpisode.cs b/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiEpisode.cs deleted file mode 100644 index 4cee71e..0000000 --- a/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiEpisode.cs +++ /dev/null @@ -1,53 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Bangumi.Models -{ - public class BangumiEpisode : BaseModel - { - [JsonProperty("aid")] - public long Aid { get; set; } - [JsonProperty("badge")] - public string Badge { get; set; } - // badge_info - // badge_type - [JsonProperty("bvid")] - public string Bvid { get; set; } - [JsonProperty("cid")] - public long Cid { get; set; } - [JsonProperty("cover")] - public string Cover { get; set; } - [JsonProperty("dimension")] - public Dimension Dimension { get; set; } - [JsonProperty("duration")] - public long Duration { get; set; } - [JsonProperty("from")] - public string From { get; set; } - [JsonProperty("id")] - public long Id { get; set; } - [JsonProperty("link")] - public string Link { get; set; } - [JsonProperty("long_title")] - public string LongTitle { get; set; } - [JsonProperty("pub_time")] - public long PubTime { get; set; } - // pv - // release_date - // rights - [JsonProperty("share_copy")] - public string ShareCopy { get; set; } - [JsonProperty("share_url")] - public string ShareUrl { get; set; } - [JsonProperty("short_link")] - public string ShortLink { get; set; } - // stat - [JsonProperty("status")] - public int Status { get; set; } - [JsonProperty("subtitle")] - public string Subtitle { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - [JsonProperty("vid")] - public string Vid { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiMedia.cs b/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiMedia.cs deleted file mode 100644 index d22667c..0000000 --- a/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiMedia.cs +++ /dev/null @@ -1,46 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Bangumi.Models -{ - // https://api.bilibili.com/pgc/review/user - public class BangumiMediaOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("result")] - public BangumiMediaData Result { get; set; } - } - - public class BangumiMediaData : BaseModel - { - [JsonProperty("media")] - public BangumiMedia Media { get; set; } - } - - public class BangumiMedia : BaseModel - { - [JsonProperty("areas")] - public List Areas { get; set; } - [JsonProperty("cover")] - public string Cover { get; set; } - [JsonProperty("media_id")] - public long MediaId { get; set; } - // new_ep - // rating - [JsonProperty("season_id")] - public long SeasonId { get; set; } - [JsonProperty("share_url")] - public string ShareUrl { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - [JsonProperty("type_name")] - public string TypeName { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiPositive.cs b/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiPositive.cs deleted file mode 100644 index acbfd2c..0000000 --- a/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiPositive.cs +++ /dev/null @@ -1,13 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Bangumi.Models -{ - public class BangumiPositive : BaseModel - { - [JsonProperty("id")] - public long Id { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiSeason.cs b/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiSeason.cs deleted file mode 100644 index 87d3dcf..0000000 --- a/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiSeason.cs +++ /dev/null @@ -1,79 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Bangumi.Models -{ - // https://api.bilibili.com/pgc/view/web/season - public class BangumiSeasonOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("result")] - public BangumiSeason Result { get; set; } - } - - public class BangumiSeason : BaseModel - { - // activity - // alias - [JsonProperty("areas")] - public List Areas { get; set; } - [JsonProperty("bkg_cover")] - public string BkgCover { get; set; } - [JsonProperty("cover")] - public string Cover { get; set; } - [JsonProperty("episodes")] - public List Episodes { get; set; } - [JsonProperty("evaluate")] - public string Evaluate { get; set; } - // freya - // jp_title - [JsonProperty("link")] - public string Link { get; set; } - [JsonProperty("media_id")] - public long MediaId { get; set; } - // mode - // new_ep - // payment - [JsonProperty("positive")] - public BangumiPositive Positive { get; set; } - // publish - // rating - // record - // rights - [JsonProperty("season_id")] - public long SeasonId { get; set; } - [JsonProperty("season_title")] - public string SeasonTitle { get; set; } - [JsonProperty("seasons")] - public List Seasons { get; set; } - [JsonProperty("section")] - public List Section { get; set; } - // series - // share_copy - // share_sub_title - // share_url - // show - [JsonProperty("square_cover")] - public string SquareCover { get; set; } - [JsonProperty("stat")] - public BangumiStat Stat { get; set; } - // status - [JsonProperty("subtitle")] - public string Subtitle { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - [JsonProperty("total")] - public int Total { get; set; } - [JsonProperty("type")] - public int Type { get; set; } - [JsonProperty("up_info")] - public BangumiUpInfo UpInfo { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiSeasonInfo.cs b/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiSeasonInfo.cs deleted file mode 100644 index 2adaf55..0000000 --- a/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiSeasonInfo.cs +++ /dev/null @@ -1,25 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Bangumi.Models -{ - public class BangumiSeasonInfo : BaseModel - { - [JsonProperty("badge")] - public string Badge { get; set; } - // badge_info - // badge_type - [JsonProperty("cover")] - public string Cover { get; set; } - [JsonProperty("media_id")] - public long MediaId { get; set; } - // new_ep - [JsonProperty("season_id")] - public long SeasonId { get; set; } - [JsonProperty("season_title")] - public string SeasonTitle { get; set; } - [JsonProperty("season_type")] - public int SeasonType { get; set; } - // stat - } -} diff --git a/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiSection.cs b/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiSection.cs deleted file mode 100644 index e416938..0000000 --- a/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiSection.cs +++ /dev/null @@ -1,20 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Bangumi.Models -{ - public class BangumiSection : BaseModel - { - [JsonProperty("episode_id")] - public long EpisodeId { get; set; } - [JsonProperty("episodes")] - public List Episodes { get; set; } - [JsonProperty("id")] - public long Id { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - [JsonProperty("type")] - public int Type { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiStat.cs b/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiStat.cs deleted file mode 100644 index fac010d..0000000 --- a/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiStat.cs +++ /dev/null @@ -1,25 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Bangumi.Models -{ - public class BangumiStat : BaseModel - { - [JsonProperty("coins")] - public long Coins { get; set; } - [JsonProperty("danmakus")] - public long Danmakus { get; set; } - [JsonProperty("favorite")] - public long Favorite { get; set; } - [JsonProperty("favorites")] - public long Favorites { get; set; } - [JsonProperty("likes")] - public long Likes { get; set; } - [JsonProperty("reply")] - public long Reply { get; set; } - [JsonProperty("share")] - public long Share { get; set; } - [JsonProperty("views")] - public long Views { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiUpInfo.cs b/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiUpInfo.cs deleted file mode 100644 index b7b8638..0000000 --- a/src/DownKyi.Core/BiliApi/Bangumi/Models/BangumiUpInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Bangumi.Models -{ - public class BangumiUpInfo : BaseModel - { - [JsonProperty("avatar")] - public string Avatar { get; set; } - // follower - // is_follow - [JsonProperty("mid")] - public long Mid { get; set; } - // pendant - // theme_type - [JsonProperty("uname")] - public string Name { get; set; } - // verify_type - // vip_status - // vip_type - } -} diff --git a/src/DownKyi.Core/BiliApi/BiliUtils/BvId.cs b/src/DownKyi.Core/BiliApi/BiliUtils/BvId.cs deleted file mode 100644 index 665bc50..0000000 --- a/src/DownKyi.Core/BiliApi/BiliUtils/BvId.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; - -namespace DownKyi.Core.BiliApi.BiliUtils -{ - public static class BvId - { - private const string tableStr = "fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF"; //码表 - private static readonly char[] table = tableStr.ToCharArray(); - - private static readonly char[] tr = new char[124]; //反查码表 - private const ulong Xor = 177451812; //固定异或值 - private const ulong add = 8728348608; //固定加法值 - private static readonly int[] s = { 11, 10, 3, 8, 4, 6 }; //位置编码表 - - static BvId() - { - Tr_init(); - } - - //初始化反查码表 - private static void Tr_init() - { - for (int i = 0; i < 58; i++) - tr[table[i]] = (char)i; - } - - /// - /// bvid转avid - /// - /// - /// - public static ulong Bv2Av(string bvid) - { - char[] bv = bvid.ToCharArray(); - - ulong r = 0; - ulong av; - for (int i = 0; i < 6; i++) - r += tr[bv[s[i]]] * (ulong)Math.Pow(58, i); - av = (r - add) ^ Xor; - return av; - } - - /// - /// avid转bvid - /// - /// - /// - public static string Av2Bv(ulong av) - { - //编码结果 - string res = "BV1 4 1 7 "; - char[] result = res.ToCharArray(); - - av = (av ^ Xor) + add; - for (int i = 0; i < 6; i++) - result[s[i]] = table[av / (ulong)Math.Pow(58, i) % 58]; - string bv = new string(result); - return bv; - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/BiliUtils/Constant.cs b/src/DownKyi.Core/BiliApi/BiliUtils/Constant.cs deleted file mode 100644 index e0df068..0000000 --- a/src/DownKyi.Core/BiliApi/BiliUtils/Constant.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.BiliUtils -{ - public static class Constant - { - private static readonly List resolutions = new List - { - new Quality { Name = "360P 流畅", Id = 16 }, - new Quality { Name = "480P 清晰", Id = 32 }, - new Quality { Name = "720P 高清", Id = 64 }, - new Quality { Name = "720P 60帧", Id = 74 }, - new Quality { Name = "1080P 高清", Id = 80 }, - new Quality { Name = "1080P 高码率", Id = 112 }, - new Quality { Name = "1080P 60帧", Id = 116 }, - new Quality { Name = "4K 超清", Id = 120 }, - new Quality { Name = "HDR 真彩", Id = 125 }, - new Quality { Name = "杜比视界", Id = 126 }, - new Quality { Name = "超高清 8K", Id = 127 }, - }; - - private static readonly List codecIds = new List - { - new Quality { Name = "H.264/AVC", Id = 7 }, - new Quality { Name = "H.265/HEVC", Id = 12 }, - new Quality { Name = "AV1", Id = 13 }, - }; - - private static readonly List qualities = new List - { - //new Quality { Name = "64K", Id = 30216 }, - //new Quality { Name = "132K", Id = 30232 }, - //new Quality { Name = "192K", Id = 30280 }, - new Quality { Name = "低质量", Id = 30216 }, - new Quality { Name = "中质量", Id = 30232 }, - new Quality { Name = "高质量", Id = 30280 }, - new Quality { Name = "Dolby Atmos", Id = 30250 }, - new Quality { Name = "Hi-Res无损", Id = 30251 }, - }; - - /// - /// 获取支持的视频画质 - /// - /// - public static List GetResolutions() - { - // 使用深复制, - // 保证外部修改list后, - // 不会影响其他调用处 - return new List(resolutions); - } - - /// - /// 获取视频编码代码 - /// - /// - public static List GetCodecIds() - { - // 使用深复制, - // 保证外部修改list后, - // 不会影响其他调用处 - return new List(codecIds); - } - - /// - /// 获取支持的视频音质 - /// - /// - public static List GetAudioQualities() - { - // 使用深复制, - // 保证外部修改list后, - // 不会影响其他调用处 - return new List(qualities); - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/BiliUtils/DanmakuSender.cs b/src/DownKyi.Core/BiliApi/BiliUtils/DanmakuSender.cs deleted file mode 100644 index 9404f22..0000000 --- a/src/DownKyi.Core/BiliApi/BiliUtils/DanmakuSender.cs +++ /dev/null @@ -1,154 +0,0 @@ -using System; - -namespace DownKyi.Core.BiliApi.BiliUtils -{ - public static class DanmakuSender - { - private const uint CRCPOLYNOMIAL = 0xEDB88320; - private static readonly uint[] crctable = new uint[256]; - - static DanmakuSender() - { - CreateTable(); - } - - private static void CreateTable() - { - for (int i = 0; i < 256; i++) - { - uint crcreg = (uint)i; - - for (int j = 0; j < 8; j++) - { - if ((crcreg & 1) != 0) - { - crcreg = CRCPOLYNOMIAL ^ (crcreg >> 1); - } - else - { - crcreg >>= 1; - } - } - crctable[i] = crcreg; - } - } - - private static uint Crc32(string userId) - { - uint crcstart = 0xFFFFFFFF; - for (int i = 0; i < userId.Length; i++) - { - uint index = (uint)(crcstart ^ (int)userId[i]) & 255; - crcstart = (crcstart >> 8) ^ crctable[index]; - } - return crcstart; - } - - private static uint Crc32LastIndex(string userId) - { - uint index = 0; - uint crcstart = 0xFFFFFFFF; - for (int i = 0; i < userId.Length; i++) - { - index = (uint)((crcstart ^ (int)userId[i]) & 255); - crcstart = (crcstart >> 8) ^ crctable[index]; - } - return index; - } - - private static int GetCrcIndex(long t) - { - for (int i = 0; i < 256; i++) - { - if ((crctable[i] >> 24) == t) - { - return i; - } - } - return -1; - } - - private static object[] DeepCheck(int i, int[] index) - { - object[] resultArray = new object[2]; - - string result = ""; - uint tc;// = 0x00; - var hashcode = Crc32(i.ToString()); - tc = (uint)(hashcode & 0xff ^ index[2]); - - if (!(tc <= 57 && tc >= 48)) - { - resultArray[0] = 0; - return resultArray; - } - - result += (tc - 48).ToString(); - hashcode = crctable[index[2]] ^ (hashcode >> 8); - tc = (uint)(hashcode & 0xff ^ index[1]); - - if (!(tc <= 57 && tc >= 48)) - { - resultArray[0] = 0; - return resultArray; - } - - result += (tc - 48).ToString(); - hashcode = crctable[index[1]] ^ (hashcode >> 8); - tc = (uint)(hashcode & 0xff ^ index[0]); - - if (!(tc <= 57 && tc >= 48)) - { - resultArray[0] = 0; - return resultArray; - } - - result += (tc - 48).ToString(); - //hashcode = crctable[index[0]] ^ (hashcode >> 8); - - resultArray[0] = 1; - resultArray[1] = result; - return resultArray; - } - - /// - /// 查询弹幕发送者 - /// - /// - /// - public static string FindDanmakuSender(string userId) - { - object[] deepCheckData = new object[2]; - - int[] index = new int[4]; - uint ht = (uint)Convert.ToInt32($"0x{userId}", 16); - ht ^= 0xffffffff; - - int i; - for (i = 3; i > -1; i--) - { - index[3 - i] = GetCrcIndex(ht >> (i * 8)); - uint snum = crctable[index[3 - i]]; - ht ^= snum >> ((3 - i) * 8); - } - for (i = 0; i < 100000000; i++) - { - uint lastindex = Crc32LastIndex(i.ToString()); - if (lastindex == index[3]) - { - deepCheckData = DeepCheck(i, index); - if ((int)deepCheckData[0] != 0) - { - break; - } - } - } - if (i == 100000000) - { - return "-1"; - } - return $"{i}{deepCheckData[1]}"; - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/BiliUtils/ParseEntrance.cs b/src/DownKyi.Core/BiliApi/BiliUtils/ParseEntrance.cs deleted file mode 100644 index 360e829..0000000 --- a/src/DownKyi.Core/BiliApi/BiliUtils/ParseEntrance.cs +++ /dev/null @@ -1,557 +0,0 @@ -using DownKyi.Core.Utils.Validator; -using System.Text.RegularExpressions; - -namespace DownKyi.Core.BiliApi.BiliUtils -{ - /// - /// 解析输入的字符串 - /// 支持的格式有: - /// av号:av170001, AV170001, https://www.bilibili.com/video/av170001 - /// BV号:BV17x411w7KC, https://www.bilibili.com/video/BV17x411w7KC, https://b23.tv/BV17x411w7KC - /// 番剧(电影、电视剧)ss号:ss32982, SS32982, https://www.bilibili.com/bangumi/play/ss32982 - /// 番剧(电影、电视剧)ep号:ep317925, EP317925, https://www.bilibili.com/bangumi/play/ep317925 - /// 番剧(电影、电视剧)md号:md28228367, MD28228367, https://www.bilibili.com/bangumi/media/md28228367 - /// 课程ss号:https://www.bilibili.com/cheese/play/ss205 - /// 课程ep号:https://www.bilibili.com/cheese/play/ep3489 - /// 收藏夹:ml1329019876, ML1329019876, https://www.bilibili.com/medialist/detail/ml1329019876, https://www.bilibili.com/medialist/play/ml1329019876/ - /// 用户空间:uid928123, UID928123, uid:928123, UID:928123, https://space.bilibili.com/928123 - /// - public static class ParseEntrance - { - public static readonly string WwwUrl = "https://www.bilibili.com"; - public static readonly string ShareWwwUrl = "https://www.bilibili.com/s"; - public static readonly string ShortUrl = "https://b23.tv/"; - public static readonly string MobileUrl = "https://m.bilibili.com"; - - public static readonly string SpaceUrl = "https://space.bilibili.com"; - - public static readonly string VideoUrl = $"{WwwUrl}/video/"; - public static readonly string BangumiUrl = $"{WwwUrl}/bangumi/play/"; - public static readonly string BangumiMediaUrl = $"{WwwUrl}/bangumi/media/"; - public static readonly string CheeseUrl = $"{WwwUrl}/cheese/play/"; - public static readonly string FavoritesUrl1 = $"{WwwUrl}/medialist/detail/"; - public static readonly string FavoritesUrl2 = $"{WwwUrl}/medialist/play/"; - - #region 视频 - - /// - /// 是否为av id - /// - /// - /// - public static bool IsAvId(string input) - { - return IsIntId(input, "av"); - } - - /// - /// 是否为av url - /// - /// - /// - public static bool IsAvUrl(string input) - { - string id = GetVideoId(input); - return IsAvId(id); - } - - /// - /// 获取av id - /// - /// - /// - public static long GetAvId(string input) - { - if (IsAvId(input)) - { - return Number.GetInt(input.Remove(0, 2)); - } - else if (IsAvUrl(input)) - { - return Number.GetInt(GetVideoId(input).Remove(0, 2)); - } - else - { - return -1; - } - } - - /// - /// 是否为bv id - /// - /// - /// - public static bool IsBvId(string input) - { - return input.StartsWith("BV") && input.Length == 12; - } - - /// - /// 是否为bv url - /// - /// - /// - public static bool IsBvUrl(string input) - { - string id = GetVideoId(input); - return IsBvId(id); - } - - /// - /// 获取bv id - /// - /// - /// - public static string GetBvId(string input) - { - if (IsBvId(input)) - { - return input; - } - else if (IsBvUrl(input)) - { - return GetVideoId(input); - } - else - { - return ""; - } - } - - #endregion - - #region 番剧(电影、电视剧) - - /// - /// 是否为番剧season id - /// - /// - /// - public static bool IsBangumiSeasonId(string input) - { - return IsIntId(input, "ss"); - } - - /// - /// 是否为番剧season url - /// - /// - /// - public static bool IsBangumiSeasonUrl(string input) - { - string id = GetBangumiId(input); - return IsBangumiSeasonId(id); - } - - /// - /// 获取番剧season id - /// - /// - /// - public static long GetBangumiSeasonId(string input) - { - if (IsBangumiSeasonId(input)) - { - return Number.GetInt(input.Remove(0, 2)); - } - else if (IsBangumiSeasonUrl(input)) - { - return Number.GetInt(GetBangumiId(input).Remove(0, 2)); - } - else - { - return -1; - } - } - - /// - /// 是否为番剧episode id - /// - /// - /// - public static bool IsBangumiEpisodeId(string input) - { - return IsIntId(input, "ep"); - } - - /// - /// 是否为番剧episode url - /// - /// - /// - public static bool IsBangumiEpisodeUrl(string input) - { - string id = GetBangumiId(input); - return IsBangumiEpisodeId(id); - } - - /// - /// 获取番剧episode id - /// - /// - /// - public static long GetBangumiEpisodeId(string input) - { - if (IsBangumiEpisodeId(input)) - { - return Number.GetInt(input.Remove(0, 2)); - } - else if (IsBangumiEpisodeUrl(input)) - { - return Number.GetInt(GetBangumiId(input).Remove(0, 2)); - } - else - { - return -1; - } - } - - /// - /// 是否为番剧media id - /// - /// - /// - public static bool IsBangumiMediaId(string input) - { - return IsIntId(input, "md"); - } - - /// - /// 是否为番剧media url - /// - /// - /// - public static bool IsBangumiMediaUrl(string input) - { - string id = GetBangumiId(input); - return IsBangumiMediaId(id); - } - - /// - /// 获取番剧media id - /// - /// - /// - public static long GetBangumiMediaId(string input) - { - if (IsBangumiMediaId(input)) - { - return Number.GetInt(input.Remove(0, 2)); - } - else if (IsBangumiMediaUrl(input)) - { - return Number.GetInt(GetBangumiId(input).Remove(0, 2)); - } - else - { - return -1; - } - } - - #endregion - - #region 课程 - - /// - /// 是否为课程season url - /// - /// - /// - public static bool IsCheeseSeasonUrl(string input) - { - string id = GetCheeseId(input); - return IsIntId(id, "ss"); - } - - /// - /// 获取课程season id - /// - /// - /// - public static long GetCheeseSeasonId(string input) - { - return IsCheeseSeasonUrl(input) ? Number.GetInt(GetCheeseId(input).Remove(0, 2)) : -1; - } - - /// - /// 是否为课程episode url - /// - /// - /// - public static bool IsCheeseEpisodeUrl(string input) - { - string id = GetCheeseId(input); - return IsIntId(id, "ep"); - } - - /// - /// 获取课程episode id - /// - /// - /// - public static long GetCheeseEpisodeId(string input) - { - return IsCheeseEpisodeUrl(input) ? Number.GetInt(GetCheeseId(input).Remove(0, 2)) : -1; - } - - #endregion - - #region 收藏夹 - - /// - /// 是否为收藏夹id - /// - /// - /// - public static bool IsFavoritesId(string input) - { - return IsIntId(input, "ml"); - } - - /// - /// 是否为收藏夹url - /// - /// - /// - public static bool IsFavoritesUrl(string input) - { - return IsFavoritesUrl1(input) || IsFavoritesUrl2(input); - } - - /// - /// 是否为收藏夹url1 - /// - /// - /// - private static bool IsFavoritesUrl1(string input) - { - string favoritesId = GetId(input, FavoritesUrl1); - return IsFavoritesId(favoritesId); - } - - /// - /// 是否为收藏夹ur2 - /// - /// - /// - private static bool IsFavoritesUrl2(string input) - { - string favoritesId = GetId(input, FavoritesUrl2); - return IsFavoritesId(favoritesId.Split('/')[0]); - } - - /// - /// 获取收藏夹id - /// - /// - /// - public static long GetFavoritesId(string input) - { - if (IsFavoritesId(input)) - { - return Number.GetInt(input.Remove(0, 2)); - } - else if (IsFavoritesUrl1(input)) - { - return Number.GetInt(GetId(input, FavoritesUrl1).Remove(0, 2)); - } - else if (IsFavoritesUrl2(input)) - { - return Number.GetInt(GetId(input, FavoritesUrl2).Remove(0, 2).Split('/')[0]); - } - else - { - return -1; - } - } - - #endregion - - #region 用户空间 - - /// - /// 是否为用户id - /// - /// - /// - public static bool IsUserId(string input) - { - if (input.ToLower().StartsWith("uid:")) - { - return Regex.IsMatch(input.Remove(0, 4), @"^\d+$"); - } - else if (input.ToLower().StartsWith("uid")) - { - return Regex.IsMatch(input.Remove(0, 3), @"^\d+$"); - } - else { return false; } - } - - /// - /// 是否为用户空间url - /// - /// - /// - public static bool IsUserUrl(string input) - { - if (!IsUrl(input)) { return false; } - - if (input.Contains("space.bilibili.com")) - { - return true; - } - else - { - return false; - } - } - - /// - /// 获取用户mid - /// - /// - /// - public static long GetUserId(string input) - { - if (input.ToLower().StartsWith("uid:")) - { - return Number.GetInt(input.Remove(0, 4)); - } - else if (input.ToLower().StartsWith("uid")) - { - return Number.GetInt(input.Remove(0, 3)); - } - else if (IsUserUrl(input)) - { - string url = EnableHttps(input); - url = DeleteUrlParam(url); - var match = Regex.Match(url, @"\d+"); - if (match.Success) - { - return long.Parse(match.Value); - } - else - { - return -1; - } - } - else - { - return -1; - } - } - - #endregion - - /// - /// 是否为网址 - /// - /// - /// - private static bool IsUrl(string input) - { - return input.StartsWith("http://") || input.StartsWith("https://"); - } - - /// - /// 将http转为https - /// - /// - private static string EnableHttps(string url) - { - if (!IsUrl(url)) { return null; } - - return url.Replace("http://", "https://"); - } - - /// - /// 去除url中的参数 - /// - /// - /// - private static string DeleteUrlParam(string url) - { - string[] strList = url.Split('?'); - - return strList[0].EndsWith("/") ? strList[0].TrimEnd('/') : strList[0]; - } - - /// - /// 从url中获取视频id(avid/bvid) - /// - /// - /// - private static string GetVideoId(string input) - { - return GetId(input, VideoUrl); - } - - /// - /// 从url中获取番剧id(ss/ep/md) - /// - /// - /// - private static string GetBangumiId(string input) - { - string id = GetId(input, BangumiUrl); - if (id != "") { return id; } - return GetId(input, BangumiMediaUrl); - } - - /// - /// 从url中获取课程id(ss/ep) - /// - /// - /// - private static string GetCheeseId(string input) - { - return GetId(input, CheeseUrl); - } - - /// - /// 是否为数字型id - /// - /// - /// - /// - private static bool IsIntId(string input, string prefix) - { - if (input.ToLower().StartsWith(prefix)) - { - return Regex.IsMatch(input.Remove(0, 2), @"^\d+$"); - } - return false; - } - - /// - /// 从url中获取id - /// - /// - /// - /// - private static string GetId(string input, string baseUrl) - { - if (!IsUrl(input)) { return ""; } - - string url = EnableHttps(input); - url = DeleteUrlParam(url); - - url = url.Replace(ShareWwwUrl, WwwUrl); - url = url.Replace(MobileUrl, WwwUrl); - - if (url.Contains("b23.tv/ss") || url.Contains("b23.tv/ep")) - { - url = url.Replace(ShortUrl, BangumiUrl); - } - else - { - url = url.Replace(ShortUrl, VideoUrl); - } - - if (!url.StartsWith(baseUrl)) { return ""; } - - return url.Replace(baseUrl, ""); - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/BiliUtils/Quality.cs b/src/DownKyi.Core/BiliApi/BiliUtils/Quality.cs deleted file mode 100644 index 60aa324..0000000 --- a/src/DownKyi.Core/BiliApi/BiliUtils/Quality.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace DownKyi.Core.BiliApi.BiliUtils -{ - [Serializable] - public class Quality - { - public string Name { get; set; } - public int Id { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/BilibiliImages.xaml b/src/DownKyi.Core/BiliApi/BilibiliImages.xaml deleted file mode 100644 index f151f50..0000000 --- a/src/DownKyi.Core/BiliApi/BilibiliImages.xaml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/DownKyi.Core/BiliApi/Cheese/CheeseInfo.cs b/src/DownKyi.Core/BiliApi/Cheese/CheeseInfo.cs deleted file mode 100644 index dc14168..0000000 --- a/src/DownKyi.Core/BiliApi/Cheese/CheeseInfo.cs +++ /dev/null @@ -1,70 +0,0 @@ -using DownKyi.Core.BiliApi.Cheese.Models; -using DownKyi.Core.Logging; -using Newtonsoft.Json; -using System; - -namespace DownKyi.Core.BiliApi.Cheese -{ - public static class CheeseInfo - { - - /// - /// 获取课程基本信息 - /// - /// - /// - /// - public static CheeseView CheeseViewInfo(long seasonId = -1, long episodeId = -1) - { - string baseUrl = "https://api.bilibili.com/pugv/view/web/season"; - string referer = "https://www.bilibili.com"; - string url; - if (seasonId > -1) { url = $"{baseUrl}?season_id={seasonId}"; } - else if (episodeId > -1) { url = $"{baseUrl}?ep_id={episodeId}"; } - else { return null; } - - string response = WebClient.RequestWeb(url, referer); - - try - { - CheeseViewOrigin cheese = JsonConvert.DeserializeObject(response); - if (cheese != null) { return cheese.Data; } - else { return null; } - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("CheeseViewInfo()发生异常: {0}", e); - LogManager.Error("CheeseInfo", e); - return null; - } - } - - /// - /// 获取课程分集列表 - /// - /// - /// - /// - /// - public static CheeseEpisodeList CheeseEpisodeList(long seasonId, int ps = 50, int pn = 1) - { - string url = $"https://api.bilibili.com/pugv/view/web/ep/list?season_id={seasonId}&pn={pn}&ps={ps}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - CheeseEpisodeListOrigin cheese = JsonConvert.DeserializeObject(response); - if (cheese != null) { return cheese.Data; } - else { return null; } - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("CheeseEpisodeList()发生异常: {0}", e); - LogManager.Error("CheeseInfo", e); - return null; - } - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseBrief.cs b/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseBrief.cs deleted file mode 100644 index 2b0159a..0000000 --- a/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseBrief.cs +++ /dev/null @@ -1,17 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Cheese.Models -{ - public class CheeseBrief : BaseModel - { - // content - [JsonProperty("img")] - public List Img { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - [JsonProperty("type")] - public int Type { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseEpisode.cs b/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseEpisode.cs deleted file mode 100644 index 5643e3d..0000000 --- a/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseEpisode.cs +++ /dev/null @@ -1,43 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Cheese.Models -{ - public class CheeseEpisode : BaseModel - { - [JsonProperty("aid")] - public long Aid { get; set; } - [JsonProperty("catalogue_index")] - public int CatalogueIndex { get; set; } - [JsonProperty("cid")] - public long Cid { get; set; } - [JsonProperty("cover")] - public string Cover { get; set; } - [JsonProperty("duration")] - public long Duration { get; set; } - [JsonProperty("from")] - public string From { get; set; } - [JsonProperty("id")] - public long Id { get; set; } - [JsonProperty("index")] - public int Index { get; set; } - [JsonProperty("page")] - public int Page { get; set; } - [JsonProperty("play")] - public long Play { get; set; } - [JsonProperty("play_way")] - public int PlayWay { get; set; } - [JsonProperty("play_way_format")] - public string PlayWayFormat { get; set; } - [JsonProperty("release_date")] - public long ReleaseDate { get; set; } - [JsonProperty("status")] - public int Status { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - [JsonProperty("watched")] - public bool Watched { get; set; } - [JsonProperty("watchedHistory")] - public int WatchedHistory { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseEpisodeList.cs b/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseEpisodeList.cs deleted file mode 100644 index aebc4c5..0000000 --- a/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseEpisodeList.cs +++ /dev/null @@ -1,26 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Cheese.Models -{ - // https://api.bilibili.com/pugv/view/web/ep/list - public class CheeseEpisodeListOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - [JsonProperty("data")] - public CheeseEpisodeList Data { get; set; } - } - - public class CheeseEpisodeList : BaseModel - { - [JsonProperty("items")] - public List Items { get; set; } - [JsonProperty("page")] - public CheeseEpisodePage Page { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseEpisodePage.cs b/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseEpisodePage.cs deleted file mode 100644 index d3145a3..0000000 --- a/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseEpisodePage.cs +++ /dev/null @@ -1,17 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Cheese.Models -{ - public class CheeseEpisodePage : BaseModel - { - [JsonProperty("next")] - public bool Next { get; set; } - [JsonProperty("num")] - public int Num { get; set; } - [JsonProperty("size")] - public int Size { get; set; } - [JsonProperty("total")] - public int Total { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseImg.cs b/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseImg.cs deleted file mode 100644 index 12a1fa1..0000000 --- a/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseImg.cs +++ /dev/null @@ -1,13 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Cheese.Models -{ - public class CheeseImg : BaseModel - { - [JsonProperty("aspect_ratio")] - public double AspectRatio { get; set; } - [JsonProperty("url")] - public string Url { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseStat.cs b/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseStat.cs deleted file mode 100644 index 226a41e..0000000 --- a/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseStat.cs +++ /dev/null @@ -1,13 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Cheese.Models -{ - public class CheeseStat : BaseModel - { - [JsonProperty("play")] - public long Play { get; set; } - [JsonProperty("play_desc")] - public string PlayDesc { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseUpInfo.cs b/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseUpInfo.cs deleted file mode 100644 index f1a8da8..0000000 --- a/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseUpInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Cheese.Models -{ - public class CheeseUpInfo : BaseModel - { - [JsonProperty("avatar")] - public string Avatar { get; set; } - [JsonProperty("brief")] - public string Brief { get; set; } - [JsonProperty("follower")] - public long Follower { get; set; } - [JsonProperty("is_follow")] - public int IsFollow { get; set; } - [JsonProperty("link")] - public string Link { get; set; } - [JsonProperty("mid")] - public long Mid { get; set; } - [JsonProperty("uname")] - public string Name { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseView.cs b/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseView.cs deleted file mode 100644 index a6349a3..0000000 --- a/src/DownKyi.Core/BiliApi/Cheese/Models/CheeseView.cs +++ /dev/null @@ -1,69 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Cheese.Models -{ - // https://api.bilibili.com/pugv/view/web/season - public class CheeseViewOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - [JsonProperty("data")] - public CheeseView Data { get; set; } - } - - public class CheeseView : BaseModel - { - // active_market - // activity_list - [JsonProperty("brief")] - public CheeseBrief Brief { get; set; } - // cooperation - // coupon - // course_content - // courses - [JsonProperty("cover")] - public string Cover { get; set; } - // ep_catalogue - // ep_count - // episode_page - // episode_sort - // episode_tag - [JsonProperty("episodes")] - public List Episodes { get; set; } - // faq - // faq1 - // live_ep_count - // opened_ep_count - // payment - // previewed_purchase_note - // purchase_format_note - // purchase_note - // purchase_protocol - // recommend_seasons 推荐课程 - // release_bottom_info - // release_info - // release_info2 - // release_status - [JsonProperty("season_id")] - public long SeasonId { get; set; } - [JsonProperty("share_url")] - public string ShareUrl { get; set; } - // short_link - [JsonProperty("stat")] - public CheeseStat Stat { get; set; } - // status - [JsonProperty("subtitle")] - public string Subtitle { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - [JsonProperty("up_info")] - public CheeseUpInfo UpInfo { get; set; } - // update_status - // user_status - } - -} diff --git a/src/DownKyi.Core/BiliApi/Danmaku/DanmakuProtobuf.cs b/src/DownKyi.Core/BiliApi/Danmaku/DanmakuProtobuf.cs deleted file mode 100644 index be4d83b..0000000 --- a/src/DownKyi.Core/BiliApi/Danmaku/DanmakuProtobuf.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Bilibili.Community.Service.Dm.V1; -using DownKyi.Core.BiliApi.Danmaku.Models; -using System; -using System.Collections.Generic; -using System.IO; - -namespace DownKyi.Core.BiliApi.Danmaku -{ - public static class DanmakuProtobuf - { - - /// - /// 下载6分钟内的弹幕,返回弹幕列表 - /// - /// 稿件avID - /// 视频CID - /// 分包,每6分钟一包 - /// - public static List GetDanmakuProto(long avid, long cid, int segmentIndex) - { - string url = $"https://api.bilibili.com/x/v2/dm/web/seg.so?type=1&oid={cid}&pid={avid}&segment_index={segmentIndex}"; - //string referer = "https://www.bilibili.com"; - - string directory = Path.Combine(Storage.StorageManager.GetDanmaku(), $"{cid}"); - string filePath = Path.Combine(directory, $"{segmentIndex}.proto"); - if (!Directory.Exists(directory)) - { - Directory.CreateDirectory(directory); - } - - try - { - System.Net.WebClient mywebclient = new System.Net.WebClient(); - mywebclient.DownloadFile(url, filePath); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetDanmakuProto()发生异常: {0}", e); - //Logging.LogManager.Error(e); - } - - var danmakuList = new List(); - try - { - using (var input = File.OpenRead(filePath)) - { - DmSegMobileReply danmakus = DmSegMobileReply.Parser.ParseFrom(input); - if (danmakus == null || danmakus.Elems == null) - { - return danmakuList; - } - - foreach (var dm in danmakus.Elems) - { - var danmaku = new BiliDanmaku - { - Id = dm.Id, - Progress = dm.Progress, - Mode = dm.Mode, - Fontsize = dm.Fontsize, - Color = dm.Color, - MidHash = dm.MidHash, - Content = dm.Content, - Ctime = dm.Ctime, - Weight = dm.Weight, - //Action = dm.Action, - Pool = dm.Pool - }; - danmakuList.Add(danmaku); - } - } - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetDanmakuProto()发生异常: {0}", e); - //Logging.LogManager.Error(e); - return null; - } - - return danmakuList; - } - - /// - /// 下载所有弹幕,返回弹幕列表 - /// - /// 稿件avID - /// 视频CID - /// - public static List GetAllDanmakuProto(long avid, long cid) - { - var danmakuList = new List(); - - int segmentIndex = 0; - while (true) - { - segmentIndex += 1; - var danmakus = GetDanmakuProto(avid, cid, segmentIndex); - if (danmakus == null) { break; } - danmakuList.AddRange(danmakus); - } - return danmakuList; - } - } -} diff --git a/src/DownKyi.Core/BiliApi/Danmaku/Models/BiliDanmaku.cs b/src/DownKyi.Core/BiliApi/Danmaku/Models/BiliDanmaku.cs deleted file mode 100644 index 48892ba..0000000 --- a/src/DownKyi.Core/BiliApi/Danmaku/Models/BiliDanmaku.cs +++ /dev/null @@ -1,33 +0,0 @@ -namespace DownKyi.Core.BiliApi.Danmaku.Models -{ - public class BiliDanmaku - { - public long Id { get; set; } //弹幕dmID - public int Progress { get; set; } //出现时间 - public int Mode { get; set; } //弹幕类型 - public int Fontsize { get; set; } //文字大小 - public uint Color { get; set; } //弹幕颜色 - public string MidHash { get; set; } //发送者UID的HASH - public string Content { get; set; } //弹幕内容 - public long Ctime { get; set; } //发送时间 - public int Weight { get; set; } //权重 - //public string Action { get; set; } //动作? - public int Pool { get; set; } //弹幕池 - - public override string ToString() - { - string separator = "\n"; - return $"id: {Id}{separator}" + - $"progress: {Progress}{separator}" + - $"mode: {Mode}{separator}" + - $"fontsize: {Fontsize}{separator}" + - $"color: {Color}{separator}" + - $"midHash: {MidHash}{separator}" + - $"content: {Content}{separator}" + - $"ctime: {Ctime}{separator}" + - $"weight: {Weight}{separator}" + - //$"action: {Action}{separator}" + - $"pool: {Pool}"; - } - } -} diff --git a/src/DownKyi.Core/BiliApi/Favorites/FavoritesInfo.cs b/src/DownKyi.Core/BiliApi/Favorites/FavoritesInfo.cs deleted file mode 100644 index 157c698..0000000 --- a/src/DownKyi.Core/BiliApi/Favorites/FavoritesInfo.cs +++ /dev/null @@ -1,142 +0,0 @@ -using DownKyi.Core.BiliApi.Favorites.Models; -using DownKyi.Core.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Favorites -{ - public static class FavoritesInfo - { - - /// - /// 获取收藏夹元数据 - /// - /// - public static FavoritesMetaInfo GetFavoritesInfo(long mediaId) - { - string url = $"https://api.bilibili.com/x/v3/fav/folder/info?media_id={mediaId}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - var info = JsonConvert.DeserializeObject(response); - if (info != null) { return info.Data; } - else { return null; } - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetFavoritesInfo()发生异常: {0}", e); - LogManager.Error("FavoritesInfo", e); - return null; - } - } - - /// - /// 查询用户创建的视频收藏夹 - /// - /// 目标用户UID - /// 页码 - /// 每页项数 - /// - public static List GetCreatedFavorites(long mid, int pn, int ps) - { - string url = $"https://api.bilibili.com/x/v3/fav/folder/created/list?up_mid={mid}&pn={pn}&ps={ps}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - var favorites = JsonConvert.DeserializeObject(response); - if (favorites == null || favorites.Data == null || favorites.Data.List == null) - { return null; } - return favorites.Data.List; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetCreatedFavorites()发生异常: {0}", e); - LogManager.Error("FavoritesInfo", e); - return null; - } - } - - /// - /// 查询所有的用户创建的视频收藏夹 - /// - /// 目标用户UID - /// - public static List GetAllCreatedFavorites(long mid) - { - List result = new List(); - - int i = 0; - while (true) - { - i++; - int ps = 50; - - var data = GetCreatedFavorites(mid, i, ps); - if (data == null || data.Count == 0) - { break; } - - result.AddRange(data); - } - return result; - } - - /// - /// 查询用户收藏的视频收藏夹 - /// - /// 目标用户UID - /// 页码 - /// 每页项数 - /// - public static List GetCollectedFavorites(long mid, int pn, int ps) - { - string url = $"https://api.bilibili.com/x/v3/fav/folder/collected/list?up_mid={mid}&pn={pn}&ps={ps}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - var favorites = JsonConvert.DeserializeObject(response); - if (favorites == null || favorites.Data == null || favorites.Data.List == null) - { return null; } - return favorites.Data.List; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetCollectedFavorites()发生异常: {0}", e); - LogManager.Error("FavoritesInfo", e); - return null; - } - } - - /// - /// 查询所有的用户收藏的视频收藏夹 - /// - /// 目标用户UID - /// - public static List GetAllCollectedFavorites(long mid) - { - List result = new List(); - - int i = 0; - while (true) - { - i++; - int ps = 50; - - var data = GetCollectedFavorites(mid, i, ps); - if (data == null || data.Count == 0) - { break; } - - result.AddRange(data); - } - return result; - } - - - } -} diff --git a/src/DownKyi.Core/BiliApi/Favorites/FavoritesResource.cs b/src/DownKyi.Core/BiliApi/Favorites/FavoritesResource.cs deleted file mode 100644 index 9268ff7..0000000 --- a/src/DownKyi.Core/BiliApi/Favorites/FavoritesResource.cs +++ /dev/null @@ -1,91 +0,0 @@ -using DownKyi.Core.BiliApi.Favorites.Models; -using DownKyi.Core.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Favorites -{ - public static class FavoritesResource - { - - /// - /// 获取收藏夹内容明细列表 - /// - /// 收藏夹ID - /// 页码 - /// 每页项数 - /// - public static List GetFavoritesMedia(long mediaId, int pn, int ps) - { - string url = $"https://api.bilibili.com/x/v3/fav/resource/list?media_id={mediaId}&pn={pn}&ps={ps}&platform=web"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - var resource = JsonConvert.DeserializeObject(response); - if (resource == null || resource.Data == null || resource.Data.Medias == null) - { return null; } - return resource.Data.Medias; - } - catch (Exception e) - { - Console.WriteLine("GetFavoritesMedia()发生异常: {0}", e); - LogManager.Error("FavoritesResource", e); - return null; - } - } - - /// - /// 获取收藏夹内容明细列表(全部) - /// - /// 收藏夹ID - /// - public static List GetAllFavoritesMedia(long mediaId) - { - List result = new List(); - - int i = 0; - while (true) - { - i++; - int ps = 20; - - var data = GetFavoritesMedia(mediaId, i, ps); - if (data == null || data.Count == 0) - { break; } - - result.AddRange(data); - } - return result; - } - - /// - /// 获取收藏夹全部内容id - /// - /// - /// - public static List GetFavoritesMediaId(long mediaId) - { - string url = $"https://api.bilibili.com/x/v3/fav/resource/ids?media_id={mediaId}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - var media = JsonConvert.DeserializeObject(response); - if (media == null || media.Data == null) - { return null; } - return media.Data; - } - catch (Exception e) - { - Console.WriteLine("GetFavoritesMediaId()发生异常: {0}", e); - LogManager.Error("FavoritesResource", e); - return null; - } - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/Favorites/Models/FavStatus.cs b/src/DownKyi.Core/BiliApi/Favorites/Models/FavStatus.cs deleted file mode 100644 index 9c77cbb..0000000 --- a/src/DownKyi.Core/BiliApi/Favorites/Models/FavStatus.cs +++ /dev/null @@ -1,17 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Favorites.Models -{ - public class FavStatus : BaseModel - { - [JsonProperty("collect")] - public long Collect { get; set; } - [JsonProperty("play")] - public long Play { get; set; } - [JsonProperty("thumb_up")] - public long ThumbUp { get; set; } - [JsonProperty("share")] - public long Share { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Favorites/Models/FavUpper.cs b/src/DownKyi.Core/BiliApi/Favorites/Models/FavUpper.cs deleted file mode 100644 index 562277e..0000000 --- a/src/DownKyi.Core/BiliApi/Favorites/Models/FavUpper.cs +++ /dev/null @@ -1,19 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Favorites.Models -{ - public class FavUpper : BaseModel - { - [JsonProperty("mid")] - public long Mid { get; set; } - [JsonProperty("name")] - public string Name { get; set; } - [JsonProperty("face")] - public string Face { get; set; } - [JsonProperty("followed")] - public bool Followed { get; set; } - // vip_type - // vip_statue - } -} diff --git a/src/DownKyi.Core/BiliApi/Favorites/Models/FavoritesList.cs b/src/DownKyi.Core/BiliApi/Favorites/Models/FavoritesList.cs deleted file mode 100644 index 9face79..0000000 --- a/src/DownKyi.Core/BiliApi/Favorites/Models/FavoritesList.cs +++ /dev/null @@ -1,30 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Favorites.Models -{ - // https://api.bilibili.com/x/v3/fav/folder/collected/list - public class FavoritesListOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("data")] - public FavoritesList Data { get; set; } - } - - public class FavoritesList : BaseModel - { - [JsonProperty("count")] - public int Count { get; set; } - [JsonProperty("list")] - public List List { get; set; } - //[JsonProperty("has_more")] - //public bool HasMore { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Favorites/Models/FavoritesMedia.cs b/src/DownKyi.Core/BiliApi/Favorites/Models/FavoritesMedia.cs deleted file mode 100644 index 8464c35..0000000 --- a/src/DownKyi.Core/BiliApi/Favorites/Models/FavoritesMedia.cs +++ /dev/null @@ -1,43 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Favorites.Models -{ - public class FavoritesMedia : BaseModel - { - [JsonProperty("id")] - public long Id { get; set; } - [JsonProperty("type")] - public int Type { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - [JsonProperty("cover")] - public string Cover { get; set; } - [JsonProperty("intro")] - public string Intro { get; set; } - [JsonProperty("page")] - public int Page { get; set; } - [JsonProperty("duration")] - public long Duration { get; set; } - [JsonProperty("upper")] - public FavUpper Upper { get; set; } - // attr - [JsonProperty("cnt_info")] - public MediaStatus CntInfo { get; set; } - [JsonProperty("link")] - public string Link { get; set; } - [JsonProperty("ctime")] - public long Ctime { get; set; } - [JsonProperty("pubtime")] - public long Pubtime { get; set; } - [JsonProperty("fav_time")] - public long FavTime { get; set; } - [JsonProperty("bv_id")] - public string BvId { get; set; } - [JsonProperty("bvid")] - public string Bvid { get; set; } - // season - // ogv - // ugc - } -} diff --git a/src/DownKyi.Core/BiliApi/Favorites/Models/FavoritesMediaId.cs b/src/DownKyi.Core/BiliApi/Favorites/Models/FavoritesMediaId.cs deleted file mode 100644 index 173bec8..0000000 --- a/src/DownKyi.Core/BiliApi/Favorites/Models/FavoritesMediaId.cs +++ /dev/null @@ -1,32 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Favorites.Models -{ - // https://api.bilibili.com/x/v3/fav/resource/ids - public class FavoritesMediaIdOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("data")] - public List Data { get; set; } - } - - public class FavoritesMediaId : BaseModel - { - [JsonProperty("id")] - public long Id { get; set; } - [JsonProperty("type")] - public int Type { get; set; } - [JsonProperty("bv_id")] - public string BvId { get; set; } - [JsonProperty("bvid")] - public string Bvid { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Favorites/Models/FavoritesMediaResource.cs b/src/DownKyi.Core/BiliApi/Favorites/Models/FavoritesMediaResource.cs deleted file mode 100644 index edaa0d7..0000000 --- a/src/DownKyi.Core/BiliApi/Favorites/Models/FavoritesMediaResource.cs +++ /dev/null @@ -1,30 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Favorites.Models -{ - // https://api.bilibili.com/x/v3/fav/resource/list - public class FavoritesMediaResourceOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("data")] - public FavoritesMediaResource Data { get; set; } - } - - public class FavoritesMediaResource : BaseModel - { - [JsonProperty("info")] - public FavoritesMetaInfo Info { get; set; } - [JsonProperty("medias")] - public List Medias { get; set; } - [JsonProperty("has_more")] - public bool HasMore { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Favorites/Models/FavoritesMetaInfo.cs b/src/DownKyi.Core/BiliApi/Favorites/Models/FavoritesMetaInfo.cs deleted file mode 100644 index d30848f..0000000 --- a/src/DownKyi.Core/BiliApi/Favorites/Models/FavoritesMetaInfo.cs +++ /dev/null @@ -1,53 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Favorites.Models -{ - // https://api.bilibili.com/x/v3/fav/folder/info - public class FavoritesMetaInfoOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("data")] - public FavoritesMetaInfo Data { get; set; } - } - - public class FavoritesMetaInfo : BaseModel - { - [JsonProperty("id")] - public long Id { get; set; } - [JsonProperty("fid")] - public long Fid { get; set; } - [JsonProperty("mid")] - public long Mid { get; set; } - // attr - [JsonProperty("title")] - public string Title { get; set; } - [JsonProperty("cover")] - public string Cover { get; set; } - [JsonProperty("upper")] - public FavUpper Upper { get; set; } - // cover_type - [JsonProperty("cnt_info")] - public FavStatus CntInfo { get; set; } - // type - [JsonProperty("intro")] - public string Intro { get; set; } - [JsonProperty("ctime")] - public long Ctime { get; set; } - [JsonProperty("mtime")] - public long Mtime { get; set; } - // state - [JsonProperty("fav_state")] - public int FavState { get; set; } - [JsonProperty("like_state")] - public int LikeState { get; set; } - [JsonProperty("media_count")] - public int MediaCount { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Favorites/Models/MediaStatus.cs b/src/DownKyi.Core/BiliApi/Favorites/Models/MediaStatus.cs deleted file mode 100644 index 1e56f86..0000000 --- a/src/DownKyi.Core/BiliApi/Favorites/Models/MediaStatus.cs +++ /dev/null @@ -1,15 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Favorites.Models -{ - public class MediaStatus : BaseModel - { - [JsonProperty("collect")] - public long Collect { get; set; } - [JsonProperty("play")] - public long Play { get; set; } - [JsonProperty("danmaku")] - public long Danmaku { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/History/History.cs b/src/DownKyi.Core/BiliApi/History/History.cs deleted file mode 100644 index 1bfd2bd..0000000 --- a/src/DownKyi.Core/BiliApi/History/History.cs +++ /dev/null @@ -1,63 +0,0 @@ -using DownKyi.Core.BiliApi.History.Models; -using DownKyi.Core.Logging; -using Newtonsoft.Json; -using System; - -namespace DownKyi.Core.BiliApi.History -{ - /// - /// 历史记录 - /// - public static class History - { - /// - /// 获取历史记录列表(视频、直播、专栏) - /// startId和startTime必须同时使用才有效,分别对应结果中的max和view_at,默认为0 - /// - /// 历史记录开始目标ID - /// 历史记录开始时间 - /// 每页项数 - /// 历史记录ID类型 - /// - public static HistoryData GetHistory(long startId, long startTime, int ps = 30, HistoryBusiness business = HistoryBusiness.ARCHIVE) - { - string businessStr = string.Empty; - switch (business) - { - case HistoryBusiness.ARCHIVE: - businessStr = "archive"; - break; - case HistoryBusiness.PGC: - businessStr = "pgc"; - break; - case HistoryBusiness.LIVE: - businessStr = "live"; - break; - case HistoryBusiness.ARTICLE_LIST: - businessStr = "article-list"; - break; - case HistoryBusiness.ARTICLE: - businessStr = "article"; - break; - } - - string url = $"https://api.bilibili.com/x/web-interface/history/cursor?max={startId}&view_at={startTime}&ps={ps}&business={businessStr}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - var history = JsonConvert.DeserializeObject(response); - if (history == null || history.Data == null) { return null; } - return history.Data; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetHistory()发生异常: {0}", e); - LogManager.Error("History", e); - return null; - } - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/History/Models/HistoryBusiness.cs b/src/DownKyi.Core/BiliApi/History/Models/HistoryBusiness.cs deleted file mode 100644 index 0b40257..0000000 --- a/src/DownKyi.Core/BiliApi/History/Models/HistoryBusiness.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace DownKyi.Core.BiliApi.History.Models -{ - public enum HistoryBusiness - { - ARCHIVE = 1, // 稿件 - PGC, // 番剧(影视) - LIVE, // 直播 - ARTICLE_LIST, // 文集 - ARTICLE, // 文章 - } -} diff --git a/src/DownKyi.Core/BiliApi/History/Models/HistoryCursor.cs b/src/DownKyi.Core/BiliApi/History/Models/HistoryCursor.cs deleted file mode 100644 index c6641e7..0000000 --- a/src/DownKyi.Core/BiliApi/History/Models/HistoryCursor.cs +++ /dev/null @@ -1,17 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.History.Models -{ - public class HistoryCursor : BaseModel - { - [JsonProperty("max")] - public long Max { get; set; } - [JsonProperty("view_at")] - public long ViewAt { get; set; } - [JsonProperty("business")] - public string Business { get; set; } - [JsonProperty("ps")] - public int Ps { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/History/Models/HistoryData.cs b/src/DownKyi.Core/BiliApi/History/Models/HistoryData.cs deleted file mode 100644 index ca58a5b..0000000 --- a/src/DownKyi.Core/BiliApi/History/Models/HistoryData.cs +++ /dev/null @@ -1,28 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.History.Models -{ - // https://api.bilibili.com/x/web-interface/history/cursor?max={startId}&view_at={startTime}&ps={ps}&business={businessStr} - public class HistoryOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("data")] - public HistoryData Data { get; set; } - } - - public class HistoryData : BaseModel - { - [JsonProperty("cursor")] - public HistoryCursor Cursor { get; set; } - //public List tab { get; set; } - [JsonProperty("list")] - public List List { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/History/Models/HistoryList.cs b/src/DownKyi.Core/BiliApi/History/Models/HistoryList.cs deleted file mode 100644 index 5ac7372..0000000 --- a/src/DownKyi.Core/BiliApi/History/Models/HistoryList.cs +++ /dev/null @@ -1,46 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.History.Models -{ - public class HistoryList : BaseModel - { - [JsonProperty("title")] - public string Title { get; set; } - // long_title - [JsonProperty("cover")] - public string Cover { get; set; } - // covers - [JsonProperty("uri")] - public string Uri { get; set; } - [JsonProperty("history")] - public HistoryListHistory History { get; set; } - [JsonProperty("videos")] - public int Videos { get; set; } - [JsonProperty("author_name")] - public string AuthorName { get; set; } - [JsonProperty("author_face")] - public string AuthorFace { get; set; } - [JsonProperty("author_mid")] - public long AuthorMid { get; set; } - [JsonProperty("view_at")] - public long ViewAt { get; set; } - [JsonProperty("progress")] - public long Progress { get; set; } - // badge - [JsonProperty("show_title")] - public string ShowTitle { get; set; } - [JsonProperty("duration")] - public long Duration { get; set; } - // current - // total - [JsonProperty("new_desc")] - public string NewDesc { get; set; } - // is_finish - // is_fav - // kid - [JsonProperty("tag_name")] - public string TagName { get; set; } - // live_status - } -} diff --git a/src/DownKyi.Core/BiliApi/History/Models/HistoryListHistory.cs b/src/DownKyi.Core/BiliApi/History/Models/HistoryListHistory.cs deleted file mode 100644 index 8ea33f0..0000000 --- a/src/DownKyi.Core/BiliApi/History/Models/HistoryListHistory.cs +++ /dev/null @@ -1,25 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.History.Models -{ - public class HistoryListHistory : BaseModel - { - [JsonProperty("oid")] - public long Oid { get; set; } - [JsonProperty("epid")] - public long Epid { get; set; } - [JsonProperty("bvid")] - public string Bvid { get; set; } - [JsonProperty("page")] - public int Page { get; set; } - [JsonProperty("cid")] - public long Cid { get; set; } - [JsonProperty("part")] - public string Part { get; set; } - [JsonProperty("business")] - public string Business { get; set; } - [JsonProperty("dt")] - public int Dt { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/History/Models/ToViewData.cs b/src/DownKyi.Core/BiliApi/History/Models/ToViewData.cs deleted file mode 100644 index 5c1a7ac..0000000 --- a/src/DownKyi.Core/BiliApi/History/Models/ToViewData.cs +++ /dev/null @@ -1,27 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.History.Models -{ - // https://api.bilibili.com/x/v2/history/toview - public class ToViewOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("data")] - public ToViewData Data { get; set; } - } - - public class ToViewData : BaseModel - { - [JsonProperty("count")] - public int Count { get; set; } - [JsonProperty("list")] - public List List { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/History/Models/ToViewList.cs b/src/DownKyi.Core/BiliApi/History/Models/ToViewList.cs deleted file mode 100644 index 4458a94..0000000 --- a/src/DownKyi.Core/BiliApi/History/Models/ToViewList.cs +++ /dev/null @@ -1,43 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.History.Models -{ - public class ToViewList : BaseModel - { - [JsonProperty("aid")] - public long Aid { get; set; } - // videos - // tid - // tname - // copyright - [JsonProperty("pic")] - public string Pic { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - // pubdate - // ctime - // desc - // state - // duration - // rights - [JsonProperty("owner")] - public VideoOwner Owner { get; set; } - // stat - // dynamic - // dimension - // short_link_v2 - // first_frame - // page - // count - [JsonProperty("cid")] - public long Cid { get; set; } - // progress - [JsonProperty("add_at")] - public long AddAt { get; set; } - [JsonProperty("bvid")] - public string Bvid { get; set; } - // uri - // viewed - } -} diff --git a/src/DownKyi.Core/BiliApi/History/ToView.cs b/src/DownKyi.Core/BiliApi/History/ToView.cs deleted file mode 100644 index 354569b..0000000 --- a/src/DownKyi.Core/BiliApi/History/ToView.cs +++ /dev/null @@ -1,38 +0,0 @@ -using DownKyi.Core.BiliApi.History.Models; -using DownKyi.Core.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.History -{ - /// - /// 稍后再看 - /// - public static class ToView - { - /// - /// 获取稍后再看视频列表 - /// - /// - public static List GetToView() - { - string url = "https://api.bilibili.com/x/v2/history/toview"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - var toView = JsonConvert.DeserializeObject(response); - if (toView == null || toView.Data == null) { return null; } - return toView.Data.List; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetToView()发生异常: {0}", e); - LogManager.Error("ToView", e); - return null; - } - } - } -} diff --git a/src/DownKyi.Core/BiliApi/Login/LoginHelper.cs b/src/DownKyi.Core/BiliApi/Login/LoginHelper.cs deleted file mode 100644 index 78fcd00..0000000 --- a/src/DownKyi.Core/BiliApi/Login/LoginHelper.cs +++ /dev/null @@ -1,147 +0,0 @@ -using DownKyi.Core.Settings; -using DownKyi.Core.Settings.Models; -using DownKyi.Core.Utils; -using DownKyi.Core.Utils.Encryptor; -using System; -using System.IO; -using System.Net; - -namespace DownKyi.Core.BiliApi.Login -{ - public static class LoginHelper - { - // 本地位置 - private static readonly string LOCAL_LOGIN_INFO = Storage.StorageManager.GetLogin(); - - // 16位密码,ps:密码位数没有限制,可任意设置 - private static readonly string SecretKey = "EsOat*^y1QR!&0J6"; - - /// - /// 保存登录的cookies到文件 - /// - /// - /// - public static bool SaveLoginInfoCookies(string url) - { - string tempFile = LOCAL_LOGIN_INFO + "-" + Guid.NewGuid().ToString("N"); - CookieContainer cookieContainer = ObjectHelper.ParseCookie(url); - - bool isSucceed = ObjectHelper.WriteCookiesToDisk(tempFile, cookieContainer); - if (isSucceed) - { - // 加密密钥,增加机器码 - string password = SecretKey + MachineCode.GetMachineCodeString(); - - try - { - Encryptor.EncryptFile(tempFile, LOCAL_LOGIN_INFO, password); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("SaveLoginInfoCookies()发生异常: {0}", e); - Logging.LogManager.Error(e); - return false; - } - } - - if (File.Exists(tempFile)) - { - File.Delete(tempFile); - } - return isSucceed; - } - - - /// - /// 获得登录的cookies - /// - /// - public static CookieContainer GetLoginInfoCookies() - { - string tempFile = LOCAL_LOGIN_INFO + "-" + Guid.NewGuid().ToString("N"); - - if (File.Exists(LOCAL_LOGIN_INFO)) - { - try - { - // 加密密钥,增加机器码 - string password = SecretKey + MachineCode.GetMachineCodeString(); - Encryptor.DecryptFile(LOCAL_LOGIN_INFO, tempFile, password); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetLoginInfoCookies()发生异常: {0}", e); - Logging.LogManager.Error(e); - if (File.Exists(tempFile)) - { - File.Delete(tempFile); - } - return null; - } - } - else { return null; } - - CookieContainer cookies = ObjectHelper.ReadCookiesFromDisk(tempFile); - - if (File.Exists(tempFile)) - { - File.Delete(tempFile); - } - return cookies; - } - - /// - /// 返回登录信息的cookies的字符串 - /// - /// - public static string GetLoginInfoCookiesString() - { - var cookieContainer = GetLoginInfoCookies(); - if (cookieContainer == null) - { - return ""; - } - - var cookies = ObjectHelper.GetAllCookies(cookieContainer); - - string cookie = string.Empty; - foreach (var item in cookies) - { - cookie += item.ToString() + ";"; - } - return cookie.TrimEnd(';'); - } - - /// - /// 注销登录 - /// - /// - public static bool Logout() - { - if (File.Exists(LOCAL_LOGIN_INFO)) - { - try - { - File.Delete(LOCAL_LOGIN_INFO); - - SettingsManager.GetInstance().SetUserInfo(new UserInfoSettings - { - Mid = -1, - Name = "", - IsLogin = false, - IsVip = false - }); - return true; - } - catch (IOException e) - { - Utils.Debugging.Console.PrintLine("Logout()发生异常: {0}", e); - Logging.LogManager.Error(e); - return false; - } - } - return false; - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/Login/LoginQR.cs b/src/DownKyi.Core/BiliApi/Login/LoginQR.cs deleted file mode 100644 index 35009f4..0000000 --- a/src/DownKyi.Core/BiliApi/Login/LoginQR.cs +++ /dev/null @@ -1,138 +0,0 @@ -using DownKyi.Core.BiliApi.Login.Models; -using DownKyi.Core.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Media.Imaging; - -namespace DownKyi.Core.BiliApi.Login -{ - /// - /// 二维码登录 - /// - public static class LoginQR - { - /// - /// 申请二维码URL及扫码密钥(web端) - /// - /// - public static LoginUrlOrigin GetLoginUrl() - { - string getLoginUrl = "https://passport.bilibili.com/qrcode/getLoginUrl"; - string referer = "https://passport.bilibili.com/login"; - string response = WebClient.RequestWeb(getLoginUrl, referer); - - try - { - var loginUrl = JsonConvert.DeserializeObject(response); - return loginUrl; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetLoginUrl()发生异常: {0}", e); - LogManager.Error("LoginQR", e); - return null; - } - } - - /// - /// 使用扫码登录(web端) - /// - /// - /// - /// - public static LoginStatus GetLoginStatus(string oauthKey, string goUrl = "https://www.bilibili.com") - { - string url = "https://passport.bilibili.com/qrcode/getLoginInfo"; - string referer = "https://passport.bilibili.com/login"; - - Dictionary parameters = new Dictionary - { - { "oauthKey", oauthKey }, - { "gourl", goUrl } - }; - - string response = WebClient.RequestWeb(url, referer, "POST", parameters); - var loginInfo = new LoginStatus(); - - try - { - if (response.Contains("\"code\":0") || response.Contains("\"code\": 0")) - { - var ready = JsonConvert.DeserializeObject(response); - if (ready == null) - { return null; } - - loginInfo.Code = ready.Code; - loginInfo.Status = ready.Status; - loginInfo.Message = "登录成功"; - loginInfo.Url = ready.Data.Url; - } - else - { - var scanning = JsonConvert.DeserializeObject(response); - if (scanning == null) - { return null; } - - loginInfo.Code = scanning.Data; - loginInfo.Status = scanning.Status; - loginInfo.Message = scanning.Message; - loginInfo.Url = ""; - } - - return loginInfo; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetLoginInfo()发生异常: {0}", e); - LogManager.Error("LoginQR", e); - return null; - } - } - - - /// - /// 获得登录二维码 - /// - /// - public static BitmapImage GetLoginQRCode() - { - try - { - string loginUrl = GetLoginUrl().Data.Url; - return GetLoginQRCode(loginUrl); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetLoginQRCode()发生异常: {0}", e); - LogManager.Error("LoginQR", e); - return null; - } - } - - /// - /// 根据输入url生成二维码 - /// - /// - /// - public static BitmapImage GetLoginQRCode(string url) - { - // 设置的参数影响app能否成功扫码 - Bitmap qrCode = Utils.QRCode.EncodeQRCode(url, 12, 10, null, 0, 0, false); - - MemoryStream ms = new MemoryStream(); - qrCode.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); - byte[] bytes = ms.GetBuffer(); - ms.Close(); - - BitmapImage image = new BitmapImage(); - image.BeginInit(); - image.StreamSource = new MemoryStream(bytes); - image.EndInit(); - return image; - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/Login/Models/LoginStatus.cs b/src/DownKyi.Core/BiliApi/Login/Models/LoginStatus.cs deleted file mode 100644 index 2d6a599..0000000 --- a/src/DownKyi.Core/BiliApi/Login/Models/LoginStatus.cs +++ /dev/null @@ -1,49 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Login.Models -{ - // https://passport.bilibili.com/qrcode/getLoginInfo - [JsonObject] - public class LoginStatus : BaseModel - { - [JsonProperty("code")] - public int Code { get; set; } - [JsonProperty("status")] - public bool Status { get; set; } - [JsonProperty("message")] - public string Message { get; set; } - [JsonProperty("url")] - public string Url { get; set; } - } - - [JsonObject] - public class LoginStatusScanning : BaseModel - { - [JsonProperty("status")] - public bool Status { get; set; } - [JsonProperty("data")] - public int Data { get; set; } - [JsonProperty("message")] - public string Message { get; set; } - } - - [JsonObject] - public class LoginStatusReady : BaseModel - { - [JsonProperty("code")] - public int Code { get; set; } - [JsonProperty("status")] - public bool Status { get; set; } - //public long ts { get; set; } - [JsonProperty("data")] - public LoginStatusData Data { get; set; } - } - - [JsonObject] - public class LoginStatusData : BaseModel - { - [JsonProperty("url")] - public string Url { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Login/Models/LoginUrl.cs b/src/DownKyi.Core/BiliApi/Login/Models/LoginUrl.cs deleted file mode 100644 index f494a78..0000000 --- a/src/DownKyi.Core/BiliApi/Login/Models/LoginUrl.cs +++ /dev/null @@ -1,26 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Login.Models -{ - // https://passport.bilibili.com/qrcode/getLoginUrl - [JsonObject] - public class LoginUrlOrigin : BaseModel - { - //public int code { get; set; } - [JsonProperty("data")] - public LoginUrl Data { get; set; } - [JsonProperty("status")] - public bool Status { get; set; } - //public long ts { get; set; } - } - - [JsonObject] - public class LoginUrl : BaseModel - { - [JsonProperty("oauthKey")] - public string OauthKey { get; set; } - [JsonProperty("url")] - public string Url { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/LoginNew/LoginQR.cs b/src/DownKyi.Core/BiliApi/LoginNew/LoginQR.cs deleted file mode 100644 index c51d0d4..0000000 --- a/src/DownKyi.Core/BiliApi/LoginNew/LoginQR.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Media.Imaging; -using DownKyi.Core.BiliApi.LoginNew.Models; -using DownKyi.Core.Logging; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.LoginNew -{ - public static class LoginQR - { - /// - /// 申请二维码URL及扫码密钥(web端) - /// - /// - public static LoginUrlOrigin GetLoginUrl() - { - string getLoginUrl = "https://passport.bilibili.com/x/passport-login/web/qrcode/generate"; - string response = WebClient.RequestWeb(getLoginUrl); - Console.Out.WriteLine(response); - try - { - return JsonConvert.DeserializeObject(response); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetLoginUrl()发生异常: {0}", e); - LogManager.Error("LoginQR", e); - return null; - } - } - - /// - /// 使用扫码登录(web端) - /// - /// - /// - /// - public static LoginStatus GetLoginStatus(string qrcodeKey, string goUrl = "https://www.bilibili.com") - { - string url = "https://passport.bilibili.com/x/passport-login/web/qrcode/poll?qrcode_key=" + qrcodeKey; - - string response = WebClient.RequestWeb(url); - - try - { - return JsonConvert.DeserializeObject(response); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetLoginInfo()发生异常: {0}", e); - LogManager.Error("LoginQR", e); - return null; - } - } - - /// - /// 获得登录二维码 - /// - /// - public static BitmapImage GetLoginQRCode() - { - try - { - string loginUrl = GetLoginUrl().Data.Url; - return GetLoginQRCode(loginUrl); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetLoginQRCode()发生异常: {0}", e); - LogManager.Error("LoginQR", e); - return null; - } - } - - /// - /// 根据输入url生成二维码 - /// - /// - /// - public static BitmapImage GetLoginQRCode(string url) - { - // 设置的参数影响app能否成功扫码 - Bitmap qrCode = Utils.QRCode.EncodeQRCode(url, 12, 10, null, 0, 0, false); - - MemoryStream ms = new MemoryStream(); - qrCode.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); - byte[] bytes = ms.GetBuffer(); - ms.Close(); - - BitmapImage image = new BitmapImage(); - image.BeginInit(); - image.StreamSource = new MemoryStream(bytes); - image.EndInit(); - return image; - } - } -} \ No newline at end of file diff --git a/src/DownKyi.Core/BiliApi/LoginNew/Models/LoginStatus.cs b/src/DownKyi.Core/BiliApi/LoginNew/Models/LoginStatus.cs deleted file mode 100644 index c8dcc5a..0000000 --- a/src/DownKyi.Core/BiliApi/LoginNew/Models/LoginStatus.cs +++ /dev/null @@ -1,23 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.LoginNew.Models -{ - [JsonObject] - public class LoginStatus : BaseModel - { - [JsonProperty("code")] public int Code { get; set; } - [JsonProperty("message")] public string Message { get; set; } - - [JsonProperty("data")] public LoginStatusData Data { get; set; } - } - - [JsonObject] - public class LoginStatusData : BaseModel - { - [JsonProperty("url")] public string Url { get; set; } - [JsonProperty("refresh_token")] public string RefreshToken { get; set; } - [JsonProperty("code")] public int Code { get; set; } - [JsonProperty("message")] public string Message { get; set; } - } -} \ No newline at end of file diff --git a/src/DownKyi.Core/BiliApi/LoginNew/Models/LoginUrl.cs b/src/DownKyi.Core/BiliApi/LoginNew/Models/LoginUrl.cs deleted file mode 100644 index c45c69b..0000000 --- a/src/DownKyi.Core/BiliApi/LoginNew/Models/LoginUrl.cs +++ /dev/null @@ -1,26 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.LoginNew.Models -{ - // https://passport.bilibili.com/qrcode/getLoginUrl - [JsonObject] - public class LoginUrlOrigin : BaseModel - { - //public int code { get; set; } - [JsonProperty("data")] - public LoginUrl Data { get; set; } - [JsonProperty("code")] - public int Code { get; set; } - //public long ts { get; set; } - } - - [JsonObject] - public class LoginUrl : BaseModel - { - [JsonProperty("qrcode_key")] - public string QrcodeKey { get; set; } - [JsonProperty("url")] - public string Url { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Models/BaseModel.cs b/src/DownKyi.Core/BiliApi/Models/BaseModel.cs deleted file mode 100644 index c0d4152..0000000 --- a/src/DownKyi.Core/BiliApi/Models/BaseModel.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Models -{ - public abstract class BaseModel - { - public string ToString(string format = "") - { - // 设置为去掉null - var jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; - - switch (format) - { - case "": - return JsonConvert.SerializeObject(this); - case "F": - // 整理json格式 - return JsonConvert.SerializeObject(this, Formatting.Indented); - case "N": - // 去掉null后,转换为json字符串 - return JsonConvert.SerializeObject(this, Formatting.None, jsonSetting); - case "FN": - case "NF": - return JsonConvert.SerializeObject(this, Formatting.Indented, jsonSetting); - default: - return ToString(); - } - } - } -} diff --git a/src/DownKyi.Core/BiliApi/Models/Dimension.cs b/src/DownKyi.Core/BiliApi/Models/Dimension.cs deleted file mode 100644 index 41ea536..0000000 --- a/src/DownKyi.Core/BiliApi/Models/Dimension.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Models -{ - public class Dimension : BaseModel - { - [JsonProperty("width")] - public int Width { get; set; } - [JsonProperty("height")] - public int Height { get; set; } - [JsonProperty("rotate")] - public int Rotate { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Models/Json/SubRipText.cs b/src/DownKyi.Core/BiliApi/Models/Json/SubRipText.cs deleted file mode 100644 index bfa9928..0000000 --- a/src/DownKyi.Core/BiliApi/Models/Json/SubRipText.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Models.Json -{ - public class SubRipText : BaseModel - { - [JsonProperty("lan")] - public string Lan { get; set; } - [JsonProperty("lan_doc")] - public string LanDoc { get; set; } - [JsonProperty("srtString")] - public string SrtString { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Models/Json/Subtitle.cs b/src/DownKyi.Core/BiliApi/Models/Json/Subtitle.cs deleted file mode 100644 index 80f9c94..0000000 --- a/src/DownKyi.Core/BiliApi/Models/Json/Subtitle.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Models.Json -{ - public class Subtitle : BaseModel - { - [JsonProperty("from")] - public float From { get; set; } - [JsonProperty("to")] - public float To { get; set; } - [JsonProperty("location")] - public int Location { get; set; } - [JsonProperty("content")] - public string Content { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Models/Json/SubtitleJson.cs b/src/DownKyi.Core/BiliApi/Models/Json/SubtitleJson.cs deleted file mode 100644 index 6437610..0000000 --- a/src/DownKyi.Core/BiliApi/Models/Json/SubtitleJson.cs +++ /dev/null @@ -1,69 +0,0 @@ -using Newtonsoft.Json; -using System; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Models.Json -{ - public class SubtitleJson : BaseModel - { - [JsonProperty("font_size")] - public float FontSize { get; set; } - [JsonProperty("font_color")] - public string FontColor { get; set; } - [JsonProperty("background_alpha")] - public float BackgroundAlpha { get; set; } - [JsonProperty("background_color")] - public string BackgroundColor { get; set; } - [JsonProperty("Stroke")] - public string Stroke { get; set; } - [JsonProperty("body")] - public List Body { get; set; } - - /// - /// srt格式字幕 - /// - /// - public string ToSubRip() - { - string subRip = string.Empty; - for (int i = 0; i < Body.Count; i++) - { - subRip += $"{i + 1}\n"; - subRip += $"{Second2hms(Body[i].From)} --> {Second2hms(Body[i].To)}\n"; - subRip += $"{Body[i].Content}\n"; - subRip += "\n"; - } - - return subRip; - } - - /// - /// 秒数转 时:分:秒 格式 - /// - /// - /// - private static string Second2hms(float seconds) - { - if (seconds < 0) - { - return "00:00:00,000"; - } - - int i = (int)Math.Floor(seconds / 1.0); - int dec = (int)(Math.Round(seconds % 1.0f, 2) * 100); - if (dec >= 100) - { - dec = 99; - } - - int min = (int)Math.Floor(i / 60.0); - int second = (int)(i % 60.0f); - - int hour = (int)Math.Floor(min / 60.0); - min = (int)Math.Floor(min % 60.0f); - - return $"{hour:D2}:{min:D2}:{second:D2},{dec:D3}"; - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/Models/VideoOwner.cs b/src/DownKyi.Core/BiliApi/Models/VideoOwner.cs deleted file mode 100644 index eaeb6d3..0000000 --- a/src/DownKyi.Core/BiliApi/Models/VideoOwner.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Models -{ - public class VideoOwner : BaseModel - { - [JsonProperty("mid")] - public long Mid { get; set; } - [JsonProperty("name")] - public string Name { get; set; } - [JsonProperty("face")] - public string Face { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Sign/WbiSign.cs b/src/DownKyi.Core/BiliApi/Sign/WbiSign.cs deleted file mode 100644 index aec4b88..0000000 --- a/src/DownKyi.Core/BiliApi/Sign/WbiSign.cs +++ /dev/null @@ -1,163 +0,0 @@ -using DownKyi.Core.Settings; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Http; -using System.Security.Cryptography; -using System.Text; -using System.Text.RegularExpressions; - -namespace DownKyi.Core.BiliApi.Sign -{ - public static class WbiSign - { - - /// - /// 打乱重排实时口令 - /// - /// - /// - private static string GetMixinKey(string origin) - { - int[] mixinKeyEncTab = new int[] - { - 46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49, - 33, 9, 42, 19, 29, 28, 14, 39,12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40, - 61, 26, 17, 0, 1, 60, 51, 30, 4, 22, 25, 54, 21, 56, 59, 6, 63, 57, 62, 11, - 36, 20, 34, 44, 52 - }; - - var temp = new StringBuilder(); - foreach (var i in mixinKeyEncTab) - { - temp.Append(origin[i]); - } - return temp.ToString().Substring(0, 32); - } - - /// - /// 将字典参数转为字符串 - /// - /// - /// - public static string ParametersToQuery(Dictionary parameters) - { - var keys = parameters.Keys.ToList(); - var queryList = new List(); - foreach (var item in keys) - { - var value = parameters[item]; - queryList.Add($"{item}={value}"); - } - return string.Join("&", queryList); - } - - /// - /// Wbi签名,返回所有参数字典 - /// - /// - /// - public static Dictionary EncodeWbi(Dictionary parameters) - { - return EncWbi(parameters, GetKey().Item1, GetKey().Item2); - } - - /// - /// Wbi签名,返回所有参数字典 - /// - /// - /// - /// - /// - private static Dictionary EncWbi(Dictionary parameters, string imgKey, string subKey) - { - Dictionary paraStr = new Dictionary(); - foreach (var para in parameters) - { - var key = para.Key; - var value = para.Value.ToString(); - paraStr.Add(key, value); - } - - string mixinKey = GetMixinKey(imgKey + subKey); - string currTime = DateTimeOffset.Now.ToUnixTimeSeconds().ToString(); - //添加 wts 字段 - paraStr["wts"] = currTime; - // 按照 key 重排参数 - paraStr = paraStr.OrderBy(p => p.Key).ToDictionary(p => p.Key, p => p.Value); - //过滤 value 中的 "!'()*" 字符 - paraStr = paraStr.ToDictionary( - kvp => kvp.Key, - kvp => new string(kvp.Value.Where(chr => !"!'()*".Contains(chr)).ToArray()) - ); - // 序列化参数 - string query = new FormUrlEncodedContent(paraStr).ReadAsStringAsync().Result; - //计算 w_rid - using (MD5 md5 = MD5.Create()) - { - //using MD5 md5 = MD5.Create(); - byte[] hashBytes = md5.ComputeHash(Encoding.UTF8.GetBytes(query + mixinKey)); - string wbiSign = BitConverter.ToString(hashBytes).Replace("-", "").ToLower(); - paraStr["w_rid"] = wbiSign; - } - - return paraStr; - } - - /// - /// Wbi签名,返回所有参数字典 - /// - /// - /// - /// - /// - public static Dictionary EncodeWbi(Dictionary parameters, string imgKey, string subKey) - { - var mixinKey = GetMixinKey(imgKey + subKey); - - var chrFilter = new Regex("[!'()*]"); - - var newParameters = new Dictionary - { - { "wts", DateTimeOffset.Now.ToUnixTimeSeconds().ToString() } - }; - - foreach (var para in parameters) - { - var key = para.Key; - var value = para.Value.ToString(); - - var encodedValue = chrFilter.Replace(value, ""); - - newParameters.Add(Uri.EscapeDataString(key), Uri.EscapeDataString(encodedValue)); - } - - var keys = newParameters.Keys.ToList(); - keys.Sort(); - - var queryList = new List(); - foreach (var item in keys) - { - var value = newParameters[item]; - queryList.Add($"{item}={value}"); - } - - var queryString = string.Join("&", queryList); - var md5Hasher = MD5.Create(); - var hashStr = queryString + mixinKey; - var hashedQueryString = md5Hasher.ComputeHash(Encoding.UTF8.GetBytes(hashStr)); - var wbiSign = BitConverter.ToString(hashedQueryString).Replace("-", "").ToLower(); - - newParameters.Add("w_rid", wbiSign); - return newParameters; - } - - public static Tuple GetKey() - { - var user = SettingsManager.GetInstance().GetUserInfo(); - - return new Tuple(user.ImgKey, user.SubKey); - } - - } -} \ No newline at end of file diff --git a/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollow.cs b/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollow.cs deleted file mode 100644 index 81d9b57..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollow.cs +++ /dev/null @@ -1,76 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class BangumiFollow : BaseModel - { - [JsonProperty("season_id")] - public long SeasonId { get; set; } - [JsonProperty("media_id")] - public long MediaId { get; set; } - [JsonProperty("season_type")] - public int SeasonType { get; set; } - [JsonProperty("season_type_name")] - public string SeasonTypeName { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - [JsonProperty("cover")] - public string Cover { get; set; } - [JsonProperty("total_count")] - public int TotalCount { get; set; } - // is_finish - // is_started - // is_play - [JsonProperty("badge")] - public string Badge { get; set; } - [JsonProperty("badge_type")] - public int BadgeType { get; set; } - // rights - // stat - [JsonProperty("new_ep")] - public BangumiFollowNewEp NewEp { get; set; } - // rating - // square_cover - [JsonProperty("season_status")] - public int SeasonStatus { get; set; } - [JsonProperty("season_title")] - public string SeasonTitle { get; set; } - [JsonProperty("badge_ep")] - public string BadgeEp { get; set; } - // media_attr - // season_attr - [JsonProperty("evaluate")] - public string Evaluate { get; set; } - [JsonProperty("areas")] - public List Areas { get; set; } - [JsonProperty("subtitle")] - public string Subtitle { get; set; } - [JsonProperty("first_ep")] - public long FirstEp { get; set; } - // can_watch - // series - // publish - // mode - // section - [JsonProperty("url")] - public string Url { get; set; } - // badge_info - // first_ep_info - // formal_ep_count - // short_url - // badge_infos - // season_version - // horizontal_cover_16_9 - // horizontal_cover_16_10 - // subtitle_14 - // viewable_crowd_type - // producers - // follow_status - // is_new - [JsonProperty("progress")] - public string Progress { get; set; } - // both_follow - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollowAreas.cs b/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollowAreas.cs deleted file mode 100644 index 56b7135..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollowAreas.cs +++ /dev/null @@ -1,13 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class BangumiFollowAreas : BaseModel - { - [JsonProperty("id")] - public int Id { get; set; } - [JsonProperty("name")] - public string Name { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollowNewEp.cs b/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollowNewEp.cs deleted file mode 100644 index a3d9060..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollowNewEp.cs +++ /dev/null @@ -1,23 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class BangumiFollowNewEp : BaseModel - { - [JsonProperty("id")] - public long Id { get; set; } - [JsonProperty("index_show")] - public string IndexShow { get; set; } - [JsonProperty("cover")] - public string Cover { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - [JsonProperty("long_title")] - public string LongTitle { get; set; } - [JsonProperty("pub_time")] - public string PubTime { get; set; } - [JsonProperty("duration")] - public long Duration { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollowOrigin.cs b/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollowOrigin.cs deleted file mode 100644 index 8690651..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollowOrigin.cs +++ /dev/null @@ -1,26 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/x/space/bangumi/follow/list?vmid={mid}&type={type:D}&pn={pn}&ps={ps} - public class BangumiFollowOrigin : BaseModel - { - [JsonProperty("data")] - public BangumiFollowData Data { get; set; } - } - - public class BangumiFollowData : BaseModel - { - [JsonProperty("list")] - public List List { get; set; } - [JsonProperty("pn")] - public int Pn { get; set; } - [JsonProperty("ps")] - public int Ps { get; set; } - [JsonProperty("total")] - public int Total { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/BangumiType.cs b/src/DownKyi.Core/BiliApi/Users/Models/BangumiType.cs deleted file mode 100644 index a8480e5..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/BangumiType.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace DownKyi.Core.BiliApi.Users.Models -{ - public enum BangumiType - { - ANIME = 1, // 番剧 - EPISODE = 2 // 剧集、电影 - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/FollowingGroup.cs b/src/DownKyi.Core/BiliApi/Users/Models/FollowingGroup.cs deleted file mode 100644 index 22267b3..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/FollowingGroup.cs +++ /dev/null @@ -1,26 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/x/relation/tags - public class FollowingGroupOrigin : BaseModel - { - [JsonProperty("data")] - public List Data { get; set; } - } - - public class FollowingGroup : BaseModel - { - [JsonProperty("tagid")] - public int TagId { get; set; } - [JsonProperty("name")] - public string Name { get; set; } - [JsonProperty("count")] - public int Count { get; set; } - [JsonProperty("tip")] - public string Tip { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/FollowingGroupContent.cs b/src/DownKyi.Core/BiliApi/Users/Models/FollowingGroupContent.cs deleted file mode 100644 index 7f1597f..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/FollowingGroupContent.cs +++ /dev/null @@ -1,14 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/x/relation/tag?tagid={tagId}&pn={pn}&ps={ps}&order_type={orderType} - public class FollowingGroupContent : BaseModel - { - [JsonProperty("data")] - public List Data { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/FollowingOrder.cs b/src/DownKyi.Core/BiliApi/Users/Models/FollowingOrder.cs deleted file mode 100644 index a480070..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/FollowingOrder.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace DownKyi.Core.BiliApi.Users.Models -{ - public enum FollowingOrder - { - DEFAULT = 1, // 按照关注顺序排列,默认 - ATTENTION // 按照最常访问排列 - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/MyInfo.cs b/src/DownKyi.Core/BiliApi/Users/Models/MyInfo.cs deleted file mode 100644 index 0141dcf..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/MyInfo.cs +++ /dev/null @@ -1,75 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/x/space/myinfo - public class MyInfoOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("data")] - public MyInfo Data { get; set; } - } - - public class MyInfo : BaseModel - { - [JsonProperty("mid")] - public long Mid { get; set; } - [JsonProperty("name")] - public string Name { get; set; } - [JsonProperty("sex")] - public string Sex { get; set; } - [JsonProperty("face")] - public string Face { get; set; } - [JsonProperty("sign")] - public string Sign { get; set; } - // rank - [JsonProperty("level")] - public int Level { get; set; } - // jointime - [JsonProperty("moral")] - public int Moral { get; set; } - [JsonProperty("silence")] - public int Silence { get; set; } - [JsonProperty("email_status")] - public int EmailStatus { get; set; } - [JsonProperty("tel_status")] - public int TelStatus { get; set; } - [JsonProperty("identification")] - public int Identification { get; set; } - [JsonProperty("vip")] - public UserInfoVip Vip { get; set; } - // pendant - // nameplate - // official - [JsonProperty("birthday")] - public long Birthday { get; set; } - [JsonProperty("is_tourist")] - public int IsTourist { get; set; } - [JsonProperty("is_fake_account")] - public int IsFakeAccount { get; set; } - [JsonProperty("pin_prompting")] - public int PinPrompting { get; set; } - [JsonProperty("is_deleted")] - public int IsDeleted { get; set; } - // in_reg_audit - // is_rip_user - // profession - // face_nft - // face_nft_new - // is_senior_member - [JsonProperty("level_exp")] - public UserInfoLevelExp LevelExp { get; set; } - [JsonProperty("coins")] - public float Coins { get; set; } - [JsonProperty("following")] - public int Following { get; set; } - [JsonProperty("follower")] - public int Follower { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/NicknameStatus.cs b/src/DownKyi.Core/BiliApi/Users/Models/NicknameStatus.cs deleted file mode 100644 index 3257b56..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/NicknameStatus.cs +++ /dev/null @@ -1,14 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/x/relation/stat?nickName={nickName} - public class NicknameStatus : BaseModel - { - [JsonProperty("code")] - public int Code { get; set; } - [JsonProperty("message")] - public string Message { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/PublicationOrder.cs b/src/DownKyi.Core/BiliApi/Users/Models/PublicationOrder.cs deleted file mode 100644 index 380fa87..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/PublicationOrder.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace DownKyi.Core.BiliApi.Users.Models -{ - public enum PublicationOrder - { - PUBDATE = 1, // 最新发布,默认 - CLICK, // 最多播放 - STOW // 最多收藏 - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/RelationBlack.cs b/src/DownKyi.Core/BiliApi/Users/Models/RelationBlack.cs deleted file mode 100644 index 95205cc..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/RelationBlack.cs +++ /dev/null @@ -1,13 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/x/relation/blacks?pn={pn}&ps={ps} - public class RelationBlack : BaseModel - { - [JsonProperty("data")] - public List Data { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/RelationFollow.cs b/src/DownKyi.Core/BiliApi/Users/Models/RelationFollow.cs deleted file mode 100644 index 4911ffc..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/RelationFollow.cs +++ /dev/null @@ -1,25 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/x/relation/followers?vmid={mid}&pn={pn}&ps={ps} - // https://api.bilibili.com/x/relation/followings?vmid={mid}&pn={pn}&ps={ps}&order_type={orderType} - public class RelationFollowOrigin : BaseModel - { - [JsonProperty("data")] - public RelationFollow Data { get; set; } - } - - public class RelationFollow : BaseModel - { - [JsonProperty("list")] - public List List { get; set; } - //[JsonProperty("re_version")] - //public long reVersion { get; set; } - [JsonProperty("total")] - public int Total { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/RelationFollowInfo.cs b/src/DownKyi.Core/BiliApi/Users/Models/RelationFollowInfo.cs deleted file mode 100644 index 23710c2..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/RelationFollowInfo.cs +++ /dev/null @@ -1,31 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class RelationFollowInfo : BaseModel - { - [JsonProperty("mid")] - public long Mid { get; set; } - [JsonProperty("attribute")] - public int Attribute { get; set; } - [JsonProperty("mtime")] - public long Mtime { get; set; } - [JsonProperty("tag")] - public List Tag { get; set; } - [JsonProperty("special")] - public int Special { get; set; } - // contract_info - [JsonProperty("uname")] - public string Name { get; set; } - [JsonProperty("face")] - public string Face { get; set; } - [JsonProperty("sign")] - public string Sign { get; set; } - // face_nft - // official_verify - // vip - // nft_icon - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/RelationWhisper.cs b/src/DownKyi.Core/BiliApi/Users/Models/RelationWhisper.cs deleted file mode 100644 index 9bab5a8..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/RelationWhisper.cs +++ /dev/null @@ -1,21 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/x/relation/whispers?pn={pn}&ps={ps} - public class RelationWhisper : BaseModel - { - [JsonProperty("data")] - public RelationWhisperData Data { get; set; } - } - - public class RelationWhisperData : BaseModel - { - [JsonProperty("list")] - public List List { get; set; } - // re_version - } - -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannel.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannel.cs deleted file mode 100644 index 6e7f635..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannel.cs +++ /dev/null @@ -1,21 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/x/space/channel/list?mid={mid} - public class SpaceChannelOrigin : BaseModel - { - [JsonProperty("data")] - public SpaceChannel Data { get; set; } - } - - public class SpaceChannel : BaseModel - { - [JsonProperty("count")] - public int Count { get; set; } - [JsonProperty("list")] - public List List { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelArchive.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelArchive.cs deleted file mode 100644 index 8a4a068..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelArchive.cs +++ /dev/null @@ -1,47 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class SpaceChannelArchive : BaseModel - { - [JsonProperty("aid")] - public long Aid { get; set; } - // videos - [JsonProperty("tid")] - public int Tid { get; set; } - [JsonProperty("tname")] - public string Tname { get; set; } - // copyright - [JsonProperty("pic")] - public string Pic { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - [JsonProperty("pubdate")] - public long Pubdate { get; set; } - [JsonProperty("ctime")] - public long Ctime { get; set; } - [JsonProperty("desc")] - public string Desc { get; set; } - // state - [JsonProperty("duration")] - public long Duration { get; set; } - // mission_id - // rights - [JsonProperty("owner")] - public VideoOwner Owner { get; set; } - [JsonProperty("stat")] - public SpaceChannelArchiveStat Stat { get; set; } - // dynamic - [JsonProperty("cid")] - public long Cid { get; set; } - [JsonProperty("dimension")] - public Dimension Dimension { get; set; } - // season_id - // short_link_v2 - [JsonProperty("bvid")] - public string Bvid { get; set; } - // inter_video - // is_live_playback - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelArchiveStat.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelArchiveStat.cs deleted file mode 100644 index 6845276..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelArchiveStat.cs +++ /dev/null @@ -1,31 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class SpaceChannelArchiveStat : BaseModel - { - [JsonProperty("aid")] - public long Aid { get; set; } - [JsonProperty("view")] - public long View { get; set; } - [JsonProperty("danmaku")] - public long Danmaku { get; set; } - [JsonProperty("reply")] - public long Reply { get; set; } - [JsonProperty("favorite")] - public long Favorite { get; set; } - [JsonProperty("coin")] - public long Coin { get; set; } - [JsonProperty("share")] - public long Share { get; set; } - [JsonProperty("now_rank")] - public long NowRank { get; set; } - [JsonProperty("his_rank")] - public long HisRank { get; set; } - [JsonProperty("like")] - public long Like { get; set; } - [JsonProperty("dislike")] - public long Dislike { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelList.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelList.cs deleted file mode 100644 index d2164f1..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelList.cs +++ /dev/null @@ -1,24 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class SpaceChannelList : BaseModel - { - [JsonProperty("cid")] - public long Cid { get; set; } - [JsonProperty("mid")] - public long Mid { get; set; } - [JsonProperty("name")] - public string Name { get; set; } - [JsonProperty("intro")] - public string Intro { get; set; } - [JsonProperty("mtime")] - public long Mtime { get; set; } - [JsonProperty("count")] - public int Count { get; set; } - [JsonProperty("cover")] - public string Cover { get; set; } - // is_live_playback - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelVideo.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelVideo.cs deleted file mode 100644 index 9c27763..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelVideo.cs +++ /dev/null @@ -1,21 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/x/space/channel/video?mid={mid}&cid={cid}&pn={pn}&ps={ps} - public class SpaceChannelVideoOrigin : BaseModel - { - [JsonProperty("data")] - public SpaceChannelVideo Data { get; set; } - } - - public class SpaceChannelVideo : BaseModel - { - // episodic_button - [JsonProperty("list")] - public SpaceChannelVideoList List { get; set; } - [JsonProperty("page")] - public SpaceChannelVideoPage Page { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelVideoList.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelVideoList.cs deleted file mode 100644 index fed996b..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelVideoList.cs +++ /dev/null @@ -1,27 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class SpaceChannelVideoList : BaseModel - { - [JsonProperty("cid")] - public long Cid { get; set; } - [JsonProperty("mid")] - public long Mid { get; set; } - [JsonProperty("name")] - public string Name { get; set; } - [JsonProperty("intro")] - public string Intro { get; set; } - [JsonProperty("mtime")] - public long Mtime { get; set; } - [JsonProperty("count")] - public int Count { get; set; } - [JsonProperty("cover")] - public string Cover { get; set; } - // is_live_playback - [JsonProperty("archives")] - public List Archives { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelVideoPage.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelVideoPage.cs deleted file mode 100644 index 5bcd872..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelVideoPage.cs +++ /dev/null @@ -1,15 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class SpaceChannelVideoPage : BaseModel - { - [JsonProperty("count")] - public int Count { get; set; } - [JsonProperty("num")] - public int Num { get; set; } - [JsonProperty("size")] - public int Size { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceCheese.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceCheese.cs deleted file mode 100644 index 9d0b5d0..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceCheese.cs +++ /dev/null @@ -1,27 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class SpaceCheese : BaseModel - { - [JsonProperty("cover")] - public string Cover { get; set; } - [JsonProperty("ep_count")] - public int EpCount { get; set; } - [JsonProperty("link")] - public string Link { get; set; } - [JsonProperty("page")] - public int Page { get; set; } - [JsonProperty("play")] - public int Play { get; set; } - [JsonProperty("season_id")] - public long SeasonId { get; set; } - [JsonProperty("status")] - public string Status { get; set; } - [JsonProperty("subtitle")] - public string SubTitle { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceCheeseOrigin.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceCheeseOrigin.cs deleted file mode 100644 index 36c2ef1..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceCheeseOrigin.cs +++ /dev/null @@ -1,21 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/pugv/app/web/season/page?mid={mid}&pn={pn}&ps={ps} - public class SpaceCheeseOrigin : BaseModel - { - [JsonProperty("data")] - public SpaceCheeseData Data { get; set; } - } - - public class SpaceCheeseData : BaseModel - { - [JsonProperty("items")] - public List Items { get; set; } - [JsonProperty("page")] - public SpaceCheesePage Page { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceCheesePage.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceCheesePage.cs deleted file mode 100644 index 8ad28d5..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceCheesePage.cs +++ /dev/null @@ -1,17 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class SpaceCheesePage : BaseModel - { - [JsonProperty("next")] - public bool Next { get; set; } - [JsonProperty("num")] - public int Num { get; set; } - [JsonProperty("size")] - public int Size { get; set; } - [JsonProperty("total")] - public int Total { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpacePublication.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpacePublication.cs deleted file mode 100644 index 23f007b..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpacePublication.cs +++ /dev/null @@ -1,21 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/x/space/arc/search - public class SpacePublicationOrigin : BaseModel - { - [JsonProperty("data")] - public SpacePublication Data { get; set; } - } - - public class SpacePublication : BaseModel - { - [JsonProperty("list")] - public SpacePublicationList List { get; set; } - [JsonProperty("page")] - public SpacePublicationPage Page { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationList.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationList.cs deleted file mode 100644 index 7bf26b8..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationList.cs +++ /dev/null @@ -1,14 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class SpacePublicationList : BaseModel - { - [JsonProperty("tlist")] - public SpacePublicationListType Tlist { get; set; } - [JsonProperty("vlist")] - public List Vlist { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationListType.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationListType.cs deleted file mode 100644 index 5a4d528..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationListType.cs +++ /dev/null @@ -1,51 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class SpacePublicationListType : BaseModel - { - [JsonProperty("1")] - public SpacePublicationListTypeVideoZone Douga { get; set; } - [JsonProperty("13")] - public SpacePublicationListTypeVideoZone Anime { get; set; } - [JsonProperty("167")] - public SpacePublicationListTypeVideoZone Guochuang { get; set; } - [JsonProperty("3")] - public SpacePublicationListTypeVideoZone Music { get; set; } - [JsonProperty("129")] - public SpacePublicationListTypeVideoZone Dance { get; set; } - [JsonProperty("4")] - public SpacePublicationListTypeVideoZone Game { get; set; } - [JsonProperty("36")] - public SpacePublicationListTypeVideoZone Technology { get; set; } - [JsonProperty("188")] - public SpacePublicationListTypeVideoZone Digital { get; set; } - [JsonProperty("234")] - public SpacePublicationListTypeVideoZone Sports { get; set; } - [JsonProperty("223")] - public SpacePublicationListTypeVideoZone Car { get; set; } - [JsonProperty("160")] - public SpacePublicationListTypeVideoZone Life { get; set; } - [JsonProperty("211")] - public SpacePublicationListTypeVideoZone Food { get; set; } - [JsonProperty("217")] - public SpacePublicationListTypeVideoZone Animal { get; set; } - [JsonProperty("119")] - public SpacePublicationListTypeVideoZone Kichiku { get; set; } - [JsonProperty("155")] - public SpacePublicationListTypeVideoZone Fashion { get; set; } - [JsonProperty("202")] - public SpacePublicationListTypeVideoZone Information { get; set; } - [JsonProperty("5")] - public SpacePublicationListTypeVideoZone Ent { get; set; } - [JsonProperty("181")] - public SpacePublicationListTypeVideoZone Cinephile { get; set; } - [JsonProperty("177")] - public SpacePublicationListTypeVideoZone Documentary { get; set; } - [JsonProperty("23")] - public SpacePublicationListTypeVideoZone Movie { get; set; } - [JsonProperty("11")] - public SpacePublicationListTypeVideoZone Tv { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationListTypeVideoZone.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationListTypeVideoZone.cs deleted file mode 100644 index 2349c3a..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationListTypeVideoZone.cs +++ /dev/null @@ -1,15 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class SpacePublicationListTypeVideoZone : BaseModel - { - [JsonProperty("tid")] - public int Tid { get; set; } - [JsonProperty("count")] - public int Count { get; set; } - [JsonProperty("name")] - public string Name { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationListVideo.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationListVideo.cs deleted file mode 100644 index d5b91f7..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationListVideo.cs +++ /dev/null @@ -1,51 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class SpacePublicationListVideo : BaseModel - { - //[JsonProperty("comment")] - //public int Comment { get; set; } - [JsonProperty("typeid")] - public int Typeid { get; set; } - [JsonProperty("play")] - public int Play { get; set; } - [JsonProperty("pic")] - public string Pic { get; set; } - //[JsonProperty("subtitle")] - //public string Subtitle { get; set; } - //[JsonProperty("description")] - //public string Description { get; set; } - //[JsonProperty("copyright")] - //public string Copyright { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - //[JsonProperty("review")] - //public int Review { get; set; } - //[JsonProperty("author")] - //public string Author { get; set; } - [JsonProperty("mid")] - public long Mid { get; set; } - [JsonProperty("created")] - public long Created { get; set; } - [JsonProperty("length")] - public string Length { get; set; } - //[JsonProperty("video_review")] - //public int VideoReview { get; set; } - [JsonProperty("aid")] - public long Aid { get; set; } - [JsonProperty("bvid")] - public string Bvid { get; set; } - //[JsonProperty("hide_click")] - //public bool HideClick { get; set; } - //[JsonProperty("is_pay")] - //public int IsPay { get; set; } - //[JsonProperty("is_union_video")] - //public int IsUnionVideo { get; set; } - //[JsonProperty("is_steins_gate")] - //public int IsSteinsGate { get; set; } - //[JsonProperty("is_live_playback")] - //public int IsLivePlayback { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationPage.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationPage.cs deleted file mode 100644 index 0b94e73..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationPage.cs +++ /dev/null @@ -1,15 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class SpacePublicationPage : BaseModel - { - [JsonProperty("pn")] - public int Pn { get; set; } - [JsonProperty("ps")] - public int Ps { get; set; } - [JsonProperty("count")] - public int Count { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsDetail.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsDetail.cs deleted file mode 100644 index a540679..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsDetail.cs +++ /dev/null @@ -1,32 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/x/polymer/space/seasons_archives_list?mid={mid}&season_id={seasonId}&page_num={pageNum}&page_size={pageSize}&sort_reverse=false - public class SpaceSeasonsDetailOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("data")] - public SpaceSeasonsDetail Data { get; set; } - } - - public class SpaceSeasonsDetail : BaseModel - { - [JsonProperty("aids")] - public List Aids { get; set; } - [JsonProperty("archives")] - public List Archives { get; set; } - [JsonProperty("meta")] - public SpaceSeasonsMeta Meta { get; set; } - [JsonProperty("page")] - public SpaceSeasonsSeriesPage Page { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeries.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeries.cs deleted file mode 100644 index 9a97f24..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeries.cs +++ /dev/null @@ -1,26 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class SpaceSeasons : BaseModel - { - [JsonProperty("archives")] - public List Archives { get; set; } - [JsonProperty("meta")] - public SpaceSeasonsMeta Meta { get; set; } - [JsonProperty("recent_aids")] - public List RecentAids { get; set; } - } - - public class SpaceSeries : BaseModel - { - [JsonProperty("archives")] - public List Archives { get; set; } - [JsonProperty("meta")] - public SpaceSeriesMeta Meta { get; set; } - [JsonProperty("recent_aids")] - public List RecentAids { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesArchives.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesArchives.cs deleted file mode 100644 index 38daebe..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesArchives.cs +++ /dev/null @@ -1,29 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class SpaceSeasonsSeriesArchives : BaseModel - { - [JsonProperty("aid")] - public long Aid { get; set; } - [JsonProperty("bvid")] - public string Bvid { get; set; } - [JsonProperty("ctime")] - public long Ctime { get; set; } - [JsonProperty("duration")] - public long Duration { get; set; } - [JsonProperty("interactive_video")] - public bool InteractiveVideo { get; set; } - [JsonProperty("pic")] - public string Pic { get; set; } - [JsonProperty("pubdate")] - public long Pubdate { get; set; } - [JsonProperty("stat")] - public SpaceSeasonsSeriesStat Stat { get; set; } - // state - [JsonProperty("title")] - public string Title { get; set; } - // ugc_pay - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesMeta.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesMeta.cs deleted file mode 100644 index dacbeb6..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesMeta.cs +++ /dev/null @@ -1,51 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class SpaceSeasonsSeriesMeta : BaseModel - { - [JsonProperty("category")] - public int Category { get; set; } - [JsonProperty("cover")] - public string Cover { get; set; } - [JsonProperty("description")] - public string Description { get; set; } - [JsonProperty("mid")] - public long Mid { get; set; } - [JsonProperty("name")] - public string Name { get; set; } - [JsonProperty("total")] - public int Total { get; set; } - } - - public class SpaceSeasonsMeta : SpaceSeasonsSeriesMeta - { - [JsonProperty("ptime")] - public long Ptime { get; set; } - [JsonProperty("season_id")] - public long SeasonId { get; set; } - } - - public class SpaceSeriesMeta : SpaceSeasonsSeriesMeta - { - [JsonProperty("creator")] - public string Creator { get; set; } - [JsonProperty("ctime")] - public long Ctime { get; set; } - [JsonProperty("keywords")] - public List Keywords { get; set; } - [JsonProperty("last_update_ts")] - public long LastUpdate { get; set; } - [JsonProperty("mtime")] - public long Mtime { get; set; } - [JsonProperty("raw_keywords")] - public string RawKeywords { get; set; } - [JsonProperty("series_id")] - public long SeriesId { get; set; } - [JsonProperty("state")] - public int State { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesOrigin.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesOrigin.cs deleted file mode 100644 index 435ba0b..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesOrigin.cs +++ /dev/null @@ -1,36 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/x/space/channel/video?mid={mid}&page_num={pageNum}&page_size={pageSize} - public class SpaceSeasonsSeriesOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("data")] - public SpaceSeasonsSeriesData Data { get; set; } - } - - public class SpaceSeasonsSeriesData : BaseModel - { - [JsonProperty("items_lists")] - public SpaceSeasonsSeries ItemsLists { get; set; } - } - - public class SpaceSeasonsSeries : BaseModel - { - [JsonProperty("page")] - public SpaceSeasonsSeriesPage Page { get; set; } - [JsonProperty("seasons_list")] - public List SeasonsList { get; set; } - [JsonProperty("series_list")] - public List SeriesList { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesPage.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesPage.cs deleted file mode 100644 index 0f651bf..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesPage.cs +++ /dev/null @@ -1,15 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class SpaceSeasonsSeriesPage : BaseModel - { - [JsonProperty("page_num")] - public int PageNum; - [JsonProperty("page_size")] - public int PageSize; - [JsonProperty("total")] - public int Total; - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesStat.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesStat.cs deleted file mode 100644 index ef53bd2..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeasonsSeriesStat.cs +++ /dev/null @@ -1,11 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class SpaceSeasonsSeriesStat : BaseModel - { - [JsonProperty("view")] - public long View { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeriesDetail.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeriesDetail.cs deleted file mode 100644 index d77643f..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeriesDetail.cs +++ /dev/null @@ -1,29 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/x/series/archives?mid={mid}&series_id={seriesId}&only_normal=true&sort=desc&pn={pn}&ps={ps} - public class SpaceSeriesDetailOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("data")] - public SpaceSeriesDetail Data { get; set; } - } - - public class SpaceSeriesDetail : BaseModel - { - [JsonProperty("aids")] - public List Aids { get; set; } - // page - [JsonProperty("archives")] - public List Archives { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeriesMeta.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeriesMeta.cs deleted file mode 100644 index 8377df1..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSeriesMeta.cs +++ /dev/null @@ -1,28 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/x/series/series?series_id={seriesId} - public class SpaceSeriesMetaOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("data")] - public SpaceSeriesMetaData Data { get; set; } - } - - public class SpaceSeriesMetaData : BaseModel - { - [JsonProperty("meta")] - public SpaceSeriesMeta Meta { get; set; } - [JsonProperty("recent_aids")] - public List RecentAids { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSettings.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceSettings.cs deleted file mode 100644 index b3fc6af..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSettings.cs +++ /dev/null @@ -1,21 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://space.bilibili.com/ajax/settings/getSettings?mid={mid} - public class SpaceSettingsOrigin : BaseModel - { - [JsonProperty("status")] - public bool Status { get; set; } - [JsonProperty("data")] - public SpaceSettings Data { get; set; } - } - - public class SpaceSettings : BaseModel - { - // ... - [JsonProperty("toutu")] - public SpaceSettingsToutu Toutu { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSettingsToutu.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceSettingsToutu.cs deleted file mode 100644 index a89c583..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSettingsToutu.cs +++ /dev/null @@ -1,27 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class SpaceSettingsToutu : BaseModel - { - [JsonProperty("sid")] - public int Sid { get; set; } - [JsonProperty("expire")] - public long Expire { get; set; } - [JsonProperty("s_img")] - public string Simg { get; set; } // 完整url为http://i0.hdslb.com/+相对路径 - [JsonProperty("l_img")] - public string Limg { get; set; } // 完整url为http://i0.hdslb.com/+相对路径 - [JsonProperty("android_img")] - public string AndroidImg { get; set; } - [JsonProperty("iphone_img")] - public string IphoneImg { get; set; } - [JsonProperty("ipad_img")] - public string IpadImg { get; set; } - [JsonProperty("thumbnail_img")] - public string ThumbnailImg { get; set; } - [JsonProperty("platform")] - public int Platform { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/UpStat.cs b/src/DownKyi.Core/BiliApi/Users/Models/UpStat.cs deleted file mode 100644 index 6cb1d28..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/UpStat.cs +++ /dev/null @@ -1,28 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/x/space/upstat?mid={mid} - public class UpStatOrigin : BaseModel - { - [JsonProperty("data")] - public UpStat Data { get; set; } - } - - public class UpStat : BaseModel - { - [JsonProperty("archive")] - public UpStatArchive Archive { get; set; } - [JsonProperty("article")] - public UpStatArchive Article { get; set; } - [JsonProperty("likes")] - public long Likes { get; set; } - } - - public class UpStatArchive : BaseModel - { - [JsonProperty("view")] - public long View { get; set; } // 视频/文章播放量 - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/UserInfoForNavigation.cs b/src/DownKyi.Core/BiliApi/Users/Models/UserInfoForNavigation.cs deleted file mode 100644 index d1256dc..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/UserInfoForNavigation.cs +++ /dev/null @@ -1,121 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/x/web-interface/nav - [JsonObject] - public class UserInfoForNavigationOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - [JsonProperty("data")] - public UserInfoForNavigation Data { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - } - - [JsonObject] - public class UserInfoForNavigation : BaseModel - { - //public int allowance_count { get; set; } - //public int answer_status { get; set; } - //public int email_verified { get; set; } - [JsonProperty("face")] - public string Face { get; set; } - //public bool has_shop { get; set; } - [JsonProperty("isLogin")] - public bool IsLogin { get; set; } - //public NavDataLevelInfo level_info { get; set; } - [JsonProperty("mid")] - public long Mid { get; set; } - //public int mobile_verified { get; set; } - [JsonProperty("money")] - public float Money { get; set; } - //public int moral { get; set; } - //public NavDataOfficial official { get; set; } - //public NavDataOfficialVerify officialVerify { get; set; } - //public NavDataPendant pendant { get; set; } - //public int scores { get; set; } - //public string shop_url { get; set; } - [JsonProperty("uname")] - public string Name { get; set; } - //public long vipDueDate { get; set; } - [JsonProperty("vipStatus")] - public int VipStatus { get; set; } - //public int vipType { get; set; } - //public int vip_avatar_subscript { get; set; } - //public NavDataVipLabel vip_label { get; set; } - //public string vip_nickname_color { get; set; } - //public int vip_pay_type { get; set; } - //public int vip_theme_type { get; set; } - [JsonProperty("wallet")] - public UserInfoWallet Wallet { get; set; } - - [JsonProperty("wbi_img")] - public Wbi Wbi { get; set; } - } - - //public class NavDataLevelInfo - //{ - // public int current_exp { get; set; } - // public int current_level { get; set; } - // public int current_min { get; set; } - // //public int next_exp { get; set; } // 当等级为6时,next_exp为string类型,值为"--" - //} - - //public class NavDataOfficial - //{ - // public string desc { get; set; } - // public int role { get; set; } - // public string title { get; set; } - // public int type { get; set; } - //} - - //public class NavDataOfficialVerify - //{ - // public string desc { get; set; } - // public int type { get; set; } - //} - - //public class NavDataPendant - //{ - // public int expire { get; set; } - // public string image { get; set; } - // public string image_enhance { get; set; } - // public string name { get; set; } - // public int pid { get; set; } - //} - - //public class NavDataVipLabel - //{ - // public string label_theme { get; set; } - // public string path { get; set; } - // public string text { get; set; } - //} - - [JsonObject] - public class UserInfoWallet : BaseModel - { - [JsonProperty("bcoin_balance")] - public float BcoinBalance { get; set; } - [JsonProperty("coupon_balance")] - public float CouponBalance { get; set; } - [JsonProperty("coupon_due_time")] - public long CouponDueTime { get; set; } - [JsonProperty("mid")] - public long Mid { get; set; } - } - - [JsonObject] - public class Wbi - { - [JsonProperty("img_url")] - public string ImgUrl { get; set; } - [JsonProperty("sub_url")] - public string SubUrl { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/UserInfoForSpace.cs b/src/DownKyi.Core/BiliApi/Users/Models/UserInfoForSpace.cs deleted file mode 100644 index 4545d56..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/UserInfoForSpace.cs +++ /dev/null @@ -1,55 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/x/space/acc/info?mid={mid} - public class UserInfoForSpaceOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("data")] - public UserInfoForSpace Data { get; set; } - } - - public class UserInfoForSpace : BaseModel - { - [JsonProperty("mid")] - public long Mid { get; set; } - [JsonProperty("name")] - public string Name { get; set; } - [JsonProperty("sex")] - public string Sex { get; set; } - [JsonProperty("face")] - public string Face { get; set; } - // face_nft - [JsonProperty("sign")] - public string Sign { get; set; } - // rank - [JsonProperty("level")] - public int Level { get; set; } - // jointime - // moral - // silence - // coins - //[JsonProperty("fans_badge")] - //public bool FansBadge { get; set; } - // fans_medal - // official - [JsonProperty("vip")] - public UserInfoVip Vip { get; set; } - // pendant - // nameplate - // user_honour_info - [JsonProperty("is_followed")] - public bool IsFollowed { get; set; } - [JsonProperty("top_photo")] - public string TopPhoto { get; set; } - // ... - } - -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/UserInfoLevelExp.cs b/src/DownKyi.Core/BiliApi/Users/Models/UserInfoLevelExp.cs deleted file mode 100644 index ba8193d..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/UserInfoLevelExp.cs +++ /dev/null @@ -1,17 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class UserInfoLevelExp : BaseModel - { - [JsonProperty("current_level")] - public int CurrentLevel { get; set; } - [JsonProperty("current_min")] - public int CurrentMin { get; set; } - [JsonProperty("current_exp")] - public int CurrentExp { get; set; } - [JsonProperty("next_exp")] - public int NextExp { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/UserInfoVip.cs b/src/DownKyi.Core/BiliApi/Users/Models/UserInfoVip.cs deleted file mode 100644 index 0ece787..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/UserInfoVip.cs +++ /dev/null @@ -1,41 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - public class UserInfoVip : BaseModel - { - [JsonProperty("type")] - public int Type { get; set; } - [JsonProperty("status")] - public int Status { get; set; } - [JsonProperty("due_date")] - public long DueDate { get; set; } - // vip_pay_type - // theme_type - [JsonProperty("label")] - public UserInfoVipLabel Label { get; set; } - [JsonProperty("avatar_subscript")] - public int AvatarSubscript { get; set; } - [JsonProperty("nickname_color")] - public string NicknameColor { get; set; } - // role - [JsonProperty("avatar_subscript_url")] - public string AvatarSubscriptUrl { get; set; } - } - - public class UserInfoVipLabel : BaseModel - { - // path - [JsonProperty("text")] - public string Text { get; set; } - [JsonProperty("label_theme")] - public string LabelTheme { get; set; } - [JsonProperty("text_color")] - public string TextColor { get; set; } - // bg_style - // bg_color - // border_color - } - -} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/UserRelationStat.cs b/src/DownKyi.Core/BiliApi/Users/Models/UserRelationStat.cs deleted file mode 100644 index 076e4c4..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Models/UserRelationStat.cs +++ /dev/null @@ -1,26 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Users.Models -{ - // https://api.bilibili.com/x/relation/stat?vmid={mid} - public class UserRelationStatOrigin : BaseModel - { - [JsonProperty("data")] - public UserRelationStat Data { get; set; } - } - - public class UserRelationStat : BaseModel - { - [JsonProperty("mid")] - public long Mid { get; set; } - [JsonProperty("following")] - public long Following { get; set; } // 关注数 - [JsonProperty("whisper")] - public long Whisper { get; set; } - [JsonProperty("black")] - public long Black { get; set; } - [JsonProperty("follower")] - public long Follower { get; set; } // 粉丝数 - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/Nickname.cs b/src/DownKyi.Core/BiliApi/Users/Nickname.cs deleted file mode 100644 index 80da154..0000000 --- a/src/DownKyi.Core/BiliApi/Users/Nickname.cs +++ /dev/null @@ -1,38 +0,0 @@ -using DownKyi.Core.BiliApi.Users.Models; -using DownKyi.Core.Logging; -using Newtonsoft.Json; -using System; - -namespace DownKyi.Core.BiliApi.Users -{ - /// - /// 用户昵称 - /// - public class Nickname - { - /// - /// 检查昵称 - /// - /// - /// - public static NicknameStatus CheckNickname(string nickName) - { - string url = $"https://api.bilibili.com/x/relation/stat?nickName={nickName}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - NicknameStatus nickname = JsonConvert.DeserializeObject(response); - return nickname; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("CheckNickname()发生异常: {0}", e); - LogManager.Error("Nickname", e); - return null; - } - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/UserInfo.cs b/src/DownKyi.Core/BiliApi/Users/UserInfo.cs deleted file mode 100644 index cafdbb8..0000000 --- a/src/DownKyi.Core/BiliApi/Users/UserInfo.cs +++ /dev/null @@ -1,95 +0,0 @@ -using DownKyi.Core.BiliApi.Sign; -using DownKyi.Core.BiliApi.Users.Models; -using DownKyi.Core.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users -{ - /// - /// 用户基本信息 - /// - public static class UserInfo - { - /// - /// 导航栏用户信息 - /// - /// - public static UserInfoForNavigation GetUserInfoForNavigation() - { - string url = "https://api.bilibili.com/x/web-interface/nav"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - UserInfoForNavigationOrigin userInfo = JsonConvert.DeserializeObject(response); - if (userInfo == null || userInfo.Data == null) { return null; } - - return userInfo.Data; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetUserInfoForNavigation()发生异常: {0}", e); - LogManager.Error("UserInfo", e); - return null; - } - } - - /// - /// 用户空间详细信息 - /// - /// - /// - public static UserInfoForSpace GetUserInfoForSpace(long mid) - { - var parameters = new Dictionary - { - { "mid", mid } - }; - string query = WbiSign.ParametersToQuery(WbiSign.EncodeWbi(parameters)); - string url = $"https://api.bilibili.com/x/space/wbi/acc/info?{query}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - UserInfoForSpaceOrigin spaceInfo = JsonConvert.DeserializeObject(response); - if (spaceInfo == null || spaceInfo.Data == null) { return null; } - return spaceInfo.Data; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetInfoForSpace()发生异常: {0}", e); - LogManager.Error("UserInfo", e); - return null; - } - } - - /// - /// 本用户详细信息 - /// - /// - public static MyInfo GetMyInfo() - { - string url = "https://api.bilibili.com/x/space/myinfo"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - MyInfoOrigin myInfo = JsonConvert.DeserializeObject(response); - if (myInfo == null || myInfo.Data == null) { return null; } - return myInfo.Data; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetMyInfo()发生异常: {0}", e); - LogManager.Error("UserInfo", e); - return null; - } - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/UserRelation.cs b/src/DownKyi.Core/BiliApi/Users/UserRelation.cs deleted file mode 100644 index f56acd7..0000000 --- a/src/DownKyi.Core/BiliApi/Users/UserRelation.cs +++ /dev/null @@ -1,268 +0,0 @@ -using DownKyi.Core.BiliApi.Users.Models; -using DownKyi.Core.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users -{ - /// - /// 用户关系相关 - /// - public static class UserRelation - { - - /// - /// 查询用户粉丝明细 - /// - /// 目标用户UID - /// 页码 - /// 每页项数 - /// - public static RelationFollow GetFollowers(long mid, int pn, int ps) - { - string url = $"https://api.bilibili.com/x/relation/followers?vmid={mid}&pn={pn}&ps={ps}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - RelationFollowOrigin relationFollower = JsonConvert.DeserializeObject(response); - if (relationFollower == null || relationFollower.Data == null) { return null; } - return relationFollower.Data; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetFollowers()发生异常: {0}", e); - LogManager.Error("UserRelation", e); - return null; - } - } - - /// - /// 查询用户所有的粉丝明细 - /// - /// 目标用户UID - /// - public static List GetAllFollowers(long mid) - { - List result = new List(); - - int i = 0; - while (true) - { - i++; - int ps = 50; - - RelationFollow data = GetFollowers(mid, i, ps); - if (data == null || data.List == null || data.List.Count == 0) - { break; } - - result.AddRange(data.List); - } - - return result; - } - - /// - /// 查询用户关注明细 - /// - /// 目标用户UID - /// 页码 - /// 每页项数 - /// 排序方式 - /// - public static RelationFollow GetFollowings(long mid, int pn, int ps, FollowingOrder order = FollowingOrder.DEFAULT) - { - string orderType = ""; - if (order == FollowingOrder.ATTENTION) - { - orderType = "attention"; - } - - string url = $"https://api.bilibili.com/x/relation/followings?vmid={mid}&pn={pn}&ps={ps}&order_type={orderType}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - RelationFollowOrigin relationFollower = JsonConvert.DeserializeObject(response); - if (relationFollower == null || relationFollower.Data == null) { return null; } - return relationFollower.Data; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetFollowings()发生异常: {0}", e); - LogManager.Error("UserRelation", e); - return null; - } - } - - /// - /// 查询用户所有的关注明细 - /// - /// 目标用户UID - /// 排序方式 - /// - public static List GetAllFollowings(long mid, FollowingOrder order = FollowingOrder.DEFAULT) - { - List result = new List(); - - int i = 0; - while (true) - { - i++; - int ps = 50; - - RelationFollow data = GetFollowings(mid, i, ps, order); - if (data == null || data.List == null || data.List.Count == 0) - { break; } - - result.AddRange(data.List); - } - - return result; - } - - /// - /// 查询悄悄关注明细 - /// - /// 页码 - /// 每页项数 - /// - public static List GetWhispers(int pn, int ps) - { - string url = $"https://api.bilibili.com/x/relation/whispers?pn={pn}&ps={ps}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - RelationWhisper relationWhisper = JsonConvert.DeserializeObject(response); - if (relationWhisper == null || relationWhisper.Data == null || relationWhisper.Data.List == null) { return null; } - return relationWhisper.Data.List; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetWhispers()发生异常: {0}", e); - LogManager.Error("UserRelation", e); - return null; - } - } - - /// - /// 查询黑名单明细 - /// - /// 页码 - /// 每页项数 - /// - public static List GetBlacks(int pn, int ps) - { - string url = $"https://api.bilibili.com/x/relation/blacks?pn={pn}&ps={ps}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - RelationBlack relationBlack = JsonConvert.DeserializeObject(response); - if (relationBlack == null || relationBlack.Data == null) { return null; } - return relationBlack.Data; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetBlacks()发生异常: {0}", e); - LogManager.Error("UserRelation", e); - return null; - } - } - - #region 关注分组相关,只能查询当前登录账户的信息 - - /// - /// 查询关注分组列表 - /// - /// - public static List GetFollowingGroup() - { - string url = $"https://api.bilibili.com/x/relation/tags"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - var followingGroup = JsonConvert.DeserializeObject(response); - if (followingGroup == null || followingGroup.Data == null) { return null; } - return followingGroup.Data; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetFollowingGroup()发生异常: {0}", e); - LogManager.Error("UserRelation", e); - return null; - } - } - - /// - /// 查询关注分组明细 - /// - /// 分组ID - /// 页数 - /// 每页项数 - /// 排序方式 - /// - public static List GetFollowingGroupContent(long tagId, int pn, int ps, FollowingOrder order = FollowingOrder.DEFAULT) - { - string orderType = ""; - if (order == FollowingOrder.ATTENTION) - { - orderType = "attention"; - } - - string url = $"https://api.bilibili.com/x/relation/tag?tagid={tagId}&pn={pn}&ps={ps}&order_type={orderType}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - FollowingGroupContent content = JsonConvert.DeserializeObject(response); - if (content == null || content.Data == null) { return null; } - return content.Data; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetFollowingGroupContent()发生异常: {0}", e); - LogManager.Error("UserRelation", e); - return null; - } - } - - /// - /// 查询所有的关注分组明细 - /// - /// 分组ID - /// 排序方式 - /// - public static List GetAllFollowingGroupContent(int tagId, FollowingOrder order = FollowingOrder.DEFAULT) - { - List result = new List(); - - int i = 0; - while (true) - { - i++; - int ps = 50; - - var data = GetFollowingGroupContent(tagId, i, ps, order); - if (data == null || data.Count == 0) - { break; } - - result.AddRange(data); - } - - return result; - } - - #endregion - - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/UserSpace.cs b/src/DownKyi.Core/BiliApi/Users/UserSpace.cs deleted file mode 100644 index 4072cf1..0000000 --- a/src/DownKyi.Core/BiliApi/Users/UserSpace.cs +++ /dev/null @@ -1,478 +0,0 @@ -using DownKyi.Core.BiliApi.Sign; -using DownKyi.Core.BiliApi.Users.Models; -using DownKyi.Core.Logging; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Users -{ - /// - /// 用户空间信息 - /// - public static class UserSpace - { - /// - /// 查询空间设置 - /// - /// - /// - public static SpaceSettings GetSpaceSettings(long mid) - { - string url = $"https://space.bilibili.com/ajax/settings/getSettings?mid={mid}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - SpaceSettingsOrigin settings = JsonConvert.DeserializeObject(response); - if (settings == null || settings.Data == null || !settings.Status) { return null; } - return settings.Data; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetSpaceSettings()发生异常: {0}", e); - LogManager.Error("UserSpace", e); - return null; - } - } - - #region 投稿 - - /// - /// 获取用户投稿视频的所有分区 - /// - /// 用户id - /// - public static List GetPublicationType(long mid) - { - int pn = 1; - int ps = 1; - SpacePublicationList publication = GetPublication(mid, pn, ps); - return GetPublicationType(publication); - } - - /// - /// 获取用户投稿视频的所有分区 - /// - /// 用户id - /// - public static List GetPublicationType(SpacePublicationList publication) - { - if (publication == null || publication.Tlist == null) - { - return null; - } - - List result = new List(); - JObject typeList = JObject.Parse(publication.Tlist.ToString("N")); - foreach (KeyValuePair item in typeList) - { - SpacePublicationListTypeVideoZone value = JsonConvert.DeserializeObject(item.Value.ToString()); - result.Add(value); - } - return result; - } - - /// - /// 查询用户所有的投稿视频明细 - /// - /// 用户id - /// 排序 - /// 视频分区 - /// 搜索关键词 - /// - public static List GetAllPublication(long mid, int tid = 0, PublicationOrder order = PublicationOrder.PUBDATE, string keyword = "") - { - List result = new List(); - - int i = 0; - while (true) - { - i++; - int ps = 100; - - SpacePublicationList data = GetPublication(mid, i, ps, tid, order, keyword); - if (data == null || data.Vlist == null || data.Vlist.Count == 0) - { break; } - - result.AddRange(data.Vlist); - } - - return result; - } - - /// - /// 查询用户投稿视频明细 - /// - /// 用户id - /// 页码 - /// 每页的视频数 - /// 排序 - /// 视频分区 - /// 搜索关键词 - /// - public static SpacePublicationList GetPublication(long mid, int pn, int ps, long tid = 0, PublicationOrder order = PublicationOrder.PUBDATE, string keyword = "") - { - var parameters = new Dictionary - { - { "mid", mid }, - { "pn", pn }, - { "ps", ps }, - { "order", order.ToString("G").ToLower() }, - { "tid", tid }, - { "keyword", keyword }, - }; - string query = WbiSign.ParametersToQuery(WbiSign.EncodeWbi(parameters)); - string url = $"https://api.bilibili.com/x/space/wbi/arc/search?{query}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - // 忽略play的值为“--”时的类型错误 - JsonSerializerSettings settings = new JsonSerializerSettings - { - Error = (sender, args) => - { - if (Equals(args.ErrorContext.Member, "play") && - args.ErrorContext.OriginalObject.GetType() == typeof(SpacePublicationListVideo)) - { - args.ErrorContext.Handled = true; - } - } - }; - - SpacePublicationOrigin spacePublication = JsonConvert.DeserializeObject(response, settings); - if (spacePublication == null || spacePublication.Data == null) { return null; } - return spacePublication.Data.List; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetPublication()发生异常: {0}", e); - LogManager.Error("UserSpace", e); - return null; - } - } - - #endregion - - #region 频道 - - /// - /// 查询用户频道列表 - /// - /// 用户id - /// - public static List GetChannelList(long mid) - { - string url = $"https://api.bilibili.com/x/space/channel/list?mid={mid}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - SpaceChannelOrigin spaceChannel = JsonConvert.DeserializeObject(response); - if (spaceChannel == null || spaceChannel.Data == null) { return null; } - return spaceChannel.Data.List; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetChannelList()发生异常: {0}", e); - LogManager.Error("UserSpace", e); - return null; - } - } - - /// - /// 查询用户频道中的所有视频 - /// - /// - /// - /// - public static List GetAllChannelVideoList(long mid, long cid) - { - List result = new List(); - - int i = 0; - while (true) - { - i++; - int ps = 100; - - List data = GetChannelVideoList(mid, cid, i, ps); - if (data == null || data.Count == 0) - { break; } - - result.AddRange(data); - } - return result; - } - - /// - /// 查询用户频道中的视频 - /// - /// - /// - /// - /// - /// - public static List GetChannelVideoList(long mid, long cid, int pn, int ps) - { - string url = $"https://api.bilibili.com/x/space/channel/video?mid={mid}&cid={cid}&pn={pn}&ps={ps}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - SpaceChannelVideoOrigin spaceChannelVideo = JsonConvert.DeserializeObject(response); - if (spaceChannelVideo == null || spaceChannelVideo.Data == null || spaceChannelVideo.Data.List == null) - { return null; } - return spaceChannelVideo.Data.List.Archives; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetChannelVideoList()发生异常: {0}", e); - LogManager.Error("UserSpace", e); - return null; - } - } - - #endregion - - #region 合集和列表 - - /// - /// 查询用户的合集和列表 - /// - /// - /// 第几页 - /// 每页的数量;最大值为20 - /// - public static SpaceSeasonsSeries GetSeasonsSeries(long mid, int pageNum, int pageSize) - { - // https://api.bilibili.com/x/polymer/space/seasons_series_list?mid=49246269&page_num=1&page_size=18 - string url = $"https://api.bilibili.com/x/polymer/space/seasons_series_list?mid={mid}&page_num={pageNum}&page_size={pageSize}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - SpaceSeasonsSeriesOrigin origin = JsonConvert.DeserializeObject(response); - if (origin == null || origin.Data == null || origin.Data.ItemsLists == null) - { return null; } - return origin.Data.ItemsLists; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetSeasonsSeries()发生异常: {0}", e); - LogManager.Error("UserSpace", e); - return null; - } - } - - /// - /// 查询用户的合集的视频详情 - /// - /// - /// - /// - /// - public static SpaceSeasonsDetail GetSeasonsDetail(long mid, long seasonId, int pageNum, int pageSize) - { - // https://api.bilibili.com/x/polymer/space/seasons_archives_list?mid=23947287&season_id=665&sort_reverse=false&page_num=1&page_size=30 - string url = $"https://api.bilibili.com/x/polymer/space/seasons_archives_list?mid={mid}&season_id={seasonId}&page_num={pageNum}&page_size={pageSize}&sort_reverse=false"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - SpaceSeasonsDetailOrigin origin = JsonConvert.DeserializeObject(response); - if (origin == null || origin.Data == null) - { return null; } - return origin.Data; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetSeasonsDetail()发生异常: {0}", e); - LogManager.Error("UserSpace", e); - return null; - } - } - - /// - /// 查询用户的列表元数据 - /// - /// - /// - public static SpaceSeriesMetaData GetSeriesMeta(long seriesId) - { - // https://api.bilibili.com/x/series/series?series_id=1253087 - string url = $"https://api.bilibili.com/x/series/series?series_id={seriesId}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - SpaceSeriesMetaOrigin origin = JsonConvert.DeserializeObject(response); - if (origin == null || origin.Data == null) - { return null; } - return origin.Data; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetSeriesMeta()发生异常: {0}", e); - LogManager.Error("UserSpace", e); - return null; - } - } - - /// - /// 查询用户的列表的视频详情 - /// - /// - /// - /// - /// - /// - public static SpaceSeriesDetail GetSeriesDetail(long mid, long seriesId, int pn, int ps) - { - // https://api.bilibili.com/x/series/archives?mid=27899754&series_id=1253087&only_normal=true&sort=desc&pn=1&ps=30 - - string url = $"https://api.bilibili.com/x/series/archives?mid={mid}&series_id={seriesId}&only_normal=true&sort=desc&pn={pn}&ps={ps}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - SpaceSeriesDetailOrigin origin = JsonConvert.DeserializeObject(response); - if (origin == null || origin.Data == null) - { return null; } - return origin.Data; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetSeriesDetail()发生异常: {0}", e); - LogManager.Error("UserSpace", e); - return null; - } - } - - #endregion - - #region 课程 - /// - /// 查询用户发布的课程列表 - /// - /// 目标用户UID - /// 页码 - /// 每页项数 - /// - public static List GetCheese(long mid, int pn, int ps) - { - string url = $"https://api.bilibili.com/pugv/app/web/season/page?mid={mid}&pn={pn}&ps={ps}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - SpaceCheeseOrigin cheese = JsonConvert.DeserializeObject(response); - if (cheese == null || cheese.Data == null || cheese.Data.Items == null) - { return null; } - return cheese.Data.Items; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetCheese()发生异常: {0}", e); - LogManager.Error("UserSpace", e); - return null; - } - } - - /// - /// 查询用户发布的所有课程列表 - /// - /// 目标用户UID - /// - public static List GetAllCheese(long mid) - { - List result = new List(); - - int i = 0; - while (true) - { - i++; - int ps = 50; - - List data = GetCheese(mid, i, ps); - if (data == null || data.Count == 0) - { break; } - - result.AddRange(data); - } - return result; - } - - #endregion - - #region 订阅 - - /// - /// 查询用户追番(追剧)明细 - /// - /// 目标用户UID - /// 查询类型 - /// 页码 - /// 每页项数 - /// - public static BangumiFollowData GetBangumiFollow(long mid, BangumiType type, int pn, int ps) - { - string url = $"https://api.bilibili.com/x/space/bangumi/follow/list?vmid={mid}&type={type:D}&pn={pn}&ps={ps}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - BangumiFollowOrigin bangumiFollow = JsonConvert.DeserializeObject(response); - if (bangumiFollow == null || bangumiFollow.Data == null) - { return null; } - return bangumiFollow.Data; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetBangumiFollow()发生异常: {0}", e); - LogManager.Error("UserSpace", e); - return null; - } - } - - /// - /// 查询用户所有的追番(追剧)明细 - /// - /// 目标用户UID - /// 查询类型 - /// - public static List GetAllBangumiFollow(long mid, BangumiType type) - { - List result = new List(); - - int i = 0; - while (true) - { - i++; - int ps = 30; - - BangumiFollowData data = GetBangumiFollow(mid, type, i, ps); - if (data == null || data.List == null || data.List.Count == 0) - { break; } - - result.AddRange(data.List); - } - return result; - } - - #endregion - - } -} diff --git a/src/DownKyi.Core/BiliApi/Users/UserStatus.cs b/src/DownKyi.Core/BiliApi/Users/UserStatus.cs deleted file mode 100644 index a1485db..0000000 --- a/src/DownKyi.Core/BiliApi/Users/UserStatus.cs +++ /dev/null @@ -1,66 +0,0 @@ -using DownKyi.Core.BiliApi.Users.Models; -using DownKyi.Core.Logging; -using Newtonsoft.Json; -using System; - -namespace DownKyi.Core.BiliApi.Users -{ - /// - /// 用户状态数 - /// - public static class UserStatus - { - /// - /// 关系状态数 - /// - /// - /// - public static UserRelationStat GetUserRelationStat(long mid) - { - string url = $"https://api.bilibili.com/x/relation/stat?vmid={mid}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - UserRelationStatOrigin userRelationStat = JsonConvert.DeserializeObject(response); - if (userRelationStat == null || userRelationStat.Data == null) { return null; } - return userRelationStat.Data; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetUserRelationStat()发生异常: {0}", e); - LogManager.Error("UserStatus", e); - return null; - } - } - - /// - /// UP主状态数 - /// - /// 注:该接口需要任意用户登录,否则不会返回任何数据 - /// - /// - /// - public static UpStat GetUpStat(long mid) - { - string url = $"https://api.bilibili.com/x/space/upstat?mid={mid}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - UpStatOrigin upStat = JsonConvert.DeserializeObject(response); - if (upStat == null || upStat.Data == null) { return null; } - return upStat.Data; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetUpStat()发生异常: {0}", e); - LogManager.Error("UserStatus", e); - return null; - } - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/Video/Dynamic.cs b/src/DownKyi.Core/BiliApi/Video/Dynamic.cs deleted file mode 100644 index 7ea757b..0000000 --- a/src/DownKyi.Core/BiliApi/Video/Dynamic.cs +++ /dev/null @@ -1,40 +0,0 @@ -using DownKyi.Core.BiliApi.Video.Models; -using DownKyi.Core.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Video -{ - public static class Dynamic - { - - /// - /// 获取分区最新视频列表 - /// - /// 目标分区tid - /// 页码 - /// 每页项数(最大50) - /// - public static List RegionDynamicList(int rid, int pn = 1, int ps = 5) - { - string url = $"https://api.bilibili.com/x/web-interface/dynamic/region?rid={rid}&pn={pn}&ps={ps}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - var dynamic = JsonConvert.DeserializeObject(response); - if (dynamic != null && dynamic.Data != null) { return dynamic.Data.Archives; } - else { return null; } - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("RegionDynamicList()发生异常: {0}", e); - LogManager.Error("Dynamic", e); - return null; - } - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/Video/Models/DynamicVideoView.cs b/src/DownKyi.Core/BiliApi/Video/Models/DynamicVideoView.cs deleted file mode 100644 index 1c59504..0000000 --- a/src/DownKyi.Core/BiliApi/Video/Models/DynamicVideoView.cs +++ /dev/null @@ -1,55 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Video.Models -{ - public class DynamicVideoView : BaseModel - { - [JsonProperty("aid")] - public long Aid { get; set; } - [JsonProperty("videos")] - public int Videos { get; set; } - [JsonProperty("tid")] - public int Tid { get; set; } - [JsonProperty("tname")] - public string Tname { get; set; } - [JsonProperty("copyright")] - public int Copyright { get; set; } - [JsonProperty("pic")] - public string Pic { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - [JsonProperty("pubdate")] - public long Pubdate { get; set; } - [JsonProperty("ctime")] - public long Ctime { get; set; } - [JsonProperty("desc")] - public string Desc { get; set; } - [JsonProperty("state")] - public int State { get; set; } - [JsonProperty("duration")] - public long Duration { get; set; } - [JsonProperty("owner")] - public VideoOwner Owner { get; set; } - [JsonProperty("stat")] - public VideoStat Stat { get; set; } - [JsonProperty("dynamic")] - public string Dynamic { get; set; } - [JsonProperty("cid")] - public long Cid { get; set; } - [JsonProperty("dimension")] - public Dimension Dimension { get; set; } - [JsonProperty("short_link")] - public string ShortLink { get; set; } - [JsonProperty("short_link_v2")] - public string ShortLinkV2 { get; set; } - [JsonProperty("first_frame")] - public string FirstFrame { get; set; } - [JsonProperty("bvid")] - public string Bvid { get; set; } - [JsonProperty("season_type")] - public int SeasonType { get; set; } - [JsonProperty("is_ogv")] - public bool IsOgv { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Video/Models/RankingVideoView.cs b/src/DownKyi.Core/BiliApi/Video/Models/RankingVideoView.cs deleted file mode 100644 index 87bc072..0000000 --- a/src/DownKyi.Core/BiliApi/Video/Models/RankingVideoView.cs +++ /dev/null @@ -1,47 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Video.Models -{ - public class RankingVideoView : BaseModel - { - [JsonProperty("aid")] - public long Aid { get; set; } - [JsonProperty("bvid")] - public string Bvid { get; set; } - [JsonProperty("typename")] - public string TypeName { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - [JsonProperty("subtitle")] - public string Subtitle { get; set; } - [JsonProperty("play")] - public long Play { get; set; } - [JsonProperty("review")] - public long Review { get; set; } - [JsonProperty("video_review")] - public long VideoReview { get; set; } - [JsonProperty("favorites")] - public long Favorites { get; set; } - [JsonProperty("mid")] - public long Mid { get; set; } - [JsonProperty("author")] - public string Author { get; set; } - [JsonProperty("description")] - public string Description { get; set; } - [JsonProperty("create")] - public string Create { get; set; } - [JsonProperty("pic")] - public string Pic { get; set; } - [JsonProperty("coins")] - public long Coins { get; set; } - [JsonProperty("duration")] - public string Duration { get; set; } - [JsonProperty("badgepay")] - public bool Badgepay { get; set; } - [JsonProperty("pts")] - public long Pts { get; set; } - [JsonProperty("redirect_url")] - public string RedirectUrl { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Video/Models/RegionDynamic.cs b/src/DownKyi.Core/BiliApi/Video/Models/RegionDynamic.cs deleted file mode 100644 index ffbb66d..0000000 --- a/src/DownKyi.Core/BiliApi/Video/Models/RegionDynamic.cs +++ /dev/null @@ -1,27 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Video.Models -{ - // https://api.bilibili.com/x/web-interface/dynamic/region - public class RegionDynamicOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("data")] - public RegionDynamic Data { get; set; } - } - - public class RegionDynamic : BaseModel - { - [JsonProperty("archives")] - public List Archives { get; set; } - // page - } - -} diff --git a/src/DownKyi.Core/BiliApi/Video/Models/RegionRanking.cs b/src/DownKyi.Core/BiliApi/Video/Models/RegionRanking.cs deleted file mode 100644 index d0f7340..0000000 --- a/src/DownKyi.Core/BiliApi/Video/Models/RegionRanking.cs +++ /dev/null @@ -1,20 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Video.Models -{ - // https://api.bilibili.com/x/web-interface/ranking/region - public class RegionRanking : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("data")] - public List Data { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Video/Models/UgcArc.cs b/src/DownKyi.Core/BiliApi/Video/Models/UgcArc.cs deleted file mode 100644 index 301d44f..0000000 --- a/src/DownKyi.Core/BiliApi/Video/Models/UgcArc.cs +++ /dev/null @@ -1,43 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Video.Models -{ - public class UgcArc : BaseModel - { - [JsonProperty("aid")] - public long Aid { get; set; } - [JsonProperty("videos")] - public int Videos { get; set; } - [JsonProperty("type_id")] - public int TypeId { get; set; } - [JsonProperty("type_name")] - public string TypeName { get; set; } - [JsonProperty("copyright")] - public int Copyright { get; set; } - [JsonProperty("pic")] - public string Pic { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - [JsonProperty("pubdate")] - public long Pubdate { get; set; } - [JsonProperty("ctime")] - public long Ctime { get; set; } - [JsonProperty("desc")] - public string Desc { get; set; } - [JsonProperty("state")] - public int State { get; set; } - [JsonProperty("duration")] - public long Duration { get; set; } - //[JsonProperty("rights")] - //public VideoRights Rights { get; set; } - [JsonProperty("author")] - public VideoOwner Author { get; set; } - [JsonProperty("stat")] - public VideoStat Stat { get; set; } - [JsonProperty("dynamic")] - public string Dynamic { get; set; } - [JsonProperty("dimension")] - public Dimension Dimension { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Video/Models/UgcEpisode.cs b/src/DownKyi.Core/BiliApi/Video/Models/UgcEpisode.cs deleted file mode 100644 index 0a7a5e9..0000000 --- a/src/DownKyi.Core/BiliApi/Video/Models/UgcEpisode.cs +++ /dev/null @@ -1,29 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Video.Models -{ - public class UgcEpisode : BaseModel - { - [JsonProperty("season_id")] - public long SeasonId { get; set; } - [JsonProperty("section_id")] - public long SectionId { get; set; } - [JsonProperty("id")] - public long Id { get; set; } - [JsonProperty("aid")] - public long Aid { get; set; } - [JsonProperty("cid")] - public long Cid { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - [JsonProperty("attribute")] - public int Attribute { get; set; } - [JsonProperty("arc")] - public UgcArc Arc { get; set; } - [JsonProperty("page")] - public VideoPage Page { get; set; } - [JsonProperty("bvid")] - public string Bvid { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Video/Models/UgcSeason.cs b/src/DownKyi.Core/BiliApi/Video/Models/UgcSeason.cs deleted file mode 100644 index cf92b20..0000000 --- a/src/DownKyi.Core/BiliApi/Video/Models/UgcSeason.cs +++ /dev/null @@ -1,32 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Video.Models -{ - public class UgcSeason : BaseModel - { - [JsonProperty("id")] - public long Id { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - [JsonProperty("cover")] - public string Cover { get; set; } - [JsonProperty("mid")] - public long Mid { get; set; } - [JsonProperty("intro")] - public string Intro { get; set; } - [JsonProperty("sign_state")] - public int SignState { get; set; } - [JsonProperty("attribute")] - public int Attribute { get; set; } - [JsonProperty("sections")] - public List Sections { get; set; } - [JsonProperty("stat")] - public UgcStat Stat { get; set; } - [JsonProperty("ep_count")] - public int EpCount { get; set; } - [JsonProperty("season_type")] - public int SeasonType { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Video/Models/UgcSection.cs b/src/DownKyi.Core/BiliApi/Video/Models/UgcSection.cs deleted file mode 100644 index e3eccd8..0000000 --- a/src/DownKyi.Core/BiliApi/Video/Models/UgcSection.cs +++ /dev/null @@ -1,20 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Video.Models -{ - public class UgcSection : BaseModel - { - [JsonProperty("season_id")] - public long SeasonId { get; set; } - [JsonProperty("id")] - public long Id { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - [JsonProperty("type")] - public int Type { get; set; } - [JsonProperty("episodes")] - public List Episodes { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Video/Models/UgcStat.cs b/src/DownKyi.Core/BiliApi/Video/Models/UgcStat.cs deleted file mode 100644 index 325eb16..0000000 --- a/src/DownKyi.Core/BiliApi/Video/Models/UgcStat.cs +++ /dev/null @@ -1,29 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Video.Models -{ - public class UgcStat : BaseModel - { - [JsonProperty("season_id")] - public long SeasonId { get; set; } - [JsonProperty("view")] - public long View { get; set; } - [JsonProperty("danmaku")] - public long Danmaku { get; set; } - [JsonProperty("reply")] - public long Reply { get; set; } - [JsonProperty("fav")] - public long Favorite { get; set; } - [JsonProperty("coin")] - public long Coin { get; set; } - [JsonProperty("share")] - public long Share { get; set; } - [JsonProperty("now_rank")] - public long NowRank { get; set; } - [JsonProperty("his_rank")] - public long HisRank { get; set; } - [JsonProperty("like")] - public long Like { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Video/Models/VideoDescription.cs b/src/DownKyi.Core/BiliApi/Video/Models/VideoDescription.cs deleted file mode 100644 index c03379c..0000000 --- a/src/DownKyi.Core/BiliApi/Video/Models/VideoDescription.cs +++ /dev/null @@ -1,18 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Video.Models -{ - // https://api.bilibili.com/x/web-interface/archive/desc - public class VideoDescription : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("data")] - public string Data { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Video/Models/VideoPage.cs b/src/DownKyi.Core/BiliApi/Video/Models/VideoPage.cs deleted file mode 100644 index c640552..0000000 --- a/src/DownKyi.Core/BiliApi/Video/Models/VideoPage.cs +++ /dev/null @@ -1,27 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Video.Models -{ - public class VideoPage : BaseModel - { - [JsonProperty("cid")] - public long Cid { get; set; } - [JsonProperty("page")] - public int Page { get; set; } - [JsonProperty("from")] - public string From { get; set; } - [JsonProperty("part")] - public string Part { get; set; } - [JsonProperty("duration")] - public long Duration { get; set; } - [JsonProperty("vid")] - public string Vid { get; set; } - [JsonProperty("weblink")] - public string Weblink { get; set; } - [JsonProperty("dimension")] - public Dimension Dimension { get; set; } - [JsonProperty("first_frame")] - public string FirstFrame { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Video/Models/VideoPagelist.cs b/src/DownKyi.Core/BiliApi/Video/Models/VideoPagelist.cs deleted file mode 100644 index f958b50..0000000 --- a/src/DownKyi.Core/BiliApi/Video/Models/VideoPagelist.cs +++ /dev/null @@ -1,19 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Video.Models -{ - // https://api.bilibili.com/x/player/pagelist - public class VideoPagelist : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("data")] - public List Data { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Video/Models/VideoStat.cs b/src/DownKyi.Core/BiliApi/Video/Models/VideoStat.cs deleted file mode 100644 index d76d56d..0000000 --- a/src/DownKyi.Core/BiliApi/Video/Models/VideoStat.cs +++ /dev/null @@ -1,35 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.Video.Models -{ - public class VideoStat : BaseModel - { - [JsonProperty("aid")] - public long Aid { get; set; } - [JsonProperty("view")] - public long View { get; set; } - [JsonProperty("danmaku")] - public long Danmaku { get; set; } - [JsonProperty("reply")] - public long Reply { get; set; } - [JsonProperty("favorite")] - public long Favorite { get; set; } - [JsonProperty("coin")] - public long Coin { get; set; } - [JsonProperty("share")] - public long Share { get; set; } - [JsonProperty("now_rank")] - public long NowRank { get; set; } - [JsonProperty("his_rank")] - public long HisRank { get; set; } - [JsonProperty("like")] - public long Like { get; set; } - [JsonProperty("dislike")] - public long Dislike { get; set; } - [JsonProperty("evaluation")] - public string Evaluation { get; set; } - [JsonProperty("argue_msg")] - public string ArgueMsg { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Video/Models/VideoSubtitle.cs b/src/DownKyi.Core/BiliApi/Video/Models/VideoSubtitle.cs deleted file mode 100644 index 0d88d8e..0000000 --- a/src/DownKyi.Core/BiliApi/Video/Models/VideoSubtitle.cs +++ /dev/null @@ -1,55 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Video.Models -{ - public class VideoSubtitle : BaseModel - { - [JsonProperty("allow_submit")] - public bool AllowSubmit { get; set; } - [JsonProperty("list")] - public List List { get; set; } - } - - public class Subtitle : BaseModel - { - [JsonProperty("id")] - public long Id { get; set; } - [JsonProperty("lan")] - public string Lan { get; set; } - [JsonProperty("lan_doc")] - public string LanDoc { get; set; } - [JsonProperty("is_lock")] - public bool IsLock { get; set; } - [JsonProperty("author_mid")] - public long AuthorMid { get; set; } - [JsonProperty("subtitle_url")] - public string SubtitleUrl { get; set; } - [JsonProperty("author")] - public SubtitleAuthor Author { get; set; } - } - - public class SubtitleAuthor : BaseModel - { - [JsonProperty("mid")] - public long Mid { get; set; } - [JsonProperty("name")] - public string Name { get; set; } - [JsonProperty("sex")] - public string Sex { get; set; } - [JsonProperty("face")] - public string Face { get; set; } - [JsonProperty("sign")] - public string Sign { get; set; } - //[JsonProperty("rank")] - //public int Rank { get; set; } - //[JsonProperty("birthday")] - //public int Birthday { get; set; } - //[JsonProperty("is_fake_account")] - //public int IsFakeAccount { get; set; } - //[JsonProperty("is_deleted")] - //public int IsDeleted { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/Video/Models/VideoView.cs b/src/DownKyi.Core/BiliApi/Video/Models/VideoView.cs deleted file mode 100644 index 42a24cf..0000000 --- a/src/DownKyi.Core/BiliApi/Video/Models/VideoView.cs +++ /dev/null @@ -1,81 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Video.Models -{ - // https://api.bilibili.com/x/web-interface/view - public class VideoViewOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("data")] - public VideoView Data { get; set; } - } - - public class VideoView : BaseModel - { - [JsonProperty("bvid")] - public string Bvid { get; set; } - [JsonProperty("aid")] - public long Aid { get; set; } - [JsonProperty("videos")] - public int Videos { get; set; } - [JsonProperty("tid")] - public int Tid { get; set; } - [JsonProperty("tname")] - public string Tname { get; set; } - [JsonProperty("copyright")] - public int Copyright { get; set; } - [JsonProperty("pic")] - public string Pic { get; set; } - [JsonProperty("title")] - public string Title { get; set; } - [JsonProperty("pubdate")] - public long Pubdate { get; set; } - [JsonProperty("ctime")] - public long Ctime { get; set; } - [JsonProperty("desc")] - public string Desc { get; set; } - [JsonProperty("state")] - public int State { get; set; } - [JsonProperty("duration")] - public long Duration { get; set; } - [JsonProperty("redirect_url")] - public string RedirectUrl { get; set; } - [JsonProperty("mission_id")] - public long MissionId { get; set; } - //[JsonProperty("rights")] - //public VideoRights Rights { get; set; } - [JsonProperty("owner")] - public VideoOwner Owner { get; set; } - [JsonProperty("stat")] - public VideoStat Stat { get; set; } - [JsonProperty("dynamic")] - public string Dynamic { get; set; } - [JsonProperty("cid")] - public long Cid { get; set; } - [JsonProperty("dimension")] - public Dimension Dimension { get; set; } - [JsonProperty("season_id")] - public long SeasonId { get; set; } - [JsonProperty("festival_jump_url")] - public string FestivalJumpUrl { get; set; } - //[JsonProperty("no_cache")] - //public bool no_cache { get; set; } - [JsonProperty("pages")] - public List Pages { get; set; } - [JsonProperty("subtitle")] - public VideoSubtitle Subtitle { get; set; } - [JsonProperty("ugc_season")] - public UgcSeason UgcSeason { get; set; } - //[JsonProperty("staff")] - //public List staff { get; set; } - //[JsonProperty("user_garb")] - //public user_garb user_garb { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/Video/Ranking.cs b/src/DownKyi.Core/BiliApi/Video/Ranking.cs deleted file mode 100644 index 0f579f4..0000000 --- a/src/DownKyi.Core/BiliApi/Video/Ranking.cs +++ /dev/null @@ -1,40 +0,0 @@ -using DownKyi.Core.BiliApi.Video.Models; -using DownKyi.Core.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Video -{ - public static class Ranking - { - - /// - /// 获取分区视频排行榜列表 - /// - /// 目标分区tid - /// 3日榜或周榜(3/7) - /// - /// - public static List RegionRankingList(int rid, int day = 3, int original = 0) - { - string url = $"https://api.bilibili.com/x/web-interface/ranking/region?rid={rid}&day={day}&ps={original}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - var ranking = JsonConvert.DeserializeObject(response); - if (ranking != null) { return ranking.Data; } - else { return null; } - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("RegionRankingList()发生异常: {0}", e); - LogManager.Error("Ranking", e); - return null; - } - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/Video/VideoInfo.cs b/src/DownKyi.Core/BiliApi/Video/VideoInfo.cs deleted file mode 100644 index 5744ccb..0000000 --- a/src/DownKyi.Core/BiliApi/Video/VideoInfo.cs +++ /dev/null @@ -1,117 +0,0 @@ -using DownKyi.Core.BiliApi.Sign; -using DownKyi.Core.BiliApi.Video.Models; -using DownKyi.Core.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Video -{ - public static class VideoInfo - { - /// - /// 获取视频详细信息(web端) - /// - /// - /// - /// - public static VideoView VideoViewInfo(string bvid = null, long aid = -1) - { - // https://api.bilibili.com/x/web-interface/view/detail?bvid=BV1Sg411F7cb&aid=969147110&need_operation_card=1&web_rm_repeat=1&need_elec=1&out_referer=https%3A%2F%2Fspace.bilibili.com%2F42018135%2Ffavlist%3Ffid%3D94341835 - - var parameters = new Dictionary(); - if (bvid != null) - { - parameters.Add("bvid", bvid); - } - else if (aid > -1) - { - parameters.Add("aid", aid); - } - else - { - return null; - } - string query = WbiSign.ParametersToQuery(WbiSign.EncodeWbi(parameters)); - string url = $"https://api.bilibili.com/x/web-interface/wbi/view?{query}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - var videoView = JsonConvert.DeserializeObject(response); - if (videoView != null) { return videoView.Data; } - else { return null; } - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("VideoInfo()发生异常: {0}", e); - LogManager.Error("VideoInfo", e); - return null; - } - } - - /// - /// 获取视频简介 - /// - /// - /// - /// - public static string VideoDescription(string bvid = null, long aid = -1) - { - string baseUrl = "https://api.bilibili.com/x/web-interface/archive/desc"; - string referer = "https://www.bilibili.com"; - string url; - if (bvid != null) { url = $"{baseUrl}?bvid={bvid}"; } - else if (aid >= -1) { url = $"{baseUrl}?aid={aid}"; } - else { return null; } - - string response = WebClient.RequestWeb(url, referer); - - try - { - var desc = JsonConvert.DeserializeObject(response); - if (desc != null) { return desc.Data; } - else { return null; } - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("VideoDescription()发生异常: {0}", e); - LogManager.Error("VideoInfo", e); - return null; - } - } - - /// - /// 查询视频分P列表 (avid/bvid转cid) - /// - /// - /// - /// - public static List VideoPagelist(string bvid = null, long aid = -1) - { - string baseUrl = "https://api.bilibili.com/x/player/pagelist"; - string referer = "https://www.bilibili.com"; - string url; - if (bvid != null) { url = $"{baseUrl}?bvid={bvid}"; } - else if (aid > -1) { url = $"{baseUrl}?aid={aid}"; } - else { return null; } - - string response = WebClient.RequestWeb(url, referer); - - try - { - var pagelist = JsonConvert.DeserializeObject(response); - if (pagelist != null) { return pagelist.Data; } - else { return null; } - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("VideoPagelist()发生异常: {0}", e); - LogManager.Error("VideoInfo", e); - return null; - } - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrl.cs b/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrl.cs deleted file mode 100644 index 2457223..0000000 --- a/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrl.cs +++ /dev/null @@ -1,46 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.VideoStream.Models -{ - public class PlayUrlOrigin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("data")] - public PlayUrl Data { get; set; } - [JsonProperty("result")] - public PlayUrl Result { get; set; } - } - - public class PlayUrl : BaseModel - { - // from - // result - // message - // quality - // format - // timelength - // accept_format - [JsonProperty("accept_description")] - public List AcceptDescription { get; set; } - [JsonProperty("accept_quality")] - public List AcceptQuality { get; set; } - // video_codecid - // seek_param - // seek_type - [JsonProperty("durl")] - public List Durl { get; set; } - [JsonProperty("dash")] - public PlayUrlDash Dash { get; set; } - [JsonProperty("support_formats")] - public List SupportFormats { get; set; } - // high_format - } - -} diff --git a/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrlDash.cs b/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrlDash.cs deleted file mode 100644 index e81a9ff..0000000 --- a/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrlDash.cs +++ /dev/null @@ -1,24 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.VideoStream.Models -{ - public class PlayUrlDash : BaseModel - { - [JsonProperty("duration")] - public long Duration { get; set; } - //[JsonProperty("minBufferTime")] - //public float minBufferTime { get; set; } - //[JsonProperty("min_buffer_time")] - //public float min_buffer_time { get; set; } - [JsonProperty("video")] - public List Video { get; set; } - [JsonProperty("audio")] - public List Audio { get; set; } - [JsonProperty("dolby")] - public PlayUrlDashDolby Dolby { get; set; } - [JsonProperty("flac")] - public PlayUrlDashFlac Flac { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrlDashDolby.cs b/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrlDashDolby.cs deleted file mode 100644 index 9629c8d..0000000 --- a/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrlDashDolby.cs +++ /dev/null @@ -1,13 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.VideoStream.Models -{ - public class PlayUrlDashDolby : BaseModel - { - // type - [JsonProperty("audio")] - public List Audio { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrlDashFlac.cs b/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrlDashFlac.cs deleted file mode 100644 index 4c54786..0000000 --- a/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrlDashFlac.cs +++ /dev/null @@ -1,12 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.VideoStream.Models -{ - public class PlayUrlDashFlac : BaseModel - { - [JsonProperty("audio")] - public PlayUrlDashVideo Audio { get; set; } - //bool display { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrlDashVideo.cs b/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrlDashVideo.cs deleted file mode 100644 index fab8044..0000000 --- a/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrlDashVideo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.VideoStream.Models -{ - public class PlayUrlDashVideo : BaseModel - { - [JsonProperty("id")] - public int Id { get; set; } - [JsonProperty("base_url")] - public string BaseUrl { get; set; } - [JsonProperty("backup_url")] - public List BackupUrl { get; set; } - // bandwidth - [JsonProperty("mimeType")] - public string MimeType { get; set; } - // mime_type - [JsonProperty("codecs")] - public string Codecs { get; set; } - [JsonProperty("width")] - public int Width { get; set; } - [JsonProperty("height")] - public int Height { get; set; } - [JsonProperty("frameRate")] - public string FrameRate { get; set; } - // frame_rate - // sar - // startWithSap - // start_with_sap - // SegmentBase - // segment_base - [JsonProperty("codecid")] - public int CodecId { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrlDurl.cs b/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrlDurl.cs deleted file mode 100644 index a61f0ec..0000000 --- a/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrlDurl.cs +++ /dev/null @@ -1,22 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.VideoStream.Models -{ - public class PlayUrlDurl : BaseModel - { - [JsonProperty("order")] - public int Order { get; set; } - [JsonProperty("length")] - public long Length { get; set; } - [JsonProperty("size")] - public long Size { get; set; } - // ahead - // vhead - [JsonProperty("url")] - public string Url { get; set; } - [JsonProperty("backup_url")] - public List BackupUrl { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrlSupportFormat.cs b/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrlSupportFormat.cs deleted file mode 100644 index f7187ad..0000000 --- a/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayUrlSupportFormat.cs +++ /dev/null @@ -1,19 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.VideoStream.Models -{ - public class PlayUrlSupportFormat : BaseModel - { - [JsonProperty("quality")] - public int Quality { get; set; } - [JsonProperty("format")] - public string Format { get; set; } - [JsonProperty("new_description")] - public string NewDescription { get; set; } - [JsonProperty("display_desc")] - public string DisplayDesc { get; set; } - [JsonProperty("superscript")] - public string Superscript { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayerV2.cs b/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayerV2.cs deleted file mode 100644 index 9ed962d..0000000 --- a/src/DownKyi.Core/BiliApi/VideoStream/Models/PlayerV2.cs +++ /dev/null @@ -1,34 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.VideoStream.Models -{ - // https://api.bilibili.com/x/player/v2?cid={cid}&aid={avid}&bvid={bvid} - public class PlayerV2Origin : BaseModel - { - //[JsonProperty("code")] - //public int Code { get; set; } - //[JsonProperty("message")] - //public string Message { get; set; } - //[JsonProperty("ttl")] - //public int Ttl { get; set; } - [JsonProperty("data")] - public PlayerV2 Data { get; set; } - } - - public class PlayerV2 : BaseModel - { - [JsonProperty("aid")] - public long Aid { get; set; } - [JsonProperty("bvid")] - public string Bvid { get; set; } - // allow_bp - // no_share - [JsonProperty("cid")] - public long Cid { get; set; } - // ... - [JsonProperty("subtitle")] - public SubtitleInfo Subtitle { get; set; } - } - -} diff --git a/src/DownKyi.Core/BiliApi/VideoStream/Models/Subtitle.cs b/src/DownKyi.Core/BiliApi/VideoStream/Models/Subtitle.cs deleted file mode 100644 index a0861b1..0000000 --- a/src/DownKyi.Core/BiliApi/VideoStream/Models/Subtitle.cs +++ /dev/null @@ -1,25 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; - -namespace DownKyi.Core.BiliApi.VideoStream.Models -{ - public class Subtitle : BaseModel - { - [JsonProperty("id")] - public long Id { get; set; } - [JsonProperty("lan")] - public string Lan { get; set; } - [JsonProperty("lan_doc")] - public string LanDoc { get; set; } - [JsonProperty("is_lock")] - public bool IsLock { get; set; } - [JsonProperty("author_mid")] - public long AuthorMid { get; set; } - [JsonProperty("subtitle_url")] - public string SubtitleUrl { get; set; } - [JsonProperty("type")] - public int Type { get; set; } - [JsonProperty("id_str")] - public string IdStr { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/VideoStream/Models/SubtitleInfo.cs b/src/DownKyi.Core/BiliApi/VideoStream/Models/SubtitleInfo.cs deleted file mode 100644 index 27b3078..0000000 --- a/src/DownKyi.Core/BiliApi/VideoStream/Models/SubtitleInfo.cs +++ /dev/null @@ -1,18 +0,0 @@ -using DownKyi.Core.BiliApi.Models; -using Newtonsoft.Json; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.VideoStream.Models -{ - public class SubtitleInfo : BaseModel - { - [JsonProperty("allow_submit")] - public bool AllowSubmit { get; set; } - [JsonProperty("lan")] - public string Lan { get; set; } - [JsonProperty("lan_doc")] - public string LanDoc { get; set; } - [JsonProperty("subtitles")] - public List Subtitles { get; set; } - } -} diff --git a/src/DownKyi.Core/BiliApi/VideoStream/PlayStreamType.cs b/src/DownKyi.Core/BiliApi/VideoStream/PlayStreamType.cs deleted file mode 100644 index e54edbb..0000000 --- a/src/DownKyi.Core/BiliApi/VideoStream/PlayStreamType.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace DownKyi.Core.BiliApi.VideoStream -{ - public enum PlayStreamType - { - VIDEO = 1, // 普通视频 - BANGUMI, // 番剧、电影、电视剧等 - CHEESE, // 课程 - } -} diff --git a/src/DownKyi.Core/BiliApi/VideoStream/VideoStream.cs b/src/DownKyi.Core/BiliApi/VideoStream/VideoStream.cs deleted file mode 100644 index 1bfb4f3..0000000 --- a/src/DownKyi.Core/BiliApi/VideoStream/VideoStream.cs +++ /dev/null @@ -1,204 +0,0 @@ -using DownKyi.Core.BiliApi.Models.Json; -using DownKyi.Core.BiliApi.Sign; -using DownKyi.Core.BiliApi.VideoStream.Models; -using DownKyi.Core.Logging; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.VideoStream -{ - public static class VideoStream - { - - /// - /// 获取播放器信息(web端) - /// - /// - /// - /// - /// - public static PlayerV2 PlayerV2(long avid, string bvid, long cid) - { - var parameters = new Dictionary - { - { "avid", avid }, - { "bvid", bvid }, - { "cid", cid }, - }; - string query = WbiSign.ParametersToQuery(WbiSign.EncodeWbi(parameters)); - string url = $"https://api.bilibili.com/x/player/wbi/v2?{query}"; - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - var playUrl = JsonConvert.DeserializeObject(response); - return playUrl?.Data; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("PlayerV2()发生异常: {0}", e); - LogManager.Error("PlayerV2()", e); - return null; - } - } - - /// - /// 获取所有字幕
- /// 若视频没有字幕,返回null - ///
- /// - /// - /// - /// - public static List GetSubtitle(long avid, string bvid, long cid) - { - List subRipTexts = new List(); - - // 获取播放器信息 - PlayerV2 player = PlayerV2(avid, bvid, cid); - if (player == null) { return subRipTexts; } - if (player.Subtitle != null && player.Subtitle.Subtitles != null && player.Subtitle.Subtitles.Count == 0) - { - return null; - } - - foreach (var subtitle in player.Subtitle.Subtitles) - { - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb($"https:{subtitle.SubtitleUrl}", referer); - - try - { - var subtitleJson = JsonConvert.DeserializeObject(response); - if (subtitleJson == null) { continue; } - - subRipTexts.Add(new SubRipText - { - Lan = subtitle.Lan, - LanDoc = subtitle.LanDoc, - SrtString = subtitleJson.ToSubRip() - }); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetSubtitle()发生异常: {0}", e); - LogManager.Error("GetSubtitle()", e); - } - } - - return subRipTexts; - } - - /// - /// 获取普通视频的视频流 - /// - /// - /// - /// - /// - /// - public static PlayUrl GetVideoPlayUrl(long avid, string bvid, long cid, int quality = 125) - { - var parameters = new Dictionary - { - { "from_client", "BROWSER" }, - { "fourk", 1 }, - { "fnver", 0 }, - { "fnval", 4048 }, - { "cid", cid }, - { "qn", quality }, - }; - - if (bvid != null) - { - parameters.Add("bvid", bvid); - } - else if (avid > -1) - { - parameters.Add("aid", avid); - } - else - { - return null; - } - - string query = WbiSign.ParametersToQuery(WbiSign.EncodeWbi(parameters)); - string url = $"https://api.bilibili.com/x/player/wbi/playurl?{query}"; - - return GetPlayUrl(url); - } - - /// - /// 获取番剧的视频流 - /// - /// - /// - /// - /// - /// - public static PlayUrl GetBangumiPlayUrl(long avid, string bvid, long cid, int quality = 125) - { - string baseUrl = $"https://api.bilibili.com/pgc/player/web/playurl?cid={cid}&qn={quality}&fourk=1&fnver=0&fnval=4048"; - string url; - if (bvid != null) { url = $"{baseUrl}&bvid={bvid}"; } - else if (avid > -1) { url = $"{baseUrl}&aid={avid}"; } - else { return null; } - - return GetPlayUrl(url); - } - - /// - /// 获取课程的视频流 - /// - /// - /// - /// - /// - /// - public static PlayUrl GetCheesePlayUrl(long avid, string bvid, long cid, long episodeId, int quality = 125) - { - string baseUrl = $"https://api.bilibili.com/pugv/player/web/playurl?cid={cid}&qn={quality}&fourk=1&fnver=0&fnval=4048"; - string url; - if (bvid != null) { url = $"{baseUrl}&bvid={bvid}"; } - else if (avid > -1) { url = $"{baseUrl}&aid={avid}"; } - else { return null; } - - // 必须有episodeId,否则会返回请求错误 - if (episodeId != 0) - { - url += $"&ep_id={episodeId}"; - } - - return GetPlayUrl(url); - } - - /// - /// 获取视频流 - /// - /// - /// - private static PlayUrl GetPlayUrl(string url) - { - string referer = "https://www.bilibili.com"; - string response = WebClient.RequestWeb(url, referer); - - try - { - var playUrl = JsonConvert.DeserializeObject(response); - if (playUrl == null) { return null; } - else if (playUrl.Data != null) { return playUrl.Data; } - else if (playUrl.Result != null) { return playUrl.Result; } - else { return null; } - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetPlayUrl()发生异常: {0}", e); - LogManager.Error("GetPlayUrl()", e); - return null; - } - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/WebClient.cs b/src/DownKyi.Core/BiliApi/WebClient.cs deleted file mode 100644 index d828c5d..0000000 --- a/src/DownKyi.Core/BiliApi/WebClient.cs +++ /dev/null @@ -1,145 +0,0 @@ -using Brotli; -using DownKyi.Core.BiliApi.Login; -using DownKyi.Core.Settings; -using System; -using System.Collections.Generic; -using System.IO; -using System.IO.Compression; -using System.Net; -using System.Text; - -namespace DownKyi.Core.BiliApi -{ - internal static class WebClient - { - - /// - /// 发送get或post请求 - /// - /// - /// - /// - /// - /// - public static string RequestWeb(string url, string referer = null, string method = "GET", Dictionary parameters = null, int retry = 3) - { - // 重试次数 - if (retry <= 0) { return ""; } - - // post请求,发送参数 - if (method == "POST" && parameters != null) - { - StringBuilder builder = new StringBuilder(); - int i = 0; - foreach (var item in parameters) - { - if (i > 0) - { - builder.Append("&"); - } - - builder.AppendFormat("{0}={1}", item.Key, item.Value); - i++; - } - - url += "?" + builder.ToString(); - } - - try - { - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); - request.Method = method; - request.Timeout = 30 * 1000; - - request.UserAgent = SettingsManager.GetInstance().GetUserAgent(); - - //request.ContentType = "application/json,text/html,application/xhtml+xml,application/xml;charset=UTF-8"; - request.Headers["accept-language"] = "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7"; - request.Headers["accept-encoding"] = "gzip, deflate, br"; - - // referer - if (referer != null) - { - request.Referer = referer; - } - - // 构造cookie - if (!url.Contains("getLogin")) - { - request.Headers["origin"] = "https://www.bilibili.com"; - - CookieContainer cookies = LoginHelper.GetLoginInfoCookies(); - if (cookies != null) - { - request.CookieContainer = cookies; - } - } - - string html = string.Empty; - using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) - { - if (response.ContentEncoding.ToLower().Contains("gzip")) - { - using (GZipStream stream = new GZipStream(response.GetResponseStream(), CompressionMode.Decompress)) - { - using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) - { - html = reader.ReadToEnd(); - } - } - } - else if (response.ContentEncoding.ToLower().Contains("deflate")) - { - using (DeflateStream stream = new DeflateStream(response.GetResponseStream(), CompressionMode.Decompress)) - { - using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) - { - html = reader.ReadToEnd(); - } - } - } - else if (response.ContentEncoding.ToLower().Contains("br")) - { - using (BrotliStream stream = new BrotliStream(response.GetResponseStream(), CompressionMode.Decompress)) - { - using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) - { - html = reader.ReadToEnd(); - } - } - } - else - { - using (Stream stream = response.GetResponseStream()) - { - using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) - { - html = reader.ReadToEnd(); - } - } - } - } - - return html; - } - catch (WebException e) - { - Console.WriteLine("RequestWeb()发生Web异常: {0}", e); - Logging.LogManager.Error(e); - return RequestWeb(url, referer, method, parameters, retry - 1); - } - catch (IOException e) - { - Console.WriteLine("RequestWeb()发生IO异常: {0}", e); - Logging.LogManager.Error(e); - return RequestWeb(url, referer, method, parameters, retry - 1); - } - catch (Exception e) - { - Console.WriteLine("RequestWeb()发生其他异常: {0}", e); - Logging.LogManager.Error(e); - return RequestWeb(url, referer, method, parameters, retry - 1); - } - } - } -} diff --git a/src/DownKyi.Core/BiliApi/Zone/VideoZone.cs b/src/DownKyi.Core/BiliApi/Zone/VideoZone.cs deleted file mode 100644 index 8d423e0..0000000 --- a/src/DownKyi.Core/BiliApi/Zone/VideoZone.cs +++ /dev/null @@ -1,211 +0,0 @@ -using System.Collections.Generic; - -namespace DownKyi.Core.BiliApi.Zone -{ - public class VideoZone - { - private static VideoZone that; - private readonly List zones = new List(); - - /// - /// 使用单例模式获取分区,注意未搜索到的分区需要额外处理 - /// - /// - public static VideoZone Instance() - { - if (that == null) - { - that = new VideoZone(); - } - return that; - } - - public List GetZones() - { - return zones; - } - - private VideoZone() - { - // SpacePublicationListType类需要同步更新 - - //动画 - zones.Add(new ZoneAttr(1, "douga", "动画")); // 主分区 - zones.Add(new ZoneAttr(24, "mad", "MAD·AMV", 1)); // 具有一定制作程度的动画或静画的二次创作视频 - zones.Add(new ZoneAttr(25, "mmd", "MMD·3D", 1)); // 使用MMD(MikuMikuDance)和其他3D建模类软件制作的视频 - zones.Add(new ZoneAttr(47, "voice", "短片·手书·配音", 1)); // 追求个人特色和创意表达的自制动画短片、手书(绘)及ACGN相关配音 - zones.Add(new ZoneAttr(210, "garage_kit", "手办·模玩", 1)); // 手办模玩的测评、改造或其他衍生内容 - zones.Add(new ZoneAttr(86, "tokusatsu", "特摄", 1)); // 特摄相关衍生视频 - zones.Add(new ZoneAttr(253, "acgntalks", "动漫杂谈", 1)); // 以谈话形式对ACGN文化圈进行的鉴赏、吐槽、评点、解说、推荐、科普等内容 - zones.Add(new ZoneAttr(27, "other", "综合", 1)); // 以动画及动画相关内容为素材,包括但不仅限于音频替换、恶搞改编、排行榜等内容 - - //番剧 - zones.Add(new ZoneAttr(13, "anime", "番剧")); // 主分区 - zones.Add(new ZoneAttr(33, "serial", "连载动画", 13)); // 当季连载的动画番剧 - zones.Add(new ZoneAttr(32, "finish", "完结动画", 13)); // 已完结的动画番剧合集 - zones.Add(new ZoneAttr(51, "information", "资讯", 13)); // 动画番剧相关资讯视频 - zones.Add(new ZoneAttr(152, "offical", "官方延伸", 13)); // 动画番剧为主题的宣传节目、采访视频,及声优相关视频 - - //国创 - zones.Add(new ZoneAttr(167, "guochuang", "国创")); // 主分区 - zones.Add(new ZoneAttr(153, "chinese", "国产动画", 167)); // 我国出品的PGC动画 - zones.Add(new ZoneAttr(168, "original", "国产原创相关", 167)); // - zones.Add(new ZoneAttr(169, "puppetry", "布袋戏", 167)); // - zones.Add(new ZoneAttr(195, "motioncomic", "动态漫·广播剧", 167)); // - zones.Add(new ZoneAttr(170, "information", "资讯", 167)); // - - //音乐 - zones.Add(new ZoneAttr(3, "music", "音乐")); // 主分区 - zones.Add(new ZoneAttr(28, "original", "原创音乐", 3)); // 原创歌曲及纯音乐,包括改编、重编曲及remix - zones.Add(new ZoneAttr(31, "cover", "翻唱", 3)); // 对曲目的人声再演绎视频 - zones.Add(new ZoneAttr(59, "perform", "演奏", 3)); // 乐器和非传统乐器器材的演奏作品 - zones.Add(new ZoneAttr(30, "vocaloid", "VOCALOID·UTAU", 3)); // 以VOCALOID等歌声合成引擎为基础,运用各类音源进行的创作 - zones.Add(new ZoneAttr(29, "live", "音乐现场", 3)); // 音乐表演的实况视频,包括官方/个人拍摄的综艺节目、音乐剧、音乐节、演唱会等 - zones.Add(new ZoneAttr(193, "mv", "MV", 3)); // 为音乐作品配合拍摄或制作的音乐录影带(Music Video),以及自制拍摄、剪辑、翻拍MV - zones.Add(new ZoneAttr(243, "commentary", "乐评盘点", 3)); // 音乐类新闻、盘点、点评、reaction、榜单、采访、幕后故事、唱片开箱等 - zones.Add(new ZoneAttr(244, "tutorial", "音乐教学", 3)); // 以音乐教学为目的的内容 - zones.Add(new ZoneAttr(130, "other", "音乐综合", 3)); // 所有无法被收纳到其他音乐二级分区的音乐类视频 - - //舞蹈 - zones.Add(new ZoneAttr(129, "dance", "舞蹈")); // 主分区 - zones.Add(new ZoneAttr(20, "otaku", "宅舞", 129)); // 与ACG相关的翻跳、原创舞蹈 - zones.Add(new ZoneAttr(198, "hiphop", "街舞", 129)); // 收录街舞相关内容,包括赛事现场、舞室作品、个人翻跳、FREESTYLE等 - zones.Add(new ZoneAttr(199, "star", "明星舞蹈", 129)); // 国内外明星发布的官方舞蹈及其翻跳内容 - zones.Add(new ZoneAttr(200, "china", "中国舞", 129)); // 传承中国艺术文化的舞蹈内容,包括古典舞、民族民间舞、汉唐舞、古风舞等 - zones.Add(new ZoneAttr(154, "three_d", "舞蹈综合", 129)); // 收录无法定义到其他舞蹈子分区的舞蹈视频 - zones.Add(new ZoneAttr(156, "demo", "舞蹈教程", 129)); // 镜面慢速,动作分解,基础教程等具有教学意义的舞蹈视频 - - //游戏 - zones.Add(new ZoneAttr(4, "game", "游戏")); // 主分区 - zones.Add(new ZoneAttr(17, "stand_alone", "单机游戏", 4)); // 以所有平台(PC、主机、移动端)的单机或联机游戏为主的视频内容,包括游戏预告、CG、实况解说及相关的评测、杂谈与视频剪辑等 - zones.Add(new ZoneAttr(171, "esports", "电子竞技", 4)); // 具有高对抗性的电子竞技游戏项目,其相关的赛事、实况、攻略、解说、短剧等视频。 - zones.Add(new ZoneAttr(172, "mobile", "手机游戏", 4)); // 以手机及平板设备为主要平台的游戏,其相关的实况、攻略、解说、短剧、演示等视频。 - zones.Add(new ZoneAttr(65, "online", "网络游戏", 4)); // 由网络运营商运营的多人在线游戏,以及电子竞技的相关游戏内容。包括赛事、攻略、实况、解说等相关视频 - zones.Add(new ZoneAttr(173, "board", "桌游棋牌", 4)); // 桌游、棋牌、卡牌对战等及其相关电子版游戏的实况、攻略、解说、演示等视频。 - zones.Add(new ZoneAttr(121, "gmv", "GMV", 4)); // 由游戏素材制作的MV视频。以游戏内容或CG为主制作的,具有一定创作程度的MV类型的视频 - zones.Add(new ZoneAttr(136, "music", "音游", 4)); // 各个平台上,通过配合音乐与节奏而进行的音乐类游戏视频 - zones.Add(new ZoneAttr(19, "mugen", "Mugen", 4)); // 以Mugen引擎为平台制作、或与Mugen相关的游戏视频 - - //知识 - zones.Add(new ZoneAttr(36, "knowledge", "知识")); // 主分区 - zones.Add(new ZoneAttr(201, "science", "科学科普", 36)); // 回答你的十万个为什么 - zones.Add(new ZoneAttr(124, "social_science", "社科·法律·心理", 36)); // 基于社会科学、法学、心理学展开或个人观点输出的知识视频 - zones.Add(new ZoneAttr(228, "humanity_history", "人文历史", 36)); // 看看古今人物,聊聊历史过往,品品文学典籍 - zones.Add(new ZoneAttr(207, "business", "财经商业", 36)); // 说金融市场,谈宏观经济,一起畅聊商业故事 - zones.Add(new ZoneAttr(208, "campus", "校园学习", 36)); // 老师很有趣,学生也有才,我们一起搞学习 - zones.Add(new ZoneAttr(209, "career", "职业职场", 36)); // 职业分享、升级指南,一起成为最有料的职场人 - zones.Add(new ZoneAttr(229, "design", "设计·创意", 36)); // 天马行空,创意设计,都在这里 - zones.Add(new ZoneAttr(122, "skill", "野生技能协会", 36)); // 技能党集合,是时候展示真正的技术了 - - //科技 - zones.Add(new ZoneAttr(188, "tech", "科技")); // 主分区 - zones.Add(new ZoneAttr(95, "digital", "数码", 188)); // 科技数码产品大全,一起来做发烧友 - zones.Add(new ZoneAttr(230, "application", "软件应用", 188)); // 超全软件应用指南 - zones.Add(new ZoneAttr(231, "computer_tech", "计算机技术", 188)); // 研究分析、教学演示、经验分享......有关计算机技术的都在这里 - zones.Add(new ZoneAttr(232, "industry", "科工机械", 188)); // 从小芯片到大工程,一起见证科工力量 - zones.Add(new ZoneAttr(233, "diy", "极客DIY", 188)); // 炫酷技能,极客文化,硬核技巧,准备好你的惊讶 - - //运动 - zones.Add(new ZoneAttr(234, "sports", "运动")); // 主分区 - zones.Add(new ZoneAttr(235, "basketball", "篮球", 234)); // 与篮球相关的视频,包括但不限于篮球赛事、教学、评述、剪辑、剧情等相关内容 - zones.Add(new ZoneAttr(249, "football", "足球", 234)); // 与足球相关的视频,包括但不限于足球赛事、教学、评述、剪辑、剧情等相关内容 - zones.Add(new ZoneAttr(164, "aerobics", "健身", 234)); // 与健身相关的视频,包括但不限于瑜伽、CrossFit、健美、力量举、普拉提、街健等相关内容 - zones.Add(new ZoneAttr(236, "athletic", "竞技体育", 234)); // 与竞技体育相关的视频,包括但不限于乒乓、羽毛球、排球、赛车等竞技项目的赛事、评述、剪辑、剧情等相关内容 - zones.Add(new ZoneAttr(237, "culture", "运动文化", 234)); // 与运动文化相关的视频,包络但不限于球鞋、球衣、球星卡等运动衍生品的分享、解读,体育产业的分析、科普等相关内容 - zones.Add(new ZoneAttr(238, "comprehensive", "运动综合", 234)); // 与运动综合相关的视频,包括但不限于钓鱼、骑行、滑板等日常运动分享、教学、Vlog等相关内容 - - //汽车 - zones.Add(new ZoneAttr(223, "car", "汽车")); // 主分区 - zones.Add(new ZoneAttr(245, "racing", "赛车", 223)); // F1等汽车运动相关 - zones.Add(new ZoneAttr(246, "modifiedvehicle", "改装玩车", 223)); // 汽车文化及改装车相关内容,包括改装车、老车修复介绍、汽车聚会分享等内容 - zones.Add(new ZoneAttr(247, "newenergyvehicle", "新能源车", 223)); // 新能源汽车相关内容,包括电动汽车、混合动力汽车等车型种类,包含不限于新车资讯、试驾体验、专业评测、技术解读、知识科普等内容 - zones.Add(new ZoneAttr(248, "touringcar", "房车", 223)); // 房车及营地相关内容,包括不限于产品介绍、驾驶体验、房车生活和房车旅行等内容 - zones.Add(new ZoneAttr(240, "motorcycle", "摩托车", 223)); // 骑士们集合啦 - zones.Add(new ZoneAttr(227, "strategy", "购车攻略", 223)); // 丰富详实的购车建议和新车体验 - zones.Add(new ZoneAttr(176, "life", "汽车生活", 223)); // 分享汽车及出行相关的生活体验类视频 - - //生活 - zones.Add(new ZoneAttr(160, "life", "生活")); // 主分区 - zones.Add(new ZoneAttr(138, "funny", "搞笑", 160)); // 各种沙雕有趣的搞笑剪辑,挑战,表演,配音等视频 - zones.Add(new ZoneAttr(250, "travel", "Energy", 160)); // 为达到观光游览、休闲娱乐为目的的远途旅行、中近途户外生活、本地探店 - zones.Add(new ZoneAttr(251, "rurallife", "三农", 160)); // 分享美好农村生活 - zones.Add(new ZoneAttr(239, "home", "家居房产", 160)); // 与买房、装修、居家生活相关的分享 - zones.Add(new ZoneAttr(161, "handmake", "手工", 160)); // 手工制品的制作过程或成品展示、教程、测评类视频 - zones.Add(new ZoneAttr(162, "painting", "绘画", 160)); // 绘画过程或绘画教程,以及绘画相关的所有视频 - zones.Add(new ZoneAttr(21, "daily", "日常", 160)); // 记录日常生活,分享生活故事 - - //美食 - zones.Add(new ZoneAttr(211, "food", "美食")); // 主分区 - zones.Add(new ZoneAttr(76, "make", "美食制作", 211)); // 学做人间美味,展示精湛厨艺 - zones.Add(new ZoneAttr(212, "detective", "美食侦探", 211)); // 寻找美味餐厅,发现街头美食 - zones.Add(new ZoneAttr(213, "measurement", "美食测评", 211)); // 吃货世界,品尝世间美味 - zones.Add(new ZoneAttr(214, "rural", "田园美食", 211)); // 品味乡野美食,寻找山与海的味道 - zones.Add(new ZoneAttr(215, "record", "美食记录", 211)); // 记录一日三餐,给生活添一点幸福感 - - //动物圈 - zones.Add(new ZoneAttr(217, "animal", "动物圈")); // 主分区 - zones.Add(new ZoneAttr(218, "cat", "喵星人", 217)); // 喵喵喵喵喵 - zones.Add(new ZoneAttr(219, "dog", "汪星人", 217)); // 汪汪汪汪汪 - zones.Add(new ZoneAttr(220, "panda", "大熊猫", 217)); // 芝麻汤圆营业中 - zones.Add(new ZoneAttr(221, "wild_animal", "野生动物", 217)); // 内有“猛兽”出没 - zones.Add(new ZoneAttr(222, "reptiles", "爬宠", 217)); // 鳞甲有灵 - zones.Add(new ZoneAttr(75, "animal_composite", "动物综合", 217)); // 收录除上述子分区外,其余动物相关视频以及非动物主体或多个动物主体的动物相关延伸内容 - - //鬼畜 - zones.Add(new ZoneAttr(119, "kichiku", "鬼畜")); // 主分区 - zones.Add(new ZoneAttr(22, "guide", "鬼畜调教", 119)); // 使用素材在音频、画面上做一定处理,达到与BGM一定的同步感 - zones.Add(new ZoneAttr(26, "mad", "音MAD", 119)); // 使用素材音频进行一定的二次创作来达到还原原曲的非商业性质稿件 - zones.Add(new ZoneAttr(126, "manual_vocaloid", "人力VOCALOID", 119)); // 将人物或者角色的无伴奏素材进行人工调音,使其就像VOCALOID一样歌唱的技术 - zones.Add(new ZoneAttr(216, "theatre", "鬼畜剧场", 119)); // 使用素材进行人工剪辑编排的有剧情的作品 - zones.Add(new ZoneAttr(127, "course", "教程演示", 119)); // 鬼畜相关的教程演示 - - //时尚 - zones.Add(new ZoneAttr(155, "fashion", "时尚")); // 主分区 - zones.Add(new ZoneAttr(157, "makeup", "美妆护肤", 155)); // 彩妆护肤、美甲美发、仿妆、医美相关内容分享或产品测评 - zones.Add(new ZoneAttr(252, "cos", "仿妆cos", 155)); // 对二次元、三次元人物角色进行模仿、还原、展示、演绎的内容 - zones.Add(new ZoneAttr(158, "clothing", "穿搭", 155)); // 穿搭风格、穿搭技巧的展示分享,涵盖衣服、鞋靴、箱包配件、配饰(帽子、钟表、珠宝首饰)等 - zones.Add(new ZoneAttr(159, "trend", "时尚潮流", 155)); // 时尚街拍、时装周、时尚大片,时尚品牌、潮流等行业相关记录及知识科普 - - //资讯 - zones.Add(new ZoneAttr(202, "information", "资讯")); // 主分区 - zones.Add(new ZoneAttr(203, "hotspot", "热点", 202)); // 全民关注的时政热门资讯 - zones.Add(new ZoneAttr(204, "global", "环球", 202)); // 全球范围内发生的具有重大影响力的事件动态 - zones.Add(new ZoneAttr(205, "social", "社会", 202)); // 日常生活的社会事件、社会问题、社会风貌的报道 - zones.Add(new ZoneAttr(206, "multiple", "综合", 202)); // 除上述领域外其它垂直领域的综合资讯 - - //娱乐 - zones.Add(new ZoneAttr(5, "ent", "娱乐")); // 主分区 - zones.Add(new ZoneAttr(71, "variety", "综艺", 5)); // 所有综艺相关,全部一手掌握! - zones.Add(new ZoneAttr(241, "talker", "娱乐杂谈", 5)); // 娱乐人物解读、娱乐热点点评、娱乐行业分析 - zones.Add(new ZoneAttr(242, "fans", "粉丝创作", 5)); // 粉丝向创作视频 - zones.Add(new ZoneAttr(137, "celebrity", "明星综合", 5)); // 娱乐圈动态、明星资讯相关 - - //影视 - zones.Add(new ZoneAttr(181, "cinephile", "影视")); // 主分区 - zones.Add(new ZoneAttr(182, "cinecism", "影视杂谈", 181)); // 影视评论、解说、吐槽、科普等 - zones.Add(new ZoneAttr(183, "montage", "影视剪辑", 181)); // 对影视素材进行剪辑再创作的视频 - zones.Add(new ZoneAttr(85, "shortfilm", "小剧场", 181)); // 有场景、有剧情的演绎类内容 - zones.Add(new ZoneAttr(184, "trailer_info", "预告·资讯", 181)); // 影视类相关资讯,预告,花絮等视频 - - //纪录片 - zones.Add(new ZoneAttr(177, "documentary", "纪录片")); // 主分区 - zones.Add(new ZoneAttr(37, "history", "人文·历史", 177)); // - zones.Add(new ZoneAttr(178, "science", "科学·探索·自然", 177)); // - zones.Add(new ZoneAttr(179, "military", "军事", 177)); // - zones.Add(new ZoneAttr(180, "travel", "社会·美食·旅行", 177)); // - - //电影 - zones.Add(new ZoneAttr(23, "movie", "电影")); // 主分区 - zones.Add(new ZoneAttr(147, "chinese", "华语电影", 23)); // - zones.Add(new ZoneAttr(145, "west", "欧美电影", 23)); // - zones.Add(new ZoneAttr(146, "japan", "日本电影", 23)); // - zones.Add(new ZoneAttr(83, "movie", "其他国家", 23)); // - - //电视剧 - zones.Add(new ZoneAttr(11, "tv", "电视剧")); // 主分区 - zones.Add(new ZoneAttr(185, "mainland", "国产剧", 11)); // - zones.Add(new ZoneAttr(187, "overseas", "海外剧", 11)); // - - } - } -} diff --git a/src/DownKyi.Core/BiliApi/Zone/VideoZoneIcon.cs b/src/DownKyi.Core/BiliApi/Zone/VideoZoneIcon.cs deleted file mode 100644 index d55ab22..0000000 --- a/src/DownKyi.Core/BiliApi/Zone/VideoZoneIcon.cs +++ /dev/null @@ -1,88 +0,0 @@ -namespace DownKyi.Core.BiliApi.Zone -{ - /// - /// 视频分区图标 - /// - public class VideoZoneIcon - { - private static VideoZoneIcon instance; - - /// - /// 获取VideoZoneIcon实例 - /// - /// - public static VideoZoneIcon Instance() - { - if (instance == null) - { - instance = new VideoZoneIcon(); - } - return instance; - } - - /// - /// 隐藏VideoZoneIcon()方法,必须使用单例模式 - /// - private VideoZoneIcon() { } - - /// - /// 根据tid,获取视频分区图标 - /// - /// - /// - public string GetZoneImageKey(int tid) - { - switch (tid) - { - // 课堂 - case -10: - return "Zone.cheeseDrawingImage"; - case 1: - return "Zone.dougaDrawingImage"; - case 13: - return "Zone.animeDrawingImage"; - case 167: - return "Zone.guochuangDrawingImage"; - case 3: - return "Zone.musicDrawingImage"; - case 129: - return "Zone.danceDrawingImage"; - case 4: - return "Zone.gameDrawingImage"; - case 36: - return "Zone.techDrawingImage"; - case 188: - return "Zone.digitalDrawingImage"; - case 234: - return "Zone.sportsDrawingImage"; - case 223: - return "Zone.carDrawingImage"; - case 160: - return "Zone.lifeDrawingImage"; - case 211: - return "Zone.foodDrawingImage"; - case 217: - return "Zone.animalDrawingImage"; - case 119: - return "Zone.kichikuDrawingImage"; - case 155: - return "Zone.fashionDrawingImage"; - case 202: - return "Zone.informationDrawingImage"; - case 5: - return "Zone.entDrawingImage"; - case 181: - return "Zone.cinephileDrawingImage"; - case 177: - return "Zone.documentaryDrawingImage"; - case 23: - return "Zone.movieDrawingImage"; - case 11: - return "Zone.teleplayDrawingImage"; - default: - return "videoUpDrawingImage"; - } - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/Zone/ZoneAttr.cs b/src/DownKyi.Core/BiliApi/Zone/ZoneAttr.cs deleted file mode 100644 index ff3876a..0000000 --- a/src/DownKyi.Core/BiliApi/Zone/ZoneAttr.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace DownKyi.Core.BiliApi.Zone -{ - public class ZoneAttr - { - public int Id { get; } - public string Type { get; } - public string Name { get; } - public int ParentId { get; } - - public ZoneAttr(int id, string type, string name, int parentId = 0) - { - Id = id; - Type = type; - Name = name; - ParentId = parentId; - } - - } -} diff --git a/src/DownKyi.Core/BiliApi/Zone/ZoneImages.xaml b/src/DownKyi.Core/BiliApi/Zone/ZoneImages.xaml deleted file mode 100644 index 28a925d..0000000 --- a/src/DownKyi.Core/BiliApi/Zone/ZoneImages.xaml +++ /dev/null @@ -1,308 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/DownKyi.Core/BiliApi/protobuf/bilibili/community/service/dm/v1/Dm.cs b/src/DownKyi.Core/BiliApi/protobuf/bilibili/community/service/dm/v1/Dm.cs deleted file mode 100644 index a423dbb..0000000 --- a/src/DownKyi.Core/BiliApi/protobuf/bilibili/community/service/dm/v1/Dm.cs +++ /dev/null @@ -1,14819 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: bilibili/community/service/dm/v1/dm.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Bilibili.Community.Service.Dm.V1 { - - /// Holder for reflection information generated from bilibili/community/service/dm/v1/dm.proto - public static partial class DmReflection { - - #region Descriptor - /// File descriptor for bilibili/community/service/dm/v1/dm.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static DmReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "CiliaWxpYmlsaS9jb21tdW5pdHkvc2VydmljZS9kbS92MS9kbS5wcm90bxIg", - "YmlsaWJpbGkuY29tbXVuaXR5LnNlcnZpY2UuZG0udjEiTAoLRG1TZWdTREtS", - "ZXESCwoDcGlkGAEgASgDEgsKA29pZBgCIAEoAxIMCgR0eXBlGAMgASgFEhUK", - "DXNlZ21lbnRfaW5kZXgYBCABKAMiXQoNRG1TZWdTREtSZXBseRIOCgZjbG9z", - "ZWQYASABKAgSPAoFZWxlbXMYAiADKAsyLS5iaWxpYmlsaS5jb21tdW5pdHku", - "c2VydmljZS5kbS52MS5EYW5tYWt1RWxlbSJMCgtEbVNlZ090dFJlcRILCgNw", - "aWQYASABKAMSCwoDb2lkGAIgASgDEgwKBHR5cGUYAyABKAUSFQoNc2VnbWVu", - "dF9pbmRleBgEIAEoAyJdCg1EbVNlZ090dFJlcGx5Eg4KBmNsb3NlZBgBIAEo", - "CBI8CgVlbGVtcxgCIAMoCzItLmJpbGliaWxpLmNvbW11bml0eS5zZXJ2aWNl", - "LmRtLnYxLkRhbm1ha3VFbGVtImcKDkRtU2VnTW9iaWxlUmVxEgsKA3BpZBgB", - "IAEoAxILCgNvaWQYAiABKAMSDAoEdHlwZRgDIAEoBRIVCg1zZWdtZW50X2lu", - "ZGV4GAQgASgDEhYKDnRlZW5hZ2Vyc19tb2RlGAUgASgFIqEBChBEbVNlZ01v", - "YmlsZVJlcGx5EjwKBWVsZW1zGAEgAygLMi0uYmlsaWJpbGkuY29tbXVuaXR5", - "LnNlcnZpY2UuZG0udjEuRGFubWFrdUVsZW0SDQoFc3RhdGUYAiABKAUSQAoH", - "YWlfZmxhZxgDIAEoCzIvLmJpbGliaWxpLmNvbW11bml0eS5zZXJ2aWNlLmRt", - "LnYxLkRhbm1ha3VBSUZsYWciWAoJRG1WaWV3UmVxEgsKA3BpZBgBIAEoAxIL", - "CgNvaWQYAiABKAMSDAoEdHlwZRgDIAEoBRINCgVzcG1pZBgEIAEoCRIUCgxp", - "c19oYXJkX2Jvb3QYBSABKAUi8AMKC0RtVmlld1JlcGx5Eg4KBmNsb3NlZBgB", - "IAEoCBI5CgRtYXNrGAIgASgLMisuYmlsaWJpbGkuY29tbXVuaXR5LnNlcnZp", - "Y2UuZG0udjEuVmlkZW9NYXNrEkEKCHN1YnRpdGxlGAMgASgLMi8uYmlsaWJp", - "bGkuY29tbXVuaXR5LnNlcnZpY2UuZG0udjEuVmlkZW9TdWJ0aXRsZRITCgtz", - "cGVjaWFsX2RtcxgEIAMoCRJECgdhaV9mbGFnGAUgASgLMjMuYmlsaWJpbGku", - "Y29tbXVuaXR5LnNlcnZpY2UuZG0udjEuRGFubWFrdUZsYWdDb25maWcSTgoN", - "cGxheWVyX2NvbmZpZxgGIAEoCzI3LmJpbGliaWxpLmNvbW11bml0eS5zZXJ2", - "aWNlLmRtLnYxLkRhbm11UGxheWVyVmlld0NvbmZpZxIWCg5zZW5kX2JveF9z", - "dHlsZRgHIAEoBRINCgVhbGxvdxgIIAEoCBIRCgljaGVja19ib3gYCSABKAkS", - "GgoSY2hlY2tfYm94X3Nob3dfbXNnGAogASgJEhgKEHRleHRfcGxhY2Vob2xk", - "ZXIYCyABKAkSGQoRaW5wdXRfcGxhY2Vob2xkZXIYDCABKAkSHQoVcmVwb3J0", - "X2ZpbHRlcl9jb250ZW50GA0gAygJIqgDCg5EbVdlYlZpZXdSZXBseRINCgVz", - "dGF0ZRgBIAEoBRIMCgR0ZXh0GAIgASgJEhEKCXRleHRfc2lkZRgDIAEoCRI9", - "CgZkbV9zZ2UYBCABKAsyLS5iaWxpYmlsaS5jb21tdW5pdHkuc2VydmljZS5k", - "bS52MS5EbVNlZ0NvbmZpZxJBCgRmbGFnGAUgASgLMjMuYmlsaWJpbGkuY29t", - "bXVuaXR5LnNlcnZpY2UuZG0udjEuRGFubWFrdUZsYWdDb25maWcSEwoLc3Bl", - "Y2lhbF9kbXMYBiADKAkSEQoJY2hlY2tfYm94GAcgASgIEg0KBWNvdW50GAgg", - "ASgDEj8KCmNvbW1hbmREbXMYCSADKAsyKy5iaWxpYmlsaS5jb21tdW5pdHku", - "c2VydmljZS5kbS52MS5Db21tYW5kRG0STQoNcGxheWVyX2NvbmZpZxgKIAEo", - "CzI2LmJpbGliaWxpLmNvbW11bml0eS5zZXJ2aWNlLmRtLnYxLkRhbm11V2Vi", - "UGxheWVyQ29uZmlnEh0KFXJlcG9ydF9maWx0ZXJfY29udGVudBgLIAMoCSKh", - "AQoJQ29tbWFuZERtEgoKAmlkGAEgASgDEgsKA29pZBgCIAEoAxILCgNtaWQY", - "AyABKAkSDwoHY29tbWFuZBgEIAEoCRIPCgdjb250ZW50GAUgASgJEhAKCHBy", - "b2dyZXNzGAYgASgFEg0KBWN0aW1lGAcgASgJEg0KBW10aW1lGAggASgJEg0K", - "BWV4dHJhGAkgASgJEg0KBWlkU3RyGAogASgJIi8KC0RtU2VnQ29uZmlnEhEK", - "CXBhZ2Vfc2l6ZRgBIAEoAxINCgV0b3RhbBgCIAEoAyJTCglWaWRlb01hc2sS", - "CwoDY2lkGAEgASgDEgwKBHBsYXQYAiABKAUSCwoDZnBzGAMgASgFEgwKBHRp", - "bWUYBCABKAMSEAoIbWFza191cmwYBSABKAkibwoNVmlkZW9TdWJ0aXRsZRIL", - "CgNsYW4YASABKAkSDgoGbGFuRG9jGAIgASgJEkEKCXN1YnRpdGxlcxgDIAMo", - "CzIuLmJpbGliaWxpLmNvbW11bml0eS5zZXJ2aWNlLmRtLnYxLlN1YnRpdGxl", - "SXRlbSKPAwoURGFubXVXZWJQbGF5ZXJDb25maWcSEQoJZG1fc3dpdGNoGAEg", - "ASgIEhEKCWFpX3N3aXRjaBgCIAEoCBIQCghhaV9sZXZlbBgDIAEoBRIQCghi", - "bG9ja3RvcBgEIAEoCBITCgtibG9ja3Njcm9sbBgFIAEoCBITCgtibG9ja2Jv", - "dHRvbRgGIAEoCBISCgpibG9ja2NvbG9yGAcgASgIEhQKDGJsb2Nrc3BlY2lh", - "bBgIIAEoCBIUCgxwcmV2ZW50c2hhZGUYCSABKAgSDQoFZG1hc2sYCiABKAgS", - "DwoHb3BhY2l0eRgLIAEoAhIOCgZkbWFyZWEYDCABKAUSEQoJc3BlZWRwbHVz", - "GA0gASgCEhAKCGZvbnRzaXplGA4gASgCEhIKCnNjcmVlbnN5bmMYDyABKAgS", - "EQoJc3BlZWRzeW5jGBAgASgIEhIKCmZvbnRmYW1pbHkYESABKAkSDAoEYm9s", - "ZBgSIAEoCBISCgpmb250Ym9yZGVyGBMgASgFEhEKCWRyYXdfdHlwZRgUIAEo", - "CSKaAQoMU3VidGl0bGVJdGVtEgoKAmlkGAEgASgDEg4KBmlkX3N0chgCIAEo", - "CRILCgNsYW4YAyABKAkSDwoHbGFuX2RvYxgEIAEoCRIUCgxzdWJ0aXRsZV91", - "cmwYBSABKAkSOgoGYXV0aG9yGAYgASgLMiouYmlsaWJpbGkuY29tbXVuaXR5", - "LnNlcnZpY2UuZG0udjEuVXNlckluZm8iXAoIVXNlckluZm8SCwoDbWlkGAEg", - "ASgDEgwKBG5hbWUYAiABKAkSCwoDc2V4GAMgASgJEgwKBGZhY2UYBCABKAkS", - "DAoEc2lnbhgFIAEoCRIMCgRyYW5rGAYgASgFItYBCgtEYW5tYWt1RWxlbRIK", - "CgJpZBgBIAEoAxIQCghwcm9ncmVzcxgCIAEoBRIMCgRtb2RlGAMgASgFEhAK", - "CGZvbnRzaXplGAQgASgFEg0KBWNvbG9yGAUgASgNEg8KB21pZEhhc2gYBiAB", - "KAkSDwoHY29udGVudBgHIAEoCRINCgVjdGltZRgIIAEoAxIOCgZ3ZWlnaHQY", - "CSABKAUSDgoGYWN0aW9uGAogASgJEgwKBHBvb2wYCyABKAUSDQoFaWRTdHIY", - "DCABKAkSDAoEYXR0chgNIAEoBSKgCwoRRG1QbGF5ZXJDb25maWdSZXESCgoC", - "dHMYASABKAMSRQoGc3dpdGNoGAIgASgLMjUuYmlsaWJpbGkuY29tbXVuaXR5", - "LnNlcnZpY2UuZG0udjEuUGxheWVyRGFubWFrdVN3aXRjaBJOCgtzd2l0Y2hf", - "c2F2ZRgDIAEoCzI5LmJpbGliaWxpLmNvbW11bml0eS5zZXJ2aWNlLmRtLnYx", - "LlBsYXllckRhbm1ha3VTd2l0Y2hTYXZlElsKEnVzZV9kZWZhdWx0X2NvbmZp", - "ZxgEIAEoCzI/LmJpbGliaWxpLmNvbW11bml0eS5zZXJ2aWNlLmRtLnYxLlBs", - "YXllckRhbm1ha3VVc2VEZWZhdWx0Q29uZmlnEmEKFWFpX3JlY29tbWVuZGVk", - "X3N3aXRjaBgFIAEoCzJCLmJpbGliaWxpLmNvbW11bml0eS5zZXJ2aWNlLmRt", - "LnYxLlBsYXllckRhbm1ha3VBaVJlY29tbWVuZGVkU3dpdGNoEl8KFGFpX3Jl", - "Y29tbWVuZGVkX2xldmVsGAYgASgLMkEuYmlsaWJpbGkuY29tbXVuaXR5LnNl", - "cnZpY2UuZG0udjEuUGxheWVyRGFubWFrdUFpUmVjb21tZW5kZWRMZXZlbBJJ", - "CghibG9ja3RvcBgHIAEoCzI3LmJpbGliaWxpLmNvbW11bml0eS5zZXJ2aWNl", - "LmRtLnYxLlBsYXllckRhbm1ha3VCbG9ja3RvcBJPCgtibG9ja3Njcm9sbBgI", - "IAEoCzI6LmJpbGliaWxpLmNvbW11bml0eS5zZXJ2aWNlLmRtLnYxLlBsYXll", - "ckRhbm1ha3VCbG9ja3Njcm9sbBJPCgtibG9ja2JvdHRvbRgJIAEoCzI6LmJp", - "bGliaWxpLmNvbW11bml0eS5zZXJ2aWNlLmRtLnYxLlBsYXllckRhbm1ha3VC", - "bG9ja2JvdHRvbRJTCg1ibG9ja2NvbG9yZnVsGAogASgLMjwuYmlsaWJpbGku", - "Y29tbXVuaXR5LnNlcnZpY2UuZG0udjEuUGxheWVyRGFubWFrdUJsb2NrY29s", - "b3JmdWwSTwoLYmxvY2tyZXBlYXQYCyABKAsyOi5iaWxpYmlsaS5jb21tdW5p", - "dHkuc2VydmljZS5kbS52MS5QbGF5ZXJEYW5tYWt1QmxvY2tyZXBlYXQSUQoM", - "YmxvY2tzcGVjaWFsGAwgASgLMjsuYmlsaWJpbGkuY29tbXVuaXR5LnNlcnZp", - "Y2UuZG0udjEuUGxheWVyRGFubWFrdUJsb2Nrc3BlY2lhbBJHCgdvcGFjaXR5", - "GA0gASgLMjYuYmlsaWJpbGkuY29tbXVuaXR5LnNlcnZpY2UuZG0udjEuUGxh", - "eWVyRGFubWFrdU9wYWNpdHkSUwoNc2NhbGluZ2ZhY3RvchgOIAEoCzI8LmJp", - "bGliaWxpLmNvbW11bml0eS5zZXJ2aWNlLmRtLnYxLlBsYXllckRhbm1ha3VT", - "Y2FsaW5nZmFjdG9yEkUKBmRvbWFpbhgPIAEoCzI1LmJpbGliaWxpLmNvbW11", - "bml0eS5zZXJ2aWNlLmRtLnYxLlBsYXllckRhbm1ha3VEb21haW4SQwoFc3Bl", - "ZWQYECABKAsyNC5iaWxpYmlsaS5jb21tdW5pdHkuc2VydmljZS5kbS52MS5Q", - "bGF5ZXJEYW5tYWt1U3BlZWQSVwoPZW5hYmxlYmxvY2tsaXN0GBEgASgLMj4u", - "YmlsaWJpbGkuY29tbXVuaXR5LnNlcnZpY2UuZG0udjEuUGxheWVyRGFubWFr", - "dUVuYWJsZWJsb2NrbGlzdBJeChlpbmxpbmVQbGF5ZXJEYW5tYWt1U3dpdGNo", - "GBIgASgLMjsuYmlsaWJpbGkuY29tbXVuaXR5LnNlcnZpY2UuZG0udjEuSW5s", - "aW5lUGxheWVyRGFubWFrdVN3aXRjaCIpCghSZXNwb25zZRIMCgRjb2RlGAEg", - "ASgFEg8KB21lc3NhZ2UYAiABKAkiKQoLRGFubWFrdUZsYWcSDAoEZG1pZBgB", - "IAEoAxIMCgRmbGFnGAIgASgNIksKEURhbm1ha3VGbGFnQ29uZmlnEhAKCHJl", - "Y19mbGFnGAEgASgFEhAKCHJlY190ZXh0GAIgASgJEhIKCnJlY19zd2l0Y2gY", - "AyABKAUiUAoNRGFubWFrdUFJRmxhZxI/CghkbV9mbGFncxgBIAMoCzItLmJp", - "bGliaWxpLmNvbW11bml0eS5zZXJ2aWNlLmRtLnYxLkRhbm1ha3VGbGFnIrEC", - "ChVEYW5tdVBsYXllclZpZXdDb25maWcSYQodZGFubXVrdV9kZWZhdWx0X3Bs", - "YXllcl9jb25maWcYASABKAsyOi5iaWxpYmlsaS5jb21tdW5pdHkuc2Vydmlj", - "ZS5kbS52MS5EYW5tdURlZmF1bHRQbGF5ZXJDb25maWcSUgoVZGFubXVrdV9w", - "bGF5ZXJfY29uZmlnGAIgASgLMjMuYmlsaWJpbGkuY29tbXVuaXR5LnNlcnZp", - "Y2UuZG0udjEuRGFubXVQbGF5ZXJDb25maWcSYQodZGFubXVrdV9wbGF5ZXJf", - "ZHluYW1pY19jb25maWcYAyADKAsyOi5iaWxpYmlsaS5jb21tdW5pdHkuc2Vy", - "dmljZS5kbS52MS5EYW5tdVBsYXllckR5bmFtaWNDb25maWcioQQKGERhbm11", - "RGVmYXVsdFBsYXllckNvbmZpZxIpCiFwbGF5ZXJfZGFubWFrdV91c2VfZGVm", - "YXVsdF9jb25maWcYASABKAgSLAokcGxheWVyX2Rhbm1ha3VfYWlfcmVjb21t", - "ZW5kZWRfc3dpdGNoGAQgASgIEisKI3BsYXllcl9kYW5tYWt1X2FpX3JlY29t", - "bWVuZGVkX2xldmVsGAUgASgFEh8KF3BsYXllcl9kYW5tYWt1X2Jsb2NrdG9w", - "GAYgASgIEiIKGnBsYXllcl9kYW5tYWt1X2Jsb2Nrc2Nyb2xsGAcgASgIEiIK", - "GnBsYXllcl9kYW5tYWt1X2Jsb2NrYm90dG9tGAggASgIEiQKHHBsYXllcl9k", - "YW5tYWt1X2Jsb2NrY29sb3JmdWwYCSABKAgSIgoacGxheWVyX2Rhbm1ha3Vf", - "YmxvY2tyZXBlYXQYCiABKAgSIwobcGxheWVyX2Rhbm1ha3VfYmxvY2tzcGVj", - "aWFsGAsgASgIEh4KFnBsYXllcl9kYW5tYWt1X29wYWNpdHkYDCABKAISJAoc", - "cGxheWVyX2Rhbm1ha3Vfc2NhbGluZ2ZhY3RvchgNIAEoAhIdChVwbGF5ZXJf", - "ZGFubWFrdV9kb21haW4YDiABKAISHAoUcGxheWVyX2Rhbm1ha3Vfc3BlZWQY", - "DyABKAUSJAocaW5saW5lX3BsYXllcl9kYW5tYWt1X3N3aXRjaBgQIAEoCCKr", - "BQoRRGFubXVQbGF5ZXJDb25maWcSHQoVcGxheWVyX2Rhbm1ha3Vfc3dpdGNo", - "GAEgASgIEiIKGnBsYXllcl9kYW5tYWt1X3N3aXRjaF9zYXZlGAIgASgIEikK", - "IXBsYXllcl9kYW5tYWt1X3VzZV9kZWZhdWx0X2NvbmZpZxgDIAEoCBIsCiRw", - "bGF5ZXJfZGFubWFrdV9haV9yZWNvbW1lbmRlZF9zd2l0Y2gYBCABKAgSKwoj", - "cGxheWVyX2Rhbm1ha3VfYWlfcmVjb21tZW5kZWRfbGV2ZWwYBSABKAUSHwoX", - "cGxheWVyX2Rhbm1ha3VfYmxvY2t0b3AYBiABKAgSIgoacGxheWVyX2Rhbm1h", - "a3VfYmxvY2tzY3JvbGwYByABKAgSIgoacGxheWVyX2Rhbm1ha3VfYmxvY2ti", - "b3R0b20YCCABKAgSJAoccGxheWVyX2Rhbm1ha3VfYmxvY2tjb2xvcmZ1bBgJ", - "IAEoCBIiChpwbGF5ZXJfZGFubWFrdV9ibG9ja3JlcGVhdBgKIAEoCBIjChtw", - "bGF5ZXJfZGFubWFrdV9ibG9ja3NwZWNpYWwYCyABKAgSHgoWcGxheWVyX2Rh", - "bm1ha3Vfb3BhY2l0eRgMIAEoAhIkChxwbGF5ZXJfZGFubWFrdV9zY2FsaW5n", - "ZmFjdG9yGA0gASgCEh0KFXBsYXllcl9kYW5tYWt1X2RvbWFpbhgOIAEoAhIc", - "ChRwbGF5ZXJfZGFubWFrdV9zcGVlZBgPIAEoBRImCh5wbGF5ZXJfZGFubWFr", - "dV9lbmFibGVibG9ja2xpc3QYECABKAgSJAocaW5saW5lX3BsYXllcl9kYW5t", - "YWt1X3N3aXRjaBgRIAEoCBIkChxpbmxpbmVfcGxheWVyX2Rhbm1ha3VfY29u", - "ZmlnGBIgASgFIksKGERhbm11UGxheWVyRHluYW1pY0NvbmZpZxIQCghwcm9n", - "cmVzcxgBIAEoBRIdChVwbGF5ZXJfZGFubWFrdV9kb21haW4YAiABKAIiNwoT", - "UGxheWVyRGFubWFrdVN3aXRjaBINCgV2YWx1ZRgBIAEoCBIRCgljYW5JZ25v", - "cmUYAiABKAgiKAoXUGxheWVyRGFubWFrdVN3aXRjaFNhdmUSDQoFdmFsdWUY", - "ASABKAgiLgodUGxheWVyRGFubWFrdVVzZURlZmF1bHRDb25maWcSDQoFdmFs", - "dWUYASABKAgiMQogUGxheWVyRGFubWFrdUFpUmVjb21tZW5kZWRTd2l0Y2gS", - "DQoFdmFsdWUYASABKAgiMAofUGxheWVyRGFubWFrdUFpUmVjb21tZW5kZWRM", - "ZXZlbBINCgV2YWx1ZRgBIAEoCCImChVQbGF5ZXJEYW5tYWt1QmxvY2t0b3AS", - "DQoFdmFsdWUYASABKAgiKQoYUGxheWVyRGFubWFrdUJsb2Nrc2Nyb2xsEg0K", - "BXZhbHVlGAEgASgIIikKGFBsYXllckRhbm1ha3VCbG9ja2JvdHRvbRINCgV2", - "YWx1ZRgBIAEoCCIrChpQbGF5ZXJEYW5tYWt1QmxvY2tjb2xvcmZ1bBINCgV2", - "YWx1ZRgBIAEoCCIpChhQbGF5ZXJEYW5tYWt1QmxvY2tyZXBlYXQSDQoFdmFs", - "dWUYASABKAgiKgoZUGxheWVyRGFubWFrdUJsb2Nrc3BlY2lhbBINCgV2YWx1", - "ZRgBIAEoCCIlChRQbGF5ZXJEYW5tYWt1T3BhY2l0eRINCgV2YWx1ZRgBIAEo", - "AiIrChpQbGF5ZXJEYW5tYWt1U2NhbGluZ2ZhY3RvchINCgV2YWx1ZRgBIAEo", - "AiIkChNQbGF5ZXJEYW5tYWt1RG9tYWluEg0KBXZhbHVlGAEgASgCIiMKElBs", - "YXllckRhbm1ha3VTcGVlZBINCgV2YWx1ZRgBIAEoBSItChxQbGF5ZXJEYW5t", - "YWt1RW5hYmxlYmxvY2tsaXN0Eg0KBXZhbHVlGAEgASgIIioKGUlubGluZVBs", - "YXllckRhbm1ha3VTd2l0Y2gSDQoFdmFsdWUYASABKAgqTAoJRE1BdHRyQml0", - "EhQKEERNQXR0ckJpdFByb3RlY3QQABIVChFETUF0dHJCaXRGcm9tTGl2ZRAB", - "EhIKDkRNQXR0ckhpZ2hMaWtlEAIyqgQKAkRNEnMKC0RtU2VnTW9iaWxlEjAu", - "YmlsaWJpbGkuY29tbXVuaXR5LnNlcnZpY2UuZG0udjEuRG1TZWdNb2JpbGVS", - "ZXEaMi5iaWxpYmlsaS5jb21tdW5pdHkuc2VydmljZS5kbS52MS5EbVNlZ01v", - "YmlsZVJlcGx5EmQKBkRtVmlldxIrLmJpbGliaWxpLmNvbW11bml0eS5zZXJ2", - "aWNlLmRtLnYxLkRtVmlld1JlcRotLmJpbGliaWxpLmNvbW11bml0eS5zZXJ2", - "aWNlLmRtLnYxLkRtVmlld1JlcGx5EnEKDkRtUGxheWVyQ29uZmlnEjMuYmls", - "aWJpbGkuY29tbXVuaXR5LnNlcnZpY2UuZG0udjEuRG1QbGF5ZXJDb25maWdS", - "ZXEaKi5iaWxpYmlsaS5jb21tdW5pdHkuc2VydmljZS5kbS52MS5SZXNwb25z", - "ZRJqCghEbVNlZ090dBItLmJpbGliaWxpLmNvbW11bml0eS5zZXJ2aWNlLmRt", - "LnYxLkRtU2VnT3R0UmVxGi8uYmlsaWJpbGkuY29tbXVuaXR5LnNlcnZpY2Uu", - "ZG0udjEuRG1TZWdPdHRSZXBseRJqCghEbVNlZ1NESxItLmJpbGliaWxpLmNv", - "bW11bml0eS5zZXJ2aWNlLmRtLnYxLkRtU2VnU0RLUmVxGi8uYmlsaWJpbGku", - "Y29tbXVuaXR5LnNlcnZpY2UuZG0udjEuRG1TZWdTREtSZXBseWIGcHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Bilibili.Community.Service.Dm.V1.DMAttrBit), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DmSegSDKReq), global::Bilibili.Community.Service.Dm.V1.DmSegSDKReq.Parser, new[]{ "Pid", "Oid", "Type", "SegmentIndex" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DmSegSDKReply), global::Bilibili.Community.Service.Dm.V1.DmSegSDKReply.Parser, new[]{ "Closed", "Elems" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DmSegOttReq), global::Bilibili.Community.Service.Dm.V1.DmSegOttReq.Parser, new[]{ "Pid", "Oid", "Type", "SegmentIndex" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DmSegOttReply), global::Bilibili.Community.Service.Dm.V1.DmSegOttReply.Parser, new[]{ "Closed", "Elems" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DmSegMobileReq), global::Bilibili.Community.Service.Dm.V1.DmSegMobileReq.Parser, new[]{ "Pid", "Oid", "Type", "SegmentIndex", "TeenagersMode" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DmSegMobileReply), global::Bilibili.Community.Service.Dm.V1.DmSegMobileReply.Parser, new[]{ "Elems", "State", "AiFlag" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DmViewReq), global::Bilibili.Community.Service.Dm.V1.DmViewReq.Parser, new[]{ "Pid", "Oid", "Type", "Spmid", "IsHardBoot" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DmViewReply), global::Bilibili.Community.Service.Dm.V1.DmViewReply.Parser, new[]{ "Closed", "Mask", "Subtitle", "SpecialDms", "AiFlag", "PlayerConfig", "SendBoxStyle", "Allow", "CheckBox", "CheckBoxShowMsg", "TextPlaceholder", "InputPlaceholder", "ReportFilterContent" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DmWebViewReply), global::Bilibili.Community.Service.Dm.V1.DmWebViewReply.Parser, new[]{ "State", "Text", "TextSide", "DmSge", "Flag", "SpecialDms", "CheckBox", "Count", "CommandDms", "PlayerConfig", "ReportFilterContent" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.CommandDm), global::Bilibili.Community.Service.Dm.V1.CommandDm.Parser, new[]{ "Id", "Oid", "Mid", "Command", "Content", "Progress", "Ctime", "Mtime", "Extra", "IdStr" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DmSegConfig), global::Bilibili.Community.Service.Dm.V1.DmSegConfig.Parser, new[]{ "PageSize", "Total" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.VideoMask), global::Bilibili.Community.Service.Dm.V1.VideoMask.Parser, new[]{ "Cid", "Plat", "Fps", "Time", "MaskUrl" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.VideoSubtitle), global::Bilibili.Community.Service.Dm.V1.VideoSubtitle.Parser, new[]{ "Lan", "LanDoc", "Subtitles" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DanmuWebPlayerConfig), global::Bilibili.Community.Service.Dm.V1.DanmuWebPlayerConfig.Parser, new[]{ "DmSwitch", "AiSwitch", "AiLevel", "Blocktop", "Blockscroll", "Blockbottom", "Blockcolor", "Blockspecial", "Preventshade", "Dmask", "Opacity", "Dmarea", "Speedplus", "Fontsize", "Screensync", "Speedsync", "Fontfamily", "Bold", "Fontborder", "DrawType" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.SubtitleItem), global::Bilibili.Community.Service.Dm.V1.SubtitleItem.Parser, new[]{ "Id", "IdStr", "Lan", "LanDoc", "SubtitleUrl", "Author" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.UserInfo), global::Bilibili.Community.Service.Dm.V1.UserInfo.Parser, new[]{ "Mid", "Name", "Sex", "Face", "Sign", "Rank" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DanmakuElem), global::Bilibili.Community.Service.Dm.V1.DanmakuElem.Parser, new[]{ "Id", "Progress", "Mode", "Fontsize", "Color", "MidHash", "Content", "Ctime", "Weight", "Action", "Pool", "IdStr", "Attr" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DmPlayerConfigReq), global::Bilibili.Community.Service.Dm.V1.DmPlayerConfigReq.Parser, new[]{ "Ts", "Switch", "SwitchSave", "UseDefaultConfig", "AiRecommendedSwitch", "AiRecommendedLevel", "Blocktop", "Blockscroll", "Blockbottom", "Blockcolorful", "Blockrepeat", "Blockspecial", "Opacity", "Scalingfactor", "Domain", "Speed", "Enableblocklist", "InlinePlayerDanmakuSwitch" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.Response), global::Bilibili.Community.Service.Dm.V1.Response.Parser, new[]{ "Code", "Message" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DanmakuFlag), global::Bilibili.Community.Service.Dm.V1.DanmakuFlag.Parser, new[]{ "Dmid", "Flag" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DanmakuFlagConfig), global::Bilibili.Community.Service.Dm.V1.DanmakuFlagConfig.Parser, new[]{ "RecFlag", "RecText", "RecSwitch" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DanmakuAIFlag), global::Bilibili.Community.Service.Dm.V1.DanmakuAIFlag.Parser, new[]{ "DmFlags" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DanmuPlayerViewConfig), global::Bilibili.Community.Service.Dm.V1.DanmuPlayerViewConfig.Parser, new[]{ "DanmukuDefaultPlayerConfig", "DanmukuPlayerConfig", "DanmukuPlayerDynamicConfig" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DanmuDefaultPlayerConfig), global::Bilibili.Community.Service.Dm.V1.DanmuDefaultPlayerConfig.Parser, new[]{ "PlayerDanmakuUseDefaultConfig", "PlayerDanmakuAiRecommendedSwitch", "PlayerDanmakuAiRecommendedLevel", "PlayerDanmakuBlocktop", "PlayerDanmakuBlockscroll", "PlayerDanmakuBlockbottom", "PlayerDanmakuBlockcolorful", "PlayerDanmakuBlockrepeat", "PlayerDanmakuBlockspecial", "PlayerDanmakuOpacity", "PlayerDanmakuScalingfactor", "PlayerDanmakuDomain", "PlayerDanmakuSpeed", "InlinePlayerDanmakuSwitch" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DanmuPlayerConfig), global::Bilibili.Community.Service.Dm.V1.DanmuPlayerConfig.Parser, new[]{ "PlayerDanmakuSwitch", "PlayerDanmakuSwitchSave", "PlayerDanmakuUseDefaultConfig", "PlayerDanmakuAiRecommendedSwitch", "PlayerDanmakuAiRecommendedLevel", "PlayerDanmakuBlocktop", "PlayerDanmakuBlockscroll", "PlayerDanmakuBlockbottom", "PlayerDanmakuBlockcolorful", "PlayerDanmakuBlockrepeat", "PlayerDanmakuBlockspecial", "PlayerDanmakuOpacity", "PlayerDanmakuScalingfactor", "PlayerDanmakuDomain", "PlayerDanmakuSpeed", "PlayerDanmakuEnableblocklist", "InlinePlayerDanmakuSwitch", "InlinePlayerDanmakuConfig" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.DanmuPlayerDynamicConfig), global::Bilibili.Community.Service.Dm.V1.DanmuPlayerDynamicConfig.Parser, new[]{ "Progress", "PlayerDanmakuDomain" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSwitch), global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSwitch.Parser, new[]{ "Value", "CanIgnore" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSwitchSave), global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSwitchSave.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuUseDefaultConfig), global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuUseDefaultConfig.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuAiRecommendedSwitch), global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuAiRecommendedSwitch.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuAiRecommendedLevel), global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuAiRecommendedLevel.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlocktop), global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlocktop.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockscroll), global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockscroll.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockbottom), global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockbottom.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockcolorful), global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockcolorful.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockrepeat), global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockrepeat.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockspecial), global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockspecial.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuOpacity), global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuOpacity.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuScalingfactor), global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuScalingfactor.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuDomain), global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuDomain.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSpeed), global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSpeed.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuEnableblocklist), global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuEnableblocklist.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Bilibili.Community.Service.Dm.V1.InlinePlayerDanmakuSwitch), global::Bilibili.Community.Service.Dm.V1.InlinePlayerDanmakuSwitch.Parser, new[]{ "Value" }, null, null, null, null) - })); - } - #endregion - - } - #region Enums - /// - /// 弹幕属性位值 - /// - public enum DMAttrBit { - /// - /// 保护弹幕 - /// - [pbr::OriginalName("DMAttrBitProtect")] Protect = 0, - /// - /// 直播弹幕 - /// - [pbr::OriginalName("DMAttrBitFromLive")] FromLive = 1, - /// - /// 高赞弹幕 - /// - [pbr::OriginalName("DMAttrHighLike")] DmattrHighLike = 2, - } - - #endregion - - #region Messages - /// - /// 弹幕SDK-请求 - /// - public sealed partial class DmSegSDKReq : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DmSegSDKReq()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegSDKReq() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegSDKReq(DmSegSDKReq other) : this() { - pid_ = other.pid_; - oid_ = other.oid_; - type_ = other.type_; - segmentIndex_ = other.segmentIndex_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegSDKReq Clone() { - return new DmSegSDKReq(this); - } - - /// Field number for the "pid" field. - public const int PidFieldNumber = 1; - private long pid_; - /// - /// 稿件avid/漫画epid - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Pid { - get { return pid_; } - set { - pid_ = value; - } - } - - /// Field number for the "oid" field. - public const int OidFieldNumber = 2; - private long oid_; - /// - /// 视频cid/漫画cid - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Oid { - get { return oid_; } - set { - oid_ = value; - } - } - - /// Field number for the "type" field. - public const int TypeFieldNumber = 3; - private int type_; - /// - /// 弹幕类型 - /// 1:视频 2:漫画 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Type { - get { return type_; } - set { - type_ = value; - } - } - - /// Field number for the "segment_index" field. - public const int SegmentIndexFieldNumber = 4; - private long segmentIndex_; - /// - /// 分段(6min) - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long SegmentIndex { - get { return segmentIndex_; } - set { - segmentIndex_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DmSegSDKReq); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DmSegSDKReq other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Pid != other.Pid) return false; - if (Oid != other.Oid) return false; - if (Type != other.Type) return false; - if (SegmentIndex != other.SegmentIndex) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Pid != 0L) hash ^= Pid.GetHashCode(); - if (Oid != 0L) hash ^= Oid.GetHashCode(); - if (Type != 0) hash ^= Type.GetHashCode(); - if (SegmentIndex != 0L) hash ^= SegmentIndex.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Pid != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Pid); - } - if (Oid != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Oid); - } - if (Type != 0) { - output.WriteRawTag(24); - output.WriteInt32(Type); - } - if (SegmentIndex != 0L) { - output.WriteRawTag(32); - output.WriteInt64(SegmentIndex); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Pid != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Pid); - } - if (Oid != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Oid); - } - if (Type != 0) { - output.WriteRawTag(24); - output.WriteInt32(Type); - } - if (SegmentIndex != 0L) { - output.WriteRawTag(32); - output.WriteInt64(SegmentIndex); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Pid != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Pid); - } - if (Oid != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Oid); - } - if (Type != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Type); - } - if (SegmentIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(SegmentIndex); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DmSegSDKReq other) { - if (other == null) { - return; - } - if (other.Pid != 0L) { - Pid = other.Pid; - } - if (other.Oid != 0L) { - Oid = other.Oid; - } - if (other.Type != 0) { - Type = other.Type; - } - if (other.SegmentIndex != 0L) { - SegmentIndex = other.SegmentIndex; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Pid = input.ReadInt64(); - break; - } - case 16: { - Oid = input.ReadInt64(); - break; - } - case 24: { - Type = input.ReadInt32(); - break; - } - case 32: { - SegmentIndex = input.ReadInt64(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Pid = input.ReadInt64(); - break; - } - case 16: { - Oid = input.ReadInt64(); - break; - } - case 24: { - Type = input.ReadInt32(); - break; - } - case 32: { - SegmentIndex = input.ReadInt64(); - break; - } - } - } - } - #endif - - } - - /// - /// 弹幕SDK-响应 - /// - public sealed partial class DmSegSDKReply : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DmSegSDKReply()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegSDKReply() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegSDKReply(DmSegSDKReply other) : this() { - closed_ = other.closed_; - elems_ = other.elems_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegSDKReply Clone() { - return new DmSegSDKReply(this); - } - - /// Field number for the "closed" field. - public const int ClosedFieldNumber = 1; - private bool closed_; - /// - /// 是否已关闭弹幕 - /// 0:未关闭 1:已关闭 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Closed { - get { return closed_; } - set { - closed_ = value; - } - } - - /// Field number for the "elems" field. - public const int ElemsFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_elems_codec - = pb::FieldCodec.ForMessage(18, global::Bilibili.Community.Service.Dm.V1.DanmakuElem.Parser); - private readonly pbc::RepeatedField elems_ = new pbc::RepeatedField(); - /// - /// 弹幕列表 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public pbc::RepeatedField Elems { - get { return elems_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DmSegSDKReply); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DmSegSDKReply other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Closed != other.Closed) return false; - if(!elems_.Equals(other.elems_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Closed != false) hash ^= Closed.GetHashCode(); - hash ^= elems_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Closed != false) { - output.WriteRawTag(8); - output.WriteBool(Closed); - } - elems_.WriteTo(output, _repeated_elems_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Closed != false) { - output.WriteRawTag(8); - output.WriteBool(Closed); - } - elems_.WriteTo(ref output, _repeated_elems_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Closed != false) { - size += 1 + 1; - } - size += elems_.CalculateSize(_repeated_elems_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DmSegSDKReply other) { - if (other == null) { - return; - } - if (other.Closed != false) { - Closed = other.Closed; - } - elems_.Add(other.elems_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Closed = input.ReadBool(); - break; - } - case 18: { - elems_.AddEntriesFrom(input, _repeated_elems_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Closed = input.ReadBool(); - break; - } - case 18: { - elems_.AddEntriesFrom(ref input, _repeated_elems_codec); - break; - } - } - } - } - #endif - - } - - /// - /// ott弹幕列表-请求 - /// - public sealed partial class DmSegOttReq : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DmSegOttReq()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegOttReq() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegOttReq(DmSegOttReq other) : this() { - pid_ = other.pid_; - oid_ = other.oid_; - type_ = other.type_; - segmentIndex_ = other.segmentIndex_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegOttReq Clone() { - return new DmSegOttReq(this); - } - - /// Field number for the "pid" field. - public const int PidFieldNumber = 1; - private long pid_; - /// - /// 稿件avid/漫画epid - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Pid { - get { return pid_; } - set { - pid_ = value; - } - } - - /// Field number for the "oid" field. - public const int OidFieldNumber = 2; - private long oid_; - /// - /// 视频cid/漫画cid - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Oid { - get { return oid_; } - set { - oid_ = value; - } - } - - /// Field number for the "type" field. - public const int TypeFieldNumber = 3; - private int type_; - /// - /// 弹幕类型 - /// 1:视频 2:漫画 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Type { - get { return type_; } - set { - type_ = value; - } - } - - /// Field number for the "segment_index" field. - public const int SegmentIndexFieldNumber = 4; - private long segmentIndex_; - /// - /// 分段(6min) - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long SegmentIndex { - get { return segmentIndex_; } - set { - segmentIndex_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DmSegOttReq); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DmSegOttReq other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Pid != other.Pid) return false; - if (Oid != other.Oid) return false; - if (Type != other.Type) return false; - if (SegmentIndex != other.SegmentIndex) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Pid != 0L) hash ^= Pid.GetHashCode(); - if (Oid != 0L) hash ^= Oid.GetHashCode(); - if (Type != 0) hash ^= Type.GetHashCode(); - if (SegmentIndex != 0L) hash ^= SegmentIndex.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Pid != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Pid); - } - if (Oid != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Oid); - } - if (Type != 0) { - output.WriteRawTag(24); - output.WriteInt32(Type); - } - if (SegmentIndex != 0L) { - output.WriteRawTag(32); - output.WriteInt64(SegmentIndex); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Pid != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Pid); - } - if (Oid != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Oid); - } - if (Type != 0) { - output.WriteRawTag(24); - output.WriteInt32(Type); - } - if (SegmentIndex != 0L) { - output.WriteRawTag(32); - output.WriteInt64(SegmentIndex); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Pid != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Pid); - } - if (Oid != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Oid); - } - if (Type != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Type); - } - if (SegmentIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(SegmentIndex); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DmSegOttReq other) { - if (other == null) { - return; - } - if (other.Pid != 0L) { - Pid = other.Pid; - } - if (other.Oid != 0L) { - Oid = other.Oid; - } - if (other.Type != 0) { - Type = other.Type; - } - if (other.SegmentIndex != 0L) { - SegmentIndex = other.SegmentIndex; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Pid = input.ReadInt64(); - break; - } - case 16: { - Oid = input.ReadInt64(); - break; - } - case 24: { - Type = input.ReadInt32(); - break; - } - case 32: { - SegmentIndex = input.ReadInt64(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Pid = input.ReadInt64(); - break; - } - case 16: { - Oid = input.ReadInt64(); - break; - } - case 24: { - Type = input.ReadInt32(); - break; - } - case 32: { - SegmentIndex = input.ReadInt64(); - break; - } - } - } - } - #endif - - } - - /// - /// ott弹幕列表-响应 - /// - public sealed partial class DmSegOttReply : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DmSegOttReply()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegOttReply() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegOttReply(DmSegOttReply other) : this() { - closed_ = other.closed_; - elems_ = other.elems_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegOttReply Clone() { - return new DmSegOttReply(this); - } - - /// Field number for the "closed" field. - public const int ClosedFieldNumber = 1; - private bool closed_; - /// - /// 是否已关闭弹幕 - /// 0:未关闭 1:已关闭 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Closed { - get { return closed_; } - set { - closed_ = value; - } - } - - /// Field number for the "elems" field. - public const int ElemsFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_elems_codec - = pb::FieldCodec.ForMessage(18, global::Bilibili.Community.Service.Dm.V1.DanmakuElem.Parser); - private readonly pbc::RepeatedField elems_ = new pbc::RepeatedField(); - /// - /// 弹幕列表 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public pbc::RepeatedField Elems { - get { return elems_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DmSegOttReply); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DmSegOttReply other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Closed != other.Closed) return false; - if(!elems_.Equals(other.elems_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Closed != false) hash ^= Closed.GetHashCode(); - hash ^= elems_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Closed != false) { - output.WriteRawTag(8); - output.WriteBool(Closed); - } - elems_.WriteTo(output, _repeated_elems_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Closed != false) { - output.WriteRawTag(8); - output.WriteBool(Closed); - } - elems_.WriteTo(ref output, _repeated_elems_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Closed != false) { - size += 1 + 1; - } - size += elems_.CalculateSize(_repeated_elems_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DmSegOttReply other) { - if (other == null) { - return; - } - if (other.Closed != false) { - Closed = other.Closed; - } - elems_.Add(other.elems_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Closed = input.ReadBool(); - break; - } - case 18: { - elems_.AddEntriesFrom(input, _repeated_elems_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Closed = input.ReadBool(); - break; - } - case 18: { - elems_.AddEntriesFrom(ref input, _repeated_elems_codec); - break; - } - } - } - } - #endif - - } - - /// - /// 获取弹幕-请求 - /// - public sealed partial class DmSegMobileReq : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DmSegMobileReq()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegMobileReq() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegMobileReq(DmSegMobileReq other) : this() { - pid_ = other.pid_; - oid_ = other.oid_; - type_ = other.type_; - segmentIndex_ = other.segmentIndex_; - teenagersMode_ = other.teenagersMode_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegMobileReq Clone() { - return new DmSegMobileReq(this); - } - - /// Field number for the "pid" field. - public const int PidFieldNumber = 1; - private long pid_; - /// - /// 稿件avid/漫画epid - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Pid { - get { return pid_; } - set { - pid_ = value; - } - } - - /// Field number for the "oid" field. - public const int OidFieldNumber = 2; - private long oid_; - /// - /// 视频cid/漫画cid - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Oid { - get { return oid_; } - set { - oid_ = value; - } - } - - /// Field number for the "type" field. - public const int TypeFieldNumber = 3; - private int type_; - /// - /// 弹幕类型 - /// 1:视频 2:漫画 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Type { - get { return type_; } - set { - type_ = value; - } - } - - /// Field number for the "segment_index" field. - public const int SegmentIndexFieldNumber = 4; - private long segmentIndex_; - /// - /// 分段(6min) - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long SegmentIndex { - get { return segmentIndex_; } - set { - segmentIndex_ = value; - } - } - - /// Field number for the "teenagers_mode" field. - public const int TeenagersModeFieldNumber = 5; - private int teenagersMode_; - /// - /// 是否青少年模式 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int TeenagersMode { - get { return teenagersMode_; } - set { - teenagersMode_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DmSegMobileReq); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DmSegMobileReq other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Pid != other.Pid) return false; - if (Oid != other.Oid) return false; - if (Type != other.Type) return false; - if (SegmentIndex != other.SegmentIndex) return false; - if (TeenagersMode != other.TeenagersMode) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Pid != 0L) hash ^= Pid.GetHashCode(); - if (Oid != 0L) hash ^= Oid.GetHashCode(); - if (Type != 0) hash ^= Type.GetHashCode(); - if (SegmentIndex != 0L) hash ^= SegmentIndex.GetHashCode(); - if (TeenagersMode != 0) hash ^= TeenagersMode.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Pid != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Pid); - } - if (Oid != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Oid); - } - if (Type != 0) { - output.WriteRawTag(24); - output.WriteInt32(Type); - } - if (SegmentIndex != 0L) { - output.WriteRawTag(32); - output.WriteInt64(SegmentIndex); - } - if (TeenagersMode != 0) { - output.WriteRawTag(40); - output.WriteInt32(TeenagersMode); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Pid != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Pid); - } - if (Oid != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Oid); - } - if (Type != 0) { - output.WriteRawTag(24); - output.WriteInt32(Type); - } - if (SegmentIndex != 0L) { - output.WriteRawTag(32); - output.WriteInt64(SegmentIndex); - } - if (TeenagersMode != 0) { - output.WriteRawTag(40); - output.WriteInt32(TeenagersMode); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Pid != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Pid); - } - if (Oid != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Oid); - } - if (Type != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Type); - } - if (SegmentIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(SegmentIndex); - } - if (TeenagersMode != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(TeenagersMode); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DmSegMobileReq other) { - if (other == null) { - return; - } - if (other.Pid != 0L) { - Pid = other.Pid; - } - if (other.Oid != 0L) { - Oid = other.Oid; - } - if (other.Type != 0) { - Type = other.Type; - } - if (other.SegmentIndex != 0L) { - SegmentIndex = other.SegmentIndex; - } - if (other.TeenagersMode != 0) { - TeenagersMode = other.TeenagersMode; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Pid = input.ReadInt64(); - break; - } - case 16: { - Oid = input.ReadInt64(); - break; - } - case 24: { - Type = input.ReadInt32(); - break; - } - case 32: { - SegmentIndex = input.ReadInt64(); - break; - } - case 40: { - TeenagersMode = input.ReadInt32(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Pid = input.ReadInt64(); - break; - } - case 16: { - Oid = input.ReadInt64(); - break; - } - case 24: { - Type = input.ReadInt32(); - break; - } - case 32: { - SegmentIndex = input.ReadInt64(); - break; - } - case 40: { - TeenagersMode = input.ReadInt32(); - break; - } - } - } - } - #endif - - } - - /// - /// 获取弹幕-响应 - /// - public sealed partial class DmSegMobileReply : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DmSegMobileReply()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[5]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegMobileReply() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegMobileReply(DmSegMobileReply other) : this() { - elems_ = other.elems_.Clone(); - state_ = other.state_; - aiFlag_ = other.aiFlag_ != null ? other.aiFlag_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegMobileReply Clone() { - return new DmSegMobileReply(this); - } - - /// Field number for the "elems" field. - public const int ElemsFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_elems_codec - = pb::FieldCodec.ForMessage(10, global::Bilibili.Community.Service.Dm.V1.DanmakuElem.Parser); - private readonly pbc::RepeatedField elems_ = new pbc::RepeatedField(); - /// - /// 弹幕列表 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public pbc::RepeatedField Elems { - get { return elems_; } - } - - /// Field number for the "state" field. - public const int StateFieldNumber = 2; - private int state_; - /// - /// 是否已关闭弹幕 - /// 0:未关闭 1:已关闭 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int State { - get { return state_; } - set { - state_ = value; - } - } - - /// Field number for the "ai_flag" field. - public const int AiFlagFieldNumber = 3; - private global::Bilibili.Community.Service.Dm.V1.DanmakuAIFlag aiFlag_; - /// - /// 弹幕云屏蔽ai评分值 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.DanmakuAIFlag AiFlag { - get { return aiFlag_; } - set { - aiFlag_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DmSegMobileReply); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DmSegMobileReply other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!elems_.Equals(other.elems_)) return false; - if (State != other.State) return false; - if (!object.Equals(AiFlag, other.AiFlag)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - hash ^= elems_.GetHashCode(); - if (State != 0) hash ^= State.GetHashCode(); - if (aiFlag_ != null) hash ^= AiFlag.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - elems_.WriteTo(output, _repeated_elems_codec); - if (State != 0) { - output.WriteRawTag(16); - output.WriteInt32(State); - } - if (aiFlag_ != null) { - output.WriteRawTag(26); - output.WriteMessage(AiFlag); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - elems_.WriteTo(ref output, _repeated_elems_codec); - if (State != 0) { - output.WriteRawTag(16); - output.WriteInt32(State); - } - if (aiFlag_ != null) { - output.WriteRawTag(26); - output.WriteMessage(AiFlag); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - size += elems_.CalculateSize(_repeated_elems_codec); - if (State != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(State); - } - if (aiFlag_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(AiFlag); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DmSegMobileReply other) { - if (other == null) { - return; - } - elems_.Add(other.elems_); - if (other.State != 0) { - State = other.State; - } - if (other.aiFlag_ != null) { - if (aiFlag_ == null) { - AiFlag = new global::Bilibili.Community.Service.Dm.V1.DanmakuAIFlag(); - } - AiFlag.MergeFrom(other.AiFlag); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - elems_.AddEntriesFrom(input, _repeated_elems_codec); - break; - } - case 16: { - State = input.ReadInt32(); - break; - } - case 26: { - if (aiFlag_ == null) { - AiFlag = new global::Bilibili.Community.Service.Dm.V1.DanmakuAIFlag(); - } - input.ReadMessage(AiFlag); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - elems_.AddEntriesFrom(ref input, _repeated_elems_codec); - break; - } - case 16: { - State = input.ReadInt32(); - break; - } - case 26: { - if (aiFlag_ == null) { - AiFlag = new global::Bilibili.Community.Service.Dm.V1.DanmakuAIFlag(); - } - input.ReadMessage(AiFlag); - break; - } - } - } - } - #endif - - } - - /// - /// 客户端弹幕元数据-请求 - /// - public sealed partial class DmViewReq : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DmViewReq()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[6]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmViewReq() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmViewReq(DmViewReq other) : this() { - pid_ = other.pid_; - oid_ = other.oid_; - type_ = other.type_; - spmid_ = other.spmid_; - isHardBoot_ = other.isHardBoot_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmViewReq Clone() { - return new DmViewReq(this); - } - - /// Field number for the "pid" field. - public const int PidFieldNumber = 1; - private long pid_; - /// - /// 稿件avid/漫画epid - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Pid { - get { return pid_; } - set { - pid_ = value; - } - } - - /// Field number for the "oid" field. - public const int OidFieldNumber = 2; - private long oid_; - /// - /// 视频cid/漫画cid - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Oid { - get { return oid_; } - set { - oid_ = value; - } - } - - /// Field number for the "type" field. - public const int TypeFieldNumber = 3; - private int type_; - /// - /// 弹幕类型 - /// 1:视频 2:漫画 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Type { - get { return type_; } - set { - type_ = value; - } - } - - /// Field number for the "spmid" field. - public const int SpmidFieldNumber = 4; - private string spmid_ = ""; - /// - /// 页面spm - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Spmid { - get { return spmid_; } - set { - spmid_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "is_hard_boot" field. - public const int IsHardBootFieldNumber = 5; - private int isHardBoot_; - /// - /// 是否冷启 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int IsHardBoot { - get { return isHardBoot_; } - set { - isHardBoot_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DmViewReq); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DmViewReq other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Pid != other.Pid) return false; - if (Oid != other.Oid) return false; - if (Type != other.Type) return false; - if (Spmid != other.Spmid) return false; - if (IsHardBoot != other.IsHardBoot) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Pid != 0L) hash ^= Pid.GetHashCode(); - if (Oid != 0L) hash ^= Oid.GetHashCode(); - if (Type != 0) hash ^= Type.GetHashCode(); - if (Spmid.Length != 0) hash ^= Spmid.GetHashCode(); - if (IsHardBoot != 0) hash ^= IsHardBoot.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Pid != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Pid); - } - if (Oid != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Oid); - } - if (Type != 0) { - output.WriteRawTag(24); - output.WriteInt32(Type); - } - if (Spmid.Length != 0) { - output.WriteRawTag(34); - output.WriteString(Spmid); - } - if (IsHardBoot != 0) { - output.WriteRawTag(40); - output.WriteInt32(IsHardBoot); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Pid != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Pid); - } - if (Oid != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Oid); - } - if (Type != 0) { - output.WriteRawTag(24); - output.WriteInt32(Type); - } - if (Spmid.Length != 0) { - output.WriteRawTag(34); - output.WriteString(Spmid); - } - if (IsHardBoot != 0) { - output.WriteRawTag(40); - output.WriteInt32(IsHardBoot); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Pid != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Pid); - } - if (Oid != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Oid); - } - if (Type != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Type); - } - if (Spmid.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Spmid); - } - if (IsHardBoot != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(IsHardBoot); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DmViewReq other) { - if (other == null) { - return; - } - if (other.Pid != 0L) { - Pid = other.Pid; - } - if (other.Oid != 0L) { - Oid = other.Oid; - } - if (other.Type != 0) { - Type = other.Type; - } - if (other.Spmid.Length != 0) { - Spmid = other.Spmid; - } - if (other.IsHardBoot != 0) { - IsHardBoot = other.IsHardBoot; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Pid = input.ReadInt64(); - break; - } - case 16: { - Oid = input.ReadInt64(); - break; - } - case 24: { - Type = input.ReadInt32(); - break; - } - case 34: { - Spmid = input.ReadString(); - break; - } - case 40: { - IsHardBoot = input.ReadInt32(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Pid = input.ReadInt64(); - break; - } - case 16: { - Oid = input.ReadInt64(); - break; - } - case 24: { - Type = input.ReadInt32(); - break; - } - case 34: { - Spmid = input.ReadString(); - break; - } - case 40: { - IsHardBoot = input.ReadInt32(); - break; - } - } - } - } - #endif - - } - - /// - /// 客户端弹幕元数据-响应 - /// - public sealed partial class DmViewReply : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DmViewReply()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[7]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmViewReply() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmViewReply(DmViewReply other) : this() { - closed_ = other.closed_; - mask_ = other.mask_ != null ? other.mask_.Clone() : null; - subtitle_ = other.subtitle_ != null ? other.subtitle_.Clone() : null; - specialDms_ = other.specialDms_.Clone(); - aiFlag_ = other.aiFlag_ != null ? other.aiFlag_.Clone() : null; - playerConfig_ = other.playerConfig_ != null ? other.playerConfig_.Clone() : null; - sendBoxStyle_ = other.sendBoxStyle_; - allow_ = other.allow_; - checkBox_ = other.checkBox_; - checkBoxShowMsg_ = other.checkBoxShowMsg_; - textPlaceholder_ = other.textPlaceholder_; - inputPlaceholder_ = other.inputPlaceholder_; - reportFilterContent_ = other.reportFilterContent_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmViewReply Clone() { - return new DmViewReply(this); - } - - /// Field number for the "closed" field. - public const int ClosedFieldNumber = 1; - private bool closed_; - /// - /// 是否已关闭弹幕 - /// 0:未关闭 1:已关闭 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Closed { - get { return closed_; } - set { - closed_ = value; - } - } - - /// Field number for the "mask" field. - public const int MaskFieldNumber = 2; - private global::Bilibili.Community.Service.Dm.V1.VideoMask mask_; - /// - /// 智能防挡弹幕蒙版信息 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.VideoMask Mask { - get { return mask_; } - set { - mask_ = value; - } - } - - /// Field number for the "subtitle" field. - public const int SubtitleFieldNumber = 3; - private global::Bilibili.Community.Service.Dm.V1.VideoSubtitle subtitle_; - /// - /// 视频字幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.VideoSubtitle Subtitle { - get { return subtitle_; } - set { - subtitle_ = value; - } - } - - /// Field number for the "special_dms" field. - public const int SpecialDmsFieldNumber = 4; - private static readonly pb::FieldCodec _repeated_specialDms_codec - = pb::FieldCodec.ForString(34); - private readonly pbc::RepeatedField specialDms_ = new pbc::RepeatedField(); - /// - /// 高级弹幕专包url(bfs) - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public pbc::RepeatedField SpecialDms { - get { return specialDms_; } - } - - /// Field number for the "ai_flag" field. - public const int AiFlagFieldNumber = 5; - private global::Bilibili.Community.Service.Dm.V1.DanmakuFlagConfig aiFlag_; - /// - /// 云屏蔽配置信息 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.DanmakuFlagConfig AiFlag { - get { return aiFlag_; } - set { - aiFlag_ = value; - } - } - - /// Field number for the "player_config" field. - public const int PlayerConfigFieldNumber = 6; - private global::Bilibili.Community.Service.Dm.V1.DanmuPlayerViewConfig playerConfig_; - /// - /// 弹幕配置信息 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.DanmuPlayerViewConfig PlayerConfig { - get { return playerConfig_; } - set { - playerConfig_ = value; - } - } - - /// Field number for the "send_box_style" field. - public const int SendBoxStyleFieldNumber = 7; - private int sendBoxStyle_; - /// - /// 弹幕发送框样式 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int SendBoxStyle { - get { return sendBoxStyle_; } - set { - sendBoxStyle_ = value; - } - } - - /// Field number for the "allow" field. - public const int AllowFieldNumber = 8; - private bool allow_; - /// - /// 是否允许 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Allow { - get { return allow_; } - set { - allow_ = value; - } - } - - /// Field number for the "check_box" field. - public const int CheckBoxFieldNumber = 9; - private string checkBox_ = ""; - /// - /// check box 是否展示 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string CheckBox { - get { return checkBox_; } - set { - checkBox_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "check_box_show_msg" field. - public const int CheckBoxShowMsgFieldNumber = 10; - private string checkBoxShowMsg_ = ""; - /// - /// check box 展示文本 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string CheckBoxShowMsg { - get { return checkBoxShowMsg_; } - set { - checkBoxShowMsg_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "text_placeholder" field. - public const int TextPlaceholderFieldNumber = 11; - private string textPlaceholder_ = ""; - /// - /// 展示文案 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string TextPlaceholder { - get { return textPlaceholder_; } - set { - textPlaceholder_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "input_placeholder" field. - public const int InputPlaceholderFieldNumber = 12; - private string inputPlaceholder_ = ""; - /// - /// 弹幕输入框文案 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string InputPlaceholder { - get { return inputPlaceholder_; } - set { - inputPlaceholder_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "report_filter_content" field. - public const int ReportFilterContentFieldNumber = 13; - private static readonly pb::FieldCodec _repeated_reportFilterContent_codec - = pb::FieldCodec.ForString(106); - private readonly pbc::RepeatedField reportFilterContent_ = new pbc::RepeatedField(); - /// - /// 用户举报弹幕 cid维度屏蔽的正则规则 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public pbc::RepeatedField ReportFilterContent { - get { return reportFilterContent_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DmViewReply); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DmViewReply other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Closed != other.Closed) return false; - if (!object.Equals(Mask, other.Mask)) return false; - if (!object.Equals(Subtitle, other.Subtitle)) return false; - if(!specialDms_.Equals(other.specialDms_)) return false; - if (!object.Equals(AiFlag, other.AiFlag)) return false; - if (!object.Equals(PlayerConfig, other.PlayerConfig)) return false; - if (SendBoxStyle != other.SendBoxStyle) return false; - if (Allow != other.Allow) return false; - if (CheckBox != other.CheckBox) return false; - if (CheckBoxShowMsg != other.CheckBoxShowMsg) return false; - if (TextPlaceholder != other.TextPlaceholder) return false; - if (InputPlaceholder != other.InputPlaceholder) return false; - if(!reportFilterContent_.Equals(other.reportFilterContent_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Closed != false) hash ^= Closed.GetHashCode(); - if (mask_ != null) hash ^= Mask.GetHashCode(); - if (subtitle_ != null) hash ^= Subtitle.GetHashCode(); - hash ^= specialDms_.GetHashCode(); - if (aiFlag_ != null) hash ^= AiFlag.GetHashCode(); - if (playerConfig_ != null) hash ^= PlayerConfig.GetHashCode(); - if (SendBoxStyle != 0) hash ^= SendBoxStyle.GetHashCode(); - if (Allow != false) hash ^= Allow.GetHashCode(); - if (CheckBox.Length != 0) hash ^= CheckBox.GetHashCode(); - if (CheckBoxShowMsg.Length != 0) hash ^= CheckBoxShowMsg.GetHashCode(); - if (TextPlaceholder.Length != 0) hash ^= TextPlaceholder.GetHashCode(); - if (InputPlaceholder.Length != 0) hash ^= InputPlaceholder.GetHashCode(); - hash ^= reportFilterContent_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Closed != false) { - output.WriteRawTag(8); - output.WriteBool(Closed); - } - if (mask_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Mask); - } - if (subtitle_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Subtitle); - } - specialDms_.WriteTo(output, _repeated_specialDms_codec); - if (aiFlag_ != null) { - output.WriteRawTag(42); - output.WriteMessage(AiFlag); - } - if (playerConfig_ != null) { - output.WriteRawTag(50); - output.WriteMessage(PlayerConfig); - } - if (SendBoxStyle != 0) { - output.WriteRawTag(56); - output.WriteInt32(SendBoxStyle); - } - if (Allow != false) { - output.WriteRawTag(64); - output.WriteBool(Allow); - } - if (CheckBox.Length != 0) { - output.WriteRawTag(74); - output.WriteString(CheckBox); - } - if (CheckBoxShowMsg.Length != 0) { - output.WriteRawTag(82); - output.WriteString(CheckBoxShowMsg); - } - if (TextPlaceholder.Length != 0) { - output.WriteRawTag(90); - output.WriteString(TextPlaceholder); - } - if (InputPlaceholder.Length != 0) { - output.WriteRawTag(98); - output.WriteString(InputPlaceholder); - } - reportFilterContent_.WriteTo(output, _repeated_reportFilterContent_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Closed != false) { - output.WriteRawTag(8); - output.WriteBool(Closed); - } - if (mask_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Mask); - } - if (subtitle_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Subtitle); - } - specialDms_.WriteTo(ref output, _repeated_specialDms_codec); - if (aiFlag_ != null) { - output.WriteRawTag(42); - output.WriteMessage(AiFlag); - } - if (playerConfig_ != null) { - output.WriteRawTag(50); - output.WriteMessage(PlayerConfig); - } - if (SendBoxStyle != 0) { - output.WriteRawTag(56); - output.WriteInt32(SendBoxStyle); - } - if (Allow != false) { - output.WriteRawTag(64); - output.WriteBool(Allow); - } - if (CheckBox.Length != 0) { - output.WriteRawTag(74); - output.WriteString(CheckBox); - } - if (CheckBoxShowMsg.Length != 0) { - output.WriteRawTag(82); - output.WriteString(CheckBoxShowMsg); - } - if (TextPlaceholder.Length != 0) { - output.WriteRawTag(90); - output.WriteString(TextPlaceholder); - } - if (InputPlaceholder.Length != 0) { - output.WriteRawTag(98); - output.WriteString(InputPlaceholder); - } - reportFilterContent_.WriteTo(ref output, _repeated_reportFilterContent_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Closed != false) { - size += 1 + 1; - } - if (mask_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Mask); - } - if (subtitle_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Subtitle); - } - size += specialDms_.CalculateSize(_repeated_specialDms_codec); - if (aiFlag_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(AiFlag); - } - if (playerConfig_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(PlayerConfig); - } - if (SendBoxStyle != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(SendBoxStyle); - } - if (Allow != false) { - size += 1 + 1; - } - if (CheckBox.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(CheckBox); - } - if (CheckBoxShowMsg.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(CheckBoxShowMsg); - } - if (TextPlaceholder.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(TextPlaceholder); - } - if (InputPlaceholder.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(InputPlaceholder); - } - size += reportFilterContent_.CalculateSize(_repeated_reportFilterContent_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DmViewReply other) { - if (other == null) { - return; - } - if (other.Closed != false) { - Closed = other.Closed; - } - if (other.mask_ != null) { - if (mask_ == null) { - Mask = new global::Bilibili.Community.Service.Dm.V1.VideoMask(); - } - Mask.MergeFrom(other.Mask); - } - if (other.subtitle_ != null) { - if (subtitle_ == null) { - Subtitle = new global::Bilibili.Community.Service.Dm.V1.VideoSubtitle(); - } - Subtitle.MergeFrom(other.Subtitle); - } - specialDms_.Add(other.specialDms_); - if (other.aiFlag_ != null) { - if (aiFlag_ == null) { - AiFlag = new global::Bilibili.Community.Service.Dm.V1.DanmakuFlagConfig(); - } - AiFlag.MergeFrom(other.AiFlag); - } - if (other.playerConfig_ != null) { - if (playerConfig_ == null) { - PlayerConfig = new global::Bilibili.Community.Service.Dm.V1.DanmuPlayerViewConfig(); - } - PlayerConfig.MergeFrom(other.PlayerConfig); - } - if (other.SendBoxStyle != 0) { - SendBoxStyle = other.SendBoxStyle; - } - if (other.Allow != false) { - Allow = other.Allow; - } - if (other.CheckBox.Length != 0) { - CheckBox = other.CheckBox; - } - if (other.CheckBoxShowMsg.Length != 0) { - CheckBoxShowMsg = other.CheckBoxShowMsg; - } - if (other.TextPlaceholder.Length != 0) { - TextPlaceholder = other.TextPlaceholder; - } - if (other.InputPlaceholder.Length != 0) { - InputPlaceholder = other.InputPlaceholder; - } - reportFilterContent_.Add(other.reportFilterContent_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Closed = input.ReadBool(); - break; - } - case 18: { - if (mask_ == null) { - Mask = new global::Bilibili.Community.Service.Dm.V1.VideoMask(); - } - input.ReadMessage(Mask); - break; - } - case 26: { - if (subtitle_ == null) { - Subtitle = new global::Bilibili.Community.Service.Dm.V1.VideoSubtitle(); - } - input.ReadMessage(Subtitle); - break; - } - case 34: { - specialDms_.AddEntriesFrom(input, _repeated_specialDms_codec); - break; - } - case 42: { - if (aiFlag_ == null) { - AiFlag = new global::Bilibili.Community.Service.Dm.V1.DanmakuFlagConfig(); - } - input.ReadMessage(AiFlag); - break; - } - case 50: { - if (playerConfig_ == null) { - PlayerConfig = new global::Bilibili.Community.Service.Dm.V1.DanmuPlayerViewConfig(); - } - input.ReadMessage(PlayerConfig); - break; - } - case 56: { - SendBoxStyle = input.ReadInt32(); - break; - } - case 64: { - Allow = input.ReadBool(); - break; - } - case 74: { - CheckBox = input.ReadString(); - break; - } - case 82: { - CheckBoxShowMsg = input.ReadString(); - break; - } - case 90: { - TextPlaceholder = input.ReadString(); - break; - } - case 98: { - InputPlaceholder = input.ReadString(); - break; - } - case 106: { - reportFilterContent_.AddEntriesFrom(input, _repeated_reportFilterContent_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Closed = input.ReadBool(); - break; - } - case 18: { - if (mask_ == null) { - Mask = new global::Bilibili.Community.Service.Dm.V1.VideoMask(); - } - input.ReadMessage(Mask); - break; - } - case 26: { - if (subtitle_ == null) { - Subtitle = new global::Bilibili.Community.Service.Dm.V1.VideoSubtitle(); - } - input.ReadMessage(Subtitle); - break; - } - case 34: { - specialDms_.AddEntriesFrom(ref input, _repeated_specialDms_codec); - break; - } - case 42: { - if (aiFlag_ == null) { - AiFlag = new global::Bilibili.Community.Service.Dm.V1.DanmakuFlagConfig(); - } - input.ReadMessage(AiFlag); - break; - } - case 50: { - if (playerConfig_ == null) { - PlayerConfig = new global::Bilibili.Community.Service.Dm.V1.DanmuPlayerViewConfig(); - } - input.ReadMessage(PlayerConfig); - break; - } - case 56: { - SendBoxStyle = input.ReadInt32(); - break; - } - case 64: { - Allow = input.ReadBool(); - break; - } - case 74: { - CheckBox = input.ReadString(); - break; - } - case 82: { - CheckBoxShowMsg = input.ReadString(); - break; - } - case 90: { - TextPlaceholder = input.ReadString(); - break; - } - case 98: { - InputPlaceholder = input.ReadString(); - break; - } - case 106: { - reportFilterContent_.AddEntriesFrom(ref input, _repeated_reportFilterContent_codec); - break; - } - } - } - } - #endif - - } - - /// - /// web端弹幕元数据-响应 - /// - public sealed partial class DmWebViewReply : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DmWebViewReply()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[8]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmWebViewReply() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmWebViewReply(DmWebViewReply other) : this() { - state_ = other.state_; - text_ = other.text_; - textSide_ = other.textSide_; - dmSge_ = other.dmSge_ != null ? other.dmSge_.Clone() : null; - flag_ = other.flag_ != null ? other.flag_.Clone() : null; - specialDms_ = other.specialDms_.Clone(); - checkBox_ = other.checkBox_; - count_ = other.count_; - commandDms_ = other.commandDms_.Clone(); - playerConfig_ = other.playerConfig_ != null ? other.playerConfig_.Clone() : null; - reportFilterContent_ = other.reportFilterContent_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmWebViewReply Clone() { - return new DmWebViewReply(this); - } - - /// Field number for the "state" field. - public const int StateFieldNumber = 1; - private int state_; - /// - /// 是否已关闭弹幕 - /// 0:未关闭 1:已关闭 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int State { - get { return state_; } - set { - state_ = value; - } - } - - /// Field number for the "text" field. - public const int TextFieldNumber = 2; - private string text_ = ""; - /// - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Text { - get { return text_; } - set { - text_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "text_side" field. - public const int TextSideFieldNumber = 3; - private string textSide_ = ""; - /// - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string TextSide { - get { return textSide_; } - set { - textSide_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "dm_sge" field. - public const int DmSgeFieldNumber = 4; - private global::Bilibili.Community.Service.Dm.V1.DmSegConfig dmSge_; - /// - /// 分段弹幕配置 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.DmSegConfig DmSge { - get { return dmSge_; } - set { - dmSge_ = value; - } - } - - /// Field number for the "flag" field. - public const int FlagFieldNumber = 5; - private global::Bilibili.Community.Service.Dm.V1.DanmakuFlagConfig flag_; - /// - /// 云屏蔽配置信息 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.DanmakuFlagConfig Flag { - get { return flag_; } - set { - flag_ = value; - } - } - - /// Field number for the "special_dms" field. - public const int SpecialDmsFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_specialDms_codec - = pb::FieldCodec.ForString(50); - private readonly pbc::RepeatedField specialDms_ = new pbc::RepeatedField(); - /// - /// 高级弹幕专包url(bfs) - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public pbc::RepeatedField SpecialDms { - get { return specialDms_; } - } - - /// Field number for the "check_box" field. - public const int CheckBoxFieldNumber = 7; - private bool checkBox_; - /// - /// check box 是否展示 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool CheckBox { - get { return checkBox_; } - set { - checkBox_ = value; - } - } - - /// Field number for the "count" field. - public const int CountFieldNumber = 8; - private long count_; - /// - /// 弹幕数 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Count { - get { return count_; } - set { - count_ = value; - } - } - - /// Field number for the "commandDms" field. - public const int CommandDmsFieldNumber = 9; - private static readonly pb::FieldCodec _repeated_commandDms_codec - = pb::FieldCodec.ForMessage(74, global::Bilibili.Community.Service.Dm.V1.CommandDm.Parser); - private readonly pbc::RepeatedField commandDms_ = new pbc::RepeatedField(); - /// - /// 互动弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public pbc::RepeatedField CommandDms { - get { return commandDms_; } - } - - /// Field number for the "player_config" field. - public const int PlayerConfigFieldNumber = 10; - private global::Bilibili.Community.Service.Dm.V1.DanmuWebPlayerConfig playerConfig_; - /// - /// 用户弹幕配置 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.DanmuWebPlayerConfig PlayerConfig { - get { return playerConfig_; } - set { - playerConfig_ = value; - } - } - - /// Field number for the "report_filter_content" field. - public const int ReportFilterContentFieldNumber = 11; - private static readonly pb::FieldCodec _repeated_reportFilterContent_codec - = pb::FieldCodec.ForString(90); - private readonly pbc::RepeatedField reportFilterContent_ = new pbc::RepeatedField(); - /// - /// 用户举报弹幕 cid维度屏蔽 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public pbc::RepeatedField ReportFilterContent { - get { return reportFilterContent_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DmWebViewReply); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DmWebViewReply other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (State != other.State) return false; - if (Text != other.Text) return false; - if (TextSide != other.TextSide) return false; - if (!object.Equals(DmSge, other.DmSge)) return false; - if (!object.Equals(Flag, other.Flag)) return false; - if(!specialDms_.Equals(other.specialDms_)) return false; - if (CheckBox != other.CheckBox) return false; - if (Count != other.Count) return false; - if(!commandDms_.Equals(other.commandDms_)) return false; - if (!object.Equals(PlayerConfig, other.PlayerConfig)) return false; - if(!reportFilterContent_.Equals(other.reportFilterContent_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (State != 0) hash ^= State.GetHashCode(); - if (Text.Length != 0) hash ^= Text.GetHashCode(); - if (TextSide.Length != 0) hash ^= TextSide.GetHashCode(); - if (dmSge_ != null) hash ^= DmSge.GetHashCode(); - if (flag_ != null) hash ^= Flag.GetHashCode(); - hash ^= specialDms_.GetHashCode(); - if (CheckBox != false) hash ^= CheckBox.GetHashCode(); - if (Count != 0L) hash ^= Count.GetHashCode(); - hash ^= commandDms_.GetHashCode(); - if (playerConfig_ != null) hash ^= PlayerConfig.GetHashCode(); - hash ^= reportFilterContent_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (State != 0) { - output.WriteRawTag(8); - output.WriteInt32(State); - } - if (Text.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Text); - } - if (TextSide.Length != 0) { - output.WriteRawTag(26); - output.WriteString(TextSide); - } - if (dmSge_ != null) { - output.WriteRawTag(34); - output.WriteMessage(DmSge); - } - if (flag_ != null) { - output.WriteRawTag(42); - output.WriteMessage(Flag); - } - specialDms_.WriteTo(output, _repeated_specialDms_codec); - if (CheckBox != false) { - output.WriteRawTag(56); - output.WriteBool(CheckBox); - } - if (Count != 0L) { - output.WriteRawTag(64); - output.WriteInt64(Count); - } - commandDms_.WriteTo(output, _repeated_commandDms_codec); - if (playerConfig_ != null) { - output.WriteRawTag(82); - output.WriteMessage(PlayerConfig); - } - reportFilterContent_.WriteTo(output, _repeated_reportFilterContent_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (State != 0) { - output.WriteRawTag(8); - output.WriteInt32(State); - } - if (Text.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Text); - } - if (TextSide.Length != 0) { - output.WriteRawTag(26); - output.WriteString(TextSide); - } - if (dmSge_ != null) { - output.WriteRawTag(34); - output.WriteMessage(DmSge); - } - if (flag_ != null) { - output.WriteRawTag(42); - output.WriteMessage(Flag); - } - specialDms_.WriteTo(ref output, _repeated_specialDms_codec); - if (CheckBox != false) { - output.WriteRawTag(56); - output.WriteBool(CheckBox); - } - if (Count != 0L) { - output.WriteRawTag(64); - output.WriteInt64(Count); - } - commandDms_.WriteTo(ref output, _repeated_commandDms_codec); - if (playerConfig_ != null) { - output.WriteRawTag(82); - output.WriteMessage(PlayerConfig); - } - reportFilterContent_.WriteTo(ref output, _repeated_reportFilterContent_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (State != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(State); - } - if (Text.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Text); - } - if (TextSide.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(TextSide); - } - if (dmSge_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(DmSge); - } - if (flag_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Flag); - } - size += specialDms_.CalculateSize(_repeated_specialDms_codec); - if (CheckBox != false) { - size += 1 + 1; - } - if (Count != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Count); - } - size += commandDms_.CalculateSize(_repeated_commandDms_codec); - if (playerConfig_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(PlayerConfig); - } - size += reportFilterContent_.CalculateSize(_repeated_reportFilterContent_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DmWebViewReply other) { - if (other == null) { - return; - } - if (other.State != 0) { - State = other.State; - } - if (other.Text.Length != 0) { - Text = other.Text; - } - if (other.TextSide.Length != 0) { - TextSide = other.TextSide; - } - if (other.dmSge_ != null) { - if (dmSge_ == null) { - DmSge = new global::Bilibili.Community.Service.Dm.V1.DmSegConfig(); - } - DmSge.MergeFrom(other.DmSge); - } - if (other.flag_ != null) { - if (flag_ == null) { - Flag = new global::Bilibili.Community.Service.Dm.V1.DanmakuFlagConfig(); - } - Flag.MergeFrom(other.Flag); - } - specialDms_.Add(other.specialDms_); - if (other.CheckBox != false) { - CheckBox = other.CheckBox; - } - if (other.Count != 0L) { - Count = other.Count; - } - commandDms_.Add(other.commandDms_); - if (other.playerConfig_ != null) { - if (playerConfig_ == null) { - PlayerConfig = new global::Bilibili.Community.Service.Dm.V1.DanmuWebPlayerConfig(); - } - PlayerConfig.MergeFrom(other.PlayerConfig); - } - reportFilterContent_.Add(other.reportFilterContent_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - State = input.ReadInt32(); - break; - } - case 18: { - Text = input.ReadString(); - break; - } - case 26: { - TextSide = input.ReadString(); - break; - } - case 34: { - if (dmSge_ == null) { - DmSge = new global::Bilibili.Community.Service.Dm.V1.DmSegConfig(); - } - input.ReadMessage(DmSge); - break; - } - case 42: { - if (flag_ == null) { - Flag = new global::Bilibili.Community.Service.Dm.V1.DanmakuFlagConfig(); - } - input.ReadMessage(Flag); - break; - } - case 50: { - specialDms_.AddEntriesFrom(input, _repeated_specialDms_codec); - break; - } - case 56: { - CheckBox = input.ReadBool(); - break; - } - case 64: { - Count = input.ReadInt64(); - break; - } - case 74: { - commandDms_.AddEntriesFrom(input, _repeated_commandDms_codec); - break; - } - case 82: { - if (playerConfig_ == null) { - PlayerConfig = new global::Bilibili.Community.Service.Dm.V1.DanmuWebPlayerConfig(); - } - input.ReadMessage(PlayerConfig); - break; - } - case 90: { - reportFilterContent_.AddEntriesFrom(input, _repeated_reportFilterContent_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - State = input.ReadInt32(); - break; - } - case 18: { - Text = input.ReadString(); - break; - } - case 26: { - TextSide = input.ReadString(); - break; - } - case 34: { - if (dmSge_ == null) { - DmSge = new global::Bilibili.Community.Service.Dm.V1.DmSegConfig(); - } - input.ReadMessage(DmSge); - break; - } - case 42: { - if (flag_ == null) { - Flag = new global::Bilibili.Community.Service.Dm.V1.DanmakuFlagConfig(); - } - input.ReadMessage(Flag); - break; - } - case 50: { - specialDms_.AddEntriesFrom(ref input, _repeated_specialDms_codec); - break; - } - case 56: { - CheckBox = input.ReadBool(); - break; - } - case 64: { - Count = input.ReadInt64(); - break; - } - case 74: { - commandDms_.AddEntriesFrom(ref input, _repeated_commandDms_codec); - break; - } - case 82: { - if (playerConfig_ == null) { - PlayerConfig = new global::Bilibili.Community.Service.Dm.V1.DanmuWebPlayerConfig(); - } - input.ReadMessage(PlayerConfig); - break; - } - case 90: { - reportFilterContent_.AddEntriesFrom(ref input, _repeated_reportFilterContent_codec); - break; - } - } - } - } - #endif - - } - - /// - /// 互动弹幕条目信息 - /// - public sealed partial class CommandDm : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CommandDm()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[9]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public CommandDm() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public CommandDm(CommandDm other) : this() { - id_ = other.id_; - oid_ = other.oid_; - mid_ = other.mid_; - command_ = other.command_; - content_ = other.content_; - progress_ = other.progress_; - ctime_ = other.ctime_; - mtime_ = other.mtime_; - extra_ = other.extra_; - idStr_ = other.idStr_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public CommandDm Clone() { - return new CommandDm(this); - } - - /// Field number for the "id" field. - public const int IdFieldNumber = 1; - private long id_; - /// - /// 弹幕id - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Id { - get { return id_; } - set { - id_ = value; - } - } - - /// Field number for the "oid" field. - public const int OidFieldNumber = 2; - private long oid_; - /// - /// 对象视频cid - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Oid { - get { return oid_; } - set { - oid_ = value; - } - } - - /// Field number for the "mid" field. - public const int MidFieldNumber = 3; - private string mid_ = ""; - /// - /// 发送者mid - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Mid { - get { return mid_; } - set { - mid_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "command" field. - public const int CommandFieldNumber = 4; - private string command_ = ""; - /// - /// 互动弹幕指令 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Command { - get { return command_; } - set { - command_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "content" field. - public const int ContentFieldNumber = 5; - private string content_ = ""; - /// - /// 互动弹幕正文 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Content { - get { return content_; } - set { - content_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "progress" field. - public const int ProgressFieldNumber = 6; - private int progress_; - /// - /// 出现时间 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Progress { - get { return progress_; } - set { - progress_ = value; - } - } - - /// Field number for the "ctime" field. - public const int CtimeFieldNumber = 7; - private string ctime_ = ""; - /// - /// 创建时间 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Ctime { - get { return ctime_; } - set { - ctime_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "mtime" field. - public const int MtimeFieldNumber = 8; - private string mtime_ = ""; - /// - /// 发布时间 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Mtime { - get { return mtime_; } - set { - mtime_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "extra" field. - public const int ExtraFieldNumber = 9; - private string extra_ = ""; - /// - /// 扩展json数据 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Extra { - get { return extra_; } - set { - extra_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "idStr" field. - public const int IdStrFieldNumber = 10; - private string idStr_ = ""; - /// - /// 弹幕id str类型 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string IdStr { - get { return idStr_; } - set { - idStr_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as CommandDm); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(CommandDm other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Id != other.Id) return false; - if (Oid != other.Oid) return false; - if (Mid != other.Mid) return false; - if (Command != other.Command) return false; - if (Content != other.Content) return false; - if (Progress != other.Progress) return false; - if (Ctime != other.Ctime) return false; - if (Mtime != other.Mtime) return false; - if (Extra != other.Extra) return false; - if (IdStr != other.IdStr) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Id != 0L) hash ^= Id.GetHashCode(); - if (Oid != 0L) hash ^= Oid.GetHashCode(); - if (Mid.Length != 0) hash ^= Mid.GetHashCode(); - if (Command.Length != 0) hash ^= Command.GetHashCode(); - if (Content.Length != 0) hash ^= Content.GetHashCode(); - if (Progress != 0) hash ^= Progress.GetHashCode(); - if (Ctime.Length != 0) hash ^= Ctime.GetHashCode(); - if (Mtime.Length != 0) hash ^= Mtime.GetHashCode(); - if (Extra.Length != 0) hash ^= Extra.GetHashCode(); - if (IdStr.Length != 0) hash ^= IdStr.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Id != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Id); - } - if (Oid != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Oid); - } - if (Mid.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Mid); - } - if (Command.Length != 0) { - output.WriteRawTag(34); - output.WriteString(Command); - } - if (Content.Length != 0) { - output.WriteRawTag(42); - output.WriteString(Content); - } - if (Progress != 0) { - output.WriteRawTag(48); - output.WriteInt32(Progress); - } - if (Ctime.Length != 0) { - output.WriteRawTag(58); - output.WriteString(Ctime); - } - if (Mtime.Length != 0) { - output.WriteRawTag(66); - output.WriteString(Mtime); - } - if (Extra.Length != 0) { - output.WriteRawTag(74); - output.WriteString(Extra); - } - if (IdStr.Length != 0) { - output.WriteRawTag(82); - output.WriteString(IdStr); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Id != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Id); - } - if (Oid != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Oid); - } - if (Mid.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Mid); - } - if (Command.Length != 0) { - output.WriteRawTag(34); - output.WriteString(Command); - } - if (Content.Length != 0) { - output.WriteRawTag(42); - output.WriteString(Content); - } - if (Progress != 0) { - output.WriteRawTag(48); - output.WriteInt32(Progress); - } - if (Ctime.Length != 0) { - output.WriteRawTag(58); - output.WriteString(Ctime); - } - if (Mtime.Length != 0) { - output.WriteRawTag(66); - output.WriteString(Mtime); - } - if (Extra.Length != 0) { - output.WriteRawTag(74); - output.WriteString(Extra); - } - if (IdStr.Length != 0) { - output.WriteRawTag(82); - output.WriteString(IdStr); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Id != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Id); - } - if (Oid != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Oid); - } - if (Mid.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Mid); - } - if (Command.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Command); - } - if (Content.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Content); - } - if (Progress != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Progress); - } - if (Ctime.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Ctime); - } - if (Mtime.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Mtime); - } - if (Extra.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Extra); - } - if (IdStr.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(IdStr); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(CommandDm other) { - if (other == null) { - return; - } - if (other.Id != 0L) { - Id = other.Id; - } - if (other.Oid != 0L) { - Oid = other.Oid; - } - if (other.Mid.Length != 0) { - Mid = other.Mid; - } - if (other.Command.Length != 0) { - Command = other.Command; - } - if (other.Content.Length != 0) { - Content = other.Content; - } - if (other.Progress != 0) { - Progress = other.Progress; - } - if (other.Ctime.Length != 0) { - Ctime = other.Ctime; - } - if (other.Mtime.Length != 0) { - Mtime = other.Mtime; - } - if (other.Extra.Length != 0) { - Extra = other.Extra; - } - if (other.IdStr.Length != 0) { - IdStr = other.IdStr; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Id = input.ReadInt64(); - break; - } - case 16: { - Oid = input.ReadInt64(); - break; - } - case 26: { - Mid = input.ReadString(); - break; - } - case 34: { - Command = input.ReadString(); - break; - } - case 42: { - Content = input.ReadString(); - break; - } - case 48: { - Progress = input.ReadInt32(); - break; - } - case 58: { - Ctime = input.ReadString(); - break; - } - case 66: { - Mtime = input.ReadString(); - break; - } - case 74: { - Extra = input.ReadString(); - break; - } - case 82: { - IdStr = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Id = input.ReadInt64(); - break; - } - case 16: { - Oid = input.ReadInt64(); - break; - } - case 26: { - Mid = input.ReadString(); - break; - } - case 34: { - Command = input.ReadString(); - break; - } - case 42: { - Content = input.ReadString(); - break; - } - case 48: { - Progress = input.ReadInt32(); - break; - } - case 58: { - Ctime = input.ReadString(); - break; - } - case 66: { - Mtime = input.ReadString(); - break; - } - case 74: { - Extra = input.ReadString(); - break; - } - case 82: { - IdStr = input.ReadString(); - break; - } - } - } - } - #endif - - } - - /// - /// - public sealed partial class DmSegConfig : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DmSegConfig()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[10]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegConfig() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegConfig(DmSegConfig other) : this() { - pageSize_ = other.pageSize_; - total_ = other.total_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmSegConfig Clone() { - return new DmSegConfig(this); - } - - /// Field number for the "page_size" field. - public const int PageSizeFieldNumber = 1; - private long pageSize_; - /// - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long PageSize { - get { return pageSize_; } - set { - pageSize_ = value; - } - } - - /// Field number for the "total" field. - public const int TotalFieldNumber = 2; - private long total_; - /// - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Total { - get { return total_; } - set { - total_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DmSegConfig); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DmSegConfig other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (PageSize != other.PageSize) return false; - if (Total != other.Total) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (PageSize != 0L) hash ^= PageSize.GetHashCode(); - if (Total != 0L) hash ^= Total.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (PageSize != 0L) { - output.WriteRawTag(8); - output.WriteInt64(PageSize); - } - if (Total != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Total); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (PageSize != 0L) { - output.WriteRawTag(8); - output.WriteInt64(PageSize); - } - if (Total != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Total); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (PageSize != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(PageSize); - } - if (Total != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Total); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DmSegConfig other) { - if (other == null) { - return; - } - if (other.PageSize != 0L) { - PageSize = other.PageSize; - } - if (other.Total != 0L) { - Total = other.Total; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - PageSize = input.ReadInt64(); - break; - } - case 16: { - Total = input.ReadInt64(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - PageSize = input.ReadInt64(); - break; - } - case 16: { - Total = input.ReadInt64(); - break; - } - } - } - } - #endif - - } - - /// - /// 智能防挡弹幕蒙版信息 - /// - public sealed partial class VideoMask : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new VideoMask()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[11]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public VideoMask() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public VideoMask(VideoMask other) : this() { - cid_ = other.cid_; - plat_ = other.plat_; - fps_ = other.fps_; - time_ = other.time_; - maskUrl_ = other.maskUrl_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public VideoMask Clone() { - return new VideoMask(this); - } - - /// Field number for the "cid" field. - public const int CidFieldNumber = 1; - private long cid_; - /// - /// 视频cid - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Cid { - get { return cid_; } - set { - cid_ = value; - } - } - - /// Field number for the "plat" field. - public const int PlatFieldNumber = 2; - private int plat_; - /// - /// 平台 - /// 0:web端 1:客户端 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Plat { - get { return plat_; } - set { - plat_ = value; - } - } - - /// Field number for the "fps" field. - public const int FpsFieldNumber = 3; - private int fps_; - /// - /// 帧率 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Fps { - get { return fps_; } - set { - fps_ = value; - } - } - - /// Field number for the "time" field. - public const int TimeFieldNumber = 4; - private long time_; - /// - /// 间隔时间 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Time { - get { return time_; } - set { - time_ = value; - } - } - - /// Field number for the "mask_url" field. - public const int MaskUrlFieldNumber = 5; - private string maskUrl_ = ""; - /// - /// 蒙版url - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string MaskUrl { - get { return maskUrl_; } - set { - maskUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as VideoMask); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(VideoMask other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Cid != other.Cid) return false; - if (Plat != other.Plat) return false; - if (Fps != other.Fps) return false; - if (Time != other.Time) return false; - if (MaskUrl != other.MaskUrl) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Cid != 0L) hash ^= Cid.GetHashCode(); - if (Plat != 0) hash ^= Plat.GetHashCode(); - if (Fps != 0) hash ^= Fps.GetHashCode(); - if (Time != 0L) hash ^= Time.GetHashCode(); - if (MaskUrl.Length != 0) hash ^= MaskUrl.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Cid != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Cid); - } - if (Plat != 0) { - output.WriteRawTag(16); - output.WriteInt32(Plat); - } - if (Fps != 0) { - output.WriteRawTag(24); - output.WriteInt32(Fps); - } - if (Time != 0L) { - output.WriteRawTag(32); - output.WriteInt64(Time); - } - if (MaskUrl.Length != 0) { - output.WriteRawTag(42); - output.WriteString(MaskUrl); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Cid != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Cid); - } - if (Plat != 0) { - output.WriteRawTag(16); - output.WriteInt32(Plat); - } - if (Fps != 0) { - output.WriteRawTag(24); - output.WriteInt32(Fps); - } - if (Time != 0L) { - output.WriteRawTag(32); - output.WriteInt64(Time); - } - if (MaskUrl.Length != 0) { - output.WriteRawTag(42); - output.WriteString(MaskUrl); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Cid != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Cid); - } - if (Plat != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Plat); - } - if (Fps != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Fps); - } - if (Time != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Time); - } - if (MaskUrl.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(MaskUrl); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(VideoMask other) { - if (other == null) { - return; - } - if (other.Cid != 0L) { - Cid = other.Cid; - } - if (other.Plat != 0) { - Plat = other.Plat; - } - if (other.Fps != 0) { - Fps = other.Fps; - } - if (other.Time != 0L) { - Time = other.Time; - } - if (other.MaskUrl.Length != 0) { - MaskUrl = other.MaskUrl; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Cid = input.ReadInt64(); - break; - } - case 16: { - Plat = input.ReadInt32(); - break; - } - case 24: { - Fps = input.ReadInt32(); - break; - } - case 32: { - Time = input.ReadInt64(); - break; - } - case 42: { - MaskUrl = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Cid = input.ReadInt64(); - break; - } - case 16: { - Plat = input.ReadInt32(); - break; - } - case 24: { - Fps = input.ReadInt32(); - break; - } - case 32: { - Time = input.ReadInt64(); - break; - } - case 42: { - MaskUrl = input.ReadString(); - break; - } - } - } - } - #endif - - } - - /// - /// 视频字幕信息 - /// - public sealed partial class VideoSubtitle : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new VideoSubtitle()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[12]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public VideoSubtitle() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public VideoSubtitle(VideoSubtitle other) : this() { - lan_ = other.lan_; - lanDoc_ = other.lanDoc_; - subtitles_ = other.subtitles_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public VideoSubtitle Clone() { - return new VideoSubtitle(this); - } - - /// Field number for the "lan" field. - public const int LanFieldNumber = 1; - private string lan_ = ""; - /// - /// 视频原语言代码 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Lan { - get { return lan_; } - set { - lan_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "lanDoc" field. - public const int LanDocFieldNumber = 2; - private string lanDoc_ = ""; - /// - /// 视频原语言 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string LanDoc { - get { return lanDoc_; } - set { - lanDoc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "subtitles" field. - public const int SubtitlesFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_subtitles_codec - = pb::FieldCodec.ForMessage(26, global::Bilibili.Community.Service.Dm.V1.SubtitleItem.Parser); - private readonly pbc::RepeatedField subtitles_ = new pbc::RepeatedField(); - /// - /// 视频字幕列表 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public pbc::RepeatedField Subtitles { - get { return subtitles_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as VideoSubtitle); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(VideoSubtitle other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Lan != other.Lan) return false; - if (LanDoc != other.LanDoc) return false; - if(!subtitles_.Equals(other.subtitles_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Lan.Length != 0) hash ^= Lan.GetHashCode(); - if (LanDoc.Length != 0) hash ^= LanDoc.GetHashCode(); - hash ^= subtitles_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Lan.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Lan); - } - if (LanDoc.Length != 0) { - output.WriteRawTag(18); - output.WriteString(LanDoc); - } - subtitles_.WriteTo(output, _repeated_subtitles_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Lan.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Lan); - } - if (LanDoc.Length != 0) { - output.WriteRawTag(18); - output.WriteString(LanDoc); - } - subtitles_.WriteTo(ref output, _repeated_subtitles_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Lan.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Lan); - } - if (LanDoc.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(LanDoc); - } - size += subtitles_.CalculateSize(_repeated_subtitles_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(VideoSubtitle other) { - if (other == null) { - return; - } - if (other.Lan.Length != 0) { - Lan = other.Lan; - } - if (other.LanDoc.Length != 0) { - LanDoc = other.LanDoc; - } - subtitles_.Add(other.subtitles_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Lan = input.ReadString(); - break; - } - case 18: { - LanDoc = input.ReadString(); - break; - } - case 26: { - subtitles_.AddEntriesFrom(input, _repeated_subtitles_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Lan = input.ReadString(); - break; - } - case 18: { - LanDoc = input.ReadString(); - break; - } - case 26: { - subtitles_.AddEntriesFrom(ref input, _repeated_subtitles_codec); - break; - } - } - } - } - #endif - - } - - /// - /// web端用户弹幕配置 - /// - public sealed partial class DanmuWebPlayerConfig : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DanmuWebPlayerConfig()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[13]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmuWebPlayerConfig() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmuWebPlayerConfig(DanmuWebPlayerConfig other) : this() { - dmSwitch_ = other.dmSwitch_; - aiSwitch_ = other.aiSwitch_; - aiLevel_ = other.aiLevel_; - blocktop_ = other.blocktop_; - blockscroll_ = other.blockscroll_; - blockbottom_ = other.blockbottom_; - blockcolor_ = other.blockcolor_; - blockspecial_ = other.blockspecial_; - preventshade_ = other.preventshade_; - dmask_ = other.dmask_; - opacity_ = other.opacity_; - dmarea_ = other.dmarea_; - speedplus_ = other.speedplus_; - fontsize_ = other.fontsize_; - screensync_ = other.screensync_; - speedsync_ = other.speedsync_; - fontfamily_ = other.fontfamily_; - bold_ = other.bold_; - fontborder_ = other.fontborder_; - drawType_ = other.drawType_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmuWebPlayerConfig Clone() { - return new DanmuWebPlayerConfig(this); - } - - /// Field number for the "dm_switch" field. - public const int DmSwitchFieldNumber = 1; - private bool dmSwitch_; - /// - /// 是否开启弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool DmSwitch { - get { return dmSwitch_; } - set { - dmSwitch_ = value; - } - } - - /// Field number for the "ai_switch" field. - public const int AiSwitchFieldNumber = 2; - private bool aiSwitch_; - /// - /// 是否开启智能云屏蔽 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool AiSwitch { - get { return aiSwitch_; } - set { - aiSwitch_ = value; - } - } - - /// Field number for the "ai_level" field. - public const int AiLevelFieldNumber = 3; - private int aiLevel_; - /// - /// 智能云屏蔽等级 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int AiLevel { - get { return aiLevel_; } - set { - aiLevel_ = value; - } - } - - /// Field number for the "blocktop" field. - public const int BlocktopFieldNumber = 4; - private bool blocktop_; - /// - /// 是否屏蔽顶端弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Blocktop { - get { return blocktop_; } - set { - blocktop_ = value; - } - } - - /// Field number for the "blockscroll" field. - public const int BlockscrollFieldNumber = 5; - private bool blockscroll_; - /// - /// 是否屏蔽滚动弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Blockscroll { - get { return blockscroll_; } - set { - blockscroll_ = value; - } - } - - /// Field number for the "blockbottom" field. - public const int BlockbottomFieldNumber = 6; - private bool blockbottom_; - /// - /// 是否屏蔽底端弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Blockbottom { - get { return blockbottom_; } - set { - blockbottom_ = value; - } - } - - /// Field number for the "blockcolor" field. - public const int BlockcolorFieldNumber = 7; - private bool blockcolor_; - /// - /// 是否屏蔽彩色弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Blockcolor { - get { return blockcolor_; } - set { - blockcolor_ = value; - } - } - - /// Field number for the "blockspecial" field. - public const int BlockspecialFieldNumber = 8; - private bool blockspecial_; - /// - /// 是否屏蔽重复弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Blockspecial { - get { return blockspecial_; } - set { - blockspecial_ = value; - } - } - - /// Field number for the "preventshade" field. - public const int PreventshadeFieldNumber = 9; - private bool preventshade_; - /// - /// - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Preventshade { - get { return preventshade_; } - set { - preventshade_ = value; - } - } - - /// Field number for the "dmask" field. - public const int DmaskFieldNumber = 10; - private bool dmask_; - /// - /// - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Dmask { - get { return dmask_; } - set { - dmask_ = value; - } - } - - /// Field number for the "opacity" field. - public const int OpacityFieldNumber = 11; - private float opacity_; - /// - /// - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public float Opacity { - get { return opacity_; } - set { - opacity_ = value; - } - } - - /// Field number for the "dmarea" field. - public const int DmareaFieldNumber = 12; - private int dmarea_; - /// - /// - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Dmarea { - get { return dmarea_; } - set { - dmarea_ = value; - } - } - - /// Field number for the "speedplus" field. - public const int SpeedplusFieldNumber = 13; - private float speedplus_; - /// - /// - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public float Speedplus { - get { return speedplus_; } - set { - speedplus_ = value; - } - } - - /// Field number for the "fontsize" field. - public const int FontsizeFieldNumber = 14; - private float fontsize_; - /// - /// 弹幕字号 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public float Fontsize { - get { return fontsize_; } - set { - fontsize_ = value; - } - } - - /// Field number for the "screensync" field. - public const int ScreensyncFieldNumber = 15; - private bool screensync_; - /// - /// - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Screensync { - get { return screensync_; } - set { - screensync_ = value; - } - } - - /// Field number for the "speedsync" field. - public const int SpeedsyncFieldNumber = 16; - private bool speedsync_; - /// - /// - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Speedsync { - get { return speedsync_; } - set { - speedsync_ = value; - } - } - - /// Field number for the "fontfamily" field. - public const int FontfamilyFieldNumber = 17; - private string fontfamily_ = ""; - /// - /// - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Fontfamily { - get { return fontfamily_; } - set { - fontfamily_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "bold" field. - public const int BoldFieldNumber = 18; - private bool bold_; - /// - /// 是否使用加粗 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Bold { - get { return bold_; } - set { - bold_ = value; - } - } - - /// Field number for the "fontborder" field. - public const int FontborderFieldNumber = 19; - private int fontborder_; - /// - /// - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Fontborder { - get { return fontborder_; } - set { - fontborder_ = value; - } - } - - /// Field number for the "draw_type" field. - public const int DrawTypeFieldNumber = 20; - private string drawType_ = ""; - /// - /// 弹幕渲染类型 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string DrawType { - get { return drawType_; } - set { - drawType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DanmuWebPlayerConfig); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DanmuWebPlayerConfig other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (DmSwitch != other.DmSwitch) return false; - if (AiSwitch != other.AiSwitch) return false; - if (AiLevel != other.AiLevel) return false; - if (Blocktop != other.Blocktop) return false; - if (Blockscroll != other.Blockscroll) return false; - if (Blockbottom != other.Blockbottom) return false; - if (Blockcolor != other.Blockcolor) return false; - if (Blockspecial != other.Blockspecial) return false; - if (Preventshade != other.Preventshade) return false; - if (Dmask != other.Dmask) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Opacity, other.Opacity)) return false; - if (Dmarea != other.Dmarea) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Speedplus, other.Speedplus)) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Fontsize, other.Fontsize)) return false; - if (Screensync != other.Screensync) return false; - if (Speedsync != other.Speedsync) return false; - if (Fontfamily != other.Fontfamily) return false; - if (Bold != other.Bold) return false; - if (Fontborder != other.Fontborder) return false; - if (DrawType != other.DrawType) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (DmSwitch != false) hash ^= DmSwitch.GetHashCode(); - if (AiSwitch != false) hash ^= AiSwitch.GetHashCode(); - if (AiLevel != 0) hash ^= AiLevel.GetHashCode(); - if (Blocktop != false) hash ^= Blocktop.GetHashCode(); - if (Blockscroll != false) hash ^= Blockscroll.GetHashCode(); - if (Blockbottom != false) hash ^= Blockbottom.GetHashCode(); - if (Blockcolor != false) hash ^= Blockcolor.GetHashCode(); - if (Blockspecial != false) hash ^= Blockspecial.GetHashCode(); - if (Preventshade != false) hash ^= Preventshade.GetHashCode(); - if (Dmask != false) hash ^= Dmask.GetHashCode(); - if (Opacity != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Opacity); - if (Dmarea != 0) hash ^= Dmarea.GetHashCode(); - if (Speedplus != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Speedplus); - if (Fontsize != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Fontsize); - if (Screensync != false) hash ^= Screensync.GetHashCode(); - if (Speedsync != false) hash ^= Speedsync.GetHashCode(); - if (Fontfamily.Length != 0) hash ^= Fontfamily.GetHashCode(); - if (Bold != false) hash ^= Bold.GetHashCode(); - if (Fontborder != 0) hash ^= Fontborder.GetHashCode(); - if (DrawType.Length != 0) hash ^= DrawType.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (DmSwitch != false) { - output.WriteRawTag(8); - output.WriteBool(DmSwitch); - } - if (AiSwitch != false) { - output.WriteRawTag(16); - output.WriteBool(AiSwitch); - } - if (AiLevel != 0) { - output.WriteRawTag(24); - output.WriteInt32(AiLevel); - } - if (Blocktop != false) { - output.WriteRawTag(32); - output.WriteBool(Blocktop); - } - if (Blockscroll != false) { - output.WriteRawTag(40); - output.WriteBool(Blockscroll); - } - if (Blockbottom != false) { - output.WriteRawTag(48); - output.WriteBool(Blockbottom); - } - if (Blockcolor != false) { - output.WriteRawTag(56); - output.WriteBool(Blockcolor); - } - if (Blockspecial != false) { - output.WriteRawTag(64); - output.WriteBool(Blockspecial); - } - if (Preventshade != false) { - output.WriteRawTag(72); - output.WriteBool(Preventshade); - } - if (Dmask != false) { - output.WriteRawTag(80); - output.WriteBool(Dmask); - } - if (Opacity != 0F) { - output.WriteRawTag(93); - output.WriteFloat(Opacity); - } - if (Dmarea != 0) { - output.WriteRawTag(96); - output.WriteInt32(Dmarea); - } - if (Speedplus != 0F) { - output.WriteRawTag(109); - output.WriteFloat(Speedplus); - } - if (Fontsize != 0F) { - output.WriteRawTag(117); - output.WriteFloat(Fontsize); - } - if (Screensync != false) { - output.WriteRawTag(120); - output.WriteBool(Screensync); - } - if (Speedsync != false) { - output.WriteRawTag(128, 1); - output.WriteBool(Speedsync); - } - if (Fontfamily.Length != 0) { - output.WriteRawTag(138, 1); - output.WriteString(Fontfamily); - } - if (Bold != false) { - output.WriteRawTag(144, 1); - output.WriteBool(Bold); - } - if (Fontborder != 0) { - output.WriteRawTag(152, 1); - output.WriteInt32(Fontborder); - } - if (DrawType.Length != 0) { - output.WriteRawTag(162, 1); - output.WriteString(DrawType); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (DmSwitch != false) { - output.WriteRawTag(8); - output.WriteBool(DmSwitch); - } - if (AiSwitch != false) { - output.WriteRawTag(16); - output.WriteBool(AiSwitch); - } - if (AiLevel != 0) { - output.WriteRawTag(24); - output.WriteInt32(AiLevel); - } - if (Blocktop != false) { - output.WriteRawTag(32); - output.WriteBool(Blocktop); - } - if (Blockscroll != false) { - output.WriteRawTag(40); - output.WriteBool(Blockscroll); - } - if (Blockbottom != false) { - output.WriteRawTag(48); - output.WriteBool(Blockbottom); - } - if (Blockcolor != false) { - output.WriteRawTag(56); - output.WriteBool(Blockcolor); - } - if (Blockspecial != false) { - output.WriteRawTag(64); - output.WriteBool(Blockspecial); - } - if (Preventshade != false) { - output.WriteRawTag(72); - output.WriteBool(Preventshade); - } - if (Dmask != false) { - output.WriteRawTag(80); - output.WriteBool(Dmask); - } - if (Opacity != 0F) { - output.WriteRawTag(93); - output.WriteFloat(Opacity); - } - if (Dmarea != 0) { - output.WriteRawTag(96); - output.WriteInt32(Dmarea); - } - if (Speedplus != 0F) { - output.WriteRawTag(109); - output.WriteFloat(Speedplus); - } - if (Fontsize != 0F) { - output.WriteRawTag(117); - output.WriteFloat(Fontsize); - } - if (Screensync != false) { - output.WriteRawTag(120); - output.WriteBool(Screensync); - } - if (Speedsync != false) { - output.WriteRawTag(128, 1); - output.WriteBool(Speedsync); - } - if (Fontfamily.Length != 0) { - output.WriteRawTag(138, 1); - output.WriteString(Fontfamily); - } - if (Bold != false) { - output.WriteRawTag(144, 1); - output.WriteBool(Bold); - } - if (Fontborder != 0) { - output.WriteRawTag(152, 1); - output.WriteInt32(Fontborder); - } - if (DrawType.Length != 0) { - output.WriteRawTag(162, 1); - output.WriteString(DrawType); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (DmSwitch != false) { - size += 1 + 1; - } - if (AiSwitch != false) { - size += 1 + 1; - } - if (AiLevel != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(AiLevel); - } - if (Blocktop != false) { - size += 1 + 1; - } - if (Blockscroll != false) { - size += 1 + 1; - } - if (Blockbottom != false) { - size += 1 + 1; - } - if (Blockcolor != false) { - size += 1 + 1; - } - if (Blockspecial != false) { - size += 1 + 1; - } - if (Preventshade != false) { - size += 1 + 1; - } - if (Dmask != false) { - size += 1 + 1; - } - if (Opacity != 0F) { - size += 1 + 4; - } - if (Dmarea != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Dmarea); - } - if (Speedplus != 0F) { - size += 1 + 4; - } - if (Fontsize != 0F) { - size += 1 + 4; - } - if (Screensync != false) { - size += 1 + 1; - } - if (Speedsync != false) { - size += 2 + 1; - } - if (Fontfamily.Length != 0) { - size += 2 + pb::CodedOutputStream.ComputeStringSize(Fontfamily); - } - if (Bold != false) { - size += 2 + 1; - } - if (Fontborder != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32Size(Fontborder); - } - if (DrawType.Length != 0) { - size += 2 + pb::CodedOutputStream.ComputeStringSize(DrawType); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DanmuWebPlayerConfig other) { - if (other == null) { - return; - } - if (other.DmSwitch != false) { - DmSwitch = other.DmSwitch; - } - if (other.AiSwitch != false) { - AiSwitch = other.AiSwitch; - } - if (other.AiLevel != 0) { - AiLevel = other.AiLevel; - } - if (other.Blocktop != false) { - Blocktop = other.Blocktop; - } - if (other.Blockscroll != false) { - Blockscroll = other.Blockscroll; - } - if (other.Blockbottom != false) { - Blockbottom = other.Blockbottom; - } - if (other.Blockcolor != false) { - Blockcolor = other.Blockcolor; - } - if (other.Blockspecial != false) { - Blockspecial = other.Blockspecial; - } - if (other.Preventshade != false) { - Preventshade = other.Preventshade; - } - if (other.Dmask != false) { - Dmask = other.Dmask; - } - if (other.Opacity != 0F) { - Opacity = other.Opacity; - } - if (other.Dmarea != 0) { - Dmarea = other.Dmarea; - } - if (other.Speedplus != 0F) { - Speedplus = other.Speedplus; - } - if (other.Fontsize != 0F) { - Fontsize = other.Fontsize; - } - if (other.Screensync != false) { - Screensync = other.Screensync; - } - if (other.Speedsync != false) { - Speedsync = other.Speedsync; - } - if (other.Fontfamily.Length != 0) { - Fontfamily = other.Fontfamily; - } - if (other.Bold != false) { - Bold = other.Bold; - } - if (other.Fontborder != 0) { - Fontborder = other.Fontborder; - } - if (other.DrawType.Length != 0) { - DrawType = other.DrawType; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - DmSwitch = input.ReadBool(); - break; - } - case 16: { - AiSwitch = input.ReadBool(); - break; - } - case 24: { - AiLevel = input.ReadInt32(); - break; - } - case 32: { - Blocktop = input.ReadBool(); - break; - } - case 40: { - Blockscroll = input.ReadBool(); - break; - } - case 48: { - Blockbottom = input.ReadBool(); - break; - } - case 56: { - Blockcolor = input.ReadBool(); - break; - } - case 64: { - Blockspecial = input.ReadBool(); - break; - } - case 72: { - Preventshade = input.ReadBool(); - break; - } - case 80: { - Dmask = input.ReadBool(); - break; - } - case 93: { - Opacity = input.ReadFloat(); - break; - } - case 96: { - Dmarea = input.ReadInt32(); - break; - } - case 109: { - Speedplus = input.ReadFloat(); - break; - } - case 117: { - Fontsize = input.ReadFloat(); - break; - } - case 120: { - Screensync = input.ReadBool(); - break; - } - case 128: { - Speedsync = input.ReadBool(); - break; - } - case 138: { - Fontfamily = input.ReadString(); - break; - } - case 144: { - Bold = input.ReadBool(); - break; - } - case 152: { - Fontborder = input.ReadInt32(); - break; - } - case 162: { - DrawType = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - DmSwitch = input.ReadBool(); - break; - } - case 16: { - AiSwitch = input.ReadBool(); - break; - } - case 24: { - AiLevel = input.ReadInt32(); - break; - } - case 32: { - Blocktop = input.ReadBool(); - break; - } - case 40: { - Blockscroll = input.ReadBool(); - break; - } - case 48: { - Blockbottom = input.ReadBool(); - break; - } - case 56: { - Blockcolor = input.ReadBool(); - break; - } - case 64: { - Blockspecial = input.ReadBool(); - break; - } - case 72: { - Preventshade = input.ReadBool(); - break; - } - case 80: { - Dmask = input.ReadBool(); - break; - } - case 93: { - Opacity = input.ReadFloat(); - break; - } - case 96: { - Dmarea = input.ReadInt32(); - break; - } - case 109: { - Speedplus = input.ReadFloat(); - break; - } - case 117: { - Fontsize = input.ReadFloat(); - break; - } - case 120: { - Screensync = input.ReadBool(); - break; - } - case 128: { - Speedsync = input.ReadBool(); - break; - } - case 138: { - Fontfamily = input.ReadString(); - break; - } - case 144: { - Bold = input.ReadBool(); - break; - } - case 152: { - Fontborder = input.ReadInt32(); - break; - } - case 162: { - DrawType = input.ReadString(); - break; - } - } - } - } - #endif - - } - - /// - /// 单个字幕信息 - /// - public sealed partial class SubtitleItem : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SubtitleItem()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[14]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public SubtitleItem() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public SubtitleItem(SubtitleItem other) : this() { - id_ = other.id_; - idStr_ = other.idStr_; - lan_ = other.lan_; - lanDoc_ = other.lanDoc_; - subtitleUrl_ = other.subtitleUrl_; - author_ = other.author_ != null ? other.author_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public SubtitleItem Clone() { - return new SubtitleItem(this); - } - - /// Field number for the "id" field. - public const int IdFieldNumber = 1; - private long id_; - /// - /// 字幕id - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Id { - get { return id_; } - set { - id_ = value; - } - } - - /// Field number for the "id_str" field. - public const int IdStrFieldNumber = 2; - private string idStr_ = ""; - /// - /// 字幕id str - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string IdStr { - get { return idStr_; } - set { - idStr_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "lan" field. - public const int LanFieldNumber = 3; - private string lan_ = ""; - /// - /// 字幕语言代码 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Lan { - get { return lan_; } - set { - lan_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "lan_doc" field. - public const int LanDocFieldNumber = 4; - private string lanDoc_ = ""; - /// - /// 字幕语言 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string LanDoc { - get { return lanDoc_; } - set { - lanDoc_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "subtitle_url" field. - public const int SubtitleUrlFieldNumber = 5; - private string subtitleUrl_ = ""; - /// - /// 字幕文件url - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string SubtitleUrl { - get { return subtitleUrl_; } - set { - subtitleUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "author" field. - public const int AuthorFieldNumber = 6; - private global::Bilibili.Community.Service.Dm.V1.UserInfo author_; - /// - /// 字幕作者信息 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.UserInfo Author { - get { return author_; } - set { - author_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as SubtitleItem); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(SubtitleItem other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Id != other.Id) return false; - if (IdStr != other.IdStr) return false; - if (Lan != other.Lan) return false; - if (LanDoc != other.LanDoc) return false; - if (SubtitleUrl != other.SubtitleUrl) return false; - if (!object.Equals(Author, other.Author)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Id != 0L) hash ^= Id.GetHashCode(); - if (IdStr.Length != 0) hash ^= IdStr.GetHashCode(); - if (Lan.Length != 0) hash ^= Lan.GetHashCode(); - if (LanDoc.Length != 0) hash ^= LanDoc.GetHashCode(); - if (SubtitleUrl.Length != 0) hash ^= SubtitleUrl.GetHashCode(); - if (author_ != null) hash ^= Author.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Id != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Id); - } - if (IdStr.Length != 0) { - output.WriteRawTag(18); - output.WriteString(IdStr); - } - if (Lan.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Lan); - } - if (LanDoc.Length != 0) { - output.WriteRawTag(34); - output.WriteString(LanDoc); - } - if (SubtitleUrl.Length != 0) { - output.WriteRawTag(42); - output.WriteString(SubtitleUrl); - } - if (author_ != null) { - output.WriteRawTag(50); - output.WriteMessage(Author); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Id != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Id); - } - if (IdStr.Length != 0) { - output.WriteRawTag(18); - output.WriteString(IdStr); - } - if (Lan.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Lan); - } - if (LanDoc.Length != 0) { - output.WriteRawTag(34); - output.WriteString(LanDoc); - } - if (SubtitleUrl.Length != 0) { - output.WriteRawTag(42); - output.WriteString(SubtitleUrl); - } - if (author_ != null) { - output.WriteRawTag(50); - output.WriteMessage(Author); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Id != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Id); - } - if (IdStr.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(IdStr); - } - if (Lan.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Lan); - } - if (LanDoc.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(LanDoc); - } - if (SubtitleUrl.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(SubtitleUrl); - } - if (author_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Author); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(SubtitleItem other) { - if (other == null) { - return; - } - if (other.Id != 0L) { - Id = other.Id; - } - if (other.IdStr.Length != 0) { - IdStr = other.IdStr; - } - if (other.Lan.Length != 0) { - Lan = other.Lan; - } - if (other.LanDoc.Length != 0) { - LanDoc = other.LanDoc; - } - if (other.SubtitleUrl.Length != 0) { - SubtitleUrl = other.SubtitleUrl; - } - if (other.author_ != null) { - if (author_ == null) { - Author = new global::Bilibili.Community.Service.Dm.V1.UserInfo(); - } - Author.MergeFrom(other.Author); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Id = input.ReadInt64(); - break; - } - case 18: { - IdStr = input.ReadString(); - break; - } - case 26: { - Lan = input.ReadString(); - break; - } - case 34: { - LanDoc = input.ReadString(); - break; - } - case 42: { - SubtitleUrl = input.ReadString(); - break; - } - case 50: { - if (author_ == null) { - Author = new global::Bilibili.Community.Service.Dm.V1.UserInfo(); - } - input.ReadMessage(Author); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Id = input.ReadInt64(); - break; - } - case 18: { - IdStr = input.ReadString(); - break; - } - case 26: { - Lan = input.ReadString(); - break; - } - case 34: { - LanDoc = input.ReadString(); - break; - } - case 42: { - SubtitleUrl = input.ReadString(); - break; - } - case 50: { - if (author_ == null) { - Author = new global::Bilibili.Community.Service.Dm.V1.UserInfo(); - } - input.ReadMessage(Author); - break; - } - } - } - } - #endif - - } - - /// - /// 字幕作者信息 - /// - public sealed partial class UserInfo : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UserInfo()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[15]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public UserInfo() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public UserInfo(UserInfo other) : this() { - mid_ = other.mid_; - name_ = other.name_; - sex_ = other.sex_; - face_ = other.face_; - sign_ = other.sign_; - rank_ = other.rank_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public UserInfo Clone() { - return new UserInfo(this); - } - - /// Field number for the "mid" field. - public const int MidFieldNumber = 1; - private long mid_; - /// - /// 用户mid - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Mid { - get { return mid_; } - set { - mid_ = value; - } - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 2; - private string name_ = ""; - /// - /// 用户昵称 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "sex" field. - public const int SexFieldNumber = 3; - private string sex_ = ""; - /// - /// 用户性别 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Sex { - get { return sex_; } - set { - sex_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "face" field. - public const int FaceFieldNumber = 4; - private string face_ = ""; - /// - /// 用户头像url - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Face { - get { return face_; } - set { - face_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "sign" field. - public const int SignFieldNumber = 5; - private string sign_ = ""; - /// - /// 用户签名 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Sign { - get { return sign_; } - set { - sign_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "rank" field. - public const int RankFieldNumber = 6; - private int rank_; - /// - /// 用户等级 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Rank { - get { return rank_; } - set { - rank_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as UserInfo); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(UserInfo other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Mid != other.Mid) return false; - if (Name != other.Name) return false; - if (Sex != other.Sex) return false; - if (Face != other.Face) return false; - if (Sign != other.Sign) return false; - if (Rank != other.Rank) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Mid != 0L) hash ^= Mid.GetHashCode(); - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (Sex.Length != 0) hash ^= Sex.GetHashCode(); - if (Face.Length != 0) hash ^= Face.GetHashCode(); - if (Sign.Length != 0) hash ^= Sign.GetHashCode(); - if (Rank != 0) hash ^= Rank.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Mid != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Mid); - } - if (Name.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Name); - } - if (Sex.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Sex); - } - if (Face.Length != 0) { - output.WriteRawTag(34); - output.WriteString(Face); - } - if (Sign.Length != 0) { - output.WriteRawTag(42); - output.WriteString(Sign); - } - if (Rank != 0) { - output.WriteRawTag(48); - output.WriteInt32(Rank); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Mid != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Mid); - } - if (Name.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Name); - } - if (Sex.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Sex); - } - if (Face.Length != 0) { - output.WriteRawTag(34); - output.WriteString(Face); - } - if (Sign.Length != 0) { - output.WriteRawTag(42); - output.WriteString(Sign); - } - if (Rank != 0) { - output.WriteRawTag(48); - output.WriteInt32(Rank); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Mid != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Mid); - } - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (Sex.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Sex); - } - if (Face.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Face); - } - if (Sign.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Sign); - } - if (Rank != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Rank); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(UserInfo other) { - if (other == null) { - return; - } - if (other.Mid != 0L) { - Mid = other.Mid; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.Sex.Length != 0) { - Sex = other.Sex; - } - if (other.Face.Length != 0) { - Face = other.Face; - } - if (other.Sign.Length != 0) { - Sign = other.Sign; - } - if (other.Rank != 0) { - Rank = other.Rank; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Mid = input.ReadInt64(); - break; - } - case 18: { - Name = input.ReadString(); - break; - } - case 26: { - Sex = input.ReadString(); - break; - } - case 34: { - Face = input.ReadString(); - break; - } - case 42: { - Sign = input.ReadString(); - break; - } - case 48: { - Rank = input.ReadInt32(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Mid = input.ReadInt64(); - break; - } - case 18: { - Name = input.ReadString(); - break; - } - case 26: { - Sex = input.ReadString(); - break; - } - case 34: { - Face = input.ReadString(); - break; - } - case 42: { - Sign = input.ReadString(); - break; - } - case 48: { - Rank = input.ReadInt32(); - break; - } - } - } - } - #endif - - } - - /// - /// 弹幕条目 - /// - public sealed partial class DanmakuElem : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DanmakuElem()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[16]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmakuElem() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmakuElem(DanmakuElem other) : this() { - id_ = other.id_; - progress_ = other.progress_; - mode_ = other.mode_; - fontsize_ = other.fontsize_; - color_ = other.color_; - midHash_ = other.midHash_; - content_ = other.content_; - ctime_ = other.ctime_; - weight_ = other.weight_; - action_ = other.action_; - pool_ = other.pool_; - idStr_ = other.idStr_; - attr_ = other.attr_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmakuElem Clone() { - return new DanmakuElem(this); - } - - /// Field number for the "id" field. - public const int IdFieldNumber = 1; - private long id_; - /// - /// 弹幕dmid - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Id { - get { return id_; } - set { - id_ = value; - } - } - - /// Field number for the "progress" field. - public const int ProgressFieldNumber = 2; - private int progress_; - /// - /// 弹幕出现位置(单位ms) - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Progress { - get { return progress_; } - set { - progress_ = value; - } - } - - /// Field number for the "mode" field. - public const int ModeFieldNumber = 3; - private int mode_; - /// - /// 弹幕类型 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Mode { - get { return mode_; } - set { - mode_ = value; - } - } - - /// Field number for the "fontsize" field. - public const int FontsizeFieldNumber = 4; - private int fontsize_; - /// - /// 弹幕字号 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Fontsize { - get { return fontsize_; } - set { - fontsize_ = value; - } - } - - /// Field number for the "color" field. - public const int ColorFieldNumber = 5; - private uint color_; - /// - /// 弹幕颜色 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public uint Color { - get { return color_; } - set { - color_ = value; - } - } - - /// Field number for the "midHash" field. - public const int MidHashFieldNumber = 6; - private string midHash_ = ""; - /// - /// 发送着mid hash - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string MidHash { - get { return midHash_; } - set { - midHash_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "content" field. - public const int ContentFieldNumber = 7; - private string content_ = ""; - /// - /// 弹幕正文 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Content { - get { return content_; } - set { - content_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "ctime" field. - public const int CtimeFieldNumber = 8; - private long ctime_; - /// - /// 发送时间 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Ctime { - get { return ctime_; } - set { - ctime_ = value; - } - } - - /// Field number for the "weight" field. - public const int WeightFieldNumber = 9; - private int weight_; - /// - /// 权重 区间:[1,10] - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Weight { - get { return weight_; } - set { - weight_ = value; - } - } - - /// Field number for the "action" field. - public const int ActionFieldNumber = 10; - private string action_ = ""; - /// - /// 动作 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Action { - get { return action_; } - set { - action_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "pool" field. - public const int PoolFieldNumber = 11; - private int pool_; - /// - /// 弹幕池 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Pool { - get { return pool_; } - set { - pool_ = value; - } - } - - /// Field number for the "idStr" field. - public const int IdStrFieldNumber = 12; - private string idStr_ = ""; - /// - /// 弹幕dmid str - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string IdStr { - get { return idStr_; } - set { - idStr_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "attr" field. - public const int AttrFieldNumber = 13; - private int attr_; - /// - /// 弹幕属性位(bin求AND) - /// bit0:保护 bit1:直播 bit2:高赞 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Attr { - get { return attr_; } - set { - attr_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DanmakuElem); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DanmakuElem other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Id != other.Id) return false; - if (Progress != other.Progress) return false; - if (Mode != other.Mode) return false; - if (Fontsize != other.Fontsize) return false; - if (Color != other.Color) return false; - if (MidHash != other.MidHash) return false; - if (Content != other.Content) return false; - if (Ctime != other.Ctime) return false; - if (Weight != other.Weight) return false; - if (Action != other.Action) return false; - if (Pool != other.Pool) return false; - if (IdStr != other.IdStr) return false; - if (Attr != other.Attr) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Id != 0L) hash ^= Id.GetHashCode(); - if (Progress != 0) hash ^= Progress.GetHashCode(); - if (Mode != 0) hash ^= Mode.GetHashCode(); - if (Fontsize != 0) hash ^= Fontsize.GetHashCode(); - if (Color != 0) hash ^= Color.GetHashCode(); - if (MidHash.Length != 0) hash ^= MidHash.GetHashCode(); - if (Content.Length != 0) hash ^= Content.GetHashCode(); - if (Ctime != 0L) hash ^= Ctime.GetHashCode(); - if (Weight != 0) hash ^= Weight.GetHashCode(); - if (Action.Length != 0) hash ^= Action.GetHashCode(); - if (Pool != 0) hash ^= Pool.GetHashCode(); - if (IdStr.Length != 0) hash ^= IdStr.GetHashCode(); - if (Attr != 0) hash ^= Attr.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Id != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Id); - } - if (Progress != 0) { - output.WriteRawTag(16); - output.WriteInt32(Progress); - } - if (Mode != 0) { - output.WriteRawTag(24); - output.WriteInt32(Mode); - } - if (Fontsize != 0) { - output.WriteRawTag(32); - output.WriteInt32(Fontsize); - } - if (Color != 0) { - output.WriteRawTag(40); - output.WriteUInt32(Color); - } - if (MidHash.Length != 0) { - output.WriteRawTag(50); - output.WriteString(MidHash); - } - if (Content.Length != 0) { - output.WriteRawTag(58); - output.WriteString(Content); - } - if (Ctime != 0L) { - output.WriteRawTag(64); - output.WriteInt64(Ctime); - } - if (Weight != 0) { - output.WriteRawTag(72); - output.WriteInt32(Weight); - } - if (Action.Length != 0) { - output.WriteRawTag(82); - output.WriteString(Action); - } - if (Pool != 0) { - output.WriteRawTag(88); - output.WriteInt32(Pool); - } - if (IdStr.Length != 0) { - output.WriteRawTag(98); - output.WriteString(IdStr); - } - if (Attr != 0) { - output.WriteRawTag(104); - output.WriteInt32(Attr); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Id != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Id); - } - if (Progress != 0) { - output.WriteRawTag(16); - output.WriteInt32(Progress); - } - if (Mode != 0) { - output.WriteRawTag(24); - output.WriteInt32(Mode); - } - if (Fontsize != 0) { - output.WriteRawTag(32); - output.WriteInt32(Fontsize); - } - if (Color != 0) { - output.WriteRawTag(40); - output.WriteUInt32(Color); - } - if (MidHash.Length != 0) { - output.WriteRawTag(50); - output.WriteString(MidHash); - } - if (Content.Length != 0) { - output.WriteRawTag(58); - output.WriteString(Content); - } - if (Ctime != 0L) { - output.WriteRawTag(64); - output.WriteInt64(Ctime); - } - if (Weight != 0) { - output.WriteRawTag(72); - output.WriteInt32(Weight); - } - if (Action.Length != 0) { - output.WriteRawTag(82); - output.WriteString(Action); - } - if (Pool != 0) { - output.WriteRawTag(88); - output.WriteInt32(Pool); - } - if (IdStr.Length != 0) { - output.WriteRawTag(98); - output.WriteString(IdStr); - } - if (Attr != 0) { - output.WriteRawTag(104); - output.WriteInt32(Attr); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Id != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Id); - } - if (Progress != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Progress); - } - if (Mode != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Mode); - } - if (Fontsize != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Fontsize); - } - if (Color != 0) { - size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Color); - } - if (MidHash.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(MidHash); - } - if (Content.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Content); - } - if (Ctime != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Ctime); - } - if (Weight != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Weight); - } - if (Action.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Action); - } - if (Pool != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Pool); - } - if (IdStr.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(IdStr); - } - if (Attr != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Attr); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DanmakuElem other) { - if (other == null) { - return; - } - if (other.Id != 0L) { - Id = other.Id; - } - if (other.Progress != 0) { - Progress = other.Progress; - } - if (other.Mode != 0) { - Mode = other.Mode; - } - if (other.Fontsize != 0) { - Fontsize = other.Fontsize; - } - if (other.Color != 0) { - Color = other.Color; - } - if (other.MidHash.Length != 0) { - MidHash = other.MidHash; - } - if (other.Content.Length != 0) { - Content = other.Content; - } - if (other.Ctime != 0L) { - Ctime = other.Ctime; - } - if (other.Weight != 0) { - Weight = other.Weight; - } - if (other.Action.Length != 0) { - Action = other.Action; - } - if (other.Pool != 0) { - Pool = other.Pool; - } - if (other.IdStr.Length != 0) { - IdStr = other.IdStr; - } - if (other.Attr != 0) { - Attr = other.Attr; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Id = input.ReadInt64(); - break; - } - case 16: { - Progress = input.ReadInt32(); - break; - } - case 24: { - Mode = input.ReadInt32(); - break; - } - case 32: { - Fontsize = input.ReadInt32(); - break; - } - case 40: { - Color = input.ReadUInt32(); - break; - } - case 50: { - MidHash = input.ReadString(); - break; - } - case 58: { - Content = input.ReadString(); - break; - } - case 64: { - Ctime = input.ReadInt64(); - break; - } - case 72: { - Weight = input.ReadInt32(); - break; - } - case 82: { - Action = input.ReadString(); - break; - } - case 88: { - Pool = input.ReadInt32(); - break; - } - case 98: { - IdStr = input.ReadString(); - break; - } - case 104: { - Attr = input.ReadInt32(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Id = input.ReadInt64(); - break; - } - case 16: { - Progress = input.ReadInt32(); - break; - } - case 24: { - Mode = input.ReadInt32(); - break; - } - case 32: { - Fontsize = input.ReadInt32(); - break; - } - case 40: { - Color = input.ReadUInt32(); - break; - } - case 50: { - MidHash = input.ReadString(); - break; - } - case 58: { - Content = input.ReadString(); - break; - } - case 64: { - Ctime = input.ReadInt64(); - break; - } - case 72: { - Weight = input.ReadInt32(); - break; - } - case 82: { - Action = input.ReadString(); - break; - } - case 88: { - Pool = input.ReadInt32(); - break; - } - case 98: { - IdStr = input.ReadString(); - break; - } - case 104: { - Attr = input.ReadInt32(); - break; - } - } - } - } - #endif - - } - - /// - /// 修改弹幕配置-请求 - /// - public sealed partial class DmPlayerConfigReq : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DmPlayerConfigReq()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[17]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmPlayerConfigReq() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmPlayerConfigReq(DmPlayerConfigReq other) : this() { - ts_ = other.ts_; - switch_ = other.switch_ != null ? other.switch_.Clone() : null; - switchSave_ = other.switchSave_ != null ? other.switchSave_.Clone() : null; - useDefaultConfig_ = other.useDefaultConfig_ != null ? other.useDefaultConfig_.Clone() : null; - aiRecommendedSwitch_ = other.aiRecommendedSwitch_ != null ? other.aiRecommendedSwitch_.Clone() : null; - aiRecommendedLevel_ = other.aiRecommendedLevel_ != null ? other.aiRecommendedLevel_.Clone() : null; - blocktop_ = other.blocktop_ != null ? other.blocktop_.Clone() : null; - blockscroll_ = other.blockscroll_ != null ? other.blockscroll_.Clone() : null; - blockbottom_ = other.blockbottom_ != null ? other.blockbottom_.Clone() : null; - blockcolorful_ = other.blockcolorful_ != null ? other.blockcolorful_.Clone() : null; - blockrepeat_ = other.blockrepeat_ != null ? other.blockrepeat_.Clone() : null; - blockspecial_ = other.blockspecial_ != null ? other.blockspecial_.Clone() : null; - opacity_ = other.opacity_ != null ? other.opacity_.Clone() : null; - scalingfactor_ = other.scalingfactor_ != null ? other.scalingfactor_.Clone() : null; - domain_ = other.domain_ != null ? other.domain_.Clone() : null; - speed_ = other.speed_ != null ? other.speed_.Clone() : null; - enableblocklist_ = other.enableblocklist_ != null ? other.enableblocklist_.Clone() : null; - inlinePlayerDanmakuSwitch_ = other.inlinePlayerDanmakuSwitch_ != null ? other.inlinePlayerDanmakuSwitch_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DmPlayerConfigReq Clone() { - return new DmPlayerConfigReq(this); - } - - /// Field number for the "ts" field. - public const int TsFieldNumber = 1; - private long ts_; - /// - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Ts { - get { return ts_; } - set { - ts_ = value; - } - } - - /// Field number for the "switch" field. - public const int SwitchFieldNumber = 2; - private global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSwitch switch_; - /// - /// 是否开启弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSwitch Switch { - get { return switch_; } - set { - switch_ = value; - } - } - - /// Field number for the "switch_save" field. - public const int SwitchSaveFieldNumber = 3; - private global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSwitchSave switchSave_; - /// - /// 是否记录弹幕开关设置 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSwitchSave SwitchSave { - get { return switchSave_; } - set { - switchSave_ = value; - } - } - - /// Field number for the "use_default_config" field. - public const int UseDefaultConfigFieldNumber = 4; - private global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuUseDefaultConfig useDefaultConfig_; - /// - /// 是否使用推荐弹幕设置 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuUseDefaultConfig UseDefaultConfig { - get { return useDefaultConfig_; } - set { - useDefaultConfig_ = value; - } - } - - /// Field number for the "ai_recommended_switch" field. - public const int AiRecommendedSwitchFieldNumber = 5; - private global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuAiRecommendedSwitch aiRecommendedSwitch_; - /// - /// 是否开启智能云屏蔽 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuAiRecommendedSwitch AiRecommendedSwitch { - get { return aiRecommendedSwitch_; } - set { - aiRecommendedSwitch_ = value; - } - } - - /// Field number for the "ai_recommended_level" field. - public const int AiRecommendedLevelFieldNumber = 6; - private global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuAiRecommendedLevel aiRecommendedLevel_; - /// - /// 智能云屏蔽等级 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuAiRecommendedLevel AiRecommendedLevel { - get { return aiRecommendedLevel_; } - set { - aiRecommendedLevel_ = value; - } - } - - /// Field number for the "blocktop" field. - public const int BlocktopFieldNumber = 7; - private global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlocktop blocktop_; - /// - /// 是否屏蔽顶端弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlocktop Blocktop { - get { return blocktop_; } - set { - blocktop_ = value; - } - } - - /// Field number for the "blockscroll" field. - public const int BlockscrollFieldNumber = 8; - private global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockscroll blockscroll_; - /// - /// 是否屏蔽滚动弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockscroll Blockscroll { - get { return blockscroll_; } - set { - blockscroll_ = value; - } - } - - /// Field number for the "blockbottom" field. - public const int BlockbottomFieldNumber = 9; - private global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockbottom blockbottom_; - /// - /// 是否屏蔽底端弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockbottom Blockbottom { - get { return blockbottom_; } - set { - blockbottom_ = value; - } - } - - /// Field number for the "blockcolorful" field. - public const int BlockcolorfulFieldNumber = 10; - private global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockcolorful blockcolorful_; - /// - /// 是否屏蔽彩色弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockcolorful Blockcolorful { - get { return blockcolorful_; } - set { - blockcolorful_ = value; - } - } - - /// Field number for the "blockrepeat" field. - public const int BlockrepeatFieldNumber = 11; - private global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockrepeat blockrepeat_; - /// - /// 是否屏蔽重复弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockrepeat Blockrepeat { - get { return blockrepeat_; } - set { - blockrepeat_ = value; - } - } - - /// Field number for the "blockspecial" field. - public const int BlockspecialFieldNumber = 12; - private global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockspecial blockspecial_; - /// - /// 是否屏蔽高级弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockspecial Blockspecial { - get { return blockspecial_; } - set { - blockspecial_ = value; - } - } - - /// Field number for the "opacity" field. - public const int OpacityFieldNumber = 13; - private global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuOpacity opacity_; - /// - /// 弹幕不透明度 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuOpacity Opacity { - get { return opacity_; } - set { - opacity_ = value; - } - } - - /// Field number for the "scalingfactor" field. - public const int ScalingfactorFieldNumber = 14; - private global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuScalingfactor scalingfactor_; - /// - /// 弹幕缩放比例 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuScalingfactor Scalingfactor { - get { return scalingfactor_; } - set { - scalingfactor_ = value; - } - } - - /// Field number for the "domain" field. - public const int DomainFieldNumber = 15; - private global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuDomain domain_; - /// - /// 弹幕显示区域 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuDomain Domain { - get { return domain_; } - set { - domain_ = value; - } - } - - /// Field number for the "speed" field. - public const int SpeedFieldNumber = 16; - private global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSpeed speed_; - /// - /// 弹幕速度 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSpeed Speed { - get { return speed_; } - set { - speed_ = value; - } - } - - /// Field number for the "enableblocklist" field. - public const int EnableblocklistFieldNumber = 17; - private global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuEnableblocklist enableblocklist_; - /// - /// 是否开启屏蔽列表 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuEnableblocklist Enableblocklist { - get { return enableblocklist_; } - set { - enableblocklist_ = value; - } - } - - /// Field number for the "inlinePlayerDanmakuSwitch" field. - public const int InlinePlayerDanmakuSwitchFieldNumber = 18; - private global::Bilibili.Community.Service.Dm.V1.InlinePlayerDanmakuSwitch inlinePlayerDanmakuSwitch_; - /// - /// 是否开启弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.InlinePlayerDanmakuSwitch InlinePlayerDanmakuSwitch { - get { return inlinePlayerDanmakuSwitch_; } - set { - inlinePlayerDanmakuSwitch_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DmPlayerConfigReq); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DmPlayerConfigReq other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Ts != other.Ts) return false; - if (!object.Equals(Switch, other.Switch)) return false; - if (!object.Equals(SwitchSave, other.SwitchSave)) return false; - if (!object.Equals(UseDefaultConfig, other.UseDefaultConfig)) return false; - if (!object.Equals(AiRecommendedSwitch, other.AiRecommendedSwitch)) return false; - if (!object.Equals(AiRecommendedLevel, other.AiRecommendedLevel)) return false; - if (!object.Equals(Blocktop, other.Blocktop)) return false; - if (!object.Equals(Blockscroll, other.Blockscroll)) return false; - if (!object.Equals(Blockbottom, other.Blockbottom)) return false; - if (!object.Equals(Blockcolorful, other.Blockcolorful)) return false; - if (!object.Equals(Blockrepeat, other.Blockrepeat)) return false; - if (!object.Equals(Blockspecial, other.Blockspecial)) return false; - if (!object.Equals(Opacity, other.Opacity)) return false; - if (!object.Equals(Scalingfactor, other.Scalingfactor)) return false; - if (!object.Equals(Domain, other.Domain)) return false; - if (!object.Equals(Speed, other.Speed)) return false; - if (!object.Equals(Enableblocklist, other.Enableblocklist)) return false; - if (!object.Equals(InlinePlayerDanmakuSwitch, other.InlinePlayerDanmakuSwitch)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Ts != 0L) hash ^= Ts.GetHashCode(); - if (switch_ != null) hash ^= Switch.GetHashCode(); - if (switchSave_ != null) hash ^= SwitchSave.GetHashCode(); - if (useDefaultConfig_ != null) hash ^= UseDefaultConfig.GetHashCode(); - if (aiRecommendedSwitch_ != null) hash ^= AiRecommendedSwitch.GetHashCode(); - if (aiRecommendedLevel_ != null) hash ^= AiRecommendedLevel.GetHashCode(); - if (blocktop_ != null) hash ^= Blocktop.GetHashCode(); - if (blockscroll_ != null) hash ^= Blockscroll.GetHashCode(); - if (blockbottom_ != null) hash ^= Blockbottom.GetHashCode(); - if (blockcolorful_ != null) hash ^= Blockcolorful.GetHashCode(); - if (blockrepeat_ != null) hash ^= Blockrepeat.GetHashCode(); - if (blockspecial_ != null) hash ^= Blockspecial.GetHashCode(); - if (opacity_ != null) hash ^= Opacity.GetHashCode(); - if (scalingfactor_ != null) hash ^= Scalingfactor.GetHashCode(); - if (domain_ != null) hash ^= Domain.GetHashCode(); - if (speed_ != null) hash ^= Speed.GetHashCode(); - if (enableblocklist_ != null) hash ^= Enableblocklist.GetHashCode(); - if (inlinePlayerDanmakuSwitch_ != null) hash ^= InlinePlayerDanmakuSwitch.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Ts != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Ts); - } - if (switch_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Switch); - } - if (switchSave_ != null) { - output.WriteRawTag(26); - output.WriteMessage(SwitchSave); - } - if (useDefaultConfig_ != null) { - output.WriteRawTag(34); - output.WriteMessage(UseDefaultConfig); - } - if (aiRecommendedSwitch_ != null) { - output.WriteRawTag(42); - output.WriteMessage(AiRecommendedSwitch); - } - if (aiRecommendedLevel_ != null) { - output.WriteRawTag(50); - output.WriteMessage(AiRecommendedLevel); - } - if (blocktop_ != null) { - output.WriteRawTag(58); - output.WriteMessage(Blocktop); - } - if (blockscroll_ != null) { - output.WriteRawTag(66); - output.WriteMessage(Blockscroll); - } - if (blockbottom_ != null) { - output.WriteRawTag(74); - output.WriteMessage(Blockbottom); - } - if (blockcolorful_ != null) { - output.WriteRawTag(82); - output.WriteMessage(Blockcolorful); - } - if (blockrepeat_ != null) { - output.WriteRawTag(90); - output.WriteMessage(Blockrepeat); - } - if (blockspecial_ != null) { - output.WriteRawTag(98); - output.WriteMessage(Blockspecial); - } - if (opacity_ != null) { - output.WriteRawTag(106); - output.WriteMessage(Opacity); - } - if (scalingfactor_ != null) { - output.WriteRawTag(114); - output.WriteMessage(Scalingfactor); - } - if (domain_ != null) { - output.WriteRawTag(122); - output.WriteMessage(Domain); - } - if (speed_ != null) { - output.WriteRawTag(130, 1); - output.WriteMessage(Speed); - } - if (enableblocklist_ != null) { - output.WriteRawTag(138, 1); - output.WriteMessage(Enableblocklist); - } - if (inlinePlayerDanmakuSwitch_ != null) { - output.WriteRawTag(146, 1); - output.WriteMessage(InlinePlayerDanmakuSwitch); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Ts != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Ts); - } - if (switch_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Switch); - } - if (switchSave_ != null) { - output.WriteRawTag(26); - output.WriteMessage(SwitchSave); - } - if (useDefaultConfig_ != null) { - output.WriteRawTag(34); - output.WriteMessage(UseDefaultConfig); - } - if (aiRecommendedSwitch_ != null) { - output.WriteRawTag(42); - output.WriteMessage(AiRecommendedSwitch); - } - if (aiRecommendedLevel_ != null) { - output.WriteRawTag(50); - output.WriteMessage(AiRecommendedLevel); - } - if (blocktop_ != null) { - output.WriteRawTag(58); - output.WriteMessage(Blocktop); - } - if (blockscroll_ != null) { - output.WriteRawTag(66); - output.WriteMessage(Blockscroll); - } - if (blockbottom_ != null) { - output.WriteRawTag(74); - output.WriteMessage(Blockbottom); - } - if (blockcolorful_ != null) { - output.WriteRawTag(82); - output.WriteMessage(Blockcolorful); - } - if (blockrepeat_ != null) { - output.WriteRawTag(90); - output.WriteMessage(Blockrepeat); - } - if (blockspecial_ != null) { - output.WriteRawTag(98); - output.WriteMessage(Blockspecial); - } - if (opacity_ != null) { - output.WriteRawTag(106); - output.WriteMessage(Opacity); - } - if (scalingfactor_ != null) { - output.WriteRawTag(114); - output.WriteMessage(Scalingfactor); - } - if (domain_ != null) { - output.WriteRawTag(122); - output.WriteMessage(Domain); - } - if (speed_ != null) { - output.WriteRawTag(130, 1); - output.WriteMessage(Speed); - } - if (enableblocklist_ != null) { - output.WriteRawTag(138, 1); - output.WriteMessage(Enableblocklist); - } - if (inlinePlayerDanmakuSwitch_ != null) { - output.WriteRawTag(146, 1); - output.WriteMessage(InlinePlayerDanmakuSwitch); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Ts != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Ts); - } - if (switch_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Switch); - } - if (switchSave_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SwitchSave); - } - if (useDefaultConfig_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(UseDefaultConfig); - } - if (aiRecommendedSwitch_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(AiRecommendedSwitch); - } - if (aiRecommendedLevel_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(AiRecommendedLevel); - } - if (blocktop_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Blocktop); - } - if (blockscroll_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Blockscroll); - } - if (blockbottom_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Blockbottom); - } - if (blockcolorful_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Blockcolorful); - } - if (blockrepeat_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Blockrepeat); - } - if (blockspecial_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Blockspecial); - } - if (opacity_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Opacity); - } - if (scalingfactor_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Scalingfactor); - } - if (domain_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Domain); - } - if (speed_ != null) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(Speed); - } - if (enableblocklist_ != null) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(Enableblocklist); - } - if (inlinePlayerDanmakuSwitch_ != null) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(InlinePlayerDanmakuSwitch); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DmPlayerConfigReq other) { - if (other == null) { - return; - } - if (other.Ts != 0L) { - Ts = other.Ts; - } - if (other.switch_ != null) { - if (switch_ == null) { - Switch = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSwitch(); - } - Switch.MergeFrom(other.Switch); - } - if (other.switchSave_ != null) { - if (switchSave_ == null) { - SwitchSave = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSwitchSave(); - } - SwitchSave.MergeFrom(other.SwitchSave); - } - if (other.useDefaultConfig_ != null) { - if (useDefaultConfig_ == null) { - UseDefaultConfig = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuUseDefaultConfig(); - } - UseDefaultConfig.MergeFrom(other.UseDefaultConfig); - } - if (other.aiRecommendedSwitch_ != null) { - if (aiRecommendedSwitch_ == null) { - AiRecommendedSwitch = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuAiRecommendedSwitch(); - } - AiRecommendedSwitch.MergeFrom(other.AiRecommendedSwitch); - } - if (other.aiRecommendedLevel_ != null) { - if (aiRecommendedLevel_ == null) { - AiRecommendedLevel = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuAiRecommendedLevel(); - } - AiRecommendedLevel.MergeFrom(other.AiRecommendedLevel); - } - if (other.blocktop_ != null) { - if (blocktop_ == null) { - Blocktop = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlocktop(); - } - Blocktop.MergeFrom(other.Blocktop); - } - if (other.blockscroll_ != null) { - if (blockscroll_ == null) { - Blockscroll = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockscroll(); - } - Blockscroll.MergeFrom(other.Blockscroll); - } - if (other.blockbottom_ != null) { - if (blockbottom_ == null) { - Blockbottom = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockbottom(); - } - Blockbottom.MergeFrom(other.Blockbottom); - } - if (other.blockcolorful_ != null) { - if (blockcolorful_ == null) { - Blockcolorful = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockcolorful(); - } - Blockcolorful.MergeFrom(other.Blockcolorful); - } - if (other.blockrepeat_ != null) { - if (blockrepeat_ == null) { - Blockrepeat = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockrepeat(); - } - Blockrepeat.MergeFrom(other.Blockrepeat); - } - if (other.blockspecial_ != null) { - if (blockspecial_ == null) { - Blockspecial = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockspecial(); - } - Blockspecial.MergeFrom(other.Blockspecial); - } - if (other.opacity_ != null) { - if (opacity_ == null) { - Opacity = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuOpacity(); - } - Opacity.MergeFrom(other.Opacity); - } - if (other.scalingfactor_ != null) { - if (scalingfactor_ == null) { - Scalingfactor = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuScalingfactor(); - } - Scalingfactor.MergeFrom(other.Scalingfactor); - } - if (other.domain_ != null) { - if (domain_ == null) { - Domain = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuDomain(); - } - Domain.MergeFrom(other.Domain); - } - if (other.speed_ != null) { - if (speed_ == null) { - Speed = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSpeed(); - } - Speed.MergeFrom(other.Speed); - } - if (other.enableblocklist_ != null) { - if (enableblocklist_ == null) { - Enableblocklist = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuEnableblocklist(); - } - Enableblocklist.MergeFrom(other.Enableblocklist); - } - if (other.inlinePlayerDanmakuSwitch_ != null) { - if (inlinePlayerDanmakuSwitch_ == null) { - InlinePlayerDanmakuSwitch = new global::Bilibili.Community.Service.Dm.V1.InlinePlayerDanmakuSwitch(); - } - InlinePlayerDanmakuSwitch.MergeFrom(other.InlinePlayerDanmakuSwitch); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Ts = input.ReadInt64(); - break; - } - case 18: { - if (switch_ == null) { - Switch = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSwitch(); - } - input.ReadMessage(Switch); - break; - } - case 26: { - if (switchSave_ == null) { - SwitchSave = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSwitchSave(); - } - input.ReadMessage(SwitchSave); - break; - } - case 34: { - if (useDefaultConfig_ == null) { - UseDefaultConfig = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuUseDefaultConfig(); - } - input.ReadMessage(UseDefaultConfig); - break; - } - case 42: { - if (aiRecommendedSwitch_ == null) { - AiRecommendedSwitch = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuAiRecommendedSwitch(); - } - input.ReadMessage(AiRecommendedSwitch); - break; - } - case 50: { - if (aiRecommendedLevel_ == null) { - AiRecommendedLevel = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuAiRecommendedLevel(); - } - input.ReadMessage(AiRecommendedLevel); - break; - } - case 58: { - if (blocktop_ == null) { - Blocktop = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlocktop(); - } - input.ReadMessage(Blocktop); - break; - } - case 66: { - if (blockscroll_ == null) { - Blockscroll = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockscroll(); - } - input.ReadMessage(Blockscroll); - break; - } - case 74: { - if (blockbottom_ == null) { - Blockbottom = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockbottom(); - } - input.ReadMessage(Blockbottom); - break; - } - case 82: { - if (blockcolorful_ == null) { - Blockcolorful = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockcolorful(); - } - input.ReadMessage(Blockcolorful); - break; - } - case 90: { - if (blockrepeat_ == null) { - Blockrepeat = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockrepeat(); - } - input.ReadMessage(Blockrepeat); - break; - } - case 98: { - if (blockspecial_ == null) { - Blockspecial = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockspecial(); - } - input.ReadMessage(Blockspecial); - break; - } - case 106: { - if (opacity_ == null) { - Opacity = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuOpacity(); - } - input.ReadMessage(Opacity); - break; - } - case 114: { - if (scalingfactor_ == null) { - Scalingfactor = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuScalingfactor(); - } - input.ReadMessage(Scalingfactor); - break; - } - case 122: { - if (domain_ == null) { - Domain = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuDomain(); - } - input.ReadMessage(Domain); - break; - } - case 130: { - if (speed_ == null) { - Speed = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSpeed(); - } - input.ReadMessage(Speed); - break; - } - case 138: { - if (enableblocklist_ == null) { - Enableblocklist = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuEnableblocklist(); - } - input.ReadMessage(Enableblocklist); - break; - } - case 146: { - if (inlinePlayerDanmakuSwitch_ == null) { - InlinePlayerDanmakuSwitch = new global::Bilibili.Community.Service.Dm.V1.InlinePlayerDanmakuSwitch(); - } - input.ReadMessage(InlinePlayerDanmakuSwitch); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Ts = input.ReadInt64(); - break; - } - case 18: { - if (switch_ == null) { - Switch = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSwitch(); - } - input.ReadMessage(Switch); - break; - } - case 26: { - if (switchSave_ == null) { - SwitchSave = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSwitchSave(); - } - input.ReadMessage(SwitchSave); - break; - } - case 34: { - if (useDefaultConfig_ == null) { - UseDefaultConfig = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuUseDefaultConfig(); - } - input.ReadMessage(UseDefaultConfig); - break; - } - case 42: { - if (aiRecommendedSwitch_ == null) { - AiRecommendedSwitch = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuAiRecommendedSwitch(); - } - input.ReadMessage(AiRecommendedSwitch); - break; - } - case 50: { - if (aiRecommendedLevel_ == null) { - AiRecommendedLevel = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuAiRecommendedLevel(); - } - input.ReadMessage(AiRecommendedLevel); - break; - } - case 58: { - if (blocktop_ == null) { - Blocktop = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlocktop(); - } - input.ReadMessage(Blocktop); - break; - } - case 66: { - if (blockscroll_ == null) { - Blockscroll = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockscroll(); - } - input.ReadMessage(Blockscroll); - break; - } - case 74: { - if (blockbottom_ == null) { - Blockbottom = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockbottom(); - } - input.ReadMessage(Blockbottom); - break; - } - case 82: { - if (blockcolorful_ == null) { - Blockcolorful = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockcolorful(); - } - input.ReadMessage(Blockcolorful); - break; - } - case 90: { - if (blockrepeat_ == null) { - Blockrepeat = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockrepeat(); - } - input.ReadMessage(Blockrepeat); - break; - } - case 98: { - if (blockspecial_ == null) { - Blockspecial = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuBlockspecial(); - } - input.ReadMessage(Blockspecial); - break; - } - case 106: { - if (opacity_ == null) { - Opacity = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuOpacity(); - } - input.ReadMessage(Opacity); - break; - } - case 114: { - if (scalingfactor_ == null) { - Scalingfactor = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuScalingfactor(); - } - input.ReadMessage(Scalingfactor); - break; - } - case 122: { - if (domain_ == null) { - Domain = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuDomain(); - } - input.ReadMessage(Domain); - break; - } - case 130: { - if (speed_ == null) { - Speed = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuSpeed(); - } - input.ReadMessage(Speed); - break; - } - case 138: { - if (enableblocklist_ == null) { - Enableblocklist = new global::Bilibili.Community.Service.Dm.V1.PlayerDanmakuEnableblocklist(); - } - input.ReadMessage(Enableblocklist); - break; - } - case 146: { - if (inlinePlayerDanmakuSwitch_ == null) { - InlinePlayerDanmakuSwitch = new global::Bilibili.Community.Service.Dm.V1.InlinePlayerDanmakuSwitch(); - } - input.ReadMessage(InlinePlayerDanmakuSwitch); - break; - } - } - } - } - #endif - - } - - /// - /// 修改弹幕配置-响应 - /// - public sealed partial class Response : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Response()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[18]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public Response() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public Response(Response other) : this() { - code_ = other.code_; - message_ = other.message_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public Response Clone() { - return new Response(this); - } - - /// Field number for the "code" field. - public const int CodeFieldNumber = 1; - private int code_; - /// - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Code { - get { return code_; } - set { - code_ = value; - } - } - - /// Field number for the "message" field. - public const int MessageFieldNumber = 2; - private string message_ = ""; - /// - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string Message { - get { return message_; } - set { - message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as Response); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(Response other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Code != other.Code) return false; - if (Message != other.Message) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Code != 0) hash ^= Code.GetHashCode(); - if (Message.Length != 0) hash ^= Message.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Code != 0) { - output.WriteRawTag(8); - output.WriteInt32(Code); - } - if (Message.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Message); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Code != 0) { - output.WriteRawTag(8); - output.WriteInt32(Code); - } - if (Message.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Message); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Code != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Code); - } - if (Message.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(Response other) { - if (other == null) { - return; - } - if (other.Code != 0) { - Code = other.Code; - } - if (other.Message.Length != 0) { - Message = other.Message; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Code = input.ReadInt32(); - break; - } - case 18: { - Message = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Code = input.ReadInt32(); - break; - } - case 18: { - Message = input.ReadString(); - break; - } - } - } - } - #endif - - } - - /// - /// 弹幕ai云屏蔽条目 - /// - public sealed partial class DanmakuFlag : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DanmakuFlag()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[19]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmakuFlag() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmakuFlag(DanmakuFlag other) : this() { - dmid_ = other.dmid_; - flag_ = other.flag_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmakuFlag Clone() { - return new DanmakuFlag(this); - } - - /// Field number for the "dmid" field. - public const int DmidFieldNumber = 1; - private long dmid_; - /// - /// 弹幕dmid - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public long Dmid { - get { return dmid_; } - set { - dmid_ = value; - } - } - - /// Field number for the "flag" field. - public const int FlagFieldNumber = 2; - private uint flag_; - /// - /// 评分 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public uint Flag { - get { return flag_; } - set { - flag_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DanmakuFlag); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DanmakuFlag other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Dmid != other.Dmid) return false; - if (Flag != other.Flag) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Dmid != 0L) hash ^= Dmid.GetHashCode(); - if (Flag != 0) hash ^= Flag.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Dmid != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Dmid); - } - if (Flag != 0) { - output.WriteRawTag(16); - output.WriteUInt32(Flag); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Dmid != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Dmid); - } - if (Flag != 0) { - output.WriteRawTag(16); - output.WriteUInt32(Flag); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Dmid != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Dmid); - } - if (Flag != 0) { - size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Flag); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DanmakuFlag other) { - if (other == null) { - return; - } - if (other.Dmid != 0L) { - Dmid = other.Dmid; - } - if (other.Flag != 0) { - Flag = other.Flag; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Dmid = input.ReadInt64(); - break; - } - case 16: { - Flag = input.ReadUInt32(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Dmid = input.ReadInt64(); - break; - } - case 16: { - Flag = input.ReadUInt32(); - break; - } - } - } - } - #endif - - } - - /// - /// 云屏蔽配置信息 - /// - public sealed partial class DanmakuFlagConfig : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DanmakuFlagConfig()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[20]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmakuFlagConfig() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmakuFlagConfig(DanmakuFlagConfig other) : this() { - recFlag_ = other.recFlag_; - recText_ = other.recText_; - recSwitch_ = other.recSwitch_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmakuFlagConfig Clone() { - return new DanmakuFlagConfig(this); - } - - /// Field number for the "rec_flag" field. - public const int RecFlagFieldNumber = 1; - private int recFlag_; - /// - /// 云屏蔽等级 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int RecFlag { - get { return recFlag_; } - set { - recFlag_ = value; - } - } - - /// Field number for the "rec_text" field. - public const int RecTextFieldNumber = 2; - private string recText_ = ""; - /// - /// 云屏蔽文案 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public string RecText { - get { return recText_; } - set { - recText_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "rec_switch" field. - public const int RecSwitchFieldNumber = 3; - private int recSwitch_; - /// - /// 云屏蔽开关 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int RecSwitch { - get { return recSwitch_; } - set { - recSwitch_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DanmakuFlagConfig); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DanmakuFlagConfig other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (RecFlag != other.RecFlag) return false; - if (RecText != other.RecText) return false; - if (RecSwitch != other.RecSwitch) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (RecFlag != 0) hash ^= RecFlag.GetHashCode(); - if (RecText.Length != 0) hash ^= RecText.GetHashCode(); - if (RecSwitch != 0) hash ^= RecSwitch.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (RecFlag != 0) { - output.WriteRawTag(8); - output.WriteInt32(RecFlag); - } - if (RecText.Length != 0) { - output.WriteRawTag(18); - output.WriteString(RecText); - } - if (RecSwitch != 0) { - output.WriteRawTag(24); - output.WriteInt32(RecSwitch); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (RecFlag != 0) { - output.WriteRawTag(8); - output.WriteInt32(RecFlag); - } - if (RecText.Length != 0) { - output.WriteRawTag(18); - output.WriteString(RecText); - } - if (RecSwitch != 0) { - output.WriteRawTag(24); - output.WriteInt32(RecSwitch); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (RecFlag != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(RecFlag); - } - if (RecText.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(RecText); - } - if (RecSwitch != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(RecSwitch); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DanmakuFlagConfig other) { - if (other == null) { - return; - } - if (other.RecFlag != 0) { - RecFlag = other.RecFlag; - } - if (other.RecText.Length != 0) { - RecText = other.RecText; - } - if (other.RecSwitch != 0) { - RecSwitch = other.RecSwitch; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - RecFlag = input.ReadInt32(); - break; - } - case 18: { - RecText = input.ReadString(); - break; - } - case 24: { - RecSwitch = input.ReadInt32(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - RecFlag = input.ReadInt32(); - break; - } - case 18: { - RecText = input.ReadString(); - break; - } - case 24: { - RecSwitch = input.ReadInt32(); - break; - } - } - } - } - #endif - - } - - /// - /// 弹幕ai云屏蔽列表 - /// - public sealed partial class DanmakuAIFlag : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DanmakuAIFlag()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[21]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmakuAIFlag() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmakuAIFlag(DanmakuAIFlag other) : this() { - dmFlags_ = other.dmFlags_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmakuAIFlag Clone() { - return new DanmakuAIFlag(this); - } - - /// Field number for the "dm_flags" field. - public const int DmFlagsFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_dmFlags_codec - = pb::FieldCodec.ForMessage(10, global::Bilibili.Community.Service.Dm.V1.DanmakuFlag.Parser); - private readonly pbc::RepeatedField dmFlags_ = new pbc::RepeatedField(); - /// - /// 弹幕ai云屏蔽条目 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public pbc::RepeatedField DmFlags { - get { return dmFlags_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DanmakuAIFlag); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DanmakuAIFlag other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!dmFlags_.Equals(other.dmFlags_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - hash ^= dmFlags_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - dmFlags_.WriteTo(output, _repeated_dmFlags_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - dmFlags_.WriteTo(ref output, _repeated_dmFlags_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - size += dmFlags_.CalculateSize(_repeated_dmFlags_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DanmakuAIFlag other) { - if (other == null) { - return; - } - dmFlags_.Add(other.dmFlags_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - dmFlags_.AddEntriesFrom(input, _repeated_dmFlags_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - dmFlags_.AddEntriesFrom(ref input, _repeated_dmFlags_codec); - break; - } - } - } - } - #endif - - } - - /// - /// 弹幕配置信息 - /// - public sealed partial class DanmuPlayerViewConfig : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DanmuPlayerViewConfig()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[22]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmuPlayerViewConfig() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmuPlayerViewConfig(DanmuPlayerViewConfig other) : this() { - danmukuDefaultPlayerConfig_ = other.danmukuDefaultPlayerConfig_ != null ? other.danmukuDefaultPlayerConfig_.Clone() : null; - danmukuPlayerConfig_ = other.danmukuPlayerConfig_ != null ? other.danmukuPlayerConfig_.Clone() : null; - danmukuPlayerDynamicConfig_ = other.danmukuPlayerDynamicConfig_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmuPlayerViewConfig Clone() { - return new DanmuPlayerViewConfig(this); - } - - /// Field number for the "danmuku_default_player_config" field. - public const int DanmukuDefaultPlayerConfigFieldNumber = 1; - private global::Bilibili.Community.Service.Dm.V1.DanmuDefaultPlayerConfig danmukuDefaultPlayerConfig_; - /// - /// 弹幕默认配置 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.DanmuDefaultPlayerConfig DanmukuDefaultPlayerConfig { - get { return danmukuDefaultPlayerConfig_; } - set { - danmukuDefaultPlayerConfig_ = value; - } - } - - /// Field number for the "danmuku_player_config" field. - public const int DanmukuPlayerConfigFieldNumber = 2; - private global::Bilibili.Community.Service.Dm.V1.DanmuPlayerConfig danmukuPlayerConfig_; - /// - /// 弹幕用户配置 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::Bilibili.Community.Service.Dm.V1.DanmuPlayerConfig DanmukuPlayerConfig { - get { return danmukuPlayerConfig_; } - set { - danmukuPlayerConfig_ = value; - } - } - - /// Field number for the "danmuku_player_dynamic_config" field. - public const int DanmukuPlayerDynamicConfigFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_danmukuPlayerDynamicConfig_codec - = pb::FieldCodec.ForMessage(26, global::Bilibili.Community.Service.Dm.V1.DanmuPlayerDynamicConfig.Parser); - private readonly pbc::RepeatedField danmukuPlayerDynamicConfig_ = new pbc::RepeatedField(); - /// - /// 弹幕显示区域自动配置列表 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public pbc::RepeatedField DanmukuPlayerDynamicConfig { - get { return danmukuPlayerDynamicConfig_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DanmuPlayerViewConfig); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DanmuPlayerViewConfig other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(DanmukuDefaultPlayerConfig, other.DanmukuDefaultPlayerConfig)) return false; - if (!object.Equals(DanmukuPlayerConfig, other.DanmukuPlayerConfig)) return false; - if(!danmukuPlayerDynamicConfig_.Equals(other.danmukuPlayerDynamicConfig_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (danmukuDefaultPlayerConfig_ != null) hash ^= DanmukuDefaultPlayerConfig.GetHashCode(); - if (danmukuPlayerConfig_ != null) hash ^= DanmukuPlayerConfig.GetHashCode(); - hash ^= danmukuPlayerDynamicConfig_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (danmukuDefaultPlayerConfig_ != null) { - output.WriteRawTag(10); - output.WriteMessage(DanmukuDefaultPlayerConfig); - } - if (danmukuPlayerConfig_ != null) { - output.WriteRawTag(18); - output.WriteMessage(DanmukuPlayerConfig); - } - danmukuPlayerDynamicConfig_.WriteTo(output, _repeated_danmukuPlayerDynamicConfig_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (danmukuDefaultPlayerConfig_ != null) { - output.WriteRawTag(10); - output.WriteMessage(DanmukuDefaultPlayerConfig); - } - if (danmukuPlayerConfig_ != null) { - output.WriteRawTag(18); - output.WriteMessage(DanmukuPlayerConfig); - } - danmukuPlayerDynamicConfig_.WriteTo(ref output, _repeated_danmukuPlayerDynamicConfig_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (danmukuDefaultPlayerConfig_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(DanmukuDefaultPlayerConfig); - } - if (danmukuPlayerConfig_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(DanmukuPlayerConfig); - } - size += danmukuPlayerDynamicConfig_.CalculateSize(_repeated_danmukuPlayerDynamicConfig_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DanmuPlayerViewConfig other) { - if (other == null) { - return; - } - if (other.danmukuDefaultPlayerConfig_ != null) { - if (danmukuDefaultPlayerConfig_ == null) { - DanmukuDefaultPlayerConfig = new global::Bilibili.Community.Service.Dm.V1.DanmuDefaultPlayerConfig(); - } - DanmukuDefaultPlayerConfig.MergeFrom(other.DanmukuDefaultPlayerConfig); - } - if (other.danmukuPlayerConfig_ != null) { - if (danmukuPlayerConfig_ == null) { - DanmukuPlayerConfig = new global::Bilibili.Community.Service.Dm.V1.DanmuPlayerConfig(); - } - DanmukuPlayerConfig.MergeFrom(other.DanmukuPlayerConfig); - } - danmukuPlayerDynamicConfig_.Add(other.danmukuPlayerDynamicConfig_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (danmukuDefaultPlayerConfig_ == null) { - DanmukuDefaultPlayerConfig = new global::Bilibili.Community.Service.Dm.V1.DanmuDefaultPlayerConfig(); - } - input.ReadMessage(DanmukuDefaultPlayerConfig); - break; - } - case 18: { - if (danmukuPlayerConfig_ == null) { - DanmukuPlayerConfig = new global::Bilibili.Community.Service.Dm.V1.DanmuPlayerConfig(); - } - input.ReadMessage(DanmukuPlayerConfig); - break; - } - case 26: { - danmukuPlayerDynamicConfig_.AddEntriesFrom(input, _repeated_danmukuPlayerDynamicConfig_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - if (danmukuDefaultPlayerConfig_ == null) { - DanmukuDefaultPlayerConfig = new global::Bilibili.Community.Service.Dm.V1.DanmuDefaultPlayerConfig(); - } - input.ReadMessage(DanmukuDefaultPlayerConfig); - break; - } - case 18: { - if (danmukuPlayerConfig_ == null) { - DanmukuPlayerConfig = new global::Bilibili.Community.Service.Dm.V1.DanmuPlayerConfig(); - } - input.ReadMessage(DanmukuPlayerConfig); - break; - } - case 26: { - danmukuPlayerDynamicConfig_.AddEntriesFrom(ref input, _repeated_danmukuPlayerDynamicConfig_codec); - break; - } - } - } - } - #endif - - } - - /// - /// 弹幕默认配置 - /// - public sealed partial class DanmuDefaultPlayerConfig : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DanmuDefaultPlayerConfig()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[23]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmuDefaultPlayerConfig() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmuDefaultPlayerConfig(DanmuDefaultPlayerConfig other) : this() { - playerDanmakuUseDefaultConfig_ = other.playerDanmakuUseDefaultConfig_; - playerDanmakuAiRecommendedSwitch_ = other.playerDanmakuAiRecommendedSwitch_; - playerDanmakuAiRecommendedLevel_ = other.playerDanmakuAiRecommendedLevel_; - playerDanmakuBlocktop_ = other.playerDanmakuBlocktop_; - playerDanmakuBlockscroll_ = other.playerDanmakuBlockscroll_; - playerDanmakuBlockbottom_ = other.playerDanmakuBlockbottom_; - playerDanmakuBlockcolorful_ = other.playerDanmakuBlockcolorful_; - playerDanmakuBlockrepeat_ = other.playerDanmakuBlockrepeat_; - playerDanmakuBlockspecial_ = other.playerDanmakuBlockspecial_; - playerDanmakuOpacity_ = other.playerDanmakuOpacity_; - playerDanmakuScalingfactor_ = other.playerDanmakuScalingfactor_; - playerDanmakuDomain_ = other.playerDanmakuDomain_; - playerDanmakuSpeed_ = other.playerDanmakuSpeed_; - inlinePlayerDanmakuSwitch_ = other.inlinePlayerDanmakuSwitch_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmuDefaultPlayerConfig Clone() { - return new DanmuDefaultPlayerConfig(this); - } - - /// Field number for the "player_danmaku_use_default_config" field. - public const int PlayerDanmakuUseDefaultConfigFieldNumber = 1; - private bool playerDanmakuUseDefaultConfig_; - /// - /// 是否使用推荐弹幕设置 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool PlayerDanmakuUseDefaultConfig { - get { return playerDanmakuUseDefaultConfig_; } - set { - playerDanmakuUseDefaultConfig_ = value; - } - } - - /// Field number for the "player_danmaku_ai_recommended_switch" field. - public const int PlayerDanmakuAiRecommendedSwitchFieldNumber = 4; - private bool playerDanmakuAiRecommendedSwitch_; - /// - /// 是否开启智能云屏蔽 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool PlayerDanmakuAiRecommendedSwitch { - get { return playerDanmakuAiRecommendedSwitch_; } - set { - playerDanmakuAiRecommendedSwitch_ = value; - } - } - - /// Field number for the "player_danmaku_ai_recommended_level" field. - public const int PlayerDanmakuAiRecommendedLevelFieldNumber = 5; - private int playerDanmakuAiRecommendedLevel_; - /// - /// 智能云屏蔽等级 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int PlayerDanmakuAiRecommendedLevel { - get { return playerDanmakuAiRecommendedLevel_; } - set { - playerDanmakuAiRecommendedLevel_ = value; - } - } - - /// Field number for the "player_danmaku_blocktop" field. - public const int PlayerDanmakuBlocktopFieldNumber = 6; - private bool playerDanmakuBlocktop_; - /// - /// 是否屏蔽顶端弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool PlayerDanmakuBlocktop { - get { return playerDanmakuBlocktop_; } - set { - playerDanmakuBlocktop_ = value; - } - } - - /// Field number for the "player_danmaku_blockscroll" field. - public const int PlayerDanmakuBlockscrollFieldNumber = 7; - private bool playerDanmakuBlockscroll_; - /// - /// 是否屏蔽滚动弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool PlayerDanmakuBlockscroll { - get { return playerDanmakuBlockscroll_; } - set { - playerDanmakuBlockscroll_ = value; - } - } - - /// Field number for the "player_danmaku_blockbottom" field. - public const int PlayerDanmakuBlockbottomFieldNumber = 8; - private bool playerDanmakuBlockbottom_; - /// - /// 是否屏蔽底端弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool PlayerDanmakuBlockbottom { - get { return playerDanmakuBlockbottom_; } - set { - playerDanmakuBlockbottom_ = value; - } - } - - /// Field number for the "player_danmaku_blockcolorful" field. - public const int PlayerDanmakuBlockcolorfulFieldNumber = 9; - private bool playerDanmakuBlockcolorful_; - /// - /// 是否屏蔽彩色弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool PlayerDanmakuBlockcolorful { - get { return playerDanmakuBlockcolorful_; } - set { - playerDanmakuBlockcolorful_ = value; - } - } - - /// Field number for the "player_danmaku_blockrepeat" field. - public const int PlayerDanmakuBlockrepeatFieldNumber = 10; - private bool playerDanmakuBlockrepeat_; - /// - /// 是否屏蔽重复弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool PlayerDanmakuBlockrepeat { - get { return playerDanmakuBlockrepeat_; } - set { - playerDanmakuBlockrepeat_ = value; - } - } - - /// Field number for the "player_danmaku_blockspecial" field. - public const int PlayerDanmakuBlockspecialFieldNumber = 11; - private bool playerDanmakuBlockspecial_; - /// - /// 是否屏蔽高级弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool PlayerDanmakuBlockspecial { - get { return playerDanmakuBlockspecial_; } - set { - playerDanmakuBlockspecial_ = value; - } - } - - /// Field number for the "player_danmaku_opacity" field. - public const int PlayerDanmakuOpacityFieldNumber = 12; - private float playerDanmakuOpacity_; - /// - /// 弹幕不透明度 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public float PlayerDanmakuOpacity { - get { return playerDanmakuOpacity_; } - set { - playerDanmakuOpacity_ = value; - } - } - - /// Field number for the "player_danmaku_scalingfactor" field. - public const int PlayerDanmakuScalingfactorFieldNumber = 13; - private float playerDanmakuScalingfactor_; - /// - /// 弹幕缩放比例 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public float PlayerDanmakuScalingfactor { - get { return playerDanmakuScalingfactor_; } - set { - playerDanmakuScalingfactor_ = value; - } - } - - /// Field number for the "player_danmaku_domain" field. - public const int PlayerDanmakuDomainFieldNumber = 14; - private float playerDanmakuDomain_; - /// - /// 弹幕显示区域 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public float PlayerDanmakuDomain { - get { return playerDanmakuDomain_; } - set { - playerDanmakuDomain_ = value; - } - } - - /// Field number for the "player_danmaku_speed" field. - public const int PlayerDanmakuSpeedFieldNumber = 15; - private int playerDanmakuSpeed_; - /// - /// 弹幕速度 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int PlayerDanmakuSpeed { - get { return playerDanmakuSpeed_; } - set { - playerDanmakuSpeed_ = value; - } - } - - /// Field number for the "inline_player_danmaku_switch" field. - public const int InlinePlayerDanmakuSwitchFieldNumber = 16; - private bool inlinePlayerDanmakuSwitch_; - /// - /// 是否开启弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool InlinePlayerDanmakuSwitch { - get { return inlinePlayerDanmakuSwitch_; } - set { - inlinePlayerDanmakuSwitch_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DanmuDefaultPlayerConfig); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DanmuDefaultPlayerConfig other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (PlayerDanmakuUseDefaultConfig != other.PlayerDanmakuUseDefaultConfig) return false; - if (PlayerDanmakuAiRecommendedSwitch != other.PlayerDanmakuAiRecommendedSwitch) return false; - if (PlayerDanmakuAiRecommendedLevel != other.PlayerDanmakuAiRecommendedLevel) return false; - if (PlayerDanmakuBlocktop != other.PlayerDanmakuBlocktop) return false; - if (PlayerDanmakuBlockscroll != other.PlayerDanmakuBlockscroll) return false; - if (PlayerDanmakuBlockbottom != other.PlayerDanmakuBlockbottom) return false; - if (PlayerDanmakuBlockcolorful != other.PlayerDanmakuBlockcolorful) return false; - if (PlayerDanmakuBlockrepeat != other.PlayerDanmakuBlockrepeat) return false; - if (PlayerDanmakuBlockspecial != other.PlayerDanmakuBlockspecial) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(PlayerDanmakuOpacity, other.PlayerDanmakuOpacity)) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(PlayerDanmakuScalingfactor, other.PlayerDanmakuScalingfactor)) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(PlayerDanmakuDomain, other.PlayerDanmakuDomain)) return false; - if (PlayerDanmakuSpeed != other.PlayerDanmakuSpeed) return false; - if (InlinePlayerDanmakuSwitch != other.InlinePlayerDanmakuSwitch) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (PlayerDanmakuUseDefaultConfig != false) hash ^= PlayerDanmakuUseDefaultConfig.GetHashCode(); - if (PlayerDanmakuAiRecommendedSwitch != false) hash ^= PlayerDanmakuAiRecommendedSwitch.GetHashCode(); - if (PlayerDanmakuAiRecommendedLevel != 0) hash ^= PlayerDanmakuAiRecommendedLevel.GetHashCode(); - if (PlayerDanmakuBlocktop != false) hash ^= PlayerDanmakuBlocktop.GetHashCode(); - if (PlayerDanmakuBlockscroll != false) hash ^= PlayerDanmakuBlockscroll.GetHashCode(); - if (PlayerDanmakuBlockbottom != false) hash ^= PlayerDanmakuBlockbottom.GetHashCode(); - if (PlayerDanmakuBlockcolorful != false) hash ^= PlayerDanmakuBlockcolorful.GetHashCode(); - if (PlayerDanmakuBlockrepeat != false) hash ^= PlayerDanmakuBlockrepeat.GetHashCode(); - if (PlayerDanmakuBlockspecial != false) hash ^= PlayerDanmakuBlockspecial.GetHashCode(); - if (PlayerDanmakuOpacity != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(PlayerDanmakuOpacity); - if (PlayerDanmakuScalingfactor != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(PlayerDanmakuScalingfactor); - if (PlayerDanmakuDomain != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(PlayerDanmakuDomain); - if (PlayerDanmakuSpeed != 0) hash ^= PlayerDanmakuSpeed.GetHashCode(); - if (InlinePlayerDanmakuSwitch != false) hash ^= InlinePlayerDanmakuSwitch.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (PlayerDanmakuUseDefaultConfig != false) { - output.WriteRawTag(8); - output.WriteBool(PlayerDanmakuUseDefaultConfig); - } - if (PlayerDanmakuAiRecommendedSwitch != false) { - output.WriteRawTag(32); - output.WriteBool(PlayerDanmakuAiRecommendedSwitch); - } - if (PlayerDanmakuAiRecommendedLevel != 0) { - output.WriteRawTag(40); - output.WriteInt32(PlayerDanmakuAiRecommendedLevel); - } - if (PlayerDanmakuBlocktop != false) { - output.WriteRawTag(48); - output.WriteBool(PlayerDanmakuBlocktop); - } - if (PlayerDanmakuBlockscroll != false) { - output.WriteRawTag(56); - output.WriteBool(PlayerDanmakuBlockscroll); - } - if (PlayerDanmakuBlockbottom != false) { - output.WriteRawTag(64); - output.WriteBool(PlayerDanmakuBlockbottom); - } - if (PlayerDanmakuBlockcolorful != false) { - output.WriteRawTag(72); - output.WriteBool(PlayerDanmakuBlockcolorful); - } - if (PlayerDanmakuBlockrepeat != false) { - output.WriteRawTag(80); - output.WriteBool(PlayerDanmakuBlockrepeat); - } - if (PlayerDanmakuBlockspecial != false) { - output.WriteRawTag(88); - output.WriteBool(PlayerDanmakuBlockspecial); - } - if (PlayerDanmakuOpacity != 0F) { - output.WriteRawTag(101); - output.WriteFloat(PlayerDanmakuOpacity); - } - if (PlayerDanmakuScalingfactor != 0F) { - output.WriteRawTag(109); - output.WriteFloat(PlayerDanmakuScalingfactor); - } - if (PlayerDanmakuDomain != 0F) { - output.WriteRawTag(117); - output.WriteFloat(PlayerDanmakuDomain); - } - if (PlayerDanmakuSpeed != 0) { - output.WriteRawTag(120); - output.WriteInt32(PlayerDanmakuSpeed); - } - if (InlinePlayerDanmakuSwitch != false) { - output.WriteRawTag(128, 1); - output.WriteBool(InlinePlayerDanmakuSwitch); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (PlayerDanmakuUseDefaultConfig != false) { - output.WriteRawTag(8); - output.WriteBool(PlayerDanmakuUseDefaultConfig); - } - if (PlayerDanmakuAiRecommendedSwitch != false) { - output.WriteRawTag(32); - output.WriteBool(PlayerDanmakuAiRecommendedSwitch); - } - if (PlayerDanmakuAiRecommendedLevel != 0) { - output.WriteRawTag(40); - output.WriteInt32(PlayerDanmakuAiRecommendedLevel); - } - if (PlayerDanmakuBlocktop != false) { - output.WriteRawTag(48); - output.WriteBool(PlayerDanmakuBlocktop); - } - if (PlayerDanmakuBlockscroll != false) { - output.WriteRawTag(56); - output.WriteBool(PlayerDanmakuBlockscroll); - } - if (PlayerDanmakuBlockbottom != false) { - output.WriteRawTag(64); - output.WriteBool(PlayerDanmakuBlockbottom); - } - if (PlayerDanmakuBlockcolorful != false) { - output.WriteRawTag(72); - output.WriteBool(PlayerDanmakuBlockcolorful); - } - if (PlayerDanmakuBlockrepeat != false) { - output.WriteRawTag(80); - output.WriteBool(PlayerDanmakuBlockrepeat); - } - if (PlayerDanmakuBlockspecial != false) { - output.WriteRawTag(88); - output.WriteBool(PlayerDanmakuBlockspecial); - } - if (PlayerDanmakuOpacity != 0F) { - output.WriteRawTag(101); - output.WriteFloat(PlayerDanmakuOpacity); - } - if (PlayerDanmakuScalingfactor != 0F) { - output.WriteRawTag(109); - output.WriteFloat(PlayerDanmakuScalingfactor); - } - if (PlayerDanmakuDomain != 0F) { - output.WriteRawTag(117); - output.WriteFloat(PlayerDanmakuDomain); - } - if (PlayerDanmakuSpeed != 0) { - output.WriteRawTag(120); - output.WriteInt32(PlayerDanmakuSpeed); - } - if (InlinePlayerDanmakuSwitch != false) { - output.WriteRawTag(128, 1); - output.WriteBool(InlinePlayerDanmakuSwitch); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (PlayerDanmakuUseDefaultConfig != false) { - size += 1 + 1; - } - if (PlayerDanmakuAiRecommendedSwitch != false) { - size += 1 + 1; - } - if (PlayerDanmakuAiRecommendedLevel != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(PlayerDanmakuAiRecommendedLevel); - } - if (PlayerDanmakuBlocktop != false) { - size += 1 + 1; - } - if (PlayerDanmakuBlockscroll != false) { - size += 1 + 1; - } - if (PlayerDanmakuBlockbottom != false) { - size += 1 + 1; - } - if (PlayerDanmakuBlockcolorful != false) { - size += 1 + 1; - } - if (PlayerDanmakuBlockrepeat != false) { - size += 1 + 1; - } - if (PlayerDanmakuBlockspecial != false) { - size += 1 + 1; - } - if (PlayerDanmakuOpacity != 0F) { - size += 1 + 4; - } - if (PlayerDanmakuScalingfactor != 0F) { - size += 1 + 4; - } - if (PlayerDanmakuDomain != 0F) { - size += 1 + 4; - } - if (PlayerDanmakuSpeed != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(PlayerDanmakuSpeed); - } - if (InlinePlayerDanmakuSwitch != false) { - size += 2 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DanmuDefaultPlayerConfig other) { - if (other == null) { - return; - } - if (other.PlayerDanmakuUseDefaultConfig != false) { - PlayerDanmakuUseDefaultConfig = other.PlayerDanmakuUseDefaultConfig; - } - if (other.PlayerDanmakuAiRecommendedSwitch != false) { - PlayerDanmakuAiRecommendedSwitch = other.PlayerDanmakuAiRecommendedSwitch; - } - if (other.PlayerDanmakuAiRecommendedLevel != 0) { - PlayerDanmakuAiRecommendedLevel = other.PlayerDanmakuAiRecommendedLevel; - } - if (other.PlayerDanmakuBlocktop != false) { - PlayerDanmakuBlocktop = other.PlayerDanmakuBlocktop; - } - if (other.PlayerDanmakuBlockscroll != false) { - PlayerDanmakuBlockscroll = other.PlayerDanmakuBlockscroll; - } - if (other.PlayerDanmakuBlockbottom != false) { - PlayerDanmakuBlockbottom = other.PlayerDanmakuBlockbottom; - } - if (other.PlayerDanmakuBlockcolorful != false) { - PlayerDanmakuBlockcolorful = other.PlayerDanmakuBlockcolorful; - } - if (other.PlayerDanmakuBlockrepeat != false) { - PlayerDanmakuBlockrepeat = other.PlayerDanmakuBlockrepeat; - } - if (other.PlayerDanmakuBlockspecial != false) { - PlayerDanmakuBlockspecial = other.PlayerDanmakuBlockspecial; - } - if (other.PlayerDanmakuOpacity != 0F) { - PlayerDanmakuOpacity = other.PlayerDanmakuOpacity; - } - if (other.PlayerDanmakuScalingfactor != 0F) { - PlayerDanmakuScalingfactor = other.PlayerDanmakuScalingfactor; - } - if (other.PlayerDanmakuDomain != 0F) { - PlayerDanmakuDomain = other.PlayerDanmakuDomain; - } - if (other.PlayerDanmakuSpeed != 0) { - PlayerDanmakuSpeed = other.PlayerDanmakuSpeed; - } - if (other.InlinePlayerDanmakuSwitch != false) { - InlinePlayerDanmakuSwitch = other.InlinePlayerDanmakuSwitch; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - PlayerDanmakuUseDefaultConfig = input.ReadBool(); - break; - } - case 32: { - PlayerDanmakuAiRecommendedSwitch = input.ReadBool(); - break; - } - case 40: { - PlayerDanmakuAiRecommendedLevel = input.ReadInt32(); - break; - } - case 48: { - PlayerDanmakuBlocktop = input.ReadBool(); - break; - } - case 56: { - PlayerDanmakuBlockscroll = input.ReadBool(); - break; - } - case 64: { - PlayerDanmakuBlockbottom = input.ReadBool(); - break; - } - case 72: { - PlayerDanmakuBlockcolorful = input.ReadBool(); - break; - } - case 80: { - PlayerDanmakuBlockrepeat = input.ReadBool(); - break; - } - case 88: { - PlayerDanmakuBlockspecial = input.ReadBool(); - break; - } - case 101: { - PlayerDanmakuOpacity = input.ReadFloat(); - break; - } - case 109: { - PlayerDanmakuScalingfactor = input.ReadFloat(); - break; - } - case 117: { - PlayerDanmakuDomain = input.ReadFloat(); - break; - } - case 120: { - PlayerDanmakuSpeed = input.ReadInt32(); - break; - } - case 128: { - InlinePlayerDanmakuSwitch = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - PlayerDanmakuUseDefaultConfig = input.ReadBool(); - break; - } - case 32: { - PlayerDanmakuAiRecommendedSwitch = input.ReadBool(); - break; - } - case 40: { - PlayerDanmakuAiRecommendedLevel = input.ReadInt32(); - break; - } - case 48: { - PlayerDanmakuBlocktop = input.ReadBool(); - break; - } - case 56: { - PlayerDanmakuBlockscroll = input.ReadBool(); - break; - } - case 64: { - PlayerDanmakuBlockbottom = input.ReadBool(); - break; - } - case 72: { - PlayerDanmakuBlockcolorful = input.ReadBool(); - break; - } - case 80: { - PlayerDanmakuBlockrepeat = input.ReadBool(); - break; - } - case 88: { - PlayerDanmakuBlockspecial = input.ReadBool(); - break; - } - case 101: { - PlayerDanmakuOpacity = input.ReadFloat(); - break; - } - case 109: { - PlayerDanmakuScalingfactor = input.ReadFloat(); - break; - } - case 117: { - PlayerDanmakuDomain = input.ReadFloat(); - break; - } - case 120: { - PlayerDanmakuSpeed = input.ReadInt32(); - break; - } - case 128: { - InlinePlayerDanmakuSwitch = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// 弹幕配置 - /// - public sealed partial class DanmuPlayerConfig : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DanmuPlayerConfig()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[24]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmuPlayerConfig() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmuPlayerConfig(DanmuPlayerConfig other) : this() { - playerDanmakuSwitch_ = other.playerDanmakuSwitch_; - playerDanmakuSwitchSave_ = other.playerDanmakuSwitchSave_; - playerDanmakuUseDefaultConfig_ = other.playerDanmakuUseDefaultConfig_; - playerDanmakuAiRecommendedSwitch_ = other.playerDanmakuAiRecommendedSwitch_; - playerDanmakuAiRecommendedLevel_ = other.playerDanmakuAiRecommendedLevel_; - playerDanmakuBlocktop_ = other.playerDanmakuBlocktop_; - playerDanmakuBlockscroll_ = other.playerDanmakuBlockscroll_; - playerDanmakuBlockbottom_ = other.playerDanmakuBlockbottom_; - playerDanmakuBlockcolorful_ = other.playerDanmakuBlockcolorful_; - playerDanmakuBlockrepeat_ = other.playerDanmakuBlockrepeat_; - playerDanmakuBlockspecial_ = other.playerDanmakuBlockspecial_; - playerDanmakuOpacity_ = other.playerDanmakuOpacity_; - playerDanmakuScalingfactor_ = other.playerDanmakuScalingfactor_; - playerDanmakuDomain_ = other.playerDanmakuDomain_; - playerDanmakuSpeed_ = other.playerDanmakuSpeed_; - playerDanmakuEnableblocklist_ = other.playerDanmakuEnableblocklist_; - inlinePlayerDanmakuSwitch_ = other.inlinePlayerDanmakuSwitch_; - inlinePlayerDanmakuConfig_ = other.inlinePlayerDanmakuConfig_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmuPlayerConfig Clone() { - return new DanmuPlayerConfig(this); - } - - /// Field number for the "player_danmaku_switch" field. - public const int PlayerDanmakuSwitchFieldNumber = 1; - private bool playerDanmakuSwitch_; - /// - /// 是否开启弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool PlayerDanmakuSwitch { - get { return playerDanmakuSwitch_; } - set { - playerDanmakuSwitch_ = value; - } - } - - /// Field number for the "player_danmaku_switch_save" field. - public const int PlayerDanmakuSwitchSaveFieldNumber = 2; - private bool playerDanmakuSwitchSave_; - /// - /// 是否记录弹幕开关设置 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool PlayerDanmakuSwitchSave { - get { return playerDanmakuSwitchSave_; } - set { - playerDanmakuSwitchSave_ = value; - } - } - - /// Field number for the "player_danmaku_use_default_config" field. - public const int PlayerDanmakuUseDefaultConfigFieldNumber = 3; - private bool playerDanmakuUseDefaultConfig_; - /// - /// 是否使用推荐弹幕设置 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool PlayerDanmakuUseDefaultConfig { - get { return playerDanmakuUseDefaultConfig_; } - set { - playerDanmakuUseDefaultConfig_ = value; - } - } - - /// Field number for the "player_danmaku_ai_recommended_switch" field. - public const int PlayerDanmakuAiRecommendedSwitchFieldNumber = 4; - private bool playerDanmakuAiRecommendedSwitch_; - /// - /// 是否开启智能云屏蔽 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool PlayerDanmakuAiRecommendedSwitch { - get { return playerDanmakuAiRecommendedSwitch_; } - set { - playerDanmakuAiRecommendedSwitch_ = value; - } - } - - /// Field number for the "player_danmaku_ai_recommended_level" field. - public const int PlayerDanmakuAiRecommendedLevelFieldNumber = 5; - private int playerDanmakuAiRecommendedLevel_; - /// - /// 智能云屏蔽等级 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int PlayerDanmakuAiRecommendedLevel { - get { return playerDanmakuAiRecommendedLevel_; } - set { - playerDanmakuAiRecommendedLevel_ = value; - } - } - - /// Field number for the "player_danmaku_blocktop" field. - public const int PlayerDanmakuBlocktopFieldNumber = 6; - private bool playerDanmakuBlocktop_; - /// - /// 是否屏蔽顶端弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool PlayerDanmakuBlocktop { - get { return playerDanmakuBlocktop_; } - set { - playerDanmakuBlocktop_ = value; - } - } - - /// Field number for the "player_danmaku_blockscroll" field. - public const int PlayerDanmakuBlockscrollFieldNumber = 7; - private bool playerDanmakuBlockscroll_; - /// - /// 是否屏蔽滚动弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool PlayerDanmakuBlockscroll { - get { return playerDanmakuBlockscroll_; } - set { - playerDanmakuBlockscroll_ = value; - } - } - - /// Field number for the "player_danmaku_blockbottom" field. - public const int PlayerDanmakuBlockbottomFieldNumber = 8; - private bool playerDanmakuBlockbottom_; - /// - /// 是否屏蔽底端弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool PlayerDanmakuBlockbottom { - get { return playerDanmakuBlockbottom_; } - set { - playerDanmakuBlockbottom_ = value; - } - } - - /// Field number for the "player_danmaku_blockcolorful" field. - public const int PlayerDanmakuBlockcolorfulFieldNumber = 9; - private bool playerDanmakuBlockcolorful_; - /// - /// 是否屏蔽彩色弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool PlayerDanmakuBlockcolorful { - get { return playerDanmakuBlockcolorful_; } - set { - playerDanmakuBlockcolorful_ = value; - } - } - - /// Field number for the "player_danmaku_blockrepeat" field. - public const int PlayerDanmakuBlockrepeatFieldNumber = 10; - private bool playerDanmakuBlockrepeat_; - /// - /// 是否屏蔽重复弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool PlayerDanmakuBlockrepeat { - get { return playerDanmakuBlockrepeat_; } - set { - playerDanmakuBlockrepeat_ = value; - } - } - - /// Field number for the "player_danmaku_blockspecial" field. - public const int PlayerDanmakuBlockspecialFieldNumber = 11; - private bool playerDanmakuBlockspecial_; - /// - /// 是否屏蔽高级弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool PlayerDanmakuBlockspecial { - get { return playerDanmakuBlockspecial_; } - set { - playerDanmakuBlockspecial_ = value; - } - } - - /// Field number for the "player_danmaku_opacity" field. - public const int PlayerDanmakuOpacityFieldNumber = 12; - private float playerDanmakuOpacity_; - /// - /// 弹幕不透明度 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public float PlayerDanmakuOpacity { - get { return playerDanmakuOpacity_; } - set { - playerDanmakuOpacity_ = value; - } - } - - /// Field number for the "player_danmaku_scalingfactor" field. - public const int PlayerDanmakuScalingfactorFieldNumber = 13; - private float playerDanmakuScalingfactor_; - /// - /// 弹幕缩放比例 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public float PlayerDanmakuScalingfactor { - get { return playerDanmakuScalingfactor_; } - set { - playerDanmakuScalingfactor_ = value; - } - } - - /// Field number for the "player_danmaku_domain" field. - public const int PlayerDanmakuDomainFieldNumber = 14; - private float playerDanmakuDomain_; - /// - /// 弹幕显示区域 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public float PlayerDanmakuDomain { - get { return playerDanmakuDomain_; } - set { - playerDanmakuDomain_ = value; - } - } - - /// Field number for the "player_danmaku_speed" field. - public const int PlayerDanmakuSpeedFieldNumber = 15; - private int playerDanmakuSpeed_; - /// - /// 弹幕速度 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int PlayerDanmakuSpeed { - get { return playerDanmakuSpeed_; } - set { - playerDanmakuSpeed_ = value; - } - } - - /// Field number for the "player_danmaku_enableblocklist" field. - public const int PlayerDanmakuEnableblocklistFieldNumber = 16; - private bool playerDanmakuEnableblocklist_; - /// - /// 是否开启屏蔽列表 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool PlayerDanmakuEnableblocklist { - get { return playerDanmakuEnableblocklist_; } - set { - playerDanmakuEnableblocklist_ = value; - } - } - - /// Field number for the "inline_player_danmaku_switch" field. - public const int InlinePlayerDanmakuSwitchFieldNumber = 17; - private bool inlinePlayerDanmakuSwitch_; - /// - /// 是否开启弹幕 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool InlinePlayerDanmakuSwitch { - get { return inlinePlayerDanmakuSwitch_; } - set { - inlinePlayerDanmakuSwitch_ = value; - } - } - - /// Field number for the "inline_player_danmaku_config" field. - public const int InlinePlayerDanmakuConfigFieldNumber = 18; - private int inlinePlayerDanmakuConfig_; - /// - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int InlinePlayerDanmakuConfig { - get { return inlinePlayerDanmakuConfig_; } - set { - inlinePlayerDanmakuConfig_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DanmuPlayerConfig); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DanmuPlayerConfig other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (PlayerDanmakuSwitch != other.PlayerDanmakuSwitch) return false; - if (PlayerDanmakuSwitchSave != other.PlayerDanmakuSwitchSave) return false; - if (PlayerDanmakuUseDefaultConfig != other.PlayerDanmakuUseDefaultConfig) return false; - if (PlayerDanmakuAiRecommendedSwitch != other.PlayerDanmakuAiRecommendedSwitch) return false; - if (PlayerDanmakuAiRecommendedLevel != other.PlayerDanmakuAiRecommendedLevel) return false; - if (PlayerDanmakuBlocktop != other.PlayerDanmakuBlocktop) return false; - if (PlayerDanmakuBlockscroll != other.PlayerDanmakuBlockscroll) return false; - if (PlayerDanmakuBlockbottom != other.PlayerDanmakuBlockbottom) return false; - if (PlayerDanmakuBlockcolorful != other.PlayerDanmakuBlockcolorful) return false; - if (PlayerDanmakuBlockrepeat != other.PlayerDanmakuBlockrepeat) return false; - if (PlayerDanmakuBlockspecial != other.PlayerDanmakuBlockspecial) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(PlayerDanmakuOpacity, other.PlayerDanmakuOpacity)) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(PlayerDanmakuScalingfactor, other.PlayerDanmakuScalingfactor)) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(PlayerDanmakuDomain, other.PlayerDanmakuDomain)) return false; - if (PlayerDanmakuSpeed != other.PlayerDanmakuSpeed) return false; - if (PlayerDanmakuEnableblocklist != other.PlayerDanmakuEnableblocklist) return false; - if (InlinePlayerDanmakuSwitch != other.InlinePlayerDanmakuSwitch) return false; - if (InlinePlayerDanmakuConfig != other.InlinePlayerDanmakuConfig) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (PlayerDanmakuSwitch != false) hash ^= PlayerDanmakuSwitch.GetHashCode(); - if (PlayerDanmakuSwitchSave != false) hash ^= PlayerDanmakuSwitchSave.GetHashCode(); - if (PlayerDanmakuUseDefaultConfig != false) hash ^= PlayerDanmakuUseDefaultConfig.GetHashCode(); - if (PlayerDanmakuAiRecommendedSwitch != false) hash ^= PlayerDanmakuAiRecommendedSwitch.GetHashCode(); - if (PlayerDanmakuAiRecommendedLevel != 0) hash ^= PlayerDanmakuAiRecommendedLevel.GetHashCode(); - if (PlayerDanmakuBlocktop != false) hash ^= PlayerDanmakuBlocktop.GetHashCode(); - if (PlayerDanmakuBlockscroll != false) hash ^= PlayerDanmakuBlockscroll.GetHashCode(); - if (PlayerDanmakuBlockbottom != false) hash ^= PlayerDanmakuBlockbottom.GetHashCode(); - if (PlayerDanmakuBlockcolorful != false) hash ^= PlayerDanmakuBlockcolorful.GetHashCode(); - if (PlayerDanmakuBlockrepeat != false) hash ^= PlayerDanmakuBlockrepeat.GetHashCode(); - if (PlayerDanmakuBlockspecial != false) hash ^= PlayerDanmakuBlockspecial.GetHashCode(); - if (PlayerDanmakuOpacity != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(PlayerDanmakuOpacity); - if (PlayerDanmakuScalingfactor != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(PlayerDanmakuScalingfactor); - if (PlayerDanmakuDomain != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(PlayerDanmakuDomain); - if (PlayerDanmakuSpeed != 0) hash ^= PlayerDanmakuSpeed.GetHashCode(); - if (PlayerDanmakuEnableblocklist != false) hash ^= PlayerDanmakuEnableblocklist.GetHashCode(); - if (InlinePlayerDanmakuSwitch != false) hash ^= InlinePlayerDanmakuSwitch.GetHashCode(); - if (InlinePlayerDanmakuConfig != 0) hash ^= InlinePlayerDanmakuConfig.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (PlayerDanmakuSwitch != false) { - output.WriteRawTag(8); - output.WriteBool(PlayerDanmakuSwitch); - } - if (PlayerDanmakuSwitchSave != false) { - output.WriteRawTag(16); - output.WriteBool(PlayerDanmakuSwitchSave); - } - if (PlayerDanmakuUseDefaultConfig != false) { - output.WriteRawTag(24); - output.WriteBool(PlayerDanmakuUseDefaultConfig); - } - if (PlayerDanmakuAiRecommendedSwitch != false) { - output.WriteRawTag(32); - output.WriteBool(PlayerDanmakuAiRecommendedSwitch); - } - if (PlayerDanmakuAiRecommendedLevel != 0) { - output.WriteRawTag(40); - output.WriteInt32(PlayerDanmakuAiRecommendedLevel); - } - if (PlayerDanmakuBlocktop != false) { - output.WriteRawTag(48); - output.WriteBool(PlayerDanmakuBlocktop); - } - if (PlayerDanmakuBlockscroll != false) { - output.WriteRawTag(56); - output.WriteBool(PlayerDanmakuBlockscroll); - } - if (PlayerDanmakuBlockbottom != false) { - output.WriteRawTag(64); - output.WriteBool(PlayerDanmakuBlockbottom); - } - if (PlayerDanmakuBlockcolorful != false) { - output.WriteRawTag(72); - output.WriteBool(PlayerDanmakuBlockcolorful); - } - if (PlayerDanmakuBlockrepeat != false) { - output.WriteRawTag(80); - output.WriteBool(PlayerDanmakuBlockrepeat); - } - if (PlayerDanmakuBlockspecial != false) { - output.WriteRawTag(88); - output.WriteBool(PlayerDanmakuBlockspecial); - } - if (PlayerDanmakuOpacity != 0F) { - output.WriteRawTag(101); - output.WriteFloat(PlayerDanmakuOpacity); - } - if (PlayerDanmakuScalingfactor != 0F) { - output.WriteRawTag(109); - output.WriteFloat(PlayerDanmakuScalingfactor); - } - if (PlayerDanmakuDomain != 0F) { - output.WriteRawTag(117); - output.WriteFloat(PlayerDanmakuDomain); - } - if (PlayerDanmakuSpeed != 0) { - output.WriteRawTag(120); - output.WriteInt32(PlayerDanmakuSpeed); - } - if (PlayerDanmakuEnableblocklist != false) { - output.WriteRawTag(128, 1); - output.WriteBool(PlayerDanmakuEnableblocklist); - } - if (InlinePlayerDanmakuSwitch != false) { - output.WriteRawTag(136, 1); - output.WriteBool(InlinePlayerDanmakuSwitch); - } - if (InlinePlayerDanmakuConfig != 0) { - output.WriteRawTag(144, 1); - output.WriteInt32(InlinePlayerDanmakuConfig); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (PlayerDanmakuSwitch != false) { - output.WriteRawTag(8); - output.WriteBool(PlayerDanmakuSwitch); - } - if (PlayerDanmakuSwitchSave != false) { - output.WriteRawTag(16); - output.WriteBool(PlayerDanmakuSwitchSave); - } - if (PlayerDanmakuUseDefaultConfig != false) { - output.WriteRawTag(24); - output.WriteBool(PlayerDanmakuUseDefaultConfig); - } - if (PlayerDanmakuAiRecommendedSwitch != false) { - output.WriteRawTag(32); - output.WriteBool(PlayerDanmakuAiRecommendedSwitch); - } - if (PlayerDanmakuAiRecommendedLevel != 0) { - output.WriteRawTag(40); - output.WriteInt32(PlayerDanmakuAiRecommendedLevel); - } - if (PlayerDanmakuBlocktop != false) { - output.WriteRawTag(48); - output.WriteBool(PlayerDanmakuBlocktop); - } - if (PlayerDanmakuBlockscroll != false) { - output.WriteRawTag(56); - output.WriteBool(PlayerDanmakuBlockscroll); - } - if (PlayerDanmakuBlockbottom != false) { - output.WriteRawTag(64); - output.WriteBool(PlayerDanmakuBlockbottom); - } - if (PlayerDanmakuBlockcolorful != false) { - output.WriteRawTag(72); - output.WriteBool(PlayerDanmakuBlockcolorful); - } - if (PlayerDanmakuBlockrepeat != false) { - output.WriteRawTag(80); - output.WriteBool(PlayerDanmakuBlockrepeat); - } - if (PlayerDanmakuBlockspecial != false) { - output.WriteRawTag(88); - output.WriteBool(PlayerDanmakuBlockspecial); - } - if (PlayerDanmakuOpacity != 0F) { - output.WriteRawTag(101); - output.WriteFloat(PlayerDanmakuOpacity); - } - if (PlayerDanmakuScalingfactor != 0F) { - output.WriteRawTag(109); - output.WriteFloat(PlayerDanmakuScalingfactor); - } - if (PlayerDanmakuDomain != 0F) { - output.WriteRawTag(117); - output.WriteFloat(PlayerDanmakuDomain); - } - if (PlayerDanmakuSpeed != 0) { - output.WriteRawTag(120); - output.WriteInt32(PlayerDanmakuSpeed); - } - if (PlayerDanmakuEnableblocklist != false) { - output.WriteRawTag(128, 1); - output.WriteBool(PlayerDanmakuEnableblocklist); - } - if (InlinePlayerDanmakuSwitch != false) { - output.WriteRawTag(136, 1); - output.WriteBool(InlinePlayerDanmakuSwitch); - } - if (InlinePlayerDanmakuConfig != 0) { - output.WriteRawTag(144, 1); - output.WriteInt32(InlinePlayerDanmakuConfig); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (PlayerDanmakuSwitch != false) { - size += 1 + 1; - } - if (PlayerDanmakuSwitchSave != false) { - size += 1 + 1; - } - if (PlayerDanmakuUseDefaultConfig != false) { - size += 1 + 1; - } - if (PlayerDanmakuAiRecommendedSwitch != false) { - size += 1 + 1; - } - if (PlayerDanmakuAiRecommendedLevel != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(PlayerDanmakuAiRecommendedLevel); - } - if (PlayerDanmakuBlocktop != false) { - size += 1 + 1; - } - if (PlayerDanmakuBlockscroll != false) { - size += 1 + 1; - } - if (PlayerDanmakuBlockbottom != false) { - size += 1 + 1; - } - if (PlayerDanmakuBlockcolorful != false) { - size += 1 + 1; - } - if (PlayerDanmakuBlockrepeat != false) { - size += 1 + 1; - } - if (PlayerDanmakuBlockspecial != false) { - size += 1 + 1; - } - if (PlayerDanmakuOpacity != 0F) { - size += 1 + 4; - } - if (PlayerDanmakuScalingfactor != 0F) { - size += 1 + 4; - } - if (PlayerDanmakuDomain != 0F) { - size += 1 + 4; - } - if (PlayerDanmakuSpeed != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(PlayerDanmakuSpeed); - } - if (PlayerDanmakuEnableblocklist != false) { - size += 2 + 1; - } - if (InlinePlayerDanmakuSwitch != false) { - size += 2 + 1; - } - if (InlinePlayerDanmakuConfig != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32Size(InlinePlayerDanmakuConfig); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DanmuPlayerConfig other) { - if (other == null) { - return; - } - if (other.PlayerDanmakuSwitch != false) { - PlayerDanmakuSwitch = other.PlayerDanmakuSwitch; - } - if (other.PlayerDanmakuSwitchSave != false) { - PlayerDanmakuSwitchSave = other.PlayerDanmakuSwitchSave; - } - if (other.PlayerDanmakuUseDefaultConfig != false) { - PlayerDanmakuUseDefaultConfig = other.PlayerDanmakuUseDefaultConfig; - } - if (other.PlayerDanmakuAiRecommendedSwitch != false) { - PlayerDanmakuAiRecommendedSwitch = other.PlayerDanmakuAiRecommendedSwitch; - } - if (other.PlayerDanmakuAiRecommendedLevel != 0) { - PlayerDanmakuAiRecommendedLevel = other.PlayerDanmakuAiRecommendedLevel; - } - if (other.PlayerDanmakuBlocktop != false) { - PlayerDanmakuBlocktop = other.PlayerDanmakuBlocktop; - } - if (other.PlayerDanmakuBlockscroll != false) { - PlayerDanmakuBlockscroll = other.PlayerDanmakuBlockscroll; - } - if (other.PlayerDanmakuBlockbottom != false) { - PlayerDanmakuBlockbottom = other.PlayerDanmakuBlockbottom; - } - if (other.PlayerDanmakuBlockcolorful != false) { - PlayerDanmakuBlockcolorful = other.PlayerDanmakuBlockcolorful; - } - if (other.PlayerDanmakuBlockrepeat != false) { - PlayerDanmakuBlockrepeat = other.PlayerDanmakuBlockrepeat; - } - if (other.PlayerDanmakuBlockspecial != false) { - PlayerDanmakuBlockspecial = other.PlayerDanmakuBlockspecial; - } - if (other.PlayerDanmakuOpacity != 0F) { - PlayerDanmakuOpacity = other.PlayerDanmakuOpacity; - } - if (other.PlayerDanmakuScalingfactor != 0F) { - PlayerDanmakuScalingfactor = other.PlayerDanmakuScalingfactor; - } - if (other.PlayerDanmakuDomain != 0F) { - PlayerDanmakuDomain = other.PlayerDanmakuDomain; - } - if (other.PlayerDanmakuSpeed != 0) { - PlayerDanmakuSpeed = other.PlayerDanmakuSpeed; - } - if (other.PlayerDanmakuEnableblocklist != false) { - PlayerDanmakuEnableblocklist = other.PlayerDanmakuEnableblocklist; - } - if (other.InlinePlayerDanmakuSwitch != false) { - InlinePlayerDanmakuSwitch = other.InlinePlayerDanmakuSwitch; - } - if (other.InlinePlayerDanmakuConfig != 0) { - InlinePlayerDanmakuConfig = other.InlinePlayerDanmakuConfig; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - PlayerDanmakuSwitch = input.ReadBool(); - break; - } - case 16: { - PlayerDanmakuSwitchSave = input.ReadBool(); - break; - } - case 24: { - PlayerDanmakuUseDefaultConfig = input.ReadBool(); - break; - } - case 32: { - PlayerDanmakuAiRecommendedSwitch = input.ReadBool(); - break; - } - case 40: { - PlayerDanmakuAiRecommendedLevel = input.ReadInt32(); - break; - } - case 48: { - PlayerDanmakuBlocktop = input.ReadBool(); - break; - } - case 56: { - PlayerDanmakuBlockscroll = input.ReadBool(); - break; - } - case 64: { - PlayerDanmakuBlockbottom = input.ReadBool(); - break; - } - case 72: { - PlayerDanmakuBlockcolorful = input.ReadBool(); - break; - } - case 80: { - PlayerDanmakuBlockrepeat = input.ReadBool(); - break; - } - case 88: { - PlayerDanmakuBlockspecial = input.ReadBool(); - break; - } - case 101: { - PlayerDanmakuOpacity = input.ReadFloat(); - break; - } - case 109: { - PlayerDanmakuScalingfactor = input.ReadFloat(); - break; - } - case 117: { - PlayerDanmakuDomain = input.ReadFloat(); - break; - } - case 120: { - PlayerDanmakuSpeed = input.ReadInt32(); - break; - } - case 128: { - PlayerDanmakuEnableblocklist = input.ReadBool(); - break; - } - case 136: { - InlinePlayerDanmakuSwitch = input.ReadBool(); - break; - } - case 144: { - InlinePlayerDanmakuConfig = input.ReadInt32(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - PlayerDanmakuSwitch = input.ReadBool(); - break; - } - case 16: { - PlayerDanmakuSwitchSave = input.ReadBool(); - break; - } - case 24: { - PlayerDanmakuUseDefaultConfig = input.ReadBool(); - break; - } - case 32: { - PlayerDanmakuAiRecommendedSwitch = input.ReadBool(); - break; - } - case 40: { - PlayerDanmakuAiRecommendedLevel = input.ReadInt32(); - break; - } - case 48: { - PlayerDanmakuBlocktop = input.ReadBool(); - break; - } - case 56: { - PlayerDanmakuBlockscroll = input.ReadBool(); - break; - } - case 64: { - PlayerDanmakuBlockbottom = input.ReadBool(); - break; - } - case 72: { - PlayerDanmakuBlockcolorful = input.ReadBool(); - break; - } - case 80: { - PlayerDanmakuBlockrepeat = input.ReadBool(); - break; - } - case 88: { - PlayerDanmakuBlockspecial = input.ReadBool(); - break; - } - case 101: { - PlayerDanmakuOpacity = input.ReadFloat(); - break; - } - case 109: { - PlayerDanmakuScalingfactor = input.ReadFloat(); - break; - } - case 117: { - PlayerDanmakuDomain = input.ReadFloat(); - break; - } - case 120: { - PlayerDanmakuSpeed = input.ReadInt32(); - break; - } - case 128: { - PlayerDanmakuEnableblocklist = input.ReadBool(); - break; - } - case 136: { - InlinePlayerDanmakuSwitch = input.ReadBool(); - break; - } - case 144: { - InlinePlayerDanmakuConfig = input.ReadInt32(); - break; - } - } - } - } - #endif - - } - - /// - /// 弹幕显示区域自动配置 - /// - public sealed partial class DanmuPlayerDynamicConfig : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DanmuPlayerDynamicConfig()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[25]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmuPlayerDynamicConfig() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmuPlayerDynamicConfig(DanmuPlayerDynamicConfig other) : this() { - progress_ = other.progress_; - playerDanmakuDomain_ = other.playerDanmakuDomain_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public DanmuPlayerDynamicConfig Clone() { - return new DanmuPlayerDynamicConfig(this); - } - - /// Field number for the "progress" field. - public const int ProgressFieldNumber = 1; - private int progress_; - /// - /// 时间 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Progress { - get { return progress_; } - set { - progress_ = value; - } - } - - /// Field number for the "player_danmaku_domain" field. - public const int PlayerDanmakuDomainFieldNumber = 2; - private float playerDanmakuDomain_; - /// - /// 弹幕显示区域 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public float PlayerDanmakuDomain { - get { return playerDanmakuDomain_; } - set { - playerDanmakuDomain_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as DanmuPlayerDynamicConfig); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(DanmuPlayerDynamicConfig other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Progress != other.Progress) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(PlayerDanmakuDomain, other.PlayerDanmakuDomain)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Progress != 0) hash ^= Progress.GetHashCode(); - if (PlayerDanmakuDomain != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(PlayerDanmakuDomain); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Progress != 0) { - output.WriteRawTag(8); - output.WriteInt32(Progress); - } - if (PlayerDanmakuDomain != 0F) { - output.WriteRawTag(21); - output.WriteFloat(PlayerDanmakuDomain); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Progress != 0) { - output.WriteRawTag(8); - output.WriteInt32(Progress); - } - if (PlayerDanmakuDomain != 0F) { - output.WriteRawTag(21); - output.WriteFloat(PlayerDanmakuDomain); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Progress != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Progress); - } - if (PlayerDanmakuDomain != 0F) { - size += 1 + 4; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(DanmuPlayerDynamicConfig other) { - if (other == null) { - return; - } - if (other.Progress != 0) { - Progress = other.Progress; - } - if (other.PlayerDanmakuDomain != 0F) { - PlayerDanmakuDomain = other.PlayerDanmakuDomain; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Progress = input.ReadInt32(); - break; - } - case 21: { - PlayerDanmakuDomain = input.ReadFloat(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Progress = input.ReadInt32(); - break; - } - case 21: { - PlayerDanmakuDomain = input.ReadFloat(); - break; - } - } - } - } - #endif - - } - - /// - /// 是否开启弹幕 - /// - public sealed partial class PlayerDanmakuSwitch : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PlayerDanmakuSwitch()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[26]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuSwitch() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuSwitch(PlayerDanmakuSwitch other) : this() { - value_ = other.value_; - canIgnore_ = other.canIgnore_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuSwitch Clone() { - return new PlayerDanmakuSwitch(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private bool value_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Value { - get { return value_; } - set { - value_ = value; - } - } - - /// Field number for the "canIgnore" field. - public const int CanIgnoreFieldNumber = 2; - private bool canIgnore_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool CanIgnore { - get { return canIgnore_; } - set { - canIgnore_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as PlayerDanmakuSwitch); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(PlayerDanmakuSwitch other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - if (CanIgnore != other.CanIgnore) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Value != false) hash ^= Value.GetHashCode(); - if (CanIgnore != false) hash ^= CanIgnore.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (CanIgnore != false) { - output.WriteRawTag(16); - output.WriteBool(CanIgnore); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (CanIgnore != false) { - output.WriteRawTag(16); - output.WriteBool(CanIgnore); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Value != false) { - size += 1 + 1; - } - if (CanIgnore != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(PlayerDanmakuSwitch other) { - if (other == null) { - return; - } - if (other.Value != false) { - Value = other.Value; - } - if (other.CanIgnore != false) { - CanIgnore = other.CanIgnore; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - case 16: { - CanIgnore = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - case 16: { - CanIgnore = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// 是否记录弹幕开关设置 - /// - public sealed partial class PlayerDanmakuSwitchSave : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PlayerDanmakuSwitchSave()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[27]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuSwitchSave() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuSwitchSave(PlayerDanmakuSwitchSave other) : this() { - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuSwitchSave Clone() { - return new PlayerDanmakuSwitchSave(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private bool value_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as PlayerDanmakuSwitchSave); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(PlayerDanmakuSwitchSave other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Value != false) hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Value != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(PlayerDanmakuSwitchSave other) { - if (other == null) { - return; - } - if (other.Value != false) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// 是否使用推荐弹幕设置 - /// - public sealed partial class PlayerDanmakuUseDefaultConfig : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PlayerDanmakuUseDefaultConfig()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[28]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuUseDefaultConfig() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuUseDefaultConfig(PlayerDanmakuUseDefaultConfig other) : this() { - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuUseDefaultConfig Clone() { - return new PlayerDanmakuUseDefaultConfig(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private bool value_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as PlayerDanmakuUseDefaultConfig); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(PlayerDanmakuUseDefaultConfig other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Value != false) hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Value != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(PlayerDanmakuUseDefaultConfig other) { - if (other == null) { - return; - } - if (other.Value != false) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// 是否开启智能云屏蔽 - /// - public sealed partial class PlayerDanmakuAiRecommendedSwitch : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PlayerDanmakuAiRecommendedSwitch()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[29]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuAiRecommendedSwitch() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuAiRecommendedSwitch(PlayerDanmakuAiRecommendedSwitch other) : this() { - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuAiRecommendedSwitch Clone() { - return new PlayerDanmakuAiRecommendedSwitch(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private bool value_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as PlayerDanmakuAiRecommendedSwitch); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(PlayerDanmakuAiRecommendedSwitch other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Value != false) hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Value != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(PlayerDanmakuAiRecommendedSwitch other) { - if (other == null) { - return; - } - if (other.Value != false) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// 智能云屏蔽等级 - /// - public sealed partial class PlayerDanmakuAiRecommendedLevel : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PlayerDanmakuAiRecommendedLevel()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[30]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuAiRecommendedLevel() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuAiRecommendedLevel(PlayerDanmakuAiRecommendedLevel other) : this() { - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuAiRecommendedLevel Clone() { - return new PlayerDanmakuAiRecommendedLevel(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private bool value_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as PlayerDanmakuAiRecommendedLevel); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(PlayerDanmakuAiRecommendedLevel other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Value != false) hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Value != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(PlayerDanmakuAiRecommendedLevel other) { - if (other == null) { - return; - } - if (other.Value != false) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// 是否屏蔽顶端弹幕 - /// - public sealed partial class PlayerDanmakuBlocktop : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PlayerDanmakuBlocktop()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[31]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuBlocktop() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuBlocktop(PlayerDanmakuBlocktop other) : this() { - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuBlocktop Clone() { - return new PlayerDanmakuBlocktop(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private bool value_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as PlayerDanmakuBlocktop); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(PlayerDanmakuBlocktop other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Value != false) hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Value != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(PlayerDanmakuBlocktop other) { - if (other == null) { - return; - } - if (other.Value != false) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// 是否屏蔽滚动弹幕 - /// - public sealed partial class PlayerDanmakuBlockscroll : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PlayerDanmakuBlockscroll()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[32]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuBlockscroll() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuBlockscroll(PlayerDanmakuBlockscroll other) : this() { - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuBlockscroll Clone() { - return new PlayerDanmakuBlockscroll(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private bool value_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as PlayerDanmakuBlockscroll); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(PlayerDanmakuBlockscroll other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Value != false) hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Value != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(PlayerDanmakuBlockscroll other) { - if (other == null) { - return; - } - if (other.Value != false) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// 是否屏蔽底端弹幕 - /// - public sealed partial class PlayerDanmakuBlockbottom : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PlayerDanmakuBlockbottom()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[33]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuBlockbottom() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuBlockbottom(PlayerDanmakuBlockbottom other) : this() { - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuBlockbottom Clone() { - return new PlayerDanmakuBlockbottom(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private bool value_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as PlayerDanmakuBlockbottom); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(PlayerDanmakuBlockbottom other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Value != false) hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Value != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(PlayerDanmakuBlockbottom other) { - if (other == null) { - return; - } - if (other.Value != false) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// 是否屏蔽彩色弹幕 - /// - public sealed partial class PlayerDanmakuBlockcolorful : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PlayerDanmakuBlockcolorful()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[34]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuBlockcolorful() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuBlockcolorful(PlayerDanmakuBlockcolorful other) : this() { - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuBlockcolorful Clone() { - return new PlayerDanmakuBlockcolorful(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private bool value_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as PlayerDanmakuBlockcolorful); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(PlayerDanmakuBlockcolorful other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Value != false) hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Value != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(PlayerDanmakuBlockcolorful other) { - if (other == null) { - return; - } - if (other.Value != false) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// 是否屏蔽重复弹幕 - /// - public sealed partial class PlayerDanmakuBlockrepeat : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PlayerDanmakuBlockrepeat()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[35]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuBlockrepeat() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuBlockrepeat(PlayerDanmakuBlockrepeat other) : this() { - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuBlockrepeat Clone() { - return new PlayerDanmakuBlockrepeat(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private bool value_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as PlayerDanmakuBlockrepeat); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(PlayerDanmakuBlockrepeat other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Value != false) hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Value != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(PlayerDanmakuBlockrepeat other) { - if (other == null) { - return; - } - if (other.Value != false) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// 是否屏蔽高级弹幕 - /// - public sealed partial class PlayerDanmakuBlockspecial : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PlayerDanmakuBlockspecial()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[36]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuBlockspecial() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuBlockspecial(PlayerDanmakuBlockspecial other) : this() { - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuBlockspecial Clone() { - return new PlayerDanmakuBlockspecial(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private bool value_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as PlayerDanmakuBlockspecial); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(PlayerDanmakuBlockspecial other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Value != false) hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Value != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(PlayerDanmakuBlockspecial other) { - if (other == null) { - return; - } - if (other.Value != false) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// 弹幕不透明度 - /// - public sealed partial class PlayerDanmakuOpacity : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PlayerDanmakuOpacity()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[37]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuOpacity() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuOpacity(PlayerDanmakuOpacity other) : this() { - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuOpacity Clone() { - return new PlayerDanmakuOpacity(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private float value_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public float Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as PlayerDanmakuOpacity); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(PlayerDanmakuOpacity other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Value, other.Value)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Value != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Value); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Value != 0F) { - output.WriteRawTag(13); - output.WriteFloat(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Value != 0F) { - output.WriteRawTag(13); - output.WriteFloat(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Value != 0F) { - size += 1 + 4; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(PlayerDanmakuOpacity other) { - if (other == null) { - return; - } - if (other.Value != 0F) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 13: { - Value = input.ReadFloat(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 13: { - Value = input.ReadFloat(); - break; - } - } - } - } - #endif - - } - - /// - /// 弹幕缩放比例 - /// - public sealed partial class PlayerDanmakuScalingfactor : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PlayerDanmakuScalingfactor()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[38]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuScalingfactor() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuScalingfactor(PlayerDanmakuScalingfactor other) : this() { - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuScalingfactor Clone() { - return new PlayerDanmakuScalingfactor(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private float value_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public float Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as PlayerDanmakuScalingfactor); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(PlayerDanmakuScalingfactor other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Value, other.Value)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Value != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Value); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Value != 0F) { - output.WriteRawTag(13); - output.WriteFloat(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Value != 0F) { - output.WriteRawTag(13); - output.WriteFloat(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Value != 0F) { - size += 1 + 4; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(PlayerDanmakuScalingfactor other) { - if (other == null) { - return; - } - if (other.Value != 0F) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 13: { - Value = input.ReadFloat(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 13: { - Value = input.ReadFloat(); - break; - } - } - } - } - #endif - - } - - /// - /// 弹幕显示区域 - /// - public sealed partial class PlayerDanmakuDomain : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PlayerDanmakuDomain()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[39]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuDomain() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuDomain(PlayerDanmakuDomain other) : this() { - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuDomain Clone() { - return new PlayerDanmakuDomain(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private float value_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public float Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as PlayerDanmakuDomain); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(PlayerDanmakuDomain other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Value, other.Value)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Value != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Value); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Value != 0F) { - output.WriteRawTag(13); - output.WriteFloat(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Value != 0F) { - output.WriteRawTag(13); - output.WriteFloat(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Value != 0F) { - size += 1 + 4; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(PlayerDanmakuDomain other) { - if (other == null) { - return; - } - if (other.Value != 0F) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 13: { - Value = input.ReadFloat(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 13: { - Value = input.ReadFloat(); - break; - } - } - } - } - #endif - - } - - /// - /// 弹幕速度 - /// - public sealed partial class PlayerDanmakuSpeed : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PlayerDanmakuSpeed()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[40]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuSpeed() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuSpeed(PlayerDanmakuSpeed other) : this() { - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuSpeed Clone() { - return new PlayerDanmakuSpeed(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private int value_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as PlayerDanmakuSpeed); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(PlayerDanmakuSpeed other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Value != 0) hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Value != 0) { - output.WriteRawTag(8); - output.WriteInt32(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Value != 0) { - output.WriteRawTag(8); - output.WriteInt32(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Value != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Value); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(PlayerDanmakuSpeed other) { - if (other == null) { - return; - } - if (other.Value != 0) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Value = input.ReadInt32(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Value = input.ReadInt32(); - break; - } - } - } - } - #endif - - } - - /// - /// 是否开启屏蔽列表 - /// - public sealed partial class PlayerDanmakuEnableblocklist : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PlayerDanmakuEnableblocklist()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[41]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuEnableblocklist() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuEnableblocklist(PlayerDanmakuEnableblocklist other) : this() { - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public PlayerDanmakuEnableblocklist Clone() { - return new PlayerDanmakuEnableblocklist(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private bool value_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as PlayerDanmakuEnableblocklist); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(PlayerDanmakuEnableblocklist other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Value != false) hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Value != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(PlayerDanmakuEnableblocklist other) { - if (other == null) { - return; - } - if (other.Value != false) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - /// - /// 是否开启弹幕 - /// - public sealed partial class InlinePlayerDanmakuSwitch : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new InlinePlayerDanmakuSwitch()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public static pbr::MessageDescriptor Descriptor { - get { return global::Bilibili.Community.Service.Dm.V1.DmReflection.Descriptor.MessageTypes[42]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public InlinePlayerDanmakuSwitch() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public InlinePlayerDanmakuSwitch(InlinePlayerDanmakuSwitch other) : this() { - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public InlinePlayerDanmakuSwitch Clone() { - return new InlinePlayerDanmakuSwitch(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private bool value_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Value { - get { return value_; } - set { - value_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override bool Equals(object other) { - return Equals(other as InlinePlayerDanmakuSwitch); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public bool Equals(InlinePlayerDanmakuSwitch other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override int GetHashCode() { - int hash = 1; - if (Value != false) hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Value != false) { - output.WriteRawTag(8); - output.WriteBool(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public int CalculateSize() { - int size = 0; - if (Value != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(InlinePlayerDanmakuSwitch other) { - if (other == null) { - return; - } - if (other.Value != false) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Value = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/src/DownKyi.Core/Danmaku2Ass/Bilibili.cs b/src/DownKyi.Core/Danmaku2Ass/Bilibili.cs deleted file mode 100644 index 5a8e812..0000000 --- a/src/DownKyi.Core/Danmaku2Ass/Bilibili.cs +++ /dev/null @@ -1,169 +0,0 @@ -using DownKyi.Core.BiliApi.Danmaku; -using System.Collections.Generic; - -namespace DownKyi.Core.Danmaku2Ass -{ - public class Bilibili - { - private static Bilibili instance; - - private readonly Dictionary config = new Dictionary - { - { "top_filter", false }, - { "bottom_filter", false }, - { "scroll_filter", false } - }; - - private readonly Dictionary mapping = new Dictionary - { - { 0, "none" }, // 保留项 - { 1, "scroll" }, - { 2, "scroll" }, - { 3, "scroll" }, - { 4, "bottom" }, - { 5, "top" }, - { 6, "scroll" }, // 逆向滚动弹幕,还是当滚动处理 - { 7, "none" }, // 高级弹幕,暂时不要考虑 - { 8, "none" }, // 代码弹幕,暂时不要考虑 - { 9, "none" }, // BAS弹幕,暂时不要考虑 - { 10, "none" }, // 未知,暂时不要考虑 - { 11, "none" }, // 保留项 - { 12, "none" }, // 保留项 - { 13, "none" }, // 保留项 - { 14, "none" }, // 保留项 - { 15, "none" }, // 保留项 - }; - - // 弹幕标准字体大小 - private readonly int normalFontSize = 25; - - /// - /// 获取Bilibili实例 - /// - /// - public static Bilibili GetInstance() - { - if (instance == null) - { - instance = new Bilibili(); - } - - return instance; - } - - /// - /// 隐藏Bilibili()方法,必须使用单例模式 - /// - private Bilibili() { } - - /// - /// 是否屏蔽顶部弹幕 - /// - /// - /// - public Bilibili SetTopFilter(bool isFilter) - { - config["top_filter"] = isFilter; - return this; - } - - /// - /// 是否屏蔽底部弹幕 - /// - /// - /// - public Bilibili SetBottomFilter(bool isFilter) - { - config["bottom_filter"] = isFilter; - return this; - } - - /// - /// 是否屏蔽滚动弹幕 - /// - /// - /// - public Bilibili SetScrollFilter(bool isFilter) - { - config["scroll_filter"] = isFilter; - return this; - } - - public void Create(long avid, long cid, Config subtitleConfig, string assFile) - { - // 弹幕转换 - var biliDanmakus = DanmakuProtobuf.GetAllDanmakuProto(avid, cid); - - // 按弹幕出现顺序排序 - biliDanmakus.Sort((x, y) => { return x.Progress.CompareTo(y.Progress); }); - - var danmakus = new List(); - foreach (var biliDanmaku in biliDanmakus) - { - var danmaku = new Danmaku - { - // biliDanmaku.Progress单位是毫秒,所以除以1000,单位变为秒 - Start = biliDanmaku.Progress / 1000.0f, - Style = mapping[biliDanmaku.Mode], - Color = (int)biliDanmaku.Color, - Commenter = biliDanmaku.MidHash, - Content = biliDanmaku.Content, - SizeRatio = 1.0f * biliDanmaku.Fontsize / normalFontSize - }; - - danmakus.Add(danmaku); - } - - // 弹幕预处理 - Producer producer = new Producer(config, danmakus); - producer.StartHandle(); - - // 字幕生成 - var keepedDanmakus = producer.KeepedDanmakus; - var studio = new Studio(subtitleConfig, keepedDanmakus); - studio.StartHandle(); - studio.CreateAssFile(assFile); - } - - public Dictionary GetResolution(int quality) - { - var resolution = new Dictionary - { - { "width", 0 }, - { "height", 0 } - }; - - switch (quality) - { - // 240P 极速(仅mp4方式) - case 6: - break; - // 360P 流畅 - case 16: - break; - // 480P 清晰 - case 32: - break; - // 720P 高清(登录) - case 64: - break; - // 720P60 高清(大会员) - case 74: - break; - // 1080P 高清(登录) - case 80: - break; - // 1080P+ 高清(大会员) - case 112: - break; - // 1080P60 高清(大会员) - case 116: - break; - // 4K 超清(大会员)(需要fourk=1) - case 120: - break; - } - return resolution; - } - } -} diff --git a/src/DownKyi.Core/Danmaku2Ass/Collision.cs b/src/DownKyi.Core/Danmaku2Ass/Collision.cs deleted file mode 100644 index 518b997..0000000 --- a/src/DownKyi.Core/Danmaku2Ass/Collision.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace DownKyi.Core.Danmaku2Ass -{ - /// - /// 碰撞处理 - /// - public class Collision - { - private readonly int lineCount; - private readonly List leaves; - - public Collision(int lineCount) - { - this.lineCount = lineCount; - leaves = Leaves(); - } - - private List Leaves() - { - var ret = new List(lineCount); - for (int i = 0; i < lineCount; i++) ret.Add(0); - return ret; - } - - /// - /// 碰撞检测 - /// 返回行号和时间偏移 - /// - /// - /// - public Tuple Detect(Display display) - { - List beyonds = new List(); - for (int i = 0; i < leaves.Count; i++) - { - float beyond = display.Danmaku.Start - leaves[i]; - // 某一行有足够空间,直接返回行号和 0 偏移 - if (beyond >= 0) - { - return Tuple.Create(i, 0f); - } - beyonds.Add(beyond); - } - - // 所有行都没有空间了,那么找出哪一行能在最短时间内让出空间 - float soon = beyonds.Max(); - int lineIndex = beyonds.IndexOf(soon); - float offset = -soon; - return Tuple.Create(lineIndex, offset); - } - - public void Update(float leave, int lineIndex, float offset) - { - leaves[lineIndex] = Utils.IntCeiling(leave + offset); - } - } -} diff --git a/src/DownKyi.Core/Danmaku2Ass/Config.cs b/src/DownKyi.Core/Danmaku2Ass/Config.cs deleted file mode 100644 index 79b4aad..0000000 --- a/src/DownKyi.Core/Danmaku2Ass/Config.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; - -namespace DownKyi.Core.Danmaku2Ass -{ - public class Config - { - public string Title = "Downkyi"; - public int ScreenWidth = 1920; - public int ScreenHeight = 1080; - public string FontName = "黑体"; - public int BaseFontSize; // 字体大小,像素 - - // 限制行数 - private int lineCount; - public int LineCount - { - get { return lineCount; } - set - { - if (value == 0) - { - lineCount = (int)Math.Floor(ScreenHeight / BaseFontSize * 1.0); - } - else - { - lineCount = value; - } - } - } - - public string LayoutAlgorithm; // 布局算法,async/sync - public int TuneDuration; // 微调时长 - public int DropOffset; // 丢弃偏移 - public int BottomMargin; // 底部边距 - public int CustomOffset; // 自定义偏移 - public string HeaderTemplate = @"[Script Info] -; Script generated by Downkyi Danmaku Converter -; https://github.com/FlySelfLog/downkyi -Title: {title} -ScriptType: v4.00+ -Collisions: Normal -PlayResX: {width} -PlayResY: {height} -Timer: 10.0000 -WrapStyle: 2 -ScaledBorderAndShadow: no - -[V4+ Styles] -Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding -Style: Default,{fontname},54,&H00FFFFFF,&H00FFFFFF,&H00000000,&H00000000,0,0,0,0,100,100,0.00,0.00,1,2.00,0.00,2,30,30,120,0 -Style: Alternate,{fontname},36,&H00FFFFFF,&H00FFFFFF,&H00000000,&H00000000,0,0,0,0,100,100,0.00,0.00,1,2.00,0.00,2,30,30,84,0 -Style: Danmaku,{fontname},{fontsize},&H00FFFFFF,&H00FFFFFF,&H00000000,&H00000000,0,0,0,0,100,100,0.00,0.00,1,1.00,0.00,2,30,30,30,0 - -[Events] -Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text"; - } -} diff --git a/src/DownKyi.Core/Danmaku2Ass/Creater.cs b/src/DownKyi.Core/Danmaku2Ass/Creater.cs deleted file mode 100644 index c5d8090..0000000 --- a/src/DownKyi.Core/Danmaku2Ass/Creater.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System.Collections.Generic; - -namespace DownKyi.Core.Danmaku2Ass -{ - /// - /// 创建器 - /// - public class Creater - { - public Config Config; - public List Danmakus; - public List Subtitles; - public string Text; - - public Creater(Config config, List danmakus) - { - Config = config; - Danmakus = danmakus; - Subtitles = SetSubtitles(); - Text = SetText(); - } - - protected List SetSubtitles() - { - var scroll = new Collision(Config.LineCount); - var stayed = new Collision(Config.LineCount); - Dictionary collisions = new Dictionary - { - { "scroll", scroll }, - { "top", stayed }, - { "bottom", stayed } - }; - - List subtitles = new List(); - foreach (var danmaku in Danmakus) - { - // 丢弃不支持的 - if (danmaku.Style == "none") - { - continue; - } - - // 创建显示方式对象 - var display = Display.Factory(Config, danmaku); - var collision = collisions[danmaku.Style]; - var detect = collision.Detect(display); - int lineIndex = detect.Item1; - float waitingOffset = detect.Item2; - - // 超过容忍的偏移量,丢弃掉此条弹幕 - if (waitingOffset > Config.DropOffset) - { - continue; - } - - // 接受偏移,更新碰撞信息 - display.Relayout(lineIndex); - collision.Update(display.Leave, lineIndex, waitingOffset); - - // 再加上自定义偏移 - float offset = waitingOffset + Config.CustomOffset; - Subtitle subtitle = new Subtitle(danmaku, display, offset); - - subtitles.Add(subtitle); - } - return subtitles; - } - - protected string SetText() - { - string header = Config.HeaderTemplate - .Replace("{title}", Config.Title) - .Replace("{width}", Config.ScreenWidth.ToString()) - .Replace("{height}", Config.ScreenHeight.ToString()) - .Replace("{fontname}", Config.FontName) - .Replace("{fontsize}", Config.BaseFontSize.ToString()); - - string events = string.Empty; - foreach (var subtitle in Subtitles) - { - events += "\n" + subtitle.Text; - } - - return header + events; - } - } -} diff --git a/src/DownKyi.Core/Danmaku2Ass/Danmaku.cs b/src/DownKyi.Core/Danmaku2Ass/Danmaku.cs deleted file mode 100644 index f12afce..0000000 --- a/src/DownKyi.Core/Danmaku2Ass/Danmaku.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace DownKyi.Core.Danmaku2Ass -{ - public class Danmaku - { - public float Start { get; set; } - public string Style { get; set; } - public int Color { get; set; } - public string Commenter { get; set; } - public string Content { get; set; } - public float SizeRatio { get; set; } - } -} diff --git a/src/DownKyi.Core/Danmaku2Ass/Display.cs b/src/DownKyi.Core/Danmaku2Ass/Display.cs deleted file mode 100644 index 6e26576..0000000 --- a/src/DownKyi.Core/Danmaku2Ass/Display.cs +++ /dev/null @@ -1,406 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; - -namespace DownKyi.Core.Danmaku2Ass -{ - /// - /// 显示方式 - /// - public class Display - { - public Config Config; - public Danmaku Danmaku; - public int LineIndex; - - public int FontSize; - public bool IsScaled; - public int MaxLength; - public int Width; - public int Height; - - public Tuple Horizontal; - public Tuple Vertical; - - public int Duration; - public int Leave; - - protected Display() { } - - public Display(Config config, Danmaku danmaku) - { - Config = config; - Danmaku = danmaku; - LineIndex = 0; - - IsScaled = SetIsScaled(); - FontSize = SetFontSize(); - MaxLength = SetMaxLength(); - Width = SetWidth(); - Height = SetHeight(); - - Horizontal = SetHorizontal(); - Vertical = SetVertical(); - - Duration = SetDuration(); - Leave = SetLeave(); - } - - /// - /// 根据弹幕样式自动创建对应的 Display 类 - /// - /// - public static Display Factory(Config config, Danmaku danmaku) - { - Dictionary dict = new Dictionary - { - { "scroll", new ScrollDisplay(config, danmaku) }, - { "top", new TopDisplay(config, danmaku) }, - { "bottom", new BottomDisplay(config, danmaku) } - }; - return dict[danmaku.Style]; - } - - /// - /// 字体大小 - /// 按用户自定义的字体大小来缩放 - /// - /// - protected int SetFontSize() - { - if (IsScaled) - { - Console.WriteLine($"{Danmaku.SizeRatio}"); - } - return Utils.IntCeiling(Config.BaseFontSize * Danmaku.SizeRatio); - } - - /// - /// 字体是否被缩放过 - /// - /// - protected bool SetIsScaled() - { - return !Math.Round(Danmaku.SizeRatio, 2).Equals(1.0); - //return Danmaku.SizeRatio.Equals(1.0f); - } - - /// - /// 最长的行字符数 - /// - /// - protected int SetMaxLength() - { - string[] lines = Danmaku.Content.Split('\n'); - int maxLength = 0; - foreach (string line in lines) - { - int length = Utils.DisplayLength(line); - if (maxLength < length) - { - maxLength = length; - } - } - return maxLength; - } - - /// - /// 整条字幕宽度 - /// - /// - protected int SetWidth() - { - float charCount = MaxLength;// / 2; - return Utils.IntCeiling(FontSize * charCount); - } - - /// - /// 整条字幕高度 - /// - /// - protected int SetHeight() - { - int lineCount = Danmaku.Content.Split('\n').Length; - return lineCount * FontSize; - } - - /// - /// 出现和消失的水平坐标位置 - /// 默认在屏幕中间 - /// - /// - protected virtual Tuple SetHorizontal() - { - int x = (int)Math.Floor(Config.ScreenWidth / 2.0); - return Tuple.Create(x, x); - } - - /// - /// 出现和消失的垂直坐标位置 - /// 默认在屏幕中间 - /// - /// - protected virtual Tuple SetVertical() - { - int y = (int)Math.Floor(Config.ScreenHeight / 2.0); - return Tuple.Create(y, y); - } - - /// - /// 整条字幕的显示时间 - /// - /// - protected virtual int SetDuration() - { - int baseDuration = 3 + Config.TuneDuration; - if (baseDuration <= 0) - { - baseDuration = 0; - } - float charCount = MaxLength / 2; - - int value; - if (charCount < 6) - { - value = baseDuration + 1; - } - else if (charCount < 12) - { - value = baseDuration + 2; - } - else - { - value = baseDuration + 3; - } - return value; - } - - /// - /// 离开碰撞时间 - /// - /// - protected virtual int SetLeave() - { - return (int)(Danmaku.Start + Duration); - } - - /// - /// 按照新的行号重新布局 - /// - /// - public void Relayout(int lineIndex) - { - LineIndex = lineIndex; - Horizontal = SetHorizontal(); - Vertical = SetVertical(); - } - } - - - /// - /// 顶部 - /// - public class TopDisplay : Display - { - public TopDisplay(Config config, Danmaku danmaku) : base(config, danmaku) - { - //Console.WriteLine("TopDisplay constructor."); - } - - /// - /// - /// - /// - protected override Tuple SetVertical() - { - // 这里 y 坐标为 0 就是最顶行了 - int y = LineIndex * Config.BaseFontSize; - return Tuple.Create(y, y); - } - } - - /// - /// 底部 - /// - public class BottomDisplay : Display - { - public BottomDisplay(Config config, Danmaku danmaku) : base(config, danmaku) - { - //Console.WriteLine("BottomDisplay constructor."); - } - - /// - /// - /// - /// - protected override Tuple SetVertical() - { - // 要让字幕不超出底部,减去高度 - int y = Config.ScreenHeight - (LineIndex * Config.BaseFontSize) - Height; - // 再减去自定义的底部边距 - y -= Config.BottomMargin; - return Tuple.Create(y, y); - } - } - - /// - /// 滚动 - /// - public class ScrollDisplay : Display - { - public int Distance; - public int Speed; - - public ScrollDisplay(Config config, Danmaku danmaku) : base() - { - //Console.WriteLine("ScrollDisplay constructor."); - - Config = config; - Danmaku = danmaku; - LineIndex = 0; - - IsScaled = SetIsScaled(); - FontSize = SetFontSize(); - MaxLength = SetMaxLength(); - Width = SetWidth(); - Height = SetHeight(); - - Horizontal = SetHorizontal(); - Vertical = SetVertical(); - - Distance = SetDistance(); - Speed = SetSpeed(); - - Duration = SetDuration(); - Leave = SetLeave(); - } - - /// - /// ASS 的水平位置参考点是整条字幕文本的中点 - /// - /// - protected override Tuple SetHorizontal() - { - int x1 = Config.ScreenWidth + (int)Math.Floor(Width / 2.0); - int x2 = 0 - (int)Math.Floor(Width / 2.0); - return Tuple.Create(x1, x2); - } - - protected override Tuple SetVertical() - { - int baseFontSize = Config.BaseFontSize; - - // 垂直位置,按基准字体大小算每一行的高度 - int y = (LineIndex + 1) * baseFontSize; - - // 个别弹幕可能字体比基准要大,所以最上的一行还要避免挤出顶部屏幕 - // 坐标不能小于字体大小 - if (y < FontSize) - { - y = FontSize; - } - return Tuple.Create(y, y); - } - - /// - /// 字幕坐标点的移动距离 - /// - /// - protected int SetDistance() - { - Tuple x = Horizontal; - return x.Item1 - x.Item2; - } - - /// - /// 字幕每个字的移动的速度 - /// - /// - protected int SetSpeed() - { - // 基准时间,就是每个字的移动时间 - // 12 秒加上用户自定义的微调 - int baseDuration = 12 + Config.TuneDuration; - if (baseDuration <= 0) - { - baseDuration = 1; - } - return Utils.IntCeiling(Config.ScreenWidth / baseDuration); - } - - /// - /// 计算每条弹幕的显示时长,同步方式 - /// 每个弹幕的滚动速度都一样,辨认度好,适合观看剧集类视频。 - /// - /// - public int SyncDuration() - { - return Distance / Speed; - } - - /// - /// 计算每条弹幕的显示时长,异步方式 - /// 每个弹幕的滚动速度都不一样,动态调整,辨认度低,适合观看 MTV 类视频。 - /// - /// - public int AsyncDuration() - { - int baseDuration = 6 + Config.TuneDuration; - if (baseDuration <= 0) - { - baseDuration = 0; - } - float charCount = MaxLength / 2; - - int value; - if (charCount < 6) - { - value = (int)(baseDuration + charCount); - } - else if (charCount < 12) - { - value = baseDuration + (int)(charCount / 2); - } - else if (charCount < 24) - { - value = baseDuration + (int)(charCount / 3); - } - else - { - value = baseDuration + 10; - } - return value; - } - - /// - /// 整条字幕的移动时间 - /// - /// - protected override int SetDuration() - { - string methodName = Config.LayoutAlgorithm.Substring(0, 1).ToUpper() + Config.LayoutAlgorithm.Substring(1); - methodName += "Duration"; - MethodInfo method = typeof(ScrollDisplay).GetMethod(methodName); - if (method != null) - { - return (int)method.Invoke(this, null); - } - return 0; - } - - /// - /// 离开碰撞时间 - /// - /// - protected override int SetLeave() - { - // 对于滚动样式弹幕来说,就是最后一个字符离开最右边缘的时间 - // 坐标是字幕中点,在屏幕外和内各有半个字幕宽度 - // 也就是跑过一个字幕宽度的路程 - float duration = Width / Speed; - return (int)(Danmaku.Start + duration); - } - - } - -} diff --git a/src/DownKyi.Core/Danmaku2Ass/Filter.cs b/src/DownKyi.Core/Danmaku2Ass/Filter.cs deleted file mode 100644 index 625405f..0000000 --- a/src/DownKyi.Core/Danmaku2Ass/Filter.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace DownKyi.Core.Danmaku2Ass -{ - /// - /// 过滤器基类 - /// - public class Filter - { - public virtual List DoFilter(List danmakus) - { - throw new NotImplementedException("使用了过滤器的未实现的方法。"); - } - } - - /// - /// 顶部样式过滤器 - /// - public class TopFilter : Filter - { - public override List DoFilter(List danmakus) - { - List keep = new List(); - foreach (var danmaku in danmakus) - { - if (danmaku.Style == "top") - { - continue; - } - keep.Add(danmaku); - } - return keep; - } - } - - /// - /// 底部样式过滤器 - /// - public class BottomFilter : Filter - { - public override List DoFilter(List danmakus) - { - List keep = new List(); - foreach (var danmaku in danmakus) - { - if (danmaku.Style == "bottom") - { - continue; - } - keep.Add(danmaku); - } - return keep; - } - } - - /// - /// 滚动样式过滤器 - /// - public class ScrollFilter : Filter - { - public override List DoFilter(List danmakus) - { - List keep = new List(); - foreach (var danmaku in danmakus) - { - if (danmaku.Style == "scroll") - { - continue; - } - keep.Add(danmaku); - } - return keep; - } - } - - /// - /// 自定义过滤器 - /// - public class CustomFilter : Filter - { - public override List DoFilter(List danmakus) - { - // TODO - return base.DoFilter(danmakus); - } - } -} diff --git a/src/DownKyi.Core/Danmaku2Ass/Producer.cs b/src/DownKyi.Core/Danmaku2Ass/Producer.cs deleted file mode 100644 index 068c1a0..0000000 --- a/src/DownKyi.Core/Danmaku2Ass/Producer.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace DownKyi.Core.Danmaku2Ass -{ - public class Producer - { - public Dictionary Config; - public Dictionary Filters; - public List Danmakus; - public List KeepedDanmakus; - public Dictionary FilterDetail; - - public Producer(Dictionary config, List danmakus) - { - Config = config; - Danmakus = danmakus; - } - - public void StartHandle() - { - LoadFilter(); - ApplyFilter(); - } - - public void LoadFilter() - { - Filters = new Dictionary(); - if (Config["top_filter"]) - { - Filters.Add("top_filter", new TopFilter()); - } - if (Config["bottom_filter"]) - { - Filters.Add("bottom_filter", new BottomFilter()); - } - if (Config["scroll_filter"]) - { - Filters.Add("scroll_filter", new ScrollFilter()); - } - //if (Config["custom_filter"]) - //{ - // Filters.Add("custom_filter", new CustomFilter()); - //} - - } - - public void ApplyFilter() - { - Dictionary filterDetail = new Dictionary() { - { "top_filter", 0}, - { "bottom_filter", 0}, - { "scroll_filter", 0}, - //{ "custom_filter",0} - }; - - List danmakus = Danmakus; - //string[] orders = { "top_filter", "bottom_filter", "scroll_filter", "custom_filter" }; - string[] orders = { "top_filter", "bottom_filter", "scroll_filter" }; - foreach (string name in orders) - { - Filter filter; - try - { - filter = Filters[name]; - } - catch (Exception e) - { - Console.WriteLine("ApplyFilter()发生异常: {0}", e); - continue; - } - - int count = danmakus.Count; - danmakus = filter.DoFilter(danmakus); - filterDetail[name] = count - danmakus.Count; - } - - KeepedDanmakus = danmakus; - FilterDetail = filterDetail; - } - - public Dictionary Report() - { - int blockedCount = 0; - foreach (int count in FilterDetail.Values) - { - blockedCount += count; - } - - int passedCount = KeepedDanmakus.Count; - int totalCount = blockedCount + passedCount; - - Dictionary ret = new Dictionary - { - { "blocked", blockedCount }, - { "passed", passedCount }, - { "total", totalCount } - }; - - return (Dictionary)ret.Concat(FilterDetail); - } - } -} diff --git a/src/DownKyi.Core/Danmaku2Ass/Studio.cs b/src/DownKyi.Core/Danmaku2Ass/Studio.cs deleted file mode 100644 index 630e323..0000000 --- a/src/DownKyi.Core/Danmaku2Ass/Studio.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; - -namespace DownKyi.Core.Danmaku2Ass -{ - /// - /// 字幕工程类 - /// - public class Studio - { - public Config Config; - public List Danmakus; - - public Creater Creater; - public int KeepedCount; - public int DropedCount; - - public Studio(Config config, List danmakus) - { - Config = config; - Danmakus = danmakus; - } - - public void StartHandle() - { - Creater = SetCreater(); - KeepedCount = SetKeepedCount(); - DropedCount = SetDropedCount(); - } - - /// - /// ass 创建器 - /// - /// - protected Creater SetCreater() - { - return new Creater(Config, Danmakus); - } - - /// - /// 保留条数 - /// - /// - protected int SetKeepedCount() - { - return Creater.Subtitles.Count(); - } - - /// - /// 丢弃条数 - /// - /// - protected int SetDropedCount() - { - return Danmakus.Count - KeepedCount; - } - - /// - /// 创建 ass 字幕 - /// - /// - public void CreateAssFile(string fileName) - { - CreateFile(fileName, Creater.Text); - } - - public void CreateFile(string fileName, string text) - { - try - { - File.WriteAllText(fileName, text); - } - catch (Exception) - { } - } - - public Dictionary Report() - { - return new Dictionary() - { - {"total", Danmakus.Count}, - {"droped", DropedCount}, - {"keeped", KeepedCount}, - }; - } - } -} diff --git a/src/DownKyi.Core/Danmaku2Ass/Subtitle.cs b/src/DownKyi.Core/Danmaku2Ass/Subtitle.cs deleted file mode 100644 index d785065..0000000 --- a/src/DownKyi.Core/Danmaku2Ass/Subtitle.cs +++ /dev/null @@ -1,154 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace DownKyi.Core.Danmaku2Ass -{ - /// - /// 字幕 - /// - public class Subtitle - { - public Danmaku Danmaku; - public Display Display; - public float Offset; - - public float Start; - public float End; - public string Color; - public Dictionary Position; - public string StartMarkup; - public string EndMarkup; - public string ColorMarkup; - public string BorderMarkup; - public string FontSizeMarkup; - public string StyleMarkup; - public string LayerMarkup; - public string ContentMarkup; - public string Text; - - public Subtitle(Danmaku danmaku, Display display, float offset = 0) - { - Danmaku = danmaku; - Display = display; - Offset = offset; - - Start = SetStart(); - End = SetEnd(); - Color = SetColor(); - Position = SetPosition(); - StartMarkup = SetStartMarkup(); - EndMarkup = SetEndMarkup(); - ColorMarkup = SetColorMarkup(); - BorderMarkup = SetBorderMarkup(); - FontSizeMarkup = SetFontSizeMarkup(); - StyleMarkup = SetStyleMarkup(); - LayerMarkup = SetLayerMarkup(); - ContentMarkup = SetContentMarkup(); - Text = SetText(); - } - - protected float SetStart() - { - return Danmaku.Start + Offset; - } - - protected float SetEnd() - { - return Start + Display.Duration; - } - - protected string SetColor() - { - return Utils.Int2bgr(Danmaku.Color); - } - - protected Dictionary SetPosition() - { - Tuple x = Display.Horizontal; - Tuple y = Display.Vertical; - - Dictionary value = new Dictionary - { - { "x1", x.Item1 }, - { "x2", x.Item2 }, - { "y1", y.Item1 }, - { "y2", y.Item2 } - }; - return value; - } - - protected string SetStartMarkup() - { - return Utils.Second2hms(Start); - } - - protected string SetEndMarkup() - { - return Utils.Second2hms(End); - } - - protected string SetColorMarkup() - { - // 白色不需要加特别标记 - if (Color == "FFFFFF") - { - return ""; - } - return "\\c&H" + Color; - } - - protected string SetBorderMarkup() - { - // 暗色加个亮色边框,方便阅读 - if (Utils.IsDark(Danmaku.Color)) - { - //return "\\3c&HFFFFFF"; - return "\\3c&H000000"; - } - else - { - return "\\3c&H000000"; - } - //return ""; - } - - protected string SetFontSizeMarkup() - { - if (Display.IsScaled) - { - return $"\\fs{Display.FontSize}"; - } - return ""; - } - - protected string SetStyleMarkup() - { - if (Danmaku.Style == "scroll") - { - return $"\\move({Position["x1"]}, {Position["y1"]}, {Position["x2"]}, {Position["y2"]})"; - } - return $"\\a6\\pos({Position["x1"]}, {Position["y1"]})"; - } - - protected string SetLayerMarkup() - { - if (Danmaku.Style != "scroll") - { - return "-2"; - } - return "-1"; - } - - protected string SetContentMarkup() - { - string markup = StyleMarkup + ColorMarkup + BorderMarkup + FontSizeMarkup; - string content = Utils.CorrectTypos(Danmaku.Content); - return $"{{{markup}}}{content}"; - } - - protected string SetText() - { - return $"Dialogue: {LayerMarkup},{StartMarkup},{EndMarkup},Danmaku,,0000,0000,0000,,{ContentMarkup}"; - } - } -} diff --git a/src/DownKyi.Core/Danmaku2Ass/Utils.cs b/src/DownKyi.Core/Danmaku2Ass/Utils.cs deleted file mode 100644 index d54e48d..0000000 --- a/src/DownKyi.Core/Danmaku2Ass/Utils.cs +++ /dev/null @@ -1,228 +0,0 @@ -using System; -using System.Linq; -using System.Text; - -namespace DownKyi.Core.Danmaku2Ass -{ - internal static class Utils - { - /// - /// 向上取整,返回int类型 - /// - /// - /// - public static int IntCeiling(float number) - { - return (int)Math.Ceiling(number); - } - - /// - /// 字符长度,1个汉字当2个英文 - /// - /// - /// - public static int DisplayLength(string text) - { - return Encoding.Default.GetBytes(text).Length; - } - - /// - /// 修正一些评论者的拼写错误 - /// - /// - /// - public static string CorrectTypos(string text) - { - text = text.Replace("/n", "\\N"); - text = text.Replace(">", ">"); - text = text.Replace("<", "<"); - return text; - } - - /// - /// 秒数转 时:分:秒 格式 - /// - /// - /// - public static string Second2hms(float seconds) - { - if (seconds < 0) - { - return "0:00:00.00"; - } - - int i = (int)Math.Floor(seconds / 1.0); - int dec = (int)(Math.Round(seconds % 1.0f, 2) * 100); - if (dec >= 100) - { - dec = 99; - } - - int min = (int)Math.Floor(i / 60.0); - int second = (int)(i % 60.0f); - - int hour = (int)Math.Floor(min / 60.0); - min = (int)Math.Floor(min % 60.0f); - - return $"{hour:D}:{min:D2}:{second:D2}.{dec:D2}"; - } - - /// - /// 时:分:秒 格式转 秒数 - /// - /// - /// - public static float Hms2second(string hms) - { - string[] numbers = hms.Split(':'); - float seconds = 0; - - for (int i = 0; i < numbers.Length; i++) - { - seconds += (float)(float.Parse(numbers[numbers.Length - i - 1]) * Math.Pow(60, i)); - } - return seconds; - } - - /// - /// 同Hms2second(string hms),不过可以用 +/- 符号来连接多个 - /// 即 3:00-2:30 相当于 30 秒 - /// - /// - /// - public static float Xhms2second(string xhms) - { - string[] args = xhms.Replace("+", " +").Replace("-", " -").Split(' '); - float result = 0; - foreach (string hms in args) - { - result += Hms2second(hms); - } - return result; - } - - /// - /// 颜色值,整型转 RGB - /// - /// - /// - public static string Int2rgb(int integer) - { - return integer.ToString("X").PadLeft(6, '0'); ; - } - - /// - /// 颜色值,整型转 BGR - /// - /// - /// - public static string Int2bgr(int integer) - { - string rgb = Int2rgb(integer); - string bgr = rgb.Substring(4, 2) + rgb.Substring(2, 2) + rgb.Substring(0, 2); - return bgr; - } - - /// - /// 颜色值,整型转 HLS - /// - /// - /// - public static float[] Int2hls(int integer) - { - string rgb = Int2rgb(integer); - int[] rgb_decimals = { 0, 0, 0 }; - rgb_decimals[0] = int.Parse(rgb.Substring(0, 2), System.Globalization.NumberStyles.HexNumber); - rgb_decimals[1] = int.Parse(rgb.Substring(2, 2), System.Globalization.NumberStyles.HexNumber); - rgb_decimals[2] = int.Parse(rgb.Substring(4, 2), System.Globalization.NumberStyles.HexNumber); - - int[] rgb_coordinates = { 0, 0, 0 }; - rgb_coordinates[0] = (int)Math.Floor(rgb_decimals[0] / 255.0); - rgb_coordinates[1] = (int)Math.Floor(rgb_decimals[1] / 255.0); - rgb_coordinates[2] = (int)Math.Floor(rgb_decimals[2] / 255.0); - float[] hls_corrdinates = Rgb2hls(rgb_coordinates); - - float[] hls = { 0, 0, 0 }; - hls[0] = hls_corrdinates[0] * 360; - hls[1] = hls_corrdinates[1] * 100; - hls[2] = hls_corrdinates[2] * 100; - return hls; - } - - /// - /// HLS: Hue, Luminance, Saturation - /// H: position in the spectrum - /// L: color lightness - /// S: color saturation - /// - /// - /// - private static float[] Rgb2hls(int[] rgb) - { - float[] hls = { 0, 0, 0 }; - int maxc = rgb.Max(); - int minc = rgb.Min(); - hls[1] = (minc + maxc) / 2.0f; - if (minc == maxc) - { - return hls; - } - - if (hls[1] <= 0.5) - { - hls[2] = (maxc - minc) / (maxc + minc); - } - else - { - hls[2] = (maxc - minc) / (2.0f - maxc - minc); - } - float rc = (maxc - rgb[0]) / (maxc - minc); - float gc = (maxc - rgb[1]) / (maxc - minc); - float bc = (maxc - rgb[2]) / (maxc - minc); - if (rgb[0] == maxc) - { - hls[0] = bc - gc; - } - else if (rgb[1] == maxc) - { - hls[0] = 2.0f + rc - bc; - } - else - { - hls[0] = 4.0f + gc - rc; - } - hls[0] = (hls[0] / 6.0f) % 1.0f; - return hls; - } - - /// - /// 是否属于暗色 - /// - /// - /// - public static bool IsDark(int integer) - { - if (integer == 0) - { - return true; - } - - float[] hls = Int2hls(integer); - float hue = hls[0]; - float lightness = hls[1]; - - // HSL 色轮见 - // http://zh.wikipedia.org/zh-cn/HSL和HSV色彩空间 - // 以下的数值都是我的主观判断认为是暗色 - if ((hue > 30 && hue < 210) && lightness < 33) - { - return true; - } - if ((hue < 30 || hue > 210) && lightness < 66) - { - return true; - } - return false; - } - } -} diff --git a/src/DownKyi.Core/DownKyi.Core.csproj b/src/DownKyi.Core/DownKyi.Core.csproj deleted file mode 100644 index cb85a1d..0000000 --- a/src/DownKyi.Core/DownKyi.Core.csproj +++ /dev/null @@ -1,400 +0,0 @@ - - - - - Debug - AnyCPU - {4FDE0364-F65B-4812-BFE8-34E886624FBD} - Library - Properties - DownKyi.Core - DownKyi.Core - v4.7.2 - 512 - true - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - x64 - bin\x64\Debug\ - - - x64 - bin\x64\Release\ - - - x86 - bin\x86\Debug\ - - - x86 - bin\x86\Release\ - - - - ..\packages\Brotli.NET.2.1.1\lib\net45\Brotli.Core.dll - - - ..\packages\Google.Protobuf.3.29.3\lib\net45\Google.Protobuf.dll - - - ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll - - - - - ..\packages\QRCoder.1.6.0\lib\net40\QRCoder.dll - - - - ..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll - - - - ..\packages\System.Data.SQLite.Core.1.0.112.2\lib\net40\System.Data.SQLite.dll - - - - - ..\packages\System.Memory.4.6.0\lib\net462\System.Memory.dll - - - - ..\packages\System.Numerics.Vectors.4.6.0\lib\net462\System.Numerics.Vectors.dll - - - ..\packages\System.Runtime.CompilerServices.Unsafe.6.1.0\lib\net462\System.Runtime.CompilerServices.Unsafe.dll - - - ..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll - True - True - - - - - - - - - ..\packages\WebPSharp.0.5.1\lib\net472\WebPSharp.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - - - - 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 - - - - - - - - - - \ No newline at end of file diff --git a/src/DownKyi.Core/Downloader/MultiThreadDownloader.cs b/src/DownKyi.Core/Downloader/MultiThreadDownloader.cs deleted file mode 100644 index 2c142b3..0000000 --- a/src/DownKyi.Core/Downloader/MultiThreadDownloader.cs +++ /dev/null @@ -1,446 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.IO; -using System.Linq; -using System.Net; -using System.Threading; -using System.Threading.Tasks; - -namespace DownKyi.Core.Downloader -{ - /// - /// 文件合并改变事件 - /// - /// - /// - public delegate void FileMergeProgressChangedEventHandler(object sender, int e); - - /// - /// 多线程下载器 - /// - public class MultiThreadDownloader - { - #region 属性 - - private string _url; - private bool _rangeAllowed; - private readonly HttpWebRequest _request; - private Action _requestConfigure = req => req.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36"; - - #endregion 属性 - - #region 公共属性 - - /// - /// RangeAllowed - /// - public bool RangeAllowed - { - get => _rangeAllowed; - set => _rangeAllowed = value; - } - - /// - /// 临时文件夹 - /// - public string TempFileDirectory { get; set; } - - /// - /// url地址 - /// - public string Url - { - get => _url; - set => _url = value; - } - - /// - /// 第几部分 - /// - public int NumberOfParts { get; set; } - - /// - /// 已接收字节数 - /// - public long TotalBytesReceived - { - get - { - try - { - lock (this) - { - return PartialDownloaderList.Where(t => t != null).Sum(t => t.TotalBytesRead); - } - } - catch - { - return 0; - } - } - } - - /// - /// 总进度 - /// - public float TotalProgress { get; private set; } - - /// - /// 文件大小 - /// - public long Size { get; private set; } - - /// - /// 下载速度 - /// - public float TotalSpeedInBytes - { - get - { - lock (this) - { - return PartialDownloaderList.Sum(t => t.SpeedInBytes); - } - } - } - - /// - /// 下载块 - /// - public List PartialDownloaderList { get; } - - /// - /// 文件路径 - /// - public string FilePath { get; set; } - - #endregion 公共属性 - - #region 变量 - - /// - /// 总下载进度更新事件 - /// - public event EventHandler TotalProgressChanged; - - /// - /// 文件合并完成事件 - /// - public event EventHandler FileMergedComplete; - - /// - /// 文件合并事件 - /// - public event FileMergeProgressChangedEventHandler FileMergeProgressChanged; - - private readonly AsyncOperation _aop; - - #endregion 变量 - - #region 下载管理器 - - /// - /// 多线程下载管理器 - /// - /// - /// - /// - /// - public MultiThreadDownloader(string sourceUrl, string tempDir, string savePath, int numOfParts) - { - _url = sourceUrl; - NumberOfParts = numOfParts; - TempFileDirectory = tempDir; - PartialDownloaderList = new List(); - _aop = AsyncOperationManager.CreateOperation(null); - FilePath = savePath; - _request = WebRequest.Create(sourceUrl) as HttpWebRequest; - } - - /// - /// 多线程下载管理器 - /// - /// - /// - /// - public MultiThreadDownloader(string sourceUrl, string savePath, int numOfParts) : this(sourceUrl, null, savePath, numOfParts) - { - TempFileDirectory = Environment.GetEnvironmentVariable("temp"); - } - - /// - /// 多线程下载管理器 - /// - /// - /// - public MultiThreadDownloader(string sourceUrl, int numOfParts) : this(sourceUrl, null, numOfParts) - { - } - - #endregion 下载管理器 - - #region 事件 - - private void temp_DownloadPartCompleted(object sender, EventArgs e) - { - WaitOrResumeAll(PartialDownloaderList, true); - - if (TotalBytesReceived == Size) - { - UpdateProgress(); - MergeParts(); - return; - } - - PartialDownloaderList.Sort((x, y) => (int)(y.RemainingBytes - x.RemainingBytes)); - var rem = PartialDownloaderList[0].RemainingBytes; - if (rem < 50 * 1024) - { - WaitOrResumeAll(PartialDownloaderList, false); - return; - } - - var from = PartialDownloaderList[0].CurrentPosition + rem / 2; - var to = PartialDownloaderList[0].To; - if (from > to) - { - WaitOrResumeAll(PartialDownloaderList, false); - return; - } - - PartialDownloaderList[0].To = from - 1; - WaitOrResumeAll(PartialDownloaderList, false); - var temp = new PartialDownloader(_url, TempFileDirectory, Guid.NewGuid().ToString(), from, to, true); - temp.DownloadPartCompleted += temp_DownloadPartCompleted; - temp.DownloadPartProgressChanged += temp_DownloadPartProgressChanged; - lock (this) - { - PartialDownloaderList.Add(temp); - } - temp.Start(_requestConfigure); - } - - private void temp_DownloadPartProgressChanged(object sender, EventArgs e) - { - UpdateProgress(); - } - - private void UpdateProgress() - { - int pr = (int)(TotalBytesReceived * 1d / Size * 100); - if (TotalProgress != pr) - { - TotalProgress = pr; - if (TotalProgressChanged != null) - { - _aop.Post(state => TotalProgressChanged(this, EventArgs.Empty), null); - } - } - } - - #endregion 事件 - - #region 方法 - - private void CreateFirstPartitions() - { - Size = GetContentLength(ref _rangeAllowed, ref _url); - int maximumPart = (int)(Size / (25 * 1024)); - maximumPart = maximumPart == 0 ? 1 : maximumPart; - if (!_rangeAllowed) - { - NumberOfParts = 1; - } - else if (NumberOfParts > maximumPart) - { - NumberOfParts = maximumPart; - } - - for (int i = 0; i < NumberOfParts; i++) - { - var temp = CreateNew(i, NumberOfParts, Size); - temp.DownloadPartProgressChanged += temp_DownloadPartProgressChanged; - temp.DownloadPartCompleted += temp_DownloadPartCompleted; - lock (this) - { - PartialDownloaderList.Add(temp); - } - temp.Start(_requestConfigure); - } - } - - private void MergeParts() - { - var mergeOrderedList = PartialDownloaderList.OrderBy(x => x.From); - var dir = new FileInfo(FilePath).DirectoryName; - Directory.CreateDirectory(dir); - - - using (var fs = File.OpenWrite(FilePath)) - { - long totalBytesWrite = 0; - int mergeProgress = 0; - foreach (var item in mergeOrderedList) - { - using (var pdi = File.OpenRead(item.FullPath)) - { - byte[] buffer = new byte[4096]; - int read; - while ((read = pdi.Read(buffer, 0, buffer.Length)) > 0) - { - fs.Write(buffer, 0, read); - totalBytesWrite += read; - int temp = (int)(totalBytesWrite * 1d / Size * 100); - if (temp != mergeProgress && FileMergeProgressChanged != null) - { - mergeProgress = temp; - _aop.Post(state => FileMergeProgressChanged(this, temp), null); - } - } - } - - try - { - File.Delete(item.FullPath); - } - catch - { - // ignored - } - } - } - - if (FileMergedComplete != null) - { - _aop.Post(state => FileMergedComplete(state, EventArgs.Empty), this); - } - } - - private PartialDownloader CreateNew(int order, int parts, long contentLength) - { - var division = contentLength / parts; - var remaining = contentLength % parts; - var start = division * order; - var end = start + division - 1; - end += order == parts - 1 ? remaining : 0; - return new PartialDownloader(_url, TempFileDirectory, Guid.NewGuid().ToString("N"), start, end, true); - } - - /// - /// 暂停或继续 - /// - /// - /// - public static void WaitOrResumeAll(List list, bool wait) - { - for (var index = 0; index < list.Count; index++) - { - if (wait) - { - list[index].Wait(); - } - else - { - list[index].ResumeAfterWait(); - } - } - } - - /// - /// 配置请求头 - /// - /// - public void Configure(Action config) - { - _requestConfigure = config; - } - - /// - /// 获取内容长度 - /// - /// - /// - /// - public long GetContentLength(ref bool rangeAllowed, ref string redirectedUrl) - { - _request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36"; - _request.ServicePoint.ConnectionLimit = 4; - _requestConfigure(_request); - - using (var resp = _request.GetResponse() as HttpWebResponse) - { - redirectedUrl = resp.ResponseUri.OriginalString; - var ctl = resp.ContentLength; - rangeAllowed = resp.Headers.AllKeys.Select((v, i) => new - { - HeaderName = v, - HeaderValue = resp.Headers[i] - }).Any(k => k.HeaderName.ToLower().Contains("range") && k.HeaderValue.ToLower().Contains("byte")); - _request.Abort(); - return ctl; - } - } - - #endregion 方法 - - #region 公共方法 - - /// - /// 暂停下载 - /// - public void Pause() - { - lock (this) - { - foreach (var t in PartialDownloaderList.Where(t => !t.Completed)) - { - t.Stop(); - } - } - - Thread.Sleep(200); - } - - /// - /// 开始下载 - /// - public void Start() - { - Task th = new Task(CreateFirstPartitions); - th.Start(); - } - - /// - /// 唤醒下载 - /// - public void Resume() - { - int count = PartialDownloaderList.Count; - for (int i = 0; i < count; i++) - { - if (PartialDownloaderList[i].Stopped) - { - var from = PartialDownloaderList[i].CurrentPosition + 1; - var to = PartialDownloaderList[i].To; - if (from > to) - { - continue; - } - - var temp = new PartialDownloader(_url, TempFileDirectory, Guid.NewGuid().ToString(), from, to, _rangeAllowed); - temp.DownloadPartProgressChanged += temp_DownloadPartProgressChanged; - temp.DownloadPartCompleted += temp_DownloadPartCompleted; - lock (this) - { - PartialDownloaderList.Add(temp); - } - PartialDownloaderList[i].To = PartialDownloaderList[i].CurrentPosition; - temp.Start(_requestConfigure); - } - } - } - - #endregion 公共方法 - } -} diff --git a/src/DownKyi.Core/Downloader/PartialDownloader.cs b/src/DownKyi.Core/Downloader/PartialDownloader.cs deleted file mode 100644 index 9b489c8..0000000 --- a/src/DownKyi.Core/Downloader/PartialDownloader.cs +++ /dev/null @@ -1,269 +0,0 @@ -using System; -using System.ComponentModel; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Net; -using System.Threading; - -namespace DownKyi.Core.Downloader -{ - /// - /// 部分下载器 - /// - public class PartialDownloader - { - /// - /// 这部分完成事件 - /// - public event EventHandler DownloadPartCompleted; - - /// - /// 部分下载进度改变事件 - /// - public event EventHandler DownloadPartProgressChanged; - - /// - /// 部分下载停止事件 - /// - public event EventHandler DownloadPartStopped; - - private readonly AsyncOperation _aop = AsyncOperationManager.CreateOperation(null); - private readonly int[] _lastSpeeds; - private long _counter; - private long _to; - private long _totalBytesRead; - private bool _wait; - - /// - /// 下载已停止 - /// - public bool Stopped { get; private set; } - - /// - /// 下载已完成 - /// - public bool Completed { get; private set; } - - /// - /// 下载进度 - /// - public int Progress { get; private set; } - - /// - /// 下载目录 - /// - public string Directory { get; } - - /// - /// 文件名 - /// - public string FileName { get; } - - /// - /// 已读字节数 - /// - public long TotalBytesRead => _totalBytesRead; - - /// - /// 内容长度 - /// - public long ContentLength { get; private set; } - - /// - /// RangeAllowed - /// - public bool RangeAllowed { get; } - - /// - /// url - /// - public string Url { get; } - - /// - /// to - /// - public long To - { - get => _to; - set - { - _to = value; - ContentLength = _to - From + 1; - } - } - - /// - /// from - /// - public long From { get; } - - /// - /// 当前位置 - /// - public long CurrentPosition => From + _totalBytesRead - 1; - - /// - /// 剩余字节数 - /// - public long RemainingBytes => ContentLength - _totalBytesRead; - - /// - /// 完整路径 - /// - public string FullPath => Path.Combine(Directory, FileName); - - /// - /// 下载速度 - /// - public int SpeedInBytes - { - get - { - if (Completed) - { - return 0; - } - - int totalSpeeds = _lastSpeeds.Sum(); - return totalSpeeds / 10; - } - } - - /// - /// 部分块下载 - /// - /// - /// - /// - /// - /// - /// - public PartialDownloader(string url, string dir, string fileGuid, long from, long to, bool rangeAllowed) - { - From = from; - _to = to; - Url = url; - RangeAllowed = rangeAllowed; - FileName = fileGuid; - Directory = dir; - _lastSpeeds = new int[10]; - } - - private void DownloadProcedure(Action config) - { - using (var file = new FileStream(FullPath, FileMode.Create, FileAccess.ReadWrite, FileShare.Delete)) - { - var sw = new Stopwatch(); - if (WebRequest.Create(Url) is HttpWebRequest req) - { - req.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36"; - req.AllowAutoRedirect = true; - req.MaximumAutomaticRedirections = 5; - req.ServicePoint.ConnectionLimit += 1; - req.ServicePoint.Expect100Continue = true; - req.ProtocolVersion = HttpVersion.Version11; - req.Proxy = WebRequest.GetSystemWebProxy(); - config(req); - if (RangeAllowed) - { - req.AddRange(From, _to); - } - - if (req.GetResponse() is HttpWebResponse resp) - { - ContentLength = resp.ContentLength; - if (ContentLength <= 0 || (RangeAllowed && ContentLength != _to - From + 1)) - { - throw new Exception("Invalid response content"); - } - - using (var tempStream = resp.GetResponseStream()) - { - int bytesRead; - byte[] buffer = new byte[4096]; - sw.Start(); - while ((bytesRead = tempStream.Read(buffer, 0, buffer.Length)) > 0) - { - if (_totalBytesRead + bytesRead > ContentLength) - { - bytesRead = (int)(ContentLength - _totalBytesRead); - } - - file.Write(buffer, 0, bytesRead); - _totalBytesRead += bytesRead; - _lastSpeeds[_counter] = (int)(_totalBytesRead / Math.Ceiling(sw.Elapsed.TotalSeconds)); - _counter = (_counter >= 9) ? 0 : _counter + 1; - int tempProgress = (int)(_totalBytesRead * 100 / ContentLength); - if (Progress != tempProgress) - { - Progress = tempProgress; - _aop.Post(state => - { - DownloadPartProgressChanged?.Invoke(this, EventArgs.Empty); - }, null); - } - - if (Stopped || (RangeAllowed && _totalBytesRead == ContentLength)) - { - break; - } - } - } - } - - req.Abort(); - } - - sw.Stop(); - if (!Stopped && DownloadPartCompleted != null) - { - _aop.Post(state => - { - Completed = true; - DownloadPartCompleted(this, EventArgs.Empty); - }, null); - } - - if (Stopped && DownloadPartStopped != null) - { - _aop.Post(state => DownloadPartStopped(this, EventArgs.Empty), null); - } - } - } - - /// - /// 启动下载 - /// - public void Start(Action config) - { - Stopped = false; - var procThread = new Thread(_ => DownloadProcedure(config)); - procThread.Start(); - } - - /// - /// 下载停止 - /// - public void Stop() - { - Stopped = true; - } - - /// - /// 暂停等待下载 - /// - public void Wait() - { - _wait = true; - } - - /// - /// 稍后唤醒 - /// - public void ResumeAfterWait() - { - _wait = false; - } - } -} \ No newline at end of file diff --git a/src/DownKyi.Core/FFmpeg/FFmpegHelper.cs b/src/DownKyi.Core/FFmpeg/FFmpegHelper.cs deleted file mode 100644 index 32d2395..0000000 --- a/src/DownKyi.Core/FFmpeg/FFmpegHelper.cs +++ /dev/null @@ -1,253 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; - -namespace DownKyi.Core.FFmpeg -{ - public static class FFmpegHelper - { - private const string Tag = "FFmpegHelper"; - - private static readonly bool is64Bit = false; - private static readonly string exec = ""; - - static FFmpegHelper() - { - is64Bit = IntPtr.Size == 8; - - if (is64Bit) - { - exec = Path.Combine(Environment.CurrentDirectory, "ffmpeg.exe"); - } - else - { - exec = Path.Combine(Environment.CurrentDirectory, "ffmpeg.exe"); - } - } - - /// - /// 合并音频和视频 - /// - /// 音频 - /// 视频 - /// - public static bool MergeVideo(string video1, string video2, string destVideo) - { - string param = $"-y -i \"{video1}\" -i \"{video2}\" -strict -2 -acodec copy -vcodec copy -f mp4 \"{destVideo}\""; - if (video1 == null || !File.Exists(video1)) - { - param = $"-y -i \"{video2}\" -strict -2 -acodec copy -vcodec copy -f mp4 \"{destVideo}\""; - } - if (video2 == null || !File.Exists(video2)) - { - param = $"-y -i \"{video1}\" -strict -2 -acodec copy \"{destVideo}\""; - } - - // 支持flac格式音频 - //param += " -strict -2"; - - if (!File.Exists(video1) && !File.Exists(video2)) { return false; } - - // 如果存在 - try { File.Delete(destVideo); } - catch (IOException e) - { - Console.WriteLine("MergeVideo()发生IO异常: {0}", e); - Logging.LogManager.Error(Tag, e); - return false; - } - - ExcuteProcess(exec, param, null, (s, e) => Console.WriteLine(e.Data)); - - try - { - if (video1 != null) { File.Delete(video1); } - if (video2 != null) { File.Delete(video2); } - } - catch (IOException e) - { - Console.WriteLine("MergeVideo()发生IO异常: {0}", e); - Logging.LogManager.Error(Tag, e); - } - - return true; - } - - /// - /// 拼接多个视频 - /// - /// - /// - /// - /// - public static bool ConcatVideo(string workingDirectory, List flvFiles, string destVideo) - { - // contact的文件名,不包含路径 - string concatFileName = Guid.NewGuid().ToString("N") + "_concat.txt"; - try - { - string contact = ""; - foreach (string flv in flvFiles) - { - contact += $"file '{flv}'\n"; - } - - FileStream fileStream = new FileStream(workingDirectory + "/" + concatFileName, FileMode.Create); - StreamWriter streamWriter = new StreamWriter(fileStream); - //开始写入 - streamWriter.Write(contact); - //清空缓冲区 - streamWriter.Flush(); - //关闭流 - streamWriter.Close(); - fileStream.Close(); - } - catch (Exception e) - { - Console.WriteLine("ConcatVideo()发生异常: {0}", e); - Logging.LogManager.Error(Tag, e); - return false; - } - - // ffmpeg -y -f concat -safe 0 -i filelist.txt -c copy output.mkv - // 加上-y,表示如果有同名文件,则默认覆盖 - string param = $"-y -f concat -safe 0 -i {concatFileName} -c copy \"{destVideo}\" -y"; - ExcuteProcess(exec, param, workingDirectory, (s, e) => Console.WriteLine(e.Data)); - - // 删除临时文件 - try - { - // 删除concat文件 - File.Delete(workingDirectory + "/" + concatFileName); - - foreach (string flv in flvFiles) - { - File.Delete(flv); - } - } - catch (Exception e) - { - Console.WriteLine("ConcatVideo()发生异常: {0}", e); - Logging.LogManager.Error(Tag, e); - } - - return true; - } - - /// - /// 去水印,非常消耗cpu资源 - /// - /// - /// - /// - /// - /// - /// - /// - public static void Delogo(string video, string destVideo, int x, int y, int width, int height, Action action) - { - // ffmpeg -y -i "video.mp4" -vf delogo=x=1670:y=50:w=180:h=70:show=1 "delogo.mp4" - string param = $"-y -i \"{video}\" -vf delogo=x={x}:y={y}:w={width}:h={height}:show=0 \"{destVideo}\" -hide_banner"; - ExcuteProcess(exec, param, null, (s, e) => - { - Console.WriteLine(e.Data); - action.Invoke(e.Data); - }); - } - - /// - /// 从一个视频中仅提取音频 - /// - /// 源视频 - /// 目标音频 - /// 输出信息 - public static void ExtractAudio(string video, string audio, Action action) - { - // 抽取音频命令 - // ffmpeg -i 3.mp4 -vn -y -acodec copy 3.aac - // ffmpeg -i 3.mp4 -vn -y -acodec copy 3.m4a - string param = $"-i \"{video}\" -vn -y -acodec copy \"{audio}\" -hide_banner"; - ExcuteProcess(exec, param, - null, (s, e) => - { - Console.WriteLine(e.Data); - action.Invoke(e.Data); - }); - } - - /// - /// 从一个视频中仅提取视频 - /// - /// 源视频 - /// 目标视频 - /// 输出信息 - public static void ExtractVideo(string video, string destVideo, Action action) - { - // 提取视频 (Extract Video) - // ffmpeg -i Life.of.Pi.has.subtitles.mkv -vcodec copy –an videoNoAudioSubtitle.mp4 - string param = $"-i \"{video}\" -y -vcodec copy -an \"{destVideo}\" -hide_banner"; - ExcuteProcess(exec, param, - null, (s, e) => - { - Console.WriteLine(e.Data); - action.Invoke(e.Data); - }); - } - - /// - /// 提取视频的帧,输出为图片 - /// - /// - /// - /// - public static void ExtractFrame(string video, string image, uint number) - { - // 提取帧 - // ffmpeg -i caiyilin.wmv -vframes 1 wm.bmp - string param = $"-i \"{video}\" -y -vframes {number} \"{image}\""; - ExcuteProcess(exec, param, null, (s, e) => Console.WriteLine(e.Data)); - } - - - /// - /// 执行一个控制台程序 - /// - /// 程序名称 - /// 参数 - /// 工作路径 - /// 输出重定向 - private static void ExcuteProcess(string exe, string arg, string workingDirectory, DataReceivedEventHandler output) - { - using (var p = new Process()) - { - p.StartInfo.FileName = exe; - p.StartInfo.Arguments = arg; - - // 工作目录 - if (workingDirectory != null) - { - p.StartInfo.WorkingDirectory = workingDirectory; - } - - p.StartInfo.UseShellExecute = false; //输出信息重定向 - p.StartInfo.CreateNoWindow = true; - p.StartInfo.RedirectStandardError = true; - p.StartInfo.RedirectStandardOutput = true; - - // 将 StandardErrorEncoding 改为 UTF-8 才不会出现中文乱码 - p.StartInfo.StandardOutputEncoding = System.Text.Encoding.UTF8; - p.StartInfo.StandardErrorEncoding = System.Text.Encoding.UTF8; - - p.OutputDataReceived += output; - p.ErrorDataReceived += output; - - p.Start(); //启动线程 - p.BeginOutputReadLine(); - p.BeginErrorReadLine(); - p.WaitForExit(); //等待进程结束 - } - } - - } -} diff --git a/src/DownKyi.Core/FFmpeg_LICENSE.txt b/src/DownKyi.Core/FFmpeg_LICENSE.txt deleted file mode 100644 index 94a9ed0..0000000 --- a/src/DownKyi.Core/FFmpeg_LICENSE.txt +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/src/DownKyi.Core/FileName/FileName.cs b/src/DownKyi.Core/FileName/FileName.cs deleted file mode 100644 index 356a9e0..0000000 --- a/src/DownKyi.Core/FileName/FileName.cs +++ /dev/null @@ -1,195 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.RegularExpressions; - -namespace DownKyi.Core.FileName -{ - public class FileName - { - private readonly List nameParts; - private string order = "ORDER"; - private string section = "SECTION"; - private string mainTitle = "MAIN_TITLE"; - private string pageTitle = "PAGE_TITLE"; - private string videoZone = "VIDEO_ZONE"; - private string audioQuality = "AUDIO_QUALITY"; - private string videoQuality = "VIDEO_QUALITY"; - private string videoCodec = "VIDEO_CODEC"; - - private string videoPublishTime = "VIDEO_PUBLISH_TIME"; - - private long avid = -1; - private string bvid = "BVID"; - private long cid = -1; - - private long upMid = -1; - private string upName = "UP_NAME"; - - private FileName(List nameParts) - { - this.nameParts = nameParts; - } - - public static FileName Builder(List nameParts) - { - return new FileName(nameParts); - } - - public FileName SetOrder(int order) - { - this.order = order.ToString(); - return this; - } - - public FileName SetOrder(int order, int count) - { - int length = Math.Abs(count).ToString().Length; - this.order = order.ToString("D" + length); - - return this; - } - - public FileName SetSection(string section) - { - this.section = section; - return this; - } - - public FileName SetMainTitle(string mainTitle) - { - this.mainTitle = mainTitle; - return this; - } - - public FileName SetPageTitle(string pageTitle) - { - this.pageTitle = pageTitle; - return this; - } - - public FileName SetVideoZone(string videoZone) - { - this.videoZone = videoZone; - return this; - } - - public FileName SetAudioQuality(string audioQuality) - { - this.audioQuality = audioQuality; - return this; - } - - public FileName SetVideoQuality(string videoQuality) - { - this.videoQuality = videoQuality; - return this; - } - - public FileName SetVideoCodec(string videoCodec) - { - this.videoCodec = videoCodec; - return this; - } - - public FileName SetVideoPublishTime(string videoPublishTime) - { - this.videoPublishTime = videoPublishTime; - return this; - } - - public FileName SetAvid(long avid) - { - this.avid = avid; - return this; - } - - public FileName SetBvid(string bvid) - { - this.bvid = bvid; - return this; - } - - public FileName SetCid(long cid) - { - this.cid = cid; - return this; - } - - public FileName SetUpMid(long upMid) - { - this.upMid = upMid; - return this; - } - - public FileName SetUpName(string upName) - { - this.upName = upName; - return this; - } - - public string RelativePath() - { - string path = string.Empty; - - foreach (FileNamePart part in nameParts) - { - switch (part) - { - case FileNamePart.ORDER: - path += order; - break; - case FileNamePart.SECTION: - path += section; - break; - case FileNamePart.MAIN_TITLE: - path += mainTitle; - break; - case FileNamePart.PAGE_TITLE: - path += pageTitle; - break; - case FileNamePart.VIDEO_ZONE: - path += videoZone; - break; - case FileNamePart.AUDIO_QUALITY: - path += audioQuality; - break; - case FileNamePart.VIDEO_QUALITY: - path += videoQuality; - break; - case FileNamePart.VIDEO_CODEC: - path += videoCodec; - break; - case FileNamePart.VIDEO_PUBLISH_TIME: - path += videoPublishTime; - break; - case FileNamePart.AVID: - path += avid; - break; - case FileNamePart.BVID: - path += bvid; - break; - case FileNamePart.CID: - path += cid; - break; - case FileNamePart.UP_MID: - path += upMid; - break; - case FileNamePart.UP_NAME: - path += upName; - break; - } - - if (((int)part) >= 100) - { - path += HyphenSeparated.Hyphen[(int)part]; - } - } - - // 避免连续多个斜杠 - path = Regex.Replace(path, @"//+", "/"); - // 避免以斜杠开头和结尾的情况 - return path.TrimEnd('/').TrimStart('/'); - } - - } -} diff --git a/src/DownKyi.Core/FileName/FileNamePart.cs b/src/DownKyi.Core/FileName/FileNamePart.cs deleted file mode 100644 index 059e408..0000000 --- a/src/DownKyi.Core/FileName/FileNamePart.cs +++ /dev/null @@ -1,44 +0,0 @@ -namespace DownKyi.Core.FileName -{ - public enum FileNamePart - { - // Video - ORDER = 1, - SECTION, - MAIN_TITLE, - PAGE_TITLE, - VIDEO_ZONE, - AUDIO_QUALITY, - VIDEO_QUALITY, - VIDEO_CODEC, - - VIDEO_PUBLISH_TIME, - - AVID, - BVID, - CID, - - UP_MID, - UP_NAME, - - // 斜杠 - SLASH = 100, - - // HyphenSeparated - UNDERSCORE = 101, // 下划线 - HYPHEN, // 连字符 - PLUS, // 加号 - COMMA, // 逗号 - PERIOD, // 句号 - AND, // and - NUMBER, // # - OPEN_PAREN, // 左圆括号 - CLOSE_PAREN, // 右圆括号 - OPEN_BRACKET, // 左方括号 - CLOSE_BRACKET, // 右方括号 - OPEN_BRACE, // 左花括号 - CLOSE_brace, // 右花括号 - BLANK, // 空白符 - - } -} diff --git a/src/DownKyi.Core/FileName/HyphenSeparated.cs b/src/DownKyi.Core/FileName/HyphenSeparated.cs deleted file mode 100644 index 0bb3083..0000000 --- a/src/DownKyi.Core/FileName/HyphenSeparated.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Collections.Generic; - -namespace DownKyi.Core.FileName -{ - /// - /// 文件名字段 - /// - public static class HyphenSeparated - { - // 文件名的分隔符 - public static Dictionary Hyphen = new Dictionary() - { - { 100, "/" }, - { 101, "_" }, - { 102, "-" }, - { 103, "+" }, - { 104, "," }, - { 105, "." }, - { 106, "&" }, - { 107, "#" }, - { 108, "(" }, - { 109, ")" }, - { 110, "[" }, - { 111, "]" }, - { 112, "{" }, - { 113, "}" }, - { 114, " " }, - }; - - } -} diff --git a/src/DownKyi.Core/Logging/LogInfo.cs b/src/DownKyi.Core/Logging/LogInfo.cs deleted file mode 100644 index 192afe7..0000000 --- a/src/DownKyi.Core/Logging/LogInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; - -namespace DownKyi.Core.Logging -{ - /// - /// 日志信息 - /// - public class LogInfo - { - /// - /// 时间 - /// - public DateTime Time { get; set; } - - /// - /// 线程id - /// - public int ThreadId { get; set; } - - /// - /// 日志级别 - /// - public LogLevel LogLevel { get; set; } - - /// - /// 异常源 - /// - public string Source { get; set; } - - /// - /// 异常信息 - /// - public string Message { get; set; } - - /// - /// 异常对象 - /// - public Exception Exception { get; set; } - - /// - /// 日志类型 - /// - public string ExceptionType { get; set; } - - /// - /// 请求路径 - /// - public string RequestUrl { get; set; } - - /// - /// 客户端代理 - /// - public string UserAgent { get; set; } - } -} \ No newline at end of file diff --git a/src/DownKyi.Core/Logging/LogLevel.cs b/src/DownKyi.Core/Logging/LogLevel.cs deleted file mode 100644 index bf7108e..0000000 --- a/src/DownKyi.Core/Logging/LogLevel.cs +++ /dev/null @@ -1,28 +0,0 @@ -namespace DownKyi.Core.Logging -{ - /// - /// 日志级别 - /// - public enum LogLevel - { - /// - /// 信息级别 - /// - Info, - - /// - /// debug级别 - /// - Debug, - - /// - /// 错误级别 - /// - Error, - - /// - /// 致命级别 - /// - Fatal - } -} \ No newline at end of file diff --git a/src/DownKyi.Core/Logging/LogManager.cs b/src/DownKyi.Core/Logging/LogManager.cs deleted file mode 100644 index 3c515a3..0000000 --- a/src/DownKyi.Core/Logging/LogManager.cs +++ /dev/null @@ -1,457 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text.RegularExpressions; -using System.Threading; -using System.Threading.Tasks; -using static System.DateTime; - -namespace DownKyi.Core.Logging -{ - /// - /// 日志组件 - /// - public class LogManager - { - private static readonly ConcurrentQueue> LogQueue = new ConcurrentQueue>(); - - /// - /// 自定义事件 - /// - public static event Action Event; - - static LogManager() - { - var writeTask = new Task(obj => - { - while (true) - { - Pause.WaitOne(1000, true); - List temp = new List(); - foreach (var logItem in LogQueue) - { - string logPath = logItem.Item1; - string logMergeContent = string.Concat(logItem.Item2, Environment.NewLine, "----------------------------------------------------------------------------------------------------------------------", Environment.NewLine); - string[] logArr = temp.FirstOrDefault(d => d[0].Equals(logPath)); - if (logArr != null) - { - logArr[1] = string.Concat(logArr[1], logMergeContent); - } - else - { - logArr = new[] - { - logPath, - logMergeContent - }; - temp.Add(logArr); - } - - LogQueue.TryDequeue(out Tuple _); - } - - foreach (var item in temp) - { - WriteText(item[0], item[1]); - } - } - }, null, TaskCreationOptions.LongRunning); - writeTask.Start(); - } - - private static AutoResetEvent Pause => new AutoResetEvent(false); - - private static string logDirectory; - /// - /// 日志存放目录,默认日志放在当前应用程序运行目录下的logs文件夹中 - /// - public static string LogDirectory - { - get => logDirectory ?? (Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory).Any(s => s.Contains("Web.config")) ? AppDomain.CurrentDomain.BaseDirectory + @"App_Data\Logs\" : Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logs")); - set - { - //自定义目录 - if (!Directory.Exists(value)) - { - Directory.CreateDirectory(value); - } - logDirectory = value; - } - } - - /// - /// 写入Info级别的日志 - /// - /// - public static void Info(string info) - { - LogQueue.Enqueue(new Tuple(GetLogPath(), $"{Now} [{Thread.CurrentThread.ManagedThreadId}] {nameof(info).ToUpper()} {info}")); - var log = new LogInfo() - { - LogLevel = LogLevel.Info, - Message = info, - Time = Now, - ThreadId = Thread.CurrentThread.ManagedThreadId - }; - Event?.Invoke(log); - } - - /// - /// 写入Info级别的日志 - /// - /// - /// - public static void Info(string source, string info) - { - LogQueue.Enqueue(new Tuple(GetLogPath(), $"{Now} [{Thread.CurrentThread.ManagedThreadId}] {nameof(info).ToUpper()} {source} {info}")); - LogInfo log = new LogInfo() - { - LogLevel = LogLevel.Info, - Message = info, - Time = Now, - ThreadId = Thread.CurrentThread.ManagedThreadId, - Source = source - }; - Event?.Invoke(log); - } - - /// - /// 写入Info级别的日志 - /// - /// - /// - public static void Info(Type source, string info) - { - LogQueue.Enqueue(new Tuple(GetLogPath(), $"{Now} [{Thread.CurrentThread.ManagedThreadId}] {nameof(info).ToUpper()} {source.FullName} {info}")); - LogInfo log = new LogInfo() - { - LogLevel = LogLevel.Info, - Message = info, - Time = Now, - ThreadId = Thread.CurrentThread.ManagedThreadId, - Source = source.FullName - }; - Event?.Invoke(log); - } - - /// - /// 写入debug级别日志 - /// - /// 异常对象 - public static void Debug(string debug) - { - LogQueue.Enqueue(new Tuple(GetLogPath(), $"{Now} [{Thread.CurrentThread.ManagedThreadId}] {nameof(debug).ToUpper()} {debug}")); - LogInfo log = new LogInfo() - { - LogLevel = LogLevel.Debug, - Message = debug, - Time = Now, - ThreadId = Thread.CurrentThread.ManagedThreadId - }; - Event?.Invoke(log); - } - - /// - /// 写入debug级别日志 - /// - /// 异常源的类型 - /// 异常对象 - public static void Debug(string source, string debug) - { - LogQueue.Enqueue(new Tuple(GetLogPath(), $"{Now} [{Thread.CurrentThread.ManagedThreadId}] {nameof(debug).ToUpper()} {source} {debug}")); - LogInfo log = new LogInfo() - { - LogLevel = LogLevel.Debug, - Message = debug, - Time = Now, - ThreadId = Thread.CurrentThread.ManagedThreadId, - Source = source - }; - Event?.Invoke(log); - } - - /// - /// 写入debug级别日志 - /// - /// 异常源的类型 - /// 异常对象 - public static void Debug(Type source, string debug) - { - LogQueue.Enqueue(new Tuple(GetLogPath(), $"{Now} [{Thread.CurrentThread.ManagedThreadId}] {nameof(debug).ToUpper()} {source.FullName} {debug}")); - LogInfo log = new LogInfo() - { - LogLevel = LogLevel.Debug, - Message = debug, - Time = Now, - ThreadId = Thread.CurrentThread.ManagedThreadId, - Source = source.FullName - }; - Event?.Invoke(log); - } - - /// - /// 写入error级别日志 - /// - /// 异常对象 - public static void Error(Exception error) - { - LogQueue.Enqueue(new Tuple(GetLogPath(), $"{Now} [{Thread.CurrentThread.ManagedThreadId}] {nameof(error).ToUpper()} {error.Source} {error.Message}{Environment.NewLine}{error.StackTrace}")); - LogInfo log = new LogInfo() - { - LogLevel = LogLevel.Error, - Message = error.Message, - Time = Now, - ThreadId = Thread.CurrentThread.ManagedThreadId, - Source = error.Source, - Exception = error, - ExceptionType = error.GetType().Name - }; - Event?.Invoke(log); - } - - /// - /// 写入error级别日志 - /// - /// 异常源的类型 - /// 异常对象 - public static void Error(Type source, Exception error) - { - LogQueue.Enqueue(new Tuple(GetLogPath(), $"{Now} [{Thread.CurrentThread.ManagedThreadId}] {nameof(error).ToUpper()} {source.FullName} {error.Message}{Environment.NewLine}{error.StackTrace}")); - LogInfo log = new LogInfo() - { - LogLevel = LogLevel.Error, - Message = error.Message, - Time = Now, - ThreadId = Thread.CurrentThread.ManagedThreadId, - Source = source.FullName, - Exception = error, - ExceptionType = error.GetType().Name - }; - Event?.Invoke(log); - } - - /// - /// 写入error级别日志 - /// - /// 异常源的类型 - /// 异常信息 - public static void Error(Type source, string error) - { - LogQueue.Enqueue(new Tuple(GetLogPath(), $"{Now} [{Thread.CurrentThread.ManagedThreadId}] {nameof(error).ToUpper()} {source.FullName} {error}")); - LogInfo log = new LogInfo() - { - LogLevel = LogLevel.Error, - Message = error, - Time = Now, - ThreadId = Thread.CurrentThread.ManagedThreadId, - Source = source.FullName, - //Exception = error, - ExceptionType = error.GetType().Name - }; - Event?.Invoke(log); - } - - /// - /// 写入error级别日志 - /// - /// 异常源的类型 - /// 异常对象 - public static void Error(string source, Exception error) - { - LogQueue.Enqueue(new Tuple(GetLogPath(), $"{Now} [{Thread.CurrentThread.ManagedThreadId}] {nameof(error).ToUpper()} {source} {error.Message}{Environment.NewLine}{error.StackTrace}")); - LogInfo log = new LogInfo() - { - LogLevel = LogLevel.Error, - Message = error.Message, - Time = Now, - ThreadId = Thread.CurrentThread.ManagedThreadId, - Source = source, - Exception = error, - ExceptionType = error.GetType().Name - }; - Event?.Invoke(log); - } - - /// - /// 写入error级别日志 - /// - /// 异常源的类型 - /// 异常信息 - public static void Error(string source, string error) - { - LogQueue.Enqueue(new Tuple(GetLogPath(), $"{Now} [{Thread.CurrentThread.ManagedThreadId}] {nameof(error).ToUpper()} {source} {error}")); - LogInfo log = new LogInfo() - { - LogLevel = LogLevel.Error, - Message = error, - Time = Now, - ThreadId = Thread.CurrentThread.ManagedThreadId, - Source = source, - //Exception = error, - ExceptionType = error.GetType().Name - }; - Event?.Invoke(log); - } - - /// - /// 写入fatal级别日志 - /// - /// 异常对象 - public static void Fatal(Exception fatal) - { - LogQueue.Enqueue(new Tuple(GetLogPath(), $"{Now} [{Thread.CurrentThread.ManagedThreadId}] {nameof(fatal).ToUpper()} {fatal.Source} {fatal.Message}{Environment.NewLine}{fatal.StackTrace}")); - LogInfo log = new LogInfo() - { - LogLevel = LogLevel.Fatal, - Message = fatal.Message, - Time = Now, - ThreadId = Thread.CurrentThread.ManagedThreadId, - Source = fatal.Source, - Exception = fatal, - ExceptionType = fatal.GetType().Name - }; - Event?.Invoke(log); - } - - /// - /// 写入fatal级别日志 - /// - /// 异常源的类型 - /// 异常对象 - public static void Fatal(Type source, Exception fatal) - { - LogQueue.Enqueue(new Tuple(GetLogPath(), $"{Now} [{Thread.CurrentThread.ManagedThreadId}] {nameof(fatal).ToUpper()} {source.FullName} {fatal.Message}{Environment.NewLine}{fatal.StackTrace}")); - LogInfo log = new LogInfo() - { - LogLevel = LogLevel.Fatal, - Message = fatal.Message, - Time = Now, - ThreadId = Thread.CurrentThread.ManagedThreadId, - Source = source.FullName, - Exception = fatal, - ExceptionType = fatal.GetType().Name - }; - Event?.Invoke(log); - } - - /// - /// 写入fatal级别日志 - /// - /// 异常源的类型 - /// 异常对象 - public static void Fatal(Type source, string fatal) - { - LogQueue.Enqueue(new Tuple(GetLogPath(), $"{Now} [{Thread.CurrentThread.ManagedThreadId}] {nameof(fatal).ToUpper()} {source.FullName} {fatal}")); - LogInfo log = new LogInfo() - { - LogLevel = LogLevel.Fatal, - Message = fatal, - Time = Now, - ThreadId = Thread.CurrentThread.ManagedThreadId, - Source = source.FullName, - //Exception = fatal, - ExceptionType = fatal.GetType().Name - }; - Event?.Invoke(log); - } - - /// - /// 写入fatal级别日志 - /// - /// 异常源的类型 - /// 异常对象 - public static void Fatal(string source, Exception fatal) - { - LogQueue.Enqueue(new Tuple(GetLogPath(), $"{Now} [{Thread.CurrentThread.ManagedThreadId}] {nameof(fatal).ToUpper()} {source} {fatal.Message}{Environment.NewLine}{fatal.StackTrace}")); - LogInfo log = new LogInfo() - { - LogLevel = LogLevel.Fatal, - Message = fatal.Message, - Time = Now, - ThreadId = Thread.CurrentThread.ManagedThreadId, - Source = source, - Exception = fatal, - ExceptionType = fatal.GetType().Name - }; - Event?.Invoke(log); - } - - /// - /// 写入fatal级别日志 - /// - /// 异常源的类型 - /// 异常对象 - public static void Fatal(string source, string fatal) - { - LogQueue.Enqueue(new Tuple(GetLogPath(), $"{Now} [{Thread.CurrentThread.ManagedThreadId}] {nameof(fatal).ToUpper()} {source} {fatal}")); - LogInfo log = new LogInfo() - { - LogLevel = LogLevel.Fatal, - Message = fatal, - Time = Now, - ThreadId = Thread.CurrentThread.ManagedThreadId, - Source = source, - ExceptionType = fatal.GetType().Name - }; - Event?.Invoke(log); - } - - private static string GetLogPath() - { - string newFilePath; - var logDir = string.IsNullOrEmpty(LogDirectory) ? Path.Combine(Environment.CurrentDirectory, "logs") : LogDirectory; - Directory.CreateDirectory(logDir); - string extension = ".log"; - string fileNameNotExt = Now.ToString("yyyyMMdd"); - string fileNamePattern = string.Concat(fileNameNotExt, "(*)", extension); - List filePaths = Directory.GetFiles(logDir, fileNamePattern, SearchOption.TopDirectoryOnly).ToList(); - - if (filePaths.Count > 0) - { - int fileMaxLen = filePaths.Max(d => d.Length); - string lastFilePath = filePaths.Where(d => d.Length == fileMaxLen).OrderByDescending(d => d).FirstOrDefault(); - if (new FileInfo(lastFilePath).Length > 1 * 1024 * 1024) - { - var no = new Regex(@"(?is)(?<=\()(.*)(?=\))").Match(Path.GetFileName(lastFilePath)).Value; - var parse = int.TryParse(no, out int tempno); - var formatno = $"({(parse ? (tempno + 1) : tempno)})"; - var newFileName = String.Concat(fileNameNotExt, formatno, extension); - newFilePath = Path.Combine(logDir, newFileName); - } - else - { - newFilePath = lastFilePath; - } - } - else - { - var newFileName = string.Concat(fileNameNotExt, $"({0})", extension); - newFilePath = Path.Combine(logDir, newFileName); - } - - return newFilePath; - } - - private static void WriteText(string logPath, string logContent) - { - try - { - if (!File.Exists(logPath)) - { - File.CreateText(logPath).Close(); - } - - using (var sw = File.AppendText(logPath)) - { - sw.Write(logContent); - } - } - catch (Exception) - { - // ignored - } - } - } -} \ No newline at end of file diff --git a/src/DownKyi.Core/Properties/AssemblyInfo.cs b/src/DownKyi.Core/Properties/AssemblyInfo.cs deleted file mode 100644 index e0248c5..0000000 --- a/src/DownKyi.Core/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// 有关程序集的一般信息由以下 -// 控制。更改这些特性值可修改 -// 与程序集关联的信息。 -[assembly: AssemblyTitle("DownKyi.Core")] -[assembly: AssemblyDescription("DownKyi.Core")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("DownKyi")] -[assembly: AssemblyProduct("DownKyi.Core")] -[assembly: AssemblyCopyright("Copyright © Downkyi 2020-2023")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 会使此程序集中的类型 -//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 -//请将此类型的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("4fde0364-f65b-4812-bfe8-34e886624fbd")] - -// 程序集的版本信息由下列四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 -//通过使用 "*",如下所示: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.2.1.0")] -[assembly: AssemblyFileVersion("2.2.1.0")] diff --git a/src/DownKyi.Core/Settings/AfterDownloadOperation.cs b/src/DownKyi.Core/Settings/AfterDownloadOperation.cs deleted file mode 100644 index d6ebdb1..0000000 --- a/src/DownKyi.Core/Settings/AfterDownloadOperation.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace DownKyi.Core.Settings -{ - public enum AfterDownloadOperation - { - NOT_SET = 0, - NONE = 1, - OPEN_FOLDER, - CLOSE_APP, - CLOSE_SYSTEM - } -} diff --git a/src/DownKyi.Core/Settings/AllowStatus.cs b/src/DownKyi.Core/Settings/AllowStatus.cs deleted file mode 100644 index 9473713..0000000 --- a/src/DownKyi.Core/Settings/AllowStatus.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace DownKyi.Core.Settings -{ - public enum AllowStatus - { - NONE = 0, - NO, - YES - } -} diff --git a/src/DownKyi.Core/Settings/DanmakuLayoutAlgorithm.cs b/src/DownKyi.Core/Settings/DanmakuLayoutAlgorithm.cs deleted file mode 100644 index ed188f6..0000000 --- a/src/DownKyi.Core/Settings/DanmakuLayoutAlgorithm.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace DownKyi.Core.Settings -{ - public enum DanmakuLayoutAlgorithm - { - NONE = 0, - ASYNC, - SYNC - } -} diff --git a/src/DownKyi.Core/Settings/DownloadFinishedSort.cs b/src/DownKyi.Core/Settings/DownloadFinishedSort.cs deleted file mode 100644 index 9f1c773..0000000 --- a/src/DownKyi.Core/Settings/DownloadFinishedSort.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace DownKyi.Core.Settings -{ - public enum DownloadFinishedSort - { - NOT_SET = 0, - DOWNLOAD, - NUMBER - } -} diff --git a/src/DownKyi.Core/Settings/Downloader.cs b/src/DownKyi.Core/Settings/Downloader.cs deleted file mode 100644 index 0008bbe..0000000 --- a/src/DownKyi.Core/Settings/Downloader.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace DownKyi.Core.Settings -{ - public enum Downloader - { - NOT_SET = 0, - BUILT_IN, - ARIA, - CUSTOM_ARIA, - } -} diff --git a/src/DownKyi.Core/Settings/Models/AboutSettings.cs b/src/DownKyi.Core/Settings/Models/AboutSettings.cs deleted file mode 100644 index 46e1543..0000000 --- a/src/DownKyi.Core/Settings/Models/AboutSettings.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace DownKyi.Core.Settings.Models -{ - /// - /// 关于 - /// - public class AboutSettings - { - public AllowStatus IsReceiveBetaVersion { get; set; } = AllowStatus.NONE; - public AllowStatus AutoUpdateWhenLaunch { get; set; } = AllowStatus.NONE; - } -} diff --git a/src/DownKyi.Core/Settings/Models/AppSettings.cs b/src/DownKyi.Core/Settings/Models/AppSettings.cs deleted file mode 100644 index 197dbe4..0000000 --- a/src/DownKyi.Core/Settings/Models/AppSettings.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace DownKyi.Core.Settings.Models -{ - public class AppSettings - { - public BasicSettings Basic { get; set; } = new BasicSettings(); - public NetworkSettings Network { get; set; } = new NetworkSettings(); - public VideoSettings Video { get; set; } = new VideoSettings(); - public DanmakuSettings Danmaku { get; set; } = new DanmakuSettings(); - public AboutSettings About { get; set; } = new AboutSettings(); - public UserInfoSettings UserInfo { get; set; } = new UserInfoSettings(); - } -} diff --git a/src/DownKyi.Core/Settings/Models/BasicSettings.cs b/src/DownKyi.Core/Settings/Models/BasicSettings.cs deleted file mode 100644 index 43eea04..0000000 --- a/src/DownKyi.Core/Settings/Models/BasicSettings.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace DownKyi.Core.Settings.Models -{ - /// - /// 基本 - /// - public class BasicSettings - { - public AfterDownloadOperation AfterDownload { get; set; } = AfterDownloadOperation.NOT_SET; - public AllowStatus IsListenClipboard { get; set; } = AllowStatus.NONE; - public AllowStatus IsAutoParseVideo { get; set; } = AllowStatus.NONE; - public ParseScope ParseScope { get; set; } = ParseScope.NOT_SET; - public AllowStatus IsAutoDownloadAll { get; set; } = AllowStatus.NONE; - public DownloadFinishedSort DownloadFinishedSort { get; set; } = DownloadFinishedSort.NOT_SET; - } -} diff --git a/src/DownKyi.Core/Settings/Models/DanmakuSettings.cs b/src/DownKyi.Core/Settings/Models/DanmakuSettings.cs deleted file mode 100644 index e018152..0000000 --- a/src/DownKyi.Core/Settings/Models/DanmakuSettings.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace DownKyi.Core.Settings.Models -{ - /// - /// 弹幕 - /// - public class DanmakuSettings - { - public AllowStatus DanmakuTopFilter { get; set; } = AllowStatus.NONE; - public AllowStatus DanmakuBottomFilter { get; set; } = AllowStatus.NONE; - public AllowStatus DanmakuScrollFilter { get; set; } = AllowStatus.NONE; - public AllowStatus IsCustomDanmakuResolution { get; set; } = AllowStatus.NONE; - public int DanmakuScreenWidth { get; set; } = -1; - public int DanmakuScreenHeight { get; set; } = -1; - public string DanmakuFontName { get; set; } = null; - public int DanmakuFontSize { get; set; } = -1; - public int DanmakuLineCount { get; set; } = -1; - public DanmakuLayoutAlgorithm DanmakuLayoutAlgorithm { get; set; } = DanmakuLayoutAlgorithm.NONE; - } -} diff --git a/src/DownKyi.Core/Settings/Models/NetworkSettings.cs b/src/DownKyi.Core/Settings/Models/NetworkSettings.cs deleted file mode 100644 index 857952b..0000000 --- a/src/DownKyi.Core/Settings/Models/NetworkSettings.cs +++ /dev/null @@ -1,40 +0,0 @@ -using DownKyi.Core.Aria2cNet.Server; - -namespace DownKyi.Core.Settings.Models -{ - /// - /// 网络 - /// - public class NetworkSettings - { - public AllowStatus IsLiftingOfRegion { get; set; } = AllowStatus.NONE; - - public AllowStatus UseSSL { get; set; } = AllowStatus.NONE; - public string UserAgent { get; set; } = string.Empty; - - public Downloader Downloader { get; set; } = Downloader.NOT_SET; - public int MaxCurrentDownloads { get; set; } = -1; - - #region built-in - public int Split { get; set; } = -1; - public AllowStatus IsHttpProxy { get; set; } = AllowStatus.NONE; - public string HttpProxy { get; set; } = null; - public int HttpProxyListenPort { get; set; } = -1; - #endregion - - #region Aria - public string AriaToken { get; set; } = null; - public string AriaHost { get; set; } = null; - public int AriaListenPort { get; set; } = -1; - public AriaConfigLogLevel AriaLogLevel { get; set; } = AriaConfigLogLevel.NOT_SET; - public int AriaSplit { get; set; } = -1; - public int AriaMaxOverallDownloadLimit { get; set; } = -1; - public int AriaMaxDownloadLimit { get; set; } = -1; - public AriaConfigFileAllocation AriaFileAllocation { get; set; } = AriaConfigFileAllocation.NOT_SET; - - public AllowStatus IsAriaHttpProxy { get; set; } = AllowStatus.NONE; - public string AriaHttpProxy { get; set; } = null; - public int AriaHttpProxyListenPort { get; set; } = -1; - #endregion - } -} diff --git a/src/DownKyi.Core/Settings/Models/UserInfoSettings.cs b/src/DownKyi.Core/Settings/Models/UserInfoSettings.cs deleted file mode 100644 index 63debc7..0000000 --- a/src/DownKyi.Core/Settings/Models/UserInfoSettings.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace DownKyi.Core.Settings.Models -{ - public class UserInfoSettings - { - public long Mid { get; set; } - public string Name { get; set; } - public bool IsLogin { get; set; } // 是否登录 - public bool IsVip { get; set; } // 是否为大会员,未登录时为false - - public string ImgKey { get; set; } - public string SubKey { get; set; } - } -} diff --git a/src/DownKyi.Core/Settings/Models/VideoContentSettings.cs b/src/DownKyi.Core/Settings/Models/VideoContentSettings.cs deleted file mode 100644 index ddc26a1..0000000 --- a/src/DownKyi.Core/Settings/Models/VideoContentSettings.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace DownKyi.Core.Settings.Models -{ - public class VideoContentSettings - { - public bool DownloadAudio { get; set; } = true; - public bool DownloadVideo { get; set; } = true; - public bool DownloadDanmaku { get; set; } = true; - public bool DownloadSubtitle { get; set; } = true; - public bool DownloadCover { get; set; } = true; - } -} diff --git a/src/DownKyi.Core/Settings/Models/VideoSettings.cs b/src/DownKyi.Core/Settings/Models/VideoSettings.cs deleted file mode 100644 index 0eeec39..0000000 --- a/src/DownKyi.Core/Settings/Models/VideoSettings.cs +++ /dev/null @@ -1,23 +0,0 @@ -using DownKyi.Core.FileName; -using System.Collections.Generic; - -namespace DownKyi.Core.Settings.Models -{ - /// - /// 视频 - /// - public class VideoSettings - { - public int VideoCodecs { get; set; } = -1; // AVC or HEVC - public int Quality { get; set; } = -1; // 画质 - public int AudioQuality { get; set; } = -1; // 音质 - public AllowStatus IsTranscodingFlvToMp4 { get; set; } = AllowStatus.NONE; // 是否将flv转为mp4 - public string SaveVideoRootPath { get; set; } = null; // 视频保存路径 - public List HistoryVideoRootPaths { get; set; } = null; // 历史视频保存路径 - public AllowStatus IsUseSaveVideoRootPath { get; set; } = AllowStatus.NONE; // 是否使用默认视频保存路径 - public VideoContentSettings VideoContent { get; set; } = null; // 下载内容 - public List FileNameParts { get; set; } = null; // 文件命名格式 - public string FileNamePartTimeFormat { get; set; } = null; // 文件命名中的时间格式 - public OrderFormat OrderFormat { get; set; } = OrderFormat.NOT_SET; // 文件命名中的序号格式 - } -} diff --git a/src/DownKyi.Core/Settings/OrderFormat.cs b/src/DownKyi.Core/Settings/OrderFormat.cs deleted file mode 100644 index f496835..0000000 --- a/src/DownKyi.Core/Settings/OrderFormat.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace DownKyi.Core.Settings -{ - public enum OrderFormat - { - NOT_SET = 0, - NATURAL, // 自然数 - LEADING_ZEROS, // 前导零填充 - } -} diff --git a/src/DownKyi.Core/Settings/ParseScope.cs b/src/DownKyi.Core/Settings/ParseScope.cs deleted file mode 100644 index d846ebf..0000000 --- a/src/DownKyi.Core/Settings/ParseScope.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace DownKyi.Core.Settings -{ - public enum ParseScope - { - NOT_SET = 0, - NONE = 1, - SELECTED_ITEM, - CURRENT_SECTION, - ALL - } -} diff --git a/src/DownKyi.Core/Settings/SettingsManager.About.cs b/src/DownKyi.Core/Settings/SettingsManager.About.cs deleted file mode 100644 index 5cb15cb..0000000 --- a/src/DownKyi.Core/Settings/SettingsManager.About.cs +++ /dev/null @@ -1,66 +0,0 @@ -namespace DownKyi.Core.Settings -{ - public partial class SettingsManager - { - // 是否接收测试版更新 - private readonly AllowStatus isReceiveBetaVersion = AllowStatus.NO; - - // 是否在启动时自动检查更新 - private readonly AllowStatus autoUpdateWhenLaunch = AllowStatus.YES; - - /// - /// 获取是否接收测试版更新 - /// - /// - public AllowStatus IsReceiveBetaVersion() - { - appSettings = GetSettings(); - if (appSettings.About.IsReceiveBetaVersion == AllowStatus.NONE) - { - // 第一次获取,先设置默认值 - IsReceiveBetaVersion(isReceiveBetaVersion); - return isReceiveBetaVersion; - } - return appSettings.About.IsReceiveBetaVersion; - } - - /// - /// 设置是否接收测试版更新 - /// - /// - /// - public bool IsReceiveBetaVersion(AllowStatus isReceiveBetaVersion) - { - appSettings.About.IsReceiveBetaVersion = isReceiveBetaVersion; - return SetSettings(); - } - - /// - /// 获取是否允许启动时检查更新 - /// - /// - public AllowStatus GetAutoUpdateWhenLaunch() - { - appSettings = GetSettings(); - if (appSettings.About.AutoUpdateWhenLaunch == AllowStatus.NONE) - { - // 第一次获取,先设置默认值 - SetAutoUpdateWhenLaunch(autoUpdateWhenLaunch); - return autoUpdateWhenLaunch; - } - return appSettings.About.AutoUpdateWhenLaunch; - } - - /// - /// 设置是否允许启动时检查更新 - /// - /// - /// - public bool SetAutoUpdateWhenLaunch(AllowStatus autoUpdateWhenLaunch) - { - appSettings.About.AutoUpdateWhenLaunch = autoUpdateWhenLaunch; - return SetSettings(); - } - - } -} diff --git a/src/DownKyi.Core/Settings/SettingsManager.Basic.cs b/src/DownKyi.Core/Settings/SettingsManager.Basic.cs deleted file mode 100644 index ccf618f..0000000 --- a/src/DownKyi.Core/Settings/SettingsManager.Basic.cs +++ /dev/null @@ -1,186 +0,0 @@ -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.DOWNLOAD; - - /// - /// 获取下载完成后的操作 - /// - /// - 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.NOT_SET) - { - // 第一次获取,先设置默认值 - SetDownloadFinishedSort(finishedSort); - return finishedSort; - } - return appSettings.Basic.DownloadFinishedSort; - } - - /// - /// 设置下载完成列表排序 - /// - /// - /// - public bool SetDownloadFinishedSort(DownloadFinishedSort finishedSort) - { - appSettings.Basic.DownloadFinishedSort = finishedSort; - return SetSettings(); - } - - } -} diff --git a/src/DownKyi.Core/Settings/SettingsManager.Danmaku.cs b/src/DownKyi.Core/Settings/SettingsManager.Danmaku.cs deleted file mode 100644 index 48e9a1b..0000000 --- a/src/DownKyi.Core/Settings/SettingsManager.Danmaku.cs +++ /dev/null @@ -1,307 +0,0 @@ -namespace DownKyi.Core.Settings -{ - public partial class SettingsManager - { - // 是否屏蔽顶部弹幕 - private readonly AllowStatus danmakuTopFilter = AllowStatus.NO; - - // 是否屏蔽底部弹幕 - private readonly AllowStatus danmakuBottomFilter = AllowStatus.NO; - - // 是否屏蔽滚动弹幕 - private readonly AllowStatus danmakuScrollFilter = AllowStatus.NO; - - // 是否自定义分辨率 - private readonly AllowStatus isCustomDanmakuResolution = AllowStatus.NO; - - // 分辨率-宽 - private readonly int danmakuScreenWidth = 1920; - - // 分辨率-高 - private readonly int danmakuScreenHeight = 1080; - - // 弹幕字体 - private readonly string danmakuFontName = "黑体"; - - // 弹幕字体大小 - private readonly int danmakuFontSize = 50; - - // 弹幕限制行数 - private readonly int danmakuLineCount = 0; - - // 弹幕布局算法 - private readonly DanmakuLayoutAlgorithm danmakuLayoutAlgorithm = DanmakuLayoutAlgorithm.SYNC; - - - /// - /// 获取是否屏蔽顶部弹幕 - /// - /// - public AllowStatus GetDanmakuTopFilter() - { - appSettings = GetSettings(); - if (appSettings.Danmaku.DanmakuTopFilter == AllowStatus.NONE) - { - // 第一次获取,先设置默认值 - SetDanmakuTopFilter(danmakuTopFilter); - return danmakuTopFilter; - } - return appSettings.Danmaku.DanmakuTopFilter; - } - - /// - /// 设置是否屏蔽顶部弹幕 - /// - /// - /// - public bool SetDanmakuTopFilter(AllowStatus danmakuFilter) - { - appSettings.Danmaku.DanmakuTopFilter = danmakuFilter; - return SetSettings(); - } - - /// - /// 获取是否屏蔽底部弹幕 - /// - /// - public AllowStatus GetDanmakuBottomFilter() - { - appSettings = GetSettings(); - if (appSettings.Danmaku.DanmakuBottomFilter == AllowStatus.NONE) - { - // 第一次获取,先设置默认值 - SetDanmakuBottomFilter(danmakuBottomFilter); - return danmakuBottomFilter; - } - return appSettings.Danmaku.DanmakuBottomFilter; - } - - /// - /// 设置是否屏蔽底部弹幕 - /// - /// - /// - public bool SetDanmakuBottomFilter(AllowStatus danmakuFilter) - { - appSettings.Danmaku.DanmakuBottomFilter = danmakuFilter; - return SetSettings(); - } - - /// - /// 获取是否屏蔽滚动弹幕 - /// - /// - public AllowStatus GetDanmakuScrollFilter() - { - appSettings = GetSettings(); - if (appSettings.Danmaku.DanmakuScrollFilter == AllowStatus.NONE) - { - // 第一次获取,先设置默认值 - SetDanmakuScrollFilter(danmakuScrollFilter); - return danmakuScrollFilter; - } - return appSettings.Danmaku.DanmakuScrollFilter; - } - - /// - /// 设置是否屏蔽滚动弹幕 - /// - /// - /// - public bool SetDanmakuScrollFilter(AllowStatus danmakuFilter) - { - appSettings.Danmaku.DanmakuScrollFilter = danmakuFilter; - return SetSettings(); - } - - /// - /// 获取是否自定义分辨率 - /// - /// - public AllowStatus IsCustomDanmakuResolution() - { - appSettings = GetSettings(); - if (appSettings.Danmaku.IsCustomDanmakuResolution == AllowStatus.NONE) - { - // 第一次获取,先设置默认值 - IsCustomDanmakuResolution(isCustomDanmakuResolution); - return isCustomDanmakuResolution; - } - return appSettings.Danmaku.IsCustomDanmakuResolution; - } - - /// - /// 设置是否自定义分辨率 - /// - /// - /// - public bool IsCustomDanmakuResolution(AllowStatus isCustomResolution) - { - appSettings.Danmaku.IsCustomDanmakuResolution = isCustomResolution; - return SetSettings(); - } - - /// - /// 获取分辨率-宽 - /// - /// - public int GetDanmakuScreenWidth() - { - appSettings = GetSettings(); - if (appSettings.Danmaku.DanmakuScreenWidth == -1) - { - // 第一次获取,先设置默认值 - SetDanmakuScreenWidth(danmakuScreenWidth); - return danmakuScreenWidth; - } - return appSettings.Danmaku.DanmakuScreenWidth; - } - - /// - /// 设置分辨率-宽 - /// - /// - /// - public bool SetDanmakuScreenWidth(int screenWidth) - { - appSettings.Danmaku.DanmakuScreenWidth = screenWidth; - return SetSettings(); - } - - /// - /// 获取分辨率-高 - /// - /// - public int GetDanmakuScreenHeight() - { - appSettings = GetSettings(); - if (appSettings.Danmaku.DanmakuScreenHeight == -1) - { - // 第一次获取,先设置默认值 - SetDanmakuScreenHeight(danmakuScreenHeight); - return danmakuScreenHeight; - } - return appSettings.Danmaku.DanmakuScreenHeight; - } - - /// - /// 设置分辨率-高 - /// - /// - /// - public bool SetDanmakuScreenHeight(int screenHeight) - { - appSettings.Danmaku.DanmakuScreenHeight = screenHeight; - return SetSettings(); - } - - /// - /// 获取弹幕字体 - /// - /// - public string GetDanmakuFontName() - { - appSettings = GetSettings(); - if (appSettings.Danmaku.DanmakuFontName == null) - { - // 第一次获取,先设置默认值 - SetDanmakuFontName(danmakuFontName); - return danmakuFontName; - } - return appSettings.Danmaku.DanmakuFontName; - } - - /// - /// 设置弹幕字体 - /// - /// - /// - public bool SetDanmakuFontName(string danmakuFontName) - { - appSettings.Danmaku.DanmakuFontName = danmakuFontName; - return SetSettings(); - } - - /// - /// 获取弹幕字体大小 - /// - /// - public int GetDanmakuFontSize() - { - appSettings = GetSettings(); - if (appSettings.Danmaku.DanmakuFontSize == -1) - { - // 第一次获取,先设置默认值 - SetDanmakuFontSize(danmakuFontSize); - return danmakuFontSize; - } - return appSettings.Danmaku.DanmakuFontSize; - } - - /// - /// 设置弹幕字体大小 - /// - /// - /// - public bool SetDanmakuFontSize(int danmakuFontSize) - { - appSettings.Danmaku.DanmakuFontSize = danmakuFontSize; - return SetSettings(); - } - - /// - /// 获取弹幕限制行数 - /// - /// - public int GetDanmakuLineCount() - { - appSettings = GetSettings(); - if (appSettings.Danmaku.DanmakuLineCount == -1) - { - // 第一次获取,先设置默认值 - SetDanmakuLineCount(danmakuLineCount); - return danmakuLineCount; - } - return appSettings.Danmaku.DanmakuLineCount; - } - - /// - /// 设置弹幕限制行数 - /// - /// - /// - public bool SetDanmakuLineCount(int danmakuLineCount) - { - appSettings.Danmaku.DanmakuLineCount = danmakuLineCount; - return SetSettings(); - } - - /// - /// 获取弹幕布局算法 - /// - /// - public DanmakuLayoutAlgorithm GetDanmakuLayoutAlgorithm() - { - appSettings = GetSettings(); - if (appSettings.Danmaku.DanmakuLayoutAlgorithm == DanmakuLayoutAlgorithm.NONE) - { - // 第一次获取,先设置默认值 - SetDanmakuLayoutAlgorithm(danmakuLayoutAlgorithm); - return danmakuLayoutAlgorithm; - } - return appSettings.Danmaku.DanmakuLayoutAlgorithm; - } - - /// - /// 设置弹幕布局算法 - /// - /// - /// - public bool SetDanmakuLayoutAlgorithm(DanmakuLayoutAlgorithm danmakuLayoutAlgorithm) - { - appSettings.Danmaku.DanmakuLayoutAlgorithm = danmakuLayoutAlgorithm; - return SetSettings(); - } - - } -} diff --git a/src/DownKyi.Core/Settings/SettingsManager.Network.cs b/src/DownKyi.Core/Settings/SettingsManager.Network.cs deleted file mode 100644 index 4e9d04e..0000000 --- a/src/DownKyi.Core/Settings/SettingsManager.Network.cs +++ /dev/null @@ -1,600 +0,0 @@ -using DownKyi.Core.Aria2cNet.Server; - -namespace DownKyi.Core.Settings -{ - public partial class SettingsManager - { - // 是否开启解除地区限制 - private readonly AllowStatus isLiftingOfRegion = AllowStatus.YES; - - // 启用https - private readonly AllowStatus useSSL = AllowStatus.YES; - - // UserAgent - private readonly string userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"; - - // 下载器 - private readonly Downloader downloader = Downloader.ARIA; - - // 最大同时下载数(任务数) - private readonly int maxCurrentDownloads = 3; - - // 单文件最大线程数 - private readonly int split = 8; - - // HttpProxy代理 - private readonly AllowStatus isHttpProxy = AllowStatus.NO; - private readonly string httpProxy = string.Empty; - private readonly int httpProxyListenPort = 0; - - // Aria服务器token - private readonly string ariaToken = "downkyi"; - - // Aria服务器host - private readonly string ariaHost = "http://localhost"; - - // Aria服务器端口号 - private readonly int ariaListenPort = 6800; - - // Aria日志等级 - private readonly AriaConfigLogLevel ariaLogLevel = AriaConfigLogLevel.INFO; - - // Aria单文件最大线程数 - private readonly int ariaSplit = 5; - - // Aria下载速度限制 - private readonly int ariaMaxOverallDownloadLimit = 0; - - // Aria下载单文件速度限制 - private readonly int ariaMaxDownloadLimit = 0; - - // Aria文件预分配 - private readonly AriaConfigFileAllocation ariaFileAllocation = AriaConfigFileAllocation.NONE; - - // Aria HttpProxy代理 - private readonly AllowStatus isAriaHttpProxy = AllowStatus.NO; - private readonly string ariaHttpProxy = string.Empty; - private readonly int ariaHttpProxyListenPort = 0; - - /// - /// 获取是否解除地区限制 - /// - /// - public AllowStatus IsLiftingOfRegion() - { - appSettings = GetSettings(); - if (appSettings.Network.IsLiftingOfRegion == AllowStatus.NONE) - { - // 第一次获取,先设置默认值 - IsLiftingOfRegion(isLiftingOfRegion); - return isLiftingOfRegion; - } - return appSettings.Network.IsLiftingOfRegion; - } - - /// - /// 设置是否解除地区限制 - /// - /// - /// - public bool IsLiftingOfRegion(AllowStatus isLiftingOfRegion) - { - appSettings.Network.IsLiftingOfRegion = isLiftingOfRegion; - return SetSettings(); - } - - /// - /// 获取是否启用https - /// - /// - public AllowStatus UseSSL() - { - appSettings = GetSettings(); - if (appSettings.Network.UseSSL == AllowStatus.NONE) - { - // 第一次获取,先设置默认值 - UseSSL(useSSL); - return useSSL; - } - return appSettings.Network.UseSSL; - } - - /// - /// 设置是否启用https - /// - /// - /// - public bool UseSSL(AllowStatus useSSL) - { - appSettings.Network.UseSSL = useSSL; - return SetSettings(); - } - - /// - /// 获取UserAgent - /// - /// - public string GetUserAgent() - { - appSettings = GetSettings(); - if (appSettings.Network.UserAgent == string.Empty) - { - // 第一次获取,先设置默认值 - SetUserAgent(userAgent); - return userAgent; - } - return appSettings.Network.UserAgent; - } - - /// - /// 设置UserAgent - /// - /// - /// - public bool SetUserAgent(string userAgent) - { - appSettings.Network.UserAgent = userAgent; - return SetSettings(); - } - - /// - /// 获取下载器 - /// - /// - public Downloader GetDownloader() - { - appSettings = GetSettings(); - if (appSettings.Network.Downloader == Downloader.NOT_SET) - { - // 第一次获取,先设置默认值 - SetDownloader(downloader); - return downloader; - } - return appSettings.Network.Downloader; - } - - /// - /// 设置下载器 - /// - /// - /// - public bool SetDownloader(Downloader downloader) - { - appSettings.Network.Downloader = downloader; - return SetSettings(); - } - - /// - /// 获取最大同时下载数(任务数) - /// - /// - public int GetMaxCurrentDownloads() - { - appSettings = GetSettings(); - if (appSettings.Network.MaxCurrentDownloads == -1) - { - // 第一次获取,先设置默认值 - SetMaxCurrentDownloads(maxCurrentDownloads); - return maxCurrentDownloads; - } - return appSettings.Network.MaxCurrentDownloads; - } - - /// - /// 设置最大同时下载数(任务数) - /// - /// - /// - public bool SetMaxCurrentDownloads(int maxCurrentDownloads) - { - appSettings.Network.MaxCurrentDownloads = maxCurrentDownloads; - return SetSettings(); - } - - /// - /// 获取单文件最大线程数 - /// - /// - public int GetSplit() - { - appSettings = GetSettings(); - if (appSettings.Network.Split == -1) - { - // 第一次获取,先设置默认值 - SetSplit(split); - return split; - } - return appSettings.Network.Split; - } - - /// - /// 设置单文件最大线程数 - /// - /// - /// - public bool SetSplit(int split) - { - appSettings.Network.Split = split; - return SetSettings(); - } - - /// - /// 获取是否开启Http代理 - /// - /// - public AllowStatus IsHttpProxy() - { - appSettings = GetSettings(); - if (appSettings.Network.IsHttpProxy == AllowStatus.NONE) - { - // 第一次获取,先设置默认值 - IsHttpProxy(isHttpProxy); - return isHttpProxy; - } - return appSettings.Network.IsHttpProxy; - } - - /// - /// 设置是否开启Http代理 - /// - /// - /// - public bool IsHttpProxy(AllowStatus isHttpProxy) - { - appSettings.Network.IsHttpProxy = isHttpProxy; - return SetSettings(); - } - - /// - /// 获取Http代理的地址 - /// - /// - public string GetHttpProxy() - { - appSettings = GetSettings(); - if (appSettings.Network.HttpProxy == null) - { - // 第一次获取,先设置默认值 - SetHttpProxy(httpProxy); - return httpProxy; - } - return appSettings.Network.HttpProxy; - } - - /// - /// 设置Aria的http代理的地址 - /// - /// - /// - public bool SetHttpProxy(string httpProxy) - { - appSettings.Network.HttpProxy = httpProxy; - return SetSettings(); - } - - /// - /// 获取Http代理的端口 - /// - /// - public int GetHttpProxyListenPort() - { - appSettings = GetSettings(); - if (appSettings.Network.HttpProxyListenPort == -1) - { - // 第一次获取,先设置默认值 - SetHttpProxyListenPort(httpProxyListenPort); - return httpProxyListenPort; - } - return appSettings.Network.HttpProxyListenPort; - } - - /// - /// 设置Http代理的端口 - /// - /// - /// - public bool SetHttpProxyListenPort(int httpProxyListenPort) - { - appSettings.Network.HttpProxyListenPort = httpProxyListenPort; - return SetSettings(); - } - - /// - /// 获取Aria服务器的token - /// - /// - public string GetAriaToken() - { - appSettings = GetSettings(); - if (appSettings.Network.AriaToken == null) - { - // 第一次获取,先设置默认值 - SetHttpProxy(ariaToken); - return ariaToken; - } - return appSettings.Network.AriaToken; - } - - /// - /// 设置Aria服务器的token - /// - /// - /// - public bool SetAriaToken(string token) - { - appSettings.Network.AriaToken = token; - return SetSettings(); - } - - /// - /// 获取Aria服务器的host - /// - /// - public string GetAriaHost() - { - appSettings = GetSettings(); - if (appSettings.Network.AriaHost == null) - { - // 第一次获取,先设置默认值 - SetHttpProxy(ariaHost); - return ariaHost; - } - return appSettings.Network.AriaHost; - } - - /// - /// 设置Aria服务器的host - /// - /// - /// - public bool SetAriaHost(string host) - { - appSettings.Network.AriaHost = host; - return SetSettings(); - } - - /// - /// 获取Aria服务器的端口号 - /// - /// - public int GetAriaListenPort() - { - appSettings = GetSettings(); - if (appSettings.Network.AriaListenPort == -1) - { - // 第一次获取,先设置默认值 - SetAriaListenPort(ariaListenPort); - return ariaListenPort; - } - return appSettings.Network.AriaListenPort; - } - - /// - /// 设置Aria服务器的端口号 - /// - /// - /// - public bool SetAriaListenPort(int ariaListenPort) - { - appSettings.Network.AriaListenPort = ariaListenPort; - return SetSettings(); - } - - /// - /// 获取Aria日志等级 - /// - /// - public AriaConfigLogLevel GetAriaLogLevel() - { - appSettings = GetSettings(); - if (appSettings.Network.AriaLogLevel == AriaConfigLogLevel.NOT_SET) - { - // 第一次获取,先设置默认值 - SetAriaLogLevel(ariaLogLevel); - return ariaLogLevel; - } - return appSettings.Network.AriaLogLevel; - } - - /// - /// 设置Aria日志等级 - /// - /// - /// - public bool SetAriaLogLevel(AriaConfigLogLevel ariaLogLevel) - { - appSettings.Network.AriaLogLevel = ariaLogLevel; - return SetSettings(); - } - - /// - /// 获取Aria单文件最大线程数 - /// - /// - public int GetAriaSplit() - { - appSettings = GetSettings(); - if (appSettings.Network.AriaSplit == -1) - { - // 第一次获取,先设置默认值 - SetAriaSplit(ariaSplit); - return ariaSplit; - } - return appSettings.Network.AriaSplit; - } - - /// - /// 设置Aria单文件最大线程数 - /// - /// - /// - public bool SetAriaSplit(int ariaSplit) - { - appSettings.Network.AriaSplit = ariaSplit; - return SetSettings(); - } - - /// - /// 获取Aria下载速度限制 - /// - /// - public int GetAriaMaxOverallDownloadLimit() - { - appSettings = GetSettings(); - if (appSettings.Network.AriaMaxOverallDownloadLimit == -1) - { - // 第一次获取,先设置默认值 - SetAriaMaxOverallDownloadLimit(ariaMaxOverallDownloadLimit); - return ariaMaxOverallDownloadLimit; - } - return appSettings.Network.AriaMaxOverallDownloadLimit; - } - - /// - /// 设置Aria下载速度限制 - /// - /// - /// - public bool SetAriaMaxOverallDownloadLimit(int ariaMaxOverallDownloadLimit) - { - appSettings.Network.AriaMaxOverallDownloadLimit = ariaMaxOverallDownloadLimit; - return SetSettings(); - } - - /// - /// 获取Aria下载单文件速度限制 - /// - /// - public int GetAriaMaxDownloadLimit() - { - appSettings = GetSettings(); - if (appSettings.Network.AriaMaxDownloadLimit == -1) - { - // 第一次获取,先设置默认值 - SetAriaMaxDownloadLimit(ariaMaxDownloadLimit); - return ariaMaxDownloadLimit; - } - return appSettings.Network.AriaMaxDownloadLimit; - } - - /// - /// 设置Aria下载单文件速度限制 - /// - /// - /// - public bool SetAriaMaxDownloadLimit(int ariaMaxDownloadLimit) - { - appSettings.Network.AriaMaxDownloadLimit = ariaMaxDownloadLimit; - return SetSettings(); - } - - /// - /// 获取Aria文件预分配 - /// - /// - public AriaConfigFileAllocation GetAriaFileAllocation() - { - appSettings = GetSettings(); - if (appSettings.Network.AriaFileAllocation == AriaConfigFileAllocation.NOT_SET) - { - // 第一次获取,先设置默认值 - SetAriaFileAllocation(ariaFileAllocation); - return ariaFileAllocation; - } - return appSettings.Network.AriaFileAllocation; - } - - /// - /// 设置Aria文件预分配 - /// - /// - /// - public bool SetAriaFileAllocation(AriaConfigFileAllocation ariaFileAllocation) - { - appSettings.Network.AriaFileAllocation = ariaFileAllocation; - return SetSettings(); - } - - /// - /// 获取是否开启Aria http代理 - /// - /// - public AllowStatus IsAriaHttpProxy() - { - appSettings = GetSettings(); - if (appSettings.Network.IsAriaHttpProxy == AllowStatus.NONE) - { - // 第一次获取,先设置默认值 - IsAriaHttpProxy(isAriaHttpProxy); - return isAriaHttpProxy; - } - return appSettings.Network.IsAriaHttpProxy; - } - - /// - /// 设置是否开启Aria http代理 - /// - /// - /// - public bool IsAriaHttpProxy(AllowStatus isAriaHttpProxy) - { - appSettings.Network.IsAriaHttpProxy = isAriaHttpProxy; - return SetSettings(); - } - - /// - /// 获取Aria的http代理的地址 - /// - /// - public string GetAriaHttpProxy() - { - appSettings = GetSettings(); - if (appSettings.Network.AriaHttpProxy == null) - { - // 第一次获取,先设置默认值 - SetAriaHttpProxy(ariaHttpProxy); - return ariaHttpProxy; - } - return appSettings.Network.AriaHttpProxy; - } - - /// - /// 设置Aria的http代理的地址 - /// - /// - /// - public bool SetAriaHttpProxy(string ariaHttpProxy) - { - appSettings.Network.AriaHttpProxy = ariaHttpProxy; - return SetSettings(); - } - - /// - /// 获取Aria的http代理的端口 - /// - /// - public int GetAriaHttpProxyListenPort() - { - appSettings = GetSettings(); - if (appSettings.Network.AriaHttpProxyListenPort == -1) - { - // 第一次获取,先设置默认值 - SetAriaHttpProxyListenPort(ariaHttpProxyListenPort); - return ariaHttpProxyListenPort; - } - return appSettings.Network.AriaHttpProxyListenPort; - } - - /// - /// 设置Aria的http代理的端口 - /// - /// - /// - public bool SetAriaHttpProxyListenPort(int ariaHttpProxyListenPort) - { - appSettings.Network.AriaHttpProxyListenPort = ariaHttpProxyListenPort; - return SetSettings(); - } - - } -} diff --git a/src/DownKyi.Core/Settings/SettingsManager.UserInfo.cs b/src/DownKyi.Core/Settings/SettingsManager.UserInfo.cs deleted file mode 100644 index fda9352..0000000 --- a/src/DownKyi.Core/Settings/SettingsManager.UserInfo.cs +++ /dev/null @@ -1,44 +0,0 @@ -using DownKyi.Core.Settings.Models; - -namespace DownKyi.Core.Settings -{ - public partial class SettingsManager - { - // 登录用户的mid - private readonly UserInfoSettings userInfo = new UserInfoSettings - { - Mid = -1, - Name = "", - IsLogin = false, - IsVip = false - }; - - /// - /// 获取登录用户信息 - /// - /// - public UserInfoSettings GetUserInfo() - { - appSettings = GetSettings(); - if (appSettings.UserInfo == null) - { - // 第一次获取,先设置默认值 - SetUserInfo(userInfo); - return userInfo; - } - return appSettings.UserInfo; - } - - /// - /// 设置中保存登录用户的信息,在index刷新用户状态时使用 - /// - /// - /// - public bool SetUserInfo(UserInfoSettings userInfo) - { - appSettings.UserInfo = userInfo; - return SetSettings(); - } - - } -} diff --git a/src/DownKyi.Core/Settings/SettingsManager.Video.cs b/src/DownKyi.Core/Settings/SettingsManager.Video.cs deleted file mode 100644 index c8133f8..0000000 --- a/src/DownKyi.Core/Settings/SettingsManager.Video.cs +++ /dev/null @@ -1,355 +0,0 @@ -using DownKyi.Core.FileName; -using DownKyi.Core.Settings.Models; -using System; -using System.Collections.Generic; -using System.IO; - -namespace DownKyi.Core.Settings -{ - public partial class SettingsManager - { - // 设置优先下载的视频编码 - private readonly int videoCodecs = 7; - - // 设置优先下载画质 - private readonly int quality = 120; - - // 设置优先下载音质 - private readonly int audioQuality = 30280; - - // 是否下载flv视频后转码为mp4 - private readonly AllowStatus isTranscodingFlvToMp4 = AllowStatus.YES; - - // 默认下载目录 - private readonly string saveVideoRootPath = Path.Combine(Environment.CurrentDirectory, "Media"); - - // 历史下载目录 - private readonly List historyVideoRootPaths = new List(); - - // 是否使用默认下载目录,如果是,则每次点击下载选中项时不再询问下载目录 - private readonly AllowStatus isUseSaveVideoRootPath = AllowStatus.NO; - - // 下载内容 - private readonly VideoContentSettings videoContent = new VideoContentSettings(); - - // 文件命名格式 - private readonly List fileNameParts = new List - { - FileNamePart.MAIN_TITLE, - FileNamePart.SLASH, - FileNamePart.SECTION, - FileNamePart.SLASH, - FileNamePart.ORDER, - FileNamePart.HYPHEN, - FileNamePart.PAGE_TITLE, - FileNamePart.HYPHEN, - FileNamePart.VIDEO_QUALITY, - FileNamePart.HYPHEN, - FileNamePart.VIDEO_CODEC, - }; - - // 文件命名中的时间格式 - private readonly string fileNamePartTimeFormat = "yyyy-MM-dd"; - - // 文件命名中的序号格式 - private readonly OrderFormat orderFormat = OrderFormat.NATURAL; - - /// - /// 获取优先下载的视频编码 - /// - /// - public int GetVideoCodecs() - { - appSettings = GetSettings(); - if (appSettings.Video.VideoCodecs == -1) - { - // 第一次获取,先设置默认值 - SetVideoCodecs(videoCodecs); - return videoCodecs; - } - return appSettings.Video.VideoCodecs; - } - - /// - /// 设置优先下载的视频编码 - /// - /// - /// - public bool SetVideoCodecs(int videoCodecs) - { - appSettings.Video.VideoCodecs = videoCodecs; - return SetSettings(); - } - - /// - /// 获取优先下载画质 - /// - /// - public int GetQuality() - { - appSettings = GetSettings(); - if (appSettings.Video.Quality == -1) - { - // 第一次获取,先设置默认值 - SetQuality(quality); - return quality; - } - return appSettings.Video.Quality; - } - - /// - /// 设置优先下载画质 - /// - /// - /// - public bool SetQuality(int quality) - { - appSettings.Video.Quality = quality; - return SetSettings(); - } - - /// - /// 获取优先下载音质 - /// - /// - public int GetAudioQuality() - { - appSettings = GetSettings(); - if (appSettings.Video.AudioQuality == -1) - { - // 第一次获取,先设置默认值 - SetAudioQuality(audioQuality); - return audioQuality; - } - return appSettings.Video.AudioQuality; - } - - /// - /// 设置优先下载音质 - /// - /// - /// - public bool SetAudioQuality(int quality) - { - appSettings.Video.AudioQuality = quality; - return SetSettings(); - } - - /// - /// 获取是否下载flv视频后转码为mp4 - /// - /// - public AllowStatus IsTranscodingFlvToMp4() - { - appSettings = GetSettings(); - if (appSettings.Video.IsTranscodingFlvToMp4 == AllowStatus.NONE) - { - // 第一次获取,先设置默认值 - IsTranscodingFlvToMp4(isTranscodingFlvToMp4); - return isTranscodingFlvToMp4; - } - return appSettings.Video.IsTranscodingFlvToMp4; - } - - /// - /// 设置是否下载flv视频后转码为mp4 - /// - /// - /// - public bool IsTranscodingFlvToMp4(AllowStatus isTranscodingFlvToMp4) - { - appSettings.Video.IsTranscodingFlvToMp4 = isTranscodingFlvToMp4; - return SetSettings(); - } - - /// - /// 获取下载目录 - /// - /// - public string GetSaveVideoRootPath() - { - appSettings = GetSettings(); - if (appSettings.Video.SaveVideoRootPath == null) - { - // 第一次获取,先设置默认值 - SetSaveVideoRootPath(saveVideoRootPath); - return saveVideoRootPath; - } - return appSettings.Video.SaveVideoRootPath; - } - - /// - /// 设置下载目录 - /// - /// - /// - public bool SetSaveVideoRootPath(string path) - { - appSettings.Video.SaveVideoRootPath = path; - return SetSettings(); - } - - /// - /// 获取历史下载目录 - /// - /// - public List GetHistoryVideoRootPaths() - { - appSettings = GetSettings(); - if (appSettings.Video.HistoryVideoRootPaths == null) - { - // 第一次获取,先设置默认值 - SetHistoryVideoRootPaths(historyVideoRootPaths); - return historyVideoRootPaths; - } - return appSettings.Video.HistoryVideoRootPaths; - } - - /// - /// 设置历史下载目录 - /// - /// - /// - public bool SetHistoryVideoRootPaths(List historyPaths) - { - appSettings.Video.HistoryVideoRootPaths = historyPaths; - return SetSettings(); - } - - /// - /// 获取是否使用默认下载目录 - /// - /// - public AllowStatus IsUseSaveVideoRootPath() - { - appSettings = GetSettings(); - if (appSettings.Video.IsUseSaveVideoRootPath == AllowStatus.NONE) - { - // 第一次获取,先设置默认值 - IsUseSaveVideoRootPath(isUseSaveVideoRootPath); - return isUseSaveVideoRootPath; - } - return appSettings.Video.IsUseSaveVideoRootPath; - } - - /// - /// 设置是否使用默认下载目录 - /// - /// - /// - public bool IsUseSaveVideoRootPath(AllowStatus isUseSaveVideoRootPath) - { - appSettings.Video.IsUseSaveVideoRootPath = isUseSaveVideoRootPath; - return SetSettings(); - } - - /// - /// 获取下载内容 - /// - /// - public VideoContentSettings GetVideoContent() - { - appSettings = GetSettings(); - if (appSettings.Video.VideoContent == null) - { - // 第一次获取,先设置默认值 - SetVideoContent(videoContent); - return videoContent; - } - return appSettings.Video.VideoContent; - } - - /// - /// 设置下载内容 - /// - /// - /// - public bool SetVideoContent(VideoContentSettings videoContent) - { - appSettings.Video.VideoContent = videoContent; - return SetSettings(); - } - - /// - /// 获取文件命名格式 - /// - /// - public List GetFileNameParts() - { - appSettings = GetSettings(); - if (appSettings.Video.FileNameParts == null || appSettings.Video.FileNameParts.Count == 0) - { - // 第一次获取,先设置默认值 - SetFileNameParts(fileNameParts); - return fileNameParts; - } - return appSettings.Video.FileNameParts; - } - - /// - /// 设置文件命名格式 - /// - /// - /// - public bool SetFileNameParts(List fileNameParts) - { - appSettings.Video.FileNameParts = fileNameParts; - return SetSettings(); - } - - /// - /// 获取文件命名中的时间格式 - /// - /// - public string GetFileNamePartTimeFormat() - { - appSettings = GetSettings(); - if (appSettings.Video.FileNamePartTimeFormat == null || appSettings.Video.FileNamePartTimeFormat == string.Empty) - { - // 第一次获取,先设置默认值 - SetFileNamePartTimeFormat(fileNamePartTimeFormat); - return fileNamePartTimeFormat; - } - return appSettings.Video.FileNamePartTimeFormat; - } - - /// - /// 设置文件命名中的时间格式 - /// - /// - /// - public bool SetFileNamePartTimeFormat(string fileNamePartTimeFormat) - { - appSettings.Video.FileNamePartTimeFormat = fileNamePartTimeFormat; - return SetSettings(); - } - - /// - /// 获取文件命名中的序号格式 - /// - /// - public OrderFormat GetOrderFormat() - { - appSettings = GetSettings(); - if (appSettings.Video.OrderFormat == OrderFormat.NOT_SET) - { - // 第一次获取,先设置默认值 - SetOrderFormat(orderFormat); - return orderFormat; - } - return appSettings.Video.OrderFormat; - } - - /// - /// 设置文件命名中的序号格式 - /// - /// - /// - public bool SetOrderFormat(OrderFormat orderFormat) - { - appSettings.Video.OrderFormat = orderFormat; - return SetSettings(); - } - - } -} diff --git a/src/DownKyi.Core/Settings/SettingsManager.cs b/src/DownKyi.Core/Settings/SettingsManager.cs deleted file mode 100644 index 44a16bc..0000000 --- a/src/DownKyi.Core/Settings/SettingsManager.cs +++ /dev/null @@ -1,120 +0,0 @@ -using DownKyi.Core.Settings.Models; -using Newtonsoft.Json; -using System; -using System.IO; - -#if DEBUG -#else -using DownKyi.Core.Utils.Encryptor; -#endif - -namespace DownKyi.Core.Settings -{ - public partial class SettingsManager - { - private static SettingsManager instance; - - // 内存中保存一份配置 - private AppSettings appSettings; - -#if DEBUG - // 设置的配置文件 - private readonly string settingsName = Storage.StorageManager.GetSettings() + "_debug.json"; -#else - // 设置的配置文件 - private readonly string settingsName = Storage.StorageManager.GetSettings(); - - // 密钥 - private readonly string password = "YO1J$4#p"; -#endif - - /// - /// 获取SettingsManager实例 - /// - /// - public static SettingsManager GetInstance() - { - if (instance == null) - { - instance = new SettingsManager(); - } - return instance; - } - - /// - /// 隐藏Settings()方法,必须使用单例模式 - /// - private SettingsManager() - { - appSettings = GetSettings(); - } - - /// - /// 获取AppSettingsModel - /// - /// - private AppSettings GetSettings() - { - if (appSettings != null) { return appSettings; } - - try - { - //FileStream fileStream = new FileStream(settingsName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); - //StreamReader streamReader = new StreamReader(fileStream, System.Text.Encoding.UTF8); - //string jsonWordTemplate = streamReader.ReadToEnd(); - //streamReader.Close(); - //fileStream.Close(); - string jsonWordTemplate = string.Empty; - using (var stream = new FileStream(settingsName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete)) - { - using (var reader = new StreamReader(stream, System.Text.Encoding.UTF8)) - { - jsonWordTemplate = reader.ReadToEnd(); - } - } - -#if DEBUG -#else - // 解密字符串 - jsonWordTemplate = Encryptor.DecryptString(jsonWordTemplate, password); -#endif - - return JsonConvert.DeserializeObject(jsonWordTemplate); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetSettings()发生异常: {0}", e); - Logging.LogManager.Error("SettingsManager", e); - return new AppSettings(); - } - } - - /// - /// 设置AppSettingsModel - /// - /// - private bool SetSettings() - { - try - { - string json = JsonConvert.SerializeObject(appSettings); - -#if DEBUG -#else - // 加密字符串 - json = Encryptor.EncryptString(json, password); -#endif - - File.WriteAllText(settingsName, json); - return true; - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("SetSettings()发生异常: {0}", e); - Logging.LogManager.Error("SettingsManager", e); - return false; - } - } - - } -} diff --git a/src/DownKyi.Core/Settings/VideoCodecs.cs b/src/DownKyi.Core/Settings/VideoCodecs.cs deleted file mode 100644 index 4694aa0..0000000 --- a/src/DownKyi.Core/Settings/VideoCodecs.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace DownKyi.Core.Settings -{ - public enum VideoCodecs - { - NONE = 0, - AVC, - HEVC - } -} diff --git a/src/DownKyi.Core/Storage/Constant.cs b/src/DownKyi.Core/Storage/Constant.cs deleted file mode 100644 index ba25f00..0000000 --- a/src/DownKyi.Core/Storage/Constant.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; - -namespace DownKyi.Core.Storage -{ - /// - /// 存储到本地时使用的一些常量 - /// - internal static class Constant - { - // 根目录 - //private static string Root { get; } = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/Downkyi"; - private static string Root { get; } = Environment.CurrentDirectory; - - // Aria - public static string Aria { get; } = $"{Root}/Aria"; - - // 日志 - public static string Logs { get; } = $"{Root}/Logs"; - - // 数据库 - public static string Database { get; } = $"{Root}/Storage"; - - // 历史(搜索、下载) (加密) - public static string Download { get; } = $"{Database}/Download.db"; - public static string History { get; } = $"{Database}/History.db"; - - // 配置 - public static string Config { get; } = $"{Root}/Config"; - - // 设置 - public static string Settings { get; } = $"{Config}/Settings"; - - // 登录cookies - public static string Login { get; } = $"{Config}/Login"; - - // Bilibili - private static string Bilibili { get; } = $"{Root}/Bilibili"; - - // 弹幕 - public static string Danmaku { get; } = $"{Bilibili}/Danmakus"; - - // 字幕 - public static string Subtitle { get; } = $"{Bilibili}/Subtitle"; - - // 评论 - // TODO - - // 头图 - public static string Toutu { get; } = $"{Bilibili}/Toutu"; - - // 封面 - public static string Cover { get; } = $"{Bilibili}/Cover"; - - // 封面文件索引 - public static string CoverIndex { get; } = $"{Cover}/Index.db"; - - // 视频快照 - public static string Snapshot { get; } = $"{Bilibili}/Snapshot"; - - // 视频快照文件索引 - public static string SnapshotIndex { get; } = $"{Cover}/Index.db"; - - // 用户头像 - public static string Header { get; } = $"{Bilibili}/Header"; - - // 用户头像文件索引 - public static string HeaderIndex { get; } = $"{Header}/Index.db"; - - } -} diff --git a/src/DownKyi.Core/Storage/Database/Cover.cs b/src/DownKyi.Core/Storage/Database/Cover.cs deleted file mode 100644 index 47c6da7..0000000 --- a/src/DownKyi.Core/Storage/Database/Cover.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace DownKyi.Core.Storage.Database -{ - public class Cover - { - public long Avid { get; set; } - public string Bvid { get; set; } - public long Cid { get; set; } - public string Url { get; set; } - public string Md5 { get; set; } - } -} diff --git a/src/DownKyi.Core/Storage/Database/CoverDb.cs b/src/DownKyi.Core/Storage/Database/CoverDb.cs deleted file mode 100644 index 9576116..0000000 --- a/src/DownKyi.Core/Storage/Database/CoverDb.cs +++ /dev/null @@ -1,148 +0,0 @@ -using DownKyi.Core.Logging; -using System; -using System.Collections.Generic; - -namespace DownKyi.Core.Storage.Database -{ - public class CoverDb - { - private const string key = "b5018ecc-09d1-4da2-aa49-4625e41e623e"; - private readonly string tableName = "cover"; - -#if DEBUG - private readonly DbHelper dbHelper = new DbHelper(StorageManager.GetCoverIndex().Replace(".db", "_debug.db")); -#else - private readonly DbHelper dbHelper = new DbHelper(StorageManager.GetCoverIndex(), key); -#endif - - public CoverDb() - { - CreateTable(); - } - - /// - /// 关闭数据库连接 - /// - public void Close() - { - dbHelper.Close(); - } - - /// - /// 插入新的数据 - /// - /// - public void Insert(Cover cover) - { - try - { - string sql = $"insert into {tableName} values ({cover.Avid}, '{cover.Bvid}', {cover.Cid}, '{cover.Url}', '{cover.Md5}')"; - dbHelper.ExecuteNonQuery(sql); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("Insert()发生异常: {0}", e); - LogManager.Error("CoverDb", e); - } - } - - /// - /// 更新数据,以url检索 - /// - /// - public void Update(Cover cover) - { - try - { - string sql = $"update {tableName} set avid={cover.Avid}, bvid='{cover.Bvid}', cid={cover.Cid}, md5='{cover.Md5}' where url glob '{cover.Url}'"; - dbHelper.ExecuteNonQuery(sql); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("Update()发生异常: {0}", e); - LogManager.Error("CoverDb", e); - } - - } - - /// - /// 查询所有数据 - /// - /// - public List QueryAll() - { - string sql = $"select * from {tableName}"; - return Query(sql); - } - - /// - /// 查询url对应的数据 - /// - /// - /// - public Cover QueryByUrl(string url) - { - string sql = $"select * from {tableName} where url glob '{url}'"; - List query = Query(sql); - return query.Count > 0 ? query[0] : null; - } - - /// - /// 查询md5对应的数据 - /// - /// - /// - public Cover QueryByMd5(string md5) - { - string sql = $"select * from {tableName} where md5 glob '{md5}'"; - List query = Query(sql); - return query.Count > 0 ? query[0] : null; - } - - /// - /// 查询数据 - /// - /// - /// - private List Query(string sql) - { - List covers = new List(); - - try - { - dbHelper.ExecuteQuery(sql, reader => - { - while (reader.Read()) - { - Cover cover = new Cover - { - Avid = (long)reader["avid"], - Bvid = (string)reader["bvid"], - Cid = (long)reader["cid"], - Url = (string)reader["url"], - Md5 = (string)reader["md5"] - }; - covers.Add(cover); - } - }); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("Query()发生异常: {0}", e); - LogManager.Error($"{tableName}", e); - } - - return covers; - } - - /// - /// 如果表不存在则创建表 - /// - private void CreateTable() - { - string sql = $"create table if not exists {tableName} (avid unsigned big int, bvid varchar(20), cid unsigned big int, url varchar(255) unique, md5 varchar(32) unique)"; - dbHelper.ExecuteNonQuery(sql); - } - - } -} diff --git a/src/DownKyi.Core/Storage/Database/DbHelper.cs b/src/DownKyi.Core/Storage/Database/DbHelper.cs deleted file mode 100644 index a2e753f..0000000 --- a/src/DownKyi.Core/Storage/Database/DbHelper.cs +++ /dev/null @@ -1,161 +0,0 @@ -using DownKyi.Core.Logging; -using System; -using System.Collections.Generic; -using System.Data.SQLite; - -namespace DownKyi.Core.Storage.Database -{ - public class DbHelper - { - private readonly string connStr; - private readonly SQLiteConnection conn; - - private static readonly Dictionary database = new Dictionary(); - - /// - /// 创建一个数据库 - /// - /// - public DbHelper(string dbPath) - { - connStr = $"Data Source={dbPath};Version=3;"; - - if (database.ContainsKey(connStr)) - { - conn = database[connStr]; - - if (conn != null) - { - return; - } - } - - conn = new SQLiteConnection(connStr); - database.Add(connStr, conn); - } - - /// - /// 创建一个带密码的数据库 - /// - /// - /// - public DbHelper(string dbPath, string secretKey) - { - connStr = $"Data Source={dbPath};Version=3;"; - - if (database.ContainsKey(connStr)) - { - conn = database[connStr]; - - if (conn != null) - { - return; - } - } - - conn = new SQLiteConnection(connStr); - conn.SetPassword(secretKey); - database.Add(connStr, conn); - } - - /// - /// 连接是否开启 - /// - /// - public bool IsOpen() - { - return conn.State == System.Data.ConnectionState.Open; - } - - /// - /// 开启连接 - /// - public void Open() - { - if (conn == null) { return; } - - if (!IsOpen()) - { - conn.Open(); - } - } - - /// - /// 关闭数据库 - /// - public void Close() - { - if (conn == null) { return; } - - if (IsOpen()) - { - conn.Close(); - - database.Remove(connStr); - } - } - - /// - /// 执行一条SQL语句 - /// - /// - public void ExecuteNonQuery(string sql, Action action = null) - { - if (conn == null) { return; } - - try - { - lock (conn) - { - Open(); - using (var tr = conn.BeginTransaction()) - { - using (var command = conn.CreateCommand()) - { - command.CommandText = sql; - // 添加参数 - action?.Invoke(command.Parameters); - command.ExecuteNonQuery(); - } - tr.Commit(); - } - } - } - catch (SQLiteException e) - { - Utils.Debugging.Console.PrintLine("DbHelper ExecuteNonQuery()发生异常: {0}", e); - LogManager.Error("DbHelper ExecuteNonQuery()", e); - } - } - - /// - /// 执行一条SQL语句,并执行提供的操作,一般用于查询 - /// - /// - /// - public void ExecuteQuery(string sql, Action action) - { - if (conn == null) { return; } - - try - { - lock (conn) - { - Open(); - using (var command = conn.CreateCommand()) - { - command.CommandText = sql; - var reader = command.ExecuteReader(); - action(reader); - } - } - } - catch (SQLiteException e) - { - Utils.Debugging.Console.PrintLine("DbHelper ExecuteQuery()发生异常: {0}", e); - LogManager.Error("DbHelper ExecuteQuery()", e); - } - } - - } -} diff --git a/src/DownKyi.Core/Storage/Database/Download/DownloadBaseDb.cs b/src/DownKyi.Core/Storage/Database/Download/DownloadBaseDb.cs deleted file mode 100644 index 2d56986..0000000 --- a/src/DownKyi.Core/Storage/Database/Download/DownloadBaseDb.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace DownKyi.Core.Storage.Database.Download -{ - public class DownloadBaseDb : DownloadDb - { - public DownloadBaseDb() - { - tableName = "download_base"; - CreateTable(); - } - } -} diff --git a/src/DownKyi.Core/Storage/Database/Download/DownloadDb.cs b/src/DownKyi.Core/Storage/Database/Download/DownloadDb.cs deleted file mode 100644 index b4cf645..0000000 --- a/src/DownKyi.Core/Storage/Database/Download/DownloadDb.cs +++ /dev/null @@ -1,200 +0,0 @@ -using DownKyi.Core.Logging; -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.SQLite; -using System.IO; -using System.Runtime.Serialization.Formatters.Binary; - -namespace DownKyi.Core.Storage.Database.Download -{ - public class DownloadDb - { - private const string key = "bdb8eb69-3698-4af9-b722-9312d0fba623"; - protected string tableName = "download"; - -#if DEBUG - private readonly DbHelper dbHelper = new DbHelper(StorageManager.GetDownload().Replace(".db", "_debug.db")); -#else - private readonly DbHelper dbHelper = new DbHelper(StorageManager.GetDownload(), key); -#endif - - /// - /// 关闭数据库连接 - /// - public void Close() - { - dbHelper.Close(); - } - - /// - /// 插入新的数据 - /// - /// - public void Insert(string uuid, object obj) - { - try - { - // 定义一个流 - Stream stream = new MemoryStream(); - // 定义一个格式化器 - BinaryFormatter formatter = new BinaryFormatter(); - // 序列化 - formatter.Serialize(stream, obj); - - byte[] array = null; - array = new byte[stream.Length]; - - //将二进制流写入数组 - stream.Position = 0; - stream.Read(array, 0, (int)stream.Length); - - //关闭流 - stream.Close(); - - string sql = $"insert into {tableName}(id, data) values (@id, @data)"; - dbHelper.ExecuteNonQuery(sql, new Action((para) => - { - para.Add("@id", DbType.String).Value = uuid; - para.Add("@data", DbType.Binary).Value = array; - })); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("Insert()发生异常: {0}", e); - LogManager.Error($"{tableName}", e); - } - } - - /// - /// 删除uuid对应的数据 - /// - /// - public void Delete(string uuid) - { - try - { - string sql = $"delete from {tableName} where id glob '{uuid}'"; - dbHelper.ExecuteNonQuery(sql); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("Delete()发生异常: {0}", e); - LogManager.Error($"{tableName}", e); - } - } - - public void Update(string uuid, object obj) - { - try - { - // 定义一个流 - Stream stream = new MemoryStream(); - // 定义一个格式化器 - BinaryFormatter formatter = new BinaryFormatter(); - // 序列化 - formatter.Serialize(stream, obj); - - byte[] array = null; - array = new byte[stream.Length]; - - //将二进制流写入数组 - stream.Position = 0; - stream.Read(array, 0, (int)stream.Length); - - //关闭流 - stream.Close(); - - string sql = $"update {tableName} set data=@data where id glob @id"; - dbHelper.ExecuteNonQuery(sql, new Action((para) => - { - para.Add("@id", DbType.String).Value = uuid; - para.Add("@data", DbType.Binary).Value = array; - })); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("Insert()发生异常: {0}", e); - LogManager.Error($"{tableName}", e); - } - } - - /// - /// 查询所有数据 - /// - /// - /// - public Dictionary QueryAll() - { - string sql = $"select * from {tableName}"; - return Query(sql); - } - - /// - /// 查询uuid对应的数据 - /// - /// - /// - public object QueryById(string uuid) - { - string sql = $"select * from {tableName} where id glob '{uuid}'"; - Dictionary query = Query(sql); - - if (query.ContainsKey(uuid)) - { - query.TryGetValue(uuid, out object obj); - return obj; - } - else - { - return null; - } - } - - /// - /// 查询数据 - /// - /// - /// - private Dictionary Query(string sql) - { - Dictionary objects = new Dictionary(); - - dbHelper.ExecuteQuery(sql, reader => - { - while (reader.Read()) - { - try - { - // 读取字节数组 - byte[] array = (byte[])reader["data"]; - // 定义一个流 - MemoryStream stream = new MemoryStream(array); - //定义一个格式化器 - BinaryFormatter formatter = new BinaryFormatter(); - // 反序列化 - object obj = formatter.Deserialize(stream); - - objects.Add((string)reader["id"], obj); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("Query()发生异常: {0}", e); - LogManager.Error($"{tableName}", e); - } - } - }); - - return objects; - } - - /// - /// 如果表不存在则创建表 - /// - protected void CreateTable() - { - string sql = $"create table if not exists {tableName} (id varchar(255) unique, data blob)"; - dbHelper.ExecuteNonQuery(sql); - } - } -} diff --git a/src/DownKyi.Core/Storage/Database/Download/DownloadedDb.cs b/src/DownKyi.Core/Storage/Database/Download/DownloadedDb.cs deleted file mode 100644 index 7f69652..0000000 --- a/src/DownKyi.Core/Storage/Database/Download/DownloadedDb.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace DownKyi.Core.Storage.Database.Download -{ - public class DownloadedDb : DownloadDb - { - public DownloadedDb() - { - tableName = "downloaded"; - CreateTable(); - } - } -} diff --git a/src/DownKyi.Core/Storage/Database/Download/DownloadingDb.cs b/src/DownKyi.Core/Storage/Database/Download/DownloadingDb.cs deleted file mode 100644 index 8569318..0000000 --- a/src/DownKyi.Core/Storage/Database/Download/DownloadingDb.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace DownKyi.Core.Storage.Database.Download -{ - public class DownloadingDb : DownloadDb - { - public DownloadingDb() - { - tableName = "downloading"; - CreateTable(); - } - } -} diff --git a/src/DownKyi.Core/Storage/Database/Header.cs b/src/DownKyi.Core/Storage/Database/Header.cs deleted file mode 100644 index bcabba0..0000000 --- a/src/DownKyi.Core/Storage/Database/Header.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace DownKyi.Core.Storage.Database -{ - public class Header - { - public long Mid { get; set; } - public string Name { get; set; } - public string Url { get; set; } - public string Md5 { get; set; } - } -} diff --git a/src/DownKyi.Core/Storage/Database/HeaderDb.cs b/src/DownKyi.Core/Storage/Database/HeaderDb.cs deleted file mode 100644 index 28f9a48..0000000 --- a/src/DownKyi.Core/Storage/Database/HeaderDb.cs +++ /dev/null @@ -1,134 +0,0 @@ -using DownKyi.Core.Logging; -using System; -using System.Collections.Generic; - -namespace DownKyi.Core.Storage.Database -{ - public class HeaderDb - { - private const string key = "7c1f1f40-7cdf-4d11-ad28-f0137a3c5308"; - private readonly string tableName = "header"; - -#if DEBUG - private readonly DbHelper dbHelper = new DbHelper(StorageManager.GetHeaderIndex().Replace(".db", "_debug.db")); -#else - private readonly DbHelper dbHelper = new DbHelper(StorageManager.GetHeaderIndex(), key); -#endif - - public HeaderDb() - { - CreateTable(); - } - - /// - /// 关闭数据库连接 - /// - public void Close() - { - dbHelper.Close(); - } - - /// - /// 插入新的数据 - /// - /// - public void Insert(Header header) - { - try - { - string sql = $"insert into {tableName} values ({header.Mid}, '{header.Name}', '{header.Url}', '{header.Md5}')"; - dbHelper.ExecuteNonQuery(sql); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("Insert()发生异常: {0}", e); - LogManager.Error("HeaderDb", e); - } - } - - /// - /// 更新数据 - /// - /// - public void Update(Header header) - { - try - { - string sql = $"update {tableName} set name='{header.Name}', url='{header.Url}', md5='{header.Md5}' where mid={header.Mid}"; - dbHelper.ExecuteNonQuery(sql); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("Update()发生异常: {0}", e); - LogManager.Error("HeaderDb", e); - } - } - - /// - /// 查询所有数据 - /// - /// - public List
QueryAll() - { - string sql = $"select * from {tableName}"; - return Query(sql); - } - - /// - /// 查询mid对应的数据 - /// - /// - /// - public Header QueryByMid(long mid) - { - string sql = $"select * from {tableName} where mid={mid}"; - List
query = Query(sql); - return query.Count > 0 ? query[0] : null; - } - - /// - /// 查询数据 - /// - /// - /// - private List
Query(string sql) - { - List
headers = new List
(); - - try - { - dbHelper.ExecuteQuery(sql, reader => - { - while (reader.Read()) - { - Header header = new Header - { - Mid = (long)reader["mid"], - Name = (string)reader["name"], - Url = (string)reader["url"], - Md5 = (string)reader["md5"] - }; - headers.Add(header); - } - }); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("Query()发生异常: {0}", e); - LogManager.Error($"{tableName}", e); - } - - return headers; - } - - /// - /// 如果表不存在则创建表 - /// - private void CreateTable() - { - string sql = $"create table if not exists {tableName} (mid unsigned big int unique, name varchar(255), url varchar(255), md5 varchar(32))"; - dbHelper.ExecuteNonQuery(sql); - } - - } -} diff --git a/src/DownKyi.Core/Storage/StorageCover.cs b/src/DownKyi.Core/Storage/StorageCover.cs deleted file mode 100644 index dee2701..0000000 --- a/src/DownKyi.Core/Storage/StorageCover.cs +++ /dev/null @@ -1,248 +0,0 @@ -using DownKyi.Core.Logging; -using DownKyi.Core.Storage.Database; -using DownKyi.Core.Utils.Encryptor; -using System; -using System.Drawing; -using System.IO; -using System.Windows.Media.Imaging; -using WebPSharp; - -namespace DownKyi.Core.Storage -{ - public class StorageCover - { - // 先判断本地有没有 - // 如果有 - // 则返回本地的图片路径 - // 如果没有 - // 则下载图片并返回本地的图片路径 - - /// - /// 获取封面缩略图 - /// - /// - /// - /// - /// - /// - /// - /// - public BitmapImage GetCoverThumbnail(long avid, string bvid, long cid, string url, int width, int height) - { - string header = GetCover(avid, bvid, cid, url); - - return GetCoverThumbnail(header, width, height); - } - - /// - /// 获取封面缩略图 - /// - /// - /// - /// - /// - public BitmapImage GetCoverThumbnail(string cover, int width, int height) - { - if (cover == null) { return null; } - - try - { - Bitmap bitmap = new Bitmap(cover); - Image thumbnail = bitmap.GetThumbnailImage(width, height, null, IntPtr.Zero); - - return StorageUtils.BitmapToBitmapImage(new Bitmap(thumbnail)); - } - catch (ArgumentException) - { - try - { - SimpleDecoder simpleDecoder = new SimpleDecoder(cover); - Bitmap bitmap = simpleDecoder.WebPtoBitmap(); - Image thumbnail = bitmap.GetThumbnailImage(width, height, null, IntPtr.Zero); - - return StorageUtils.BitmapToBitmapImage(new Bitmap(thumbnail)); - } - catch (Exception ex) - { - Utils.Debugging.Console.PrintLine("GetCoverThumbnail()发生异常: {0}", ex); - LogManager.Error("StorageCover.GetCoverThumbnail()", ex); - - return null; - } - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetCoverThumbnail()发生异常: {0}", e); - LogManager.Error("StorageCover.GetCoverThumbnail()", e); - - return null; - } - } - - /// - /// 获取封面 - /// - /// - /// - public string GetCover(string url) - { - return GetCover(0, "", 0, url); - } - - /// - /// 获取封面 - /// - /// - /// - /// - /// - /// - public string GetCover(long avid, string bvid, long cid, string url) - { - CoverDb coverDb = new CoverDb(); - Cover cover = coverDb.QueryByUrl(url); - - // 如果存在,直接返回 - // 如果不存在,则先下载 - if (cover != null) - { - string coverPath = $"{StorageManager.GetCover()}/{cover.Md5}"; - if (File.Exists(coverPath)) - { - Cover newCover = new Cover - { - Avid = avid, - Bvid = bvid, - Cid = cid, - Url = url, - Md5 = cover.Md5 - }; - coverDb.Update(newCover); - - //coverDb.Close(); - return $"{StorageManager.GetCover()}/{cover.Md5}"; - } - else - { - string md5 = DownloadImage(url); - if (md5 != null) - { - Cover newCover = new Cover - { - Avid = avid, - Bvid = bvid, - Cid = cid, - Url = url, - Md5 = md5 - }; - coverDb.Update(newCover); - - //coverDb.Close(); - return $"{StorageManager.GetCover()}/{md5}"; - } - else - { - //coverDb.Close(); - return null; - } - } - } - else - { - string md5 = DownloadImage(url); - if (md5 != null) - { - Cover newCover = new Cover - { - Avid = avid, - Bvid = bvid, - Cid = cid, - Url = url, - Md5 = md5 - }; - coverDb.Insert(newCover); - - //coverDb.Close(); - return $"{StorageManager.GetCover()}/{md5}"; - } - else - { - //coverDb.Close(); - return null; - } - } - } - - /// - /// 下载图片 - /// - /// - /// - private string DownloadImage(string url) - { - string localFile = Path.GetTempPath() + Guid.NewGuid().ToString("N"); - - // 下载 - bool isSuccessed = StorageUtils.DownloadImage(url, localFile); - if (isSuccessed) - { - try - { - string md5 = Hash.GetMD5HashFromFile(localFile); - - if (File.Exists(localFile)) - { - string destFile = $"{StorageManager.GetCover()}/{md5}"; - - try - { - File.Delete(destFile); - } - catch { } - - // 移动到指定位置 - File.Move(localFile, destFile); - - return md5; - } - else - { - return null; - } - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("DownloadImage()发生异常: {0}", e); - LogManager.Error("StorageCover", e); - return null; - } - } - - return null; - } - - /// - /// 本地是否存在 - /// - /// - /// - public bool IsLocal(CoverDb coverDb, string url) - { - Cover cover = coverDb.QueryByUrl(url); - return cover != null; - } - - /// - /// 返回图片md5值 - /// - /// - /// - /// - public string LocalCover(CoverDb coverDb, string url) - { - Cover cover = coverDb.QueryByUrl(url); - return cover.Md5; - } - - } -} diff --git a/src/DownKyi.Core/Storage/StorageHeader.cs b/src/DownKyi.Core/Storage/StorageHeader.cs deleted file mode 100644 index 49e0d5a..0000000 --- a/src/DownKyi.Core/Storage/StorageHeader.cs +++ /dev/null @@ -1,205 +0,0 @@ -using DownKyi.Core.Logging; -using DownKyi.Core.Storage.Database; -using DownKyi.Core.Utils.Encryptor; -using System; -using System.Drawing; -using System.IO; -using System.Windows.Media.Imaging; -using WebPSharp; - -namespace DownKyi.Core.Storage -{ - public class StorageHeader - { - // 先判断本地有没有 - // 如果有 - // 则返回本地的图片路径 - // 如果没有 - // 则下载图片并返回本地的图片路径 - - /// - /// 获取用户头像缩略图 - /// - /// - /// - /// - /// - /// - /// - public BitmapImage GetHeaderThumbnail(long mid, string name, string url, int width, int height) - { - string header = GetHeader(mid, name, url); - if (header == null) { return null; } - - return GetHeaderThumbnail(header, width, height); - } - - /// - /// 获取用户头像缩略图 - /// - /// - /// - /// - /// - public BitmapImage GetHeaderThumbnail(string header, int width, int height) - { - if (header == null) { return null; } - - try - { - Bitmap bitmap = new Bitmap(header); - Image thumbnail = bitmap.GetThumbnailImage(width, height, null, IntPtr.Zero); - - return StorageUtils.BitmapToBitmapImage(new Bitmap(thumbnail)); - } - catch (ArgumentException) - { - try - { - SimpleDecoder simpleDecoder = new SimpleDecoder(header); - Bitmap bitmap = simpleDecoder.WebPtoBitmap(); - Image thumbnail = bitmap.GetThumbnailImage(width, height, null, IntPtr.Zero); - - return StorageUtils.BitmapToBitmapImage(new Bitmap(thumbnail)); - } - catch (Exception ex) - { - Utils.Debugging.Console.PrintLine("GetHeaderThumbnail()发生异常: {0}", ex); - LogManager.Error("StorageHeader.GetHeaderThumbnail()", ex); - - return null; - } - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("GetHeaderThumbnail()发生异常: {0}", e); - LogManager.Error("StorageHeader.GetHeaderThumbnail()", e); - - return null; - } - } - - /// - /// 获取用户头像 - /// - /// - /// - public string GetHeader(long mid, string name, string url) - { - HeaderDb headerDb = new HeaderDb(); - Header header = headerDb.QueryByMid(mid); - - if (header != null) - { - string headerPath = $"{StorageManager.GetHeader()}/{header.Md5}"; - if (File.Exists(headerPath)) - { - Header newHeader = new Header - { - Mid = mid, - Name = name, - Url = url, - Md5 = header.Md5 - }; - headerDb.Update(newHeader); - //headerDb.Close(); - return $"{StorageManager.GetHeader()}/{header.Md5}"; - } - else - { - string md5 = DownloadImage(url); - if (md5 != null) - { - Header newHeader = new Header - { - Mid = mid, - Name = name, - Url = url, - Md5 = md5 - }; - headerDb.Insert(newHeader); - //headerDb.Close(); - return $"{StorageManager.GetHeader()}/{md5}"; - } - else - { - //headerDb.Close(); - return null; - } - } - } - else - { - string md5 = DownloadImage(url); - if (md5 != null) - { - Header newHeader = new Header - { - Mid = mid, - Name = name, - Url = url, - Md5 = md5 - }; - headerDb.Insert(newHeader); - //headerDb.Close(); - return $"{StorageManager.GetHeader()}/{md5}"; - } - else - { - //headerDb.Close(); - return null; - } - } - } - - - /// - /// 下载图片 - /// - /// - /// - private string DownloadImage(string url) - { - string localFile = Path.GetTempPath() + Guid.NewGuid().ToString("N"); - - // 下载 - bool isSuccessed = StorageUtils.DownloadImage(url, localFile); - if (isSuccessed) - { - try - { - string md5 = Hash.GetMD5HashFromFile(localFile); - - if (File.Exists(localFile)) - { - string destFile = $"{StorageManager.GetHeader()}/{md5}"; - - try - { - File.Delete(destFile); - } - catch { } - - // 移动到指定位置 - File.Move(localFile, destFile); - - return md5; - } - else - { - return null; - } - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("DownloadImage()发生异常: {0}", e); - LogManager.Error("StorageHeader", e); - return null; - } - } - - return null; - } - - } -} diff --git a/src/DownKyi.Core/Storage/StorageManager.cs b/src/DownKyi.Core/Storage/StorageManager.cs deleted file mode 100644 index d8671ab..0000000 --- a/src/DownKyi.Core/Storage/StorageManager.cs +++ /dev/null @@ -1,156 +0,0 @@ -using System.IO; - -namespace DownKyi.Core.Storage -{ - public static class StorageManager - { - /// - /// 获取历史记录的文件路径 - /// - /// - public static string GetAriaDir() - { - CreateDirectory(Constant.Aria); - return Constant.Aria; - } - - /// - /// 获取历史记录的文件路径 - /// - /// - public static string GetDownload() - { - CreateDirectory(Constant.Database); - return Constant.Download; - } - - /// - /// 获取历史记录的文件路径 - /// - /// - public static string GetHistory() - { - CreateDirectory(Constant.Database); - return Constant.History; - } - - /// - /// 获取设置的文件路径 - /// - /// - public static string GetSettings() - { - CreateDirectory(Constant.Config); - return Constant.Settings; - } - - /// - /// 获取登录cookies的文件路径 - /// - /// - public static string GetLogin() - { - CreateDirectory(Constant.Config); - return Constant.Login; - } - - /// - /// 获取弹幕的文件夹路径 - /// - /// - public static string GetDanmaku() - { - return CreateDirectory(Constant.Danmaku); - } - - /// - /// 获取字幕的文件夹路径 - /// - /// - public static string GetSubtitle() - { - return CreateDirectory(Constant.Subtitle); - } - - /// - /// 获取头图的文件夹路径 - /// - /// - public static string GetToutu() - { - return CreateDirectory(Constant.Toutu); - } - - /// - /// 获取封面的文件夹路径 - /// - /// - public static string GetCover() - { - return CreateDirectory(Constant.Cover); - } - - /// - /// 获取封面索引的文件路径 - /// - /// - public static string GetCoverIndex() - { - CreateDirectory(Constant.Cover); - return Constant.CoverIndex; - } - - /// - /// 获取视频快照的文件夹路径 - /// - /// - public static string GetSnapshot() - { - return CreateDirectory(Constant.Snapshot); - } - - /// - /// 获取视频快照索引的文件路径 - /// - /// - public static string GetSnapshotIndex() - { - CreateDirectory(Constant.Snapshot); - return Constant.SnapshotIndex; - } - - /// - /// 获取用户头像的文件夹路径 - /// - /// - public static string GetHeader() - { - return CreateDirectory(Constant.Header); - } - - /// - /// 获取用户头像索引的文件路径 - /// - /// - public static string GetHeaderIndex() - { - CreateDirectory(Constant.Header); - return Constant.HeaderIndex; - } - - - /// - /// 若文件夹不存在,则创建文件夹 - /// - /// - /// - private static string CreateDirectory(string directory) - { - if (!Directory.Exists(directory)) - { - Directory.CreateDirectory(directory); - } - return directory; - } - } -} diff --git a/src/DownKyi.Core/Storage/StorageUtils.cs b/src/DownKyi.Core/Storage/StorageUtils.cs deleted file mode 100644 index c389974..0000000 --- a/src/DownKyi.Core/Storage/StorageUtils.cs +++ /dev/null @@ -1,58 +0,0 @@ -using DownKyi.Core.Logging; -using System; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using System.Net; -using System.Windows.Media.Imaging; - -namespace DownKyi.Core.Storage -{ - internal static class StorageUtils - { - /// - /// 下载图片 - /// - /// - /// - /// - public static bool DownloadImage(string url, string localFile) - { - try - { - WebClient mywebclient = new WebClient(); - mywebclient.DownloadFile(url, localFile); - } - catch (Exception e) - { - Utils.Debugging.Console.PrintLine("DownloadImage()发生异常: {0}", e); - LogManager.Error("StorageUtils", e); - return false; - } - return true; - } - - /// - /// Bitmap转BitmapImage - /// - /// - /// - public static BitmapImage BitmapToBitmapImage(Bitmap bitmap) - { - BitmapImage result = new BitmapImage(); - using (MemoryStream stream = new MemoryStream()) - { - bitmap.Save(stream, ImageFormat.Bmp); - stream.Position = 0; - result.BeginInit(); - result.CacheOption = BitmapCacheOption.OnLoad; - result.StreamSource = stream; - result.EndInit(); - result.Freeze(); - } - return result; - } - - } - -} diff --git a/src/DownKyi.Core/Utils/Debugging/Console.cs b/src/DownKyi.Core/Utils/Debugging/Console.cs deleted file mode 100644 index 84adbde..0000000 --- a/src/DownKyi.Core/Utils/Debugging/Console.cs +++ /dev/null @@ -1,139 +0,0 @@ -namespace DownKyi.Core.Utils.Debugging -{ - public static class Console - { - public static void PrintLine() - { -#if DEBUG - System.Console.WriteLine(); -#endif - } - - public static void PrintLine(float value) - { -#if DEBUG - System.Console.WriteLine(value); -#endif - } - - public static void PrintLine(int value) - { -#if DEBUG - System.Console.WriteLine(value); -#endif - } - - public static void PrintLine(uint value) - { -#if DEBUG - System.Console.WriteLine(value); -#endif - } - - public static void PrintLine(long value) - { -#if DEBUG - System.Console.WriteLine(value); -#endif - } - - public static void PrintLine(ulong value) - { -#if DEBUG - System.Console.WriteLine(value); -#endif - } - - public static void PrintLine(object value) - { -#if DEBUG - System.Console.WriteLine(value); -#endif - } - - public static void PrintLine(string value) - { -#if DEBUG - System.Console.WriteLine(value); -#endif - } - - public static void PrintLine(string format, object arg0) - { -#if DEBUG - System.Console.WriteLine(format, arg0); -#endif - } - - public static void PrintLine(string format, object arg0, object arg1) - { -#if DEBUG - System.Console.WriteLine(format, arg0, arg1); -#endif - } - - public static void PrintLine(string format, object arg0, object arg1, object arg2) - { -#if DEBUG - System.Console.WriteLine(format, arg0, arg1, arg2); -#endif - } - - public static void PrintLine(string format, object arg0, object arg1, object arg2, object arg3) - { -#if DEBUG - System.Console.WriteLine(format, arg0, arg1, arg2); -#endif - } - - public static void PrintLine(string format, params object[] arg) - { -#if DEBUG - System.Console.WriteLine(format, arg); -#endif - } - - public static void PrintLine(char[] buffer, int index, int count) - { -#if DEBUG - System.Console.WriteLine(buffer, index, count); -#endif - } - - public static void PrintLine(decimal value) - { -#if DEBUG - System.Console.WriteLine(value); -#endif - } - - public static void PrintLine(char[] buffer) - { -#if DEBUG - System.Console.WriteLine(buffer); -#endif - } - - public static void PrintLine(char value) - { -#if DEBUG - System.Console.WriteLine(value); -#endif - } - - public static void PrintLine(bool value) - { -#if DEBUG - System.Console.WriteLine(value); -#endif - } - - public static void PrintLine(double value) - { -#if DEBUG - System.Console.WriteLine(value); -#endif - } - - } -} diff --git a/src/DownKyi.Core/Utils/Encryptor/Encryptor.File.cs b/src/DownKyi.Core/Utils/Encryptor/Encryptor.File.cs deleted file mode 100644 index 1a9b9a5..0000000 --- a/src/DownKyi.Core/Utils/Encryptor/Encryptor.File.cs +++ /dev/null @@ -1,227 +0,0 @@ -using System; -using System.IO; -using System.Security.Cryptography; - -namespace DownKyi.Core.Utils.Encryptor -{ - public static partial class Encryptor - { - private const ulong FC_TAG = 0xFC010203040506CF; - private const int BUFFER_SIZE = 128 * 1024; - - /// - /// 加密文件 - /// - /// 待加密文件 - /// 加密后输入文件 - /// 加密密码 - public static void EncryptFile(string inFile, string outFile, string password) - { - using (FileStream fin = File.OpenRead(inFile), fout = File.OpenWrite(outFile)) - { - long lSize = fin.Length; // 输入文件长度 - int size = (int)lSize; - byte[] bytes = new byte[BUFFER_SIZE]; // 缓存 - int read = -1; // 输入文件读取数量 - int value = 0; - - // 获取IV和salt - byte[] IV = GenerateRandomBytes(16); - byte[] salt = GenerateRandomBytes(16); - - // 创建加密对象 - SymmetricAlgorithm sma = CreateRijndael(password, salt); - sma.IV = IV; - - // 在输出文件开始部分写入IV和salt - fout.Write(IV, 0, IV.Length); - fout.Write(salt, 0, salt.Length); - - // 创建散列加密 - HashAlgorithm hasher = SHA256.Create(); - using (CryptoStream cout = new CryptoStream(fout, sma.CreateEncryptor(), CryptoStreamMode.Write), - chash = new CryptoStream(Stream.Null, hasher, CryptoStreamMode.Write)) - { - BinaryWriter bw = new BinaryWriter(cout); - bw.Write(lSize); - - bw.Write(FC_TAG); - - // 读写字节块到加密流缓冲区 - while ((read = fin.Read(bytes, 0, bytes.Length)) != 0) - { - cout.Write(bytes, 0, read); - chash.Write(bytes, 0, read); - value += read; - } - // 关闭加密流 - chash.Flush(); - chash.Close(); - - // 读取散列 - byte[] hash = hasher.Hash; - - // 输入文件写入散列 - cout.Write(hash, 0, hash.Length); - - // 关闭文件流 - cout.Flush(); - cout.Close(); - } - } - } - - /// - /// 解密文件 - /// - /// 待解密文件 - /// 解密后输出文件 - /// 解密密码 - public static void DecryptFile(string inFile, string outFile, string password) - { - // 创建打开文件流 - using (FileStream fin = File.OpenRead(inFile), fout = File.OpenWrite(outFile)) - { - int size = (int)fin.Length; - byte[] bytes = new byte[BUFFER_SIZE]; - int read = -1; - int value = 0; - int outValue = 0; - - byte[] IV = new byte[16]; - fin.Read(IV, 0, 16); - byte[] salt = new byte[16]; - fin.Read(salt, 0, 16); - - SymmetricAlgorithm sma = CreateRijndael(password, salt); - sma.IV = IV; - - value = 32; - long lSize = -1; - - // 创建散列对象, 校验文件 - HashAlgorithm hasher = SHA256.Create(); - - try - { - using (CryptoStream cin = new CryptoStream(fin, sma.CreateDecryptor(), CryptoStreamMode.Read), - chash = new CryptoStream(Stream.Null, hasher, CryptoStreamMode.Write)) - { - // 读取文件长度 - BinaryReader br = new BinaryReader(cin); - lSize = br.ReadInt64(); - ulong tag = br.ReadUInt64(); - - if (FC_TAG != tag) - throw new CryptoHelpException("文件被破坏"); - - long numReads = lSize / BUFFER_SIZE; - - long slack = (long)lSize % BUFFER_SIZE; - - for (int i = 0; i < numReads; ++i) - { - read = cin.Read(bytes, 0, bytes.Length); - fout.Write(bytes, 0, read); - chash.Write(bytes, 0, read); - value += read; - outValue += read; - } - - if (slack > 0) - { - read = cin.Read(bytes, 0, (int)slack); - fout.Write(bytes, 0, read); - chash.Write(bytes, 0, read); - value += read; - outValue += read; - } - - chash.Flush(); - chash.Close(); - - fout.Flush(); - fout.Close(); - - byte[] curHash = hasher.Hash; - - // 获取比较和旧的散列对象 - byte[] oldHash = new byte[hasher.HashSize / 8]; - read = cin.Read(oldHash, 0, oldHash.Length); - if ((oldHash.Length != read) || (!CheckByteArrays(oldHash, curHash))) - throw new CryptoHelpException("文件被破坏"); - } - } - catch (Exception e) - { - Console.WriteLine("DecryptFile()发生异常: {0}", e); - } - - if (outValue != lSize) - throw new CryptoHelpException("文件大小不匹配"); - } - } - - /// - /// 检验两个Byte数组是否相同 - /// - /// Byte数组 - /// Byte数组 - /// true-相等 - private static bool CheckByteArrays(byte[] b1, byte[] b2) - { - if (b1.Length == b2.Length) - { - for (int i = 0; i < b1.Length; ++i) - { - if (b1[i] != b2[i]) - return false; - } - return true; - } - return false; - } - - /// - /// 创建DebugLZQ ,http://www.cnblogs.com/DebugLZQ - /// - /// 密码 - /// - /// 加密对象 - private static SymmetricAlgorithm CreateRijndael(string password, byte[] salt) - { - PasswordDeriveBytes pdb = new PasswordDeriveBytes(password, salt, "SHA256", 1000); - - SymmetricAlgorithm sma = Rijndael.Create(); - sma.KeySize = 256; - sma.Key = pdb.GetBytes(32); - sma.Padding = PaddingMode.PKCS7; - return sma; - } - - /// - /// 生成指定长度的随机Byte数组 - /// - /// Byte数组长度 - /// 随机Byte数组 - private static byte[] GenerateRandomBytes(int count) - { - // 加密文件随机数生成 - RandomNumberGenerator rand = new RNGCryptoServiceProvider(); - - byte[] bytes = new byte[count]; - rand.GetBytes(bytes); - return bytes; - } - - } - - /// - /// 异常处理类 - /// - public class CryptoHelpException : ApplicationException - { - public CryptoHelpException(string msg) : base(msg) { } - } - -} diff --git a/src/DownKyi.Core/Utils/Encryptor/Encryptor.String.cs b/src/DownKyi.Core/Utils/Encryptor/Encryptor.String.cs deleted file mode 100644 index f7dcf8b..0000000 --- a/src/DownKyi.Core/Utils/Encryptor/Encryptor.String.cs +++ /dev/null @@ -1,70 +0,0 @@ -using DownKyi.Core.Logging; -using System; -using System.IO; -using System.Security.Cryptography; -using System.Text; - -namespace DownKyi.Core.Utils.Encryptor -{ - public static partial class Encryptor - { - /// - /// DES加密字符串 - /// - /// 待加密的字符串 - /// 加密密钥,要求为8位 - /// 加密成功返回加密后的字符串,失败返回源串 - public static string EncryptString(string encryptString, string encryptKey) - { - try - { - byte[] rgbKey = Encoding.UTF8.GetBytes(encryptKey.Substring(0, 8));//转换为字节 - byte[] rgbIV = Encoding.UTF8.GetBytes(encryptKey.Substring(0, 8)); - byte[] inputByteArray = Encoding.UTF8.GetBytes(encryptString); - DESCryptoServiceProvider dCSP = new DESCryptoServiceProvider();//实例化数据加密标准 - MemoryStream mStream = new MemoryStream();//实例化内存流 - //将数据流链接到加密转换的流 - CryptoStream cStream = new CryptoStream(mStream, dCSP.CreateEncryptor(rgbKey, rgbIV), CryptoStreamMode.Write); - cStream.Write(inputByteArray, 0, inputByteArray.Length); - cStream.FlushFinalBlock(); - // 转base64 - return Convert.ToBase64String(mStream.ToArray()); - } - catch (Exception e) - { - Debugging.Console.PrintLine("EncryptString()发生异常: {0}", e); - LogManager.Error("Encryptor", e); - return encryptString; - } - } - - /// - /// DES解密字符串 - /// - /// 待解密的字符串 - /// 解密密钥,要求为8位,和加密密钥相同 - /// 解密成功返回解密后的字符串,失败返源串 - public static string DecryptString(string decryptString, string decryptKey) - { - try - { - byte[] rgbKey = Encoding.UTF8.GetBytes(decryptKey); - byte[] rgbIV = Encoding.UTF8.GetBytes(decryptKey); - byte[] inputByteArray = Convert.FromBase64String(decryptString); - DESCryptoServiceProvider DCSP = new DESCryptoServiceProvider(); - MemoryStream mStream = new MemoryStream(); - CryptoStream cStream = new CryptoStream(mStream, DCSP.CreateDecryptor(rgbKey, rgbIV), CryptoStreamMode.Write); - cStream.Write(inputByteArray, 0, inputByteArray.Length); - cStream.FlushFinalBlock(); - return Encoding.UTF8.GetString(mStream.ToArray()); - } - catch (Exception e) - { - Debugging.Console.PrintLine("DecryptString()发生异常: {0}", e); - LogManager.Error("Encryptor", e); - return decryptString; - } - } - - } -} diff --git a/src/DownKyi.Core/Utils/Encryptor/Hash.cs b/src/DownKyi.Core/Utils/Encryptor/Hash.cs deleted file mode 100644 index a170ccb..0000000 --- a/src/DownKyi.Core/Utils/Encryptor/Hash.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.IO; -using System.Security.Cryptography; -using System.Text; - -namespace DownKyi.Core.Utils.Encryptor -{ - public static class Hash - { - /// - /// 计算字符串MD5值 - /// - /// - /// - public static string GetMd5Hash(string input) - { - if (input == null) - { - return null; - } - - MD5 md5Hash = MD5.Create(); - - // 将输入字符串转换为字节数组并计算哈希数据 - byte[] data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input)); - - // 创建一个 Stringbuilder 来收集字节并创建字符串 - StringBuilder sBuilder = new StringBuilder(); - - // 循环遍历哈希数据的每一个字节并格式化为十六进制字符串 - for (int i = 0; i < data.Length; i++) - { - sBuilder.Append(data[i].ToString("x2")); - } - - // 返回十六进制字符串 - return sBuilder.ToString(); - } - - /// - /// 计算文件MD5值 - /// - /// - /// - public static string GetMD5HashFromFile(string fileName) - { - try - { - FileStream file = new FileStream(fileName, FileMode.Open); - MD5 md5 = new MD5CryptoServiceProvider(); - byte[] retVal = md5.ComputeHash(file); - file.Close(); - - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < retVal.Length; i++) - { - sb.Append(retVal[i].ToString("x2")); - } - return sb.ToString(); - } - catch (Exception e) - { - throw new Exception("GetMD5HashFromFile()发生异常: {0}" + e.Message); - } - } - - } -} diff --git a/src/DownKyi.Core/Utils/Format.cs b/src/DownKyi.Core/Utils/Format.cs deleted file mode 100644 index 6e4d77b..0000000 --- a/src/DownKyi.Core/Utils/Format.cs +++ /dev/null @@ -1,227 +0,0 @@ -using System.Text.RegularExpressions; - -namespace DownKyi.Core.Utils -{ - public static class Format - { - - /// - /// 格式化Duration时间 - /// - /// - /// - public static string FormatDuration(long duration) - { - string formatDuration; - if (duration / 60 > 0) - { - long dur = duration / 60; - if (dur / 60 > 0) - { - formatDuration = $"{dur / 60}h{dur % 60}m{duration % 60}s"; - } - else - { - formatDuration = $"{duration / 60}m{duration % 60}s"; - } - } - else - { - formatDuration = $"{duration}s"; - } - return formatDuration; - } - - /// - /// 格式化Duration时间,格式为00:00:00 - /// - /// - /// - public static string FormatDuration2(long duration) - { - string formatDuration; - if (duration / 60 > 0) - { - long dur = duration / 60; - if (dur / 60 > 0) - { - formatDuration = string.Format("{0:D2}", dur / 60) + ":" + string.Format("{0:D2}", dur % 60) + ":" + string.Format("{0:D2}", duration % 60); - } - else - { - formatDuration = "00:" + string.Format("{0:D2}", duration / 60) + ":" + string.Format("{0:D2}", duration % 60); - } - } - else - { - formatDuration = "00:00:" + string.Format("{0:D2}", duration); - } - return formatDuration; - } - - /// - /// 格式化Duration时间,格式为00:00 - /// - /// - /// - public static string FormatDuration3(long duration) - { - string formatDuration; - if (duration / 60 > 0) - { - long dur = duration / 60; - if (dur / 60 > 0) - { - formatDuration = string.Format("{0:D2}", dur / 60) + ":" + string.Format("{0:D2}", dur % 60) + ":" + string.Format("{0:D2}", duration % 60); - } - else - { - formatDuration = string.Format("{0:D2}", duration / 60) + ":" + string.Format("{0:D2}", duration % 60); - } - } - else - { - formatDuration = "00:" + string.Format("{0:D2}", duration); - } - return formatDuration; - } - - /// - /// 格式化数字,超过10000的数字将单位改为万,超过100000000的数字将单位改为亿,并保留1位小数 - /// - /// - /// - public static string FormatNumber(long number) - { - if (number > 99999999) - { - return (number / 100000000.0f).ToString("F1") + "亿"; - } - - if (number > 9999) - { - return (number / 10000.0f).ToString("F1") + "万"; - } - else - { - return number.ToString(); - } - } - - /// - /// 格式化网速 - /// - /// - /// - public static string FormatSpeed(float speed) - { - string formatSpeed; - if (speed <= 0) - { - formatSpeed = "0B/s"; - } - else if (speed < 1024) - { - formatSpeed = string.Format("{0:F2}", speed) + "B/s"; - } - else if (speed < 1024 * 1024) - { - formatSpeed = string.Format("{0:F2}", speed / 1024) + "KB/s"; - } - else - { - formatSpeed = string.Format("{0:F2}", speed / 1024 / 1024) + "MB/s"; - } - return formatSpeed; - } - - /// - /// 格式化字节大小,可用于文件大小的显示 - /// - /// - /// - public static string FormatFileSize(long fileSize) - { - string formatFileSize; - if (fileSize <= 0) - { - formatFileSize = "0B"; - } - else if (fileSize < 1024) - { - formatFileSize = fileSize.ToString() + "B"; - } - else if (fileSize < 1024 * 1024) - { - formatFileSize = (fileSize / 1024.0).ToString("#.##") + "KB"; - } - else if (fileSize < 1024 * 1024 * 1024) - { - formatFileSize = (fileSize / 1024.0 / 1024.0).ToString("#.##") + "MB"; - } - else - { - formatFileSize = (fileSize / 1024.0 / 1024.0 / 1024.0).ToString("#.##") + "GB"; - } - return formatFileSize; - } - - /// - /// 去除非法字符 - /// - /// - /// - public static string FormatFileName(string originName) - { - string destName = originName; - - // Windows中不能作为文件名的字符 - destName = destName.Replace("\\", " "); - destName = destName.Replace("/", " "); - destName = destName.Replace(":", " "); - destName = destName.Replace("*", " "); - destName = destName.Replace("?", " "); - destName = destName.Replace("\"", " "); - destName = destName.Replace("<", " "); - destName = destName.Replace(">", " "); - destName = destName.Replace("|", " "); - - // 转义字符 - destName = destName.Replace("\a", ""); - destName = destName.Replace("\b", ""); - destName = destName.Replace("\f", ""); - destName = destName.Replace("\n", ""); - destName = destName.Replace("\r", ""); - destName = destName.Replace("\t", ""); - destName = destName.Replace("\v", ""); - - // 控制字符 - destName = Regex.Replace(destName, @"\p{C}+", string.Empty); - - // 如果只有空白字符、dot符 - if (string.IsNullOrWhiteSpace(destName) || destName == ".") - { - return "[empty title]"; - } - - // 移除前导和尾部的空白字符、dot符 - int i, j; - for (i = 0; i < destName.Length; i++) - { - if (destName[i] != ' ' && destName[i] != '.') - { - break; - } - } - for (j = destName.Length - 1; j >= 0; j--) - { - if (destName[j] != ' ' && destName[j] != '.') - { - break; - } - } - return destName.Substring(i, j - i + 1); - } - - } -} diff --git a/src/DownKyi.Core/Utils/HardDisk.cs b/src/DownKyi.Core/Utils/HardDisk.cs deleted file mode 100644 index 9427ad1..0000000 --- a/src/DownKyi.Core/Utils/HardDisk.cs +++ /dev/null @@ -1,71 +0,0 @@ -using DownKyi.Core.Logging; -using System; -using System.IO; - -namespace DownKyi.Core.Utils -{ - public static class HardDisk - { - /// - /// 获取指定驱动器的空间总大小 - /// - /// 只需输入代表驱动器的字母即可 - /// - public static long GetHardDiskSpace(string hardDiskName) - { - long totalSize = 0; - - try - { - hardDiskName = $"{hardDiskName}:\\"; - DriveInfo[] drives = DriveInfo.GetDrives(); - - foreach (DriveInfo drive in drives) - { - if (drive.Name == hardDiskName) - { - totalSize = drive.TotalSize; - } - } - } - catch (Exception e) - { - Debugging.Console.PrintLine("GetHardDiskSpace()发生异常: {0}", e); - LogManager.Error("HardDisk", e); - } - - return totalSize; - } - - /// - /// 获取指定驱动器的剩余空间总大小 - /// - /// 只需输入代表驱动器的字母即可 - /// - public static long GetHardDiskFreeSpace(string hardDiskName) - { - long freeSpace = 0; - try - { - hardDiskName = $"{hardDiskName}:\\"; - DriveInfo[] drives = DriveInfo.GetDrives(); - - foreach (DriveInfo drive in drives) - { - if (drive.Name == hardDiskName) - { - freeSpace = drive.TotalFreeSpace; - } - } - } - catch (Exception e) - { - Debugging.Console.PrintLine("GetHardDiskFreeSpace()发生异常: {0}", e); - LogManager.Error("HardDisk", e); - } - - return freeSpace; - } - - } -} diff --git a/src/DownKyi.Core/Utils/ListHelper.cs b/src/DownKyi.Core/Utils/ListHelper.cs deleted file mode 100644 index b7f8a28..0000000 --- a/src/DownKyi.Core/Utils/ListHelper.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Collections.Generic; -using System.Collections.ObjectModel; - -namespace DownKyi.Core.Utils -{ - public static class ListHelper - { - - /// - /// 判断ObservableCollection中是否存在,不存在则添加 - /// - /// - /// - /// - public static void AddUnique(ObservableCollection list, T item) - { - if (!list.Contains(item)) - { - list.Add(item); - } - } - - /// - /// 判断List中是否存在,不存在则添加 - /// - /// - /// - /// - public static void AddUnique(List list, T item) - { - if (!list.Exists(t => t.Equals(item))) - { - list.Add(item); - } - } - - /// - /// 判断List中是否存在,不存在则添加 - /// - /// - /// - /// - /// - public static void InsertUnique(List list, T item, int index) - { - if (!list.Exists(t => t.Equals(item))) - { - list.Insert(index, item); - } - else - { - list.Remove(item); - list.Insert(index, item); - } - } - - } -} diff --git a/src/DownKyi.Core/Utils/MachineCode.cs b/src/DownKyi.Core/Utils/MachineCode.cs deleted file mode 100644 index faecd8f..0000000 --- a/src/DownKyi.Core/Utils/MachineCode.cs +++ /dev/null @@ -1,145 +0,0 @@ -using System; -using System.Management; - -namespace DownKyi.Core.Utils -{ - public class MachineCode - { - private static MachineCode machineCode; - - /// - /// 获取机器码 - /// - /// - public static string GetMachineCodeString() - { - if (machineCode == null) - { - machineCode = new MachineCode(); - } - - string machineCodeString = "PC." + - machineCode.GetMainBordId() + "." + - machineCode.GetCpuInfo();// + "." + - //machineCode.GetDiskID();// + "." + - //machineCode.GetMoAddress(); - return machineCodeString.Replace(" ", ""); - } - - /// - /// 获取主板ID - /// - /// - public string GetMainBordId() - { - string strId = ""; - try - { - using (ManagementClass mc = new ManagementClass("Win32_BaseBoard")) - { - ManagementObjectCollection moc = mc.GetInstances(); - foreach (ManagementObject mo in moc) - { - strId = mo.Properties["SerialNumber"].Value.ToString(); - mo.Dispose(); - break; - } - } - } - catch (Exception) - { - return "unknown"; - //throw; - } - return strId; - } - - /// - /// 获取cpu序列号 - /// - /// - public string GetCpuInfo() - { - string cpuInfo = ""; - try - { - using (ManagementClass cimobject = new ManagementClass("Win32_Processor")) - { - ManagementObjectCollection moc = cimobject.GetInstances(); - - foreach (ManagementObject mo in moc) - { - cpuInfo = mo.Properties["ProcessorId"].Value.ToString(); - mo.Dispose(); - } - } - } - catch (Exception) - { - return "unknown"; - //throw; - } - return cpuInfo; - } - - /// - /// 获取硬盘ID - /// - /// - public string GetDiskID() - { - string diskName = ""; - string diskID = ""; - try - { - using (ManagementClass cimobject1 = new ManagementClass("Win32_DiskDrive")) - { - ManagementObjectCollection moc1 = cimobject1.GetInstances(); - foreach (ManagementObject mo in moc1) - { - diskName = mo.Properties["Model"].Value.ToString(); - diskID = mo.Properties["SerialNumber"].Value.ToString(); - mo.Dispose(); - } - } - } - catch (Exception) - { - return "unknown"; - //throw; - } - return diskName + diskID; - } - - /// - /// 获取网卡硬件地址 - /// - /// - public string GetMoAddress() - { - string MoAddress = ""; - try - { - using (ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration")) - { - ManagementObjectCollection moc2 = mc.GetInstances(); - foreach (ManagementObject mo in moc2) - { - if ((bool)mo["IPEnabled"]) - { - MoAddress = mo["MacAddress"].ToString(); - } - - mo.Dispose(); - } - } - } - catch (Exception) - { - return "unknown"; - //throw; - } - return MoAddress; - } - } -} diff --git a/src/DownKyi.Core/Utils/ObjectHelper.cs b/src/DownKyi.Core/Utils/ObjectHelper.cs deleted file mode 100644 index ff8d175..0000000 --- a/src/DownKyi.Core/Utils/ObjectHelper.cs +++ /dev/null @@ -1,172 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Runtime.Serialization.Formatters.Binary; - -namespace DownKyi.Core.Utils -{ - public static class ObjectHelper - { - - /// - /// 解析二维码登录返回的url,用于设置cookie - /// - /// - /// - public static CookieContainer ParseCookie(string url) - { - CookieContainer cookieContainer = new CookieContainer(); - - if (url == null || url == "") { return cookieContainer; } - - string[] strList = url.Split('?'); - if (strList.Count() < 2) { return cookieContainer; } - - string[] strList2 = strList[1].Split('&'); - if (strList2.Count() == 0) { return cookieContainer; } - - // 获取expires - string expires = strList2.FirstOrDefault(it => it.Contains("Expires")).Split('=')[1]; - DateTime dateTime = DateTime.Now; - dateTime = dateTime.AddSeconds(int.Parse(expires)); - - foreach (var item in strList2) - { - string[] strList3 = item.Split('='); - if (strList3.Count() < 2) { continue; } - - string name = strList3[0]; - string value = strList3[1]; - - // 不需要 - if (name == "Expires" || name == "gourl") { continue; } - - // 添加cookie - cookieContainer.Add(new Cookie(name, value.Replace(",","%2c"), "/", ".bilibili.com") { Expires = dateTime }); - Debugging.Console.PrintLine(name + ": " + value + "\t" + cookieContainer.Count); - } - - return cookieContainer; - } - - /// - /// 将CookieContainer中的所有的Cookie读出来 - /// - /// - /// - public static List GetAllCookies(CookieContainer cc) - { - List lstCookies = new List(); - - Hashtable table = (Hashtable)cc.GetType().InvokeMember("m_domainTable", - System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField | - System.Reflection.BindingFlags.Instance, null, cc, new object[] { }); - - foreach (object pathList in table.Values) - { - SortedList lstCookieCol = (SortedList)pathList.GetType().InvokeMember("m_list", - System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField - | System.Reflection.BindingFlags.Instance, null, pathList, new object[] { }); - foreach (CookieCollection colCookies in lstCookieCol.Values) - { - foreach (Cookie c in colCookies) - { - lstCookies.Add(c); - } - } - } - - return lstCookies; - } - - /// - /// 写入cookies到磁盘 - /// - /// - /// - /// - public static bool WriteCookiesToDisk(string file, CookieContainer cookieJar) - { - return WriteObjectToDisk(file, cookieJar); - } - - /// - /// 从磁盘读取cookie - /// - /// - /// - public static CookieContainer ReadCookiesFromDisk(string file) - { - return (CookieContainer)ReadObjectFromDisk(file); - } - - /// - /// 写入序列化对象到磁盘 - /// - /// - /// - /// - public static bool WriteObjectToDisk(string file, object obj) - { - try - { - using (Stream stream = File.Create(file)) - { - Debugging.Console.PrintLine("Writing object to disk... "); - - BinaryFormatter formatter = new BinaryFormatter(); - formatter.Serialize(stream, obj); - - Debugging.Console.PrintLine("Done."); - return true; - } - } - catch (IOException e) - { - Debugging.Console.PrintLine("WriteObjectToDisk()发生IO异常: {0}", e); - Logging.LogManager.Error(e); - return false; - } - catch (Exception e) - { - Debugging.Console.PrintLine("WriteObjectToDisk()发生异常: {0}", e); - Logging.LogManager.Error(e); - return false; - } - } - - /// - /// 从磁盘读取序列化对象 - /// - /// - /// - public static object ReadObjectFromDisk(string file) - { - try - { - using (Stream stream = File.Open(file, FileMode.Open)) - { - Debugging.Console.PrintLine("Reading object from disk... "); - BinaryFormatter formatter = new BinaryFormatter(); - Debugging.Console.PrintLine("Done."); - return formatter.Deserialize(stream); - } - } - catch (IOException e) - { - Debugging.Console.PrintLine("ReadObjectFromDisk()发生IO异常: {0}", e); - Logging.LogManager.Error(e); - return null; - } - catch (Exception e) - { - Debugging.Console.PrintLine("ReadObjectFromDisk()发生异常: {0}", e); - Logging.LogManager.Error(e); - return null; - } - } - } -} diff --git a/src/DownKyi.Core/Utils/QRCode.cs b/src/DownKyi.Core/Utils/QRCode.cs deleted file mode 100644 index d7e703f..0000000 --- a/src/DownKyi.Core/Utils/QRCode.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Drawing; - -namespace DownKyi.Core.Utils -{ - public static class QRCode - { - /// - /// 生成二维码 - /// - /// 信息 - /// 版本 1 ~ 40 - /// 像素点大小 - /// 图标路径 - /// 图标尺寸 - /// 图标边框厚度 - /// 二维码白边 - /// 位图 - public static Bitmap EncodeQRCode(string msg, int version, int pixel, string icon_path, int icon_size, int icon_border, bool white_edge) - { - QRCoder.QRCodeGenerator code_generator = new QRCoder.QRCodeGenerator(); - - QRCoder.QRCodeData code_data = code_generator.CreateQrCode(msg, QRCoder.QRCodeGenerator.ECCLevel.H/* 这里设置容错率的一个级别 */, true, false, QRCoder.QRCodeGenerator.EciMode.Utf8, version); - - QRCoder.QRCode code = new QRCoder.QRCode(code_data); - - Bitmap icon; - if (icon_path == null || icon_path == "") - { - icon = null; - } - else - { - icon = new Bitmap(icon_path); - } - - Bitmap bmp = code.GetGraphic(pixel, Color.Black, Color.White, icon, icon_size, icon_border, white_edge); - return bmp; - } - - } -} diff --git a/src/DownKyi.Core/Utils/StringLogicalComparer.cs b/src/DownKyi.Core/Utils/StringLogicalComparer.cs deleted file mode 100644 index d56c1af..0000000 --- a/src/DownKyi.Core/Utils/StringLogicalComparer.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace DownKyi.Core.Utils -{ - public class StringLogicalComparer : IComparer - { - /// - /// 比较两个字符串,如果含用数字,则数字按数字的大小来比较。 - /// - /// - /// - /// - public int Compare(T x, T y) - { - if (x == null || y == null) - { - throw new ArgumentException("Parameters can't be null"); - } - - string fileA = x as string; - string fileB = y as string; - char[] arr1 = fileA.ToCharArray(); - char[] arr2 = fileB.ToCharArray(); - int i = 0, j = 0; - while (i < arr1.Length && j < arr2.Length) - { - if (char.IsDigit(arr1[i]) && char.IsDigit(arr2[j])) - { - string s1 = "", s2 = ""; - while (i < arr1.Length && char.IsDigit(arr1[i])) - { - s1 += arr1[i]; - i++; - } - while (j < arr2.Length && char.IsDigit(arr2[j])) - { - s2 += arr2[j]; - j++; - } - if (int.Parse(s1) > int.Parse(s2)) - { - return 1; - } - if (int.Parse(s1) < int.Parse(s2)) - { - return -1; - } - } - else - { - if (arr1[i] > arr2[j]) - { - return 1; - } - if (arr1[i] < arr2[j]) - { - return -1; - } - i++; - j++; - } - } - if (arr1.Length == arr2.Length) - { - return 0; - } - else - { - return arr1.Length > arr2.Length ? 1 : -1; - } - } - - } -} diff --git a/src/DownKyi.Core/Utils/Validator/Number.cs b/src/DownKyi.Core/Utils/Validator/Number.cs deleted file mode 100644 index 899ecdf..0000000 --- a/src/DownKyi.Core/Utils/Validator/Number.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Text.RegularExpressions; - -namespace DownKyi.Core.Utils.Validator -{ - public static class Number - { - - /// - /// 字符串转数字(长整型) - /// - /// - /// - public static long GetInt(string value) - { - return IsInt(value) ? long.Parse(value) : -1; - } - - /// - /// 是否为数字 - /// - /// - /// - public static bool IsInt(string value) - { - return Regex.IsMatch(value, @"^\d+$"); - } - - } -} diff --git a/src/DownKyi.Core/Utils/Web.cs b/src/DownKyi.Core/Utils/Web.cs deleted file mode 100644 index 7342460..0000000 --- a/src/DownKyi.Core/Utils/Web.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace DownKyi.Core.Utils -{ - public static class Web - { - // TODO 这里的代码只是为了测试Brotli.Core,不是最终的,需要修改 - - } -} diff --git a/src/DownKyi.Core/app.config b/src/DownKyi.Core/app.config deleted file mode 100644 index ef77b31..0000000 --- a/src/DownKyi.Core/app.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/DownKyi.Core/aria2_COPYING.txt b/src/DownKyi.Core/aria2_COPYING.txt deleted file mode 100644 index 623b625..0000000 --- a/src/DownKyi.Core/aria2_COPYING.txt +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/src/DownKyi.Core/aria2c.exe b/src/DownKyi.Core/aria2c.exe deleted file mode 100644 index 97b2b5c..0000000 Binary files a/src/DownKyi.Core/aria2c.exe and /dev/null differ diff --git a/src/DownKyi.Core/ffmpeg.exe b/src/DownKyi.Core/ffmpeg.exe deleted file mode 100644 index 06e8a67..0000000 Binary files a/src/DownKyi.Core/ffmpeg.exe and /dev/null differ diff --git a/src/DownKyi.Core/packages.config b/src/DownKyi.Core/packages.config deleted file mode 100644 index 8b9b06b..0000000 --- a/src/DownKyi.Core/packages.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/DownKyi.sln b/src/DownKyi.sln deleted file mode 100644 index 5d9f268..0000000 --- a/src/DownKyi.sln +++ /dev/null @@ -1,54 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.32126.317 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DownKyi", "DownKyi\DownKyi.csproj", "{97075FCD-6E8F-4FF9-B73A-994197F3765A}" - ProjectSection(ProjectDependencies) = postProject - {4FDE0364-F65B-4812-BFE8-34E886624FBD} = {4FDE0364-F65B-4812-BFE8-34E886624FBD} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DownKyi.Core", "DownKyi.Core\DownKyi.Core.csproj", "{4FDE0364-F65B-4812-BFE8-34E886624FBD}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {97075FCD-6E8F-4FF9-B73A-994197F3765A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {97075FCD-6E8F-4FF9-B73A-994197F3765A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {97075FCD-6E8F-4FF9-B73A-994197F3765A}.Debug|x64.ActiveCfg = Debug|x64 - {97075FCD-6E8F-4FF9-B73A-994197F3765A}.Debug|x64.Build.0 = Debug|x64 - {97075FCD-6E8F-4FF9-B73A-994197F3765A}.Debug|x86.ActiveCfg = Debug|x86 - {97075FCD-6E8F-4FF9-B73A-994197F3765A}.Debug|x86.Build.0 = Debug|x86 - {97075FCD-6E8F-4FF9-B73A-994197F3765A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {97075FCD-6E8F-4FF9-B73A-994197F3765A}.Release|Any CPU.Build.0 = Release|Any CPU - {97075FCD-6E8F-4FF9-B73A-994197F3765A}.Release|x64.ActiveCfg = Release|x64 - {97075FCD-6E8F-4FF9-B73A-994197F3765A}.Release|x64.Build.0 = Release|x64 - {97075FCD-6E8F-4FF9-B73A-994197F3765A}.Release|x86.ActiveCfg = Release|x86 - {97075FCD-6E8F-4FF9-B73A-994197F3765A}.Release|x86.Build.0 = Release|x86 - {4FDE0364-F65B-4812-BFE8-34E886624FBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4FDE0364-F65B-4812-BFE8-34E886624FBD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4FDE0364-F65B-4812-BFE8-34E886624FBD}.Debug|x64.ActiveCfg = Debug|x64 - {4FDE0364-F65B-4812-BFE8-34E886624FBD}.Debug|x64.Build.0 = Debug|x64 - {4FDE0364-F65B-4812-BFE8-34E886624FBD}.Debug|x86.ActiveCfg = Debug|x86 - {4FDE0364-F65B-4812-BFE8-34E886624FBD}.Debug|x86.Build.0 = Debug|x86 - {4FDE0364-F65B-4812-BFE8-34E886624FBD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4FDE0364-F65B-4812-BFE8-34E886624FBD}.Release|Any CPU.Build.0 = Release|Any CPU - {4FDE0364-F65B-4812-BFE8-34E886624FBD}.Release|x64.ActiveCfg = Release|x64 - {4FDE0364-F65B-4812-BFE8-34E886624FBD}.Release|x64.Build.0 = Release|x64 - {4FDE0364-F65B-4812-BFE8-34E886624FBD}.Release|x86.ActiveCfg = Release|x86 - {4FDE0364-F65B-4812-BFE8-34E886624FBD}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {B8FC6858-6EAD-46C9-AC9A-01E6DEBA32BC} - EndGlobalSection -EndGlobal diff --git a/src/DownKyi/App.xaml b/src/DownKyi/App.xaml deleted file mode 100644 index e13350d..0000000 --- a/src/DownKyi/App.xaml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - diff --git a/src/DownKyi/App.xaml.cs b/src/DownKyi/App.xaml.cs deleted file mode 100644 index a8d4427..0000000 --- a/src/DownKyi/App.xaml.cs +++ /dev/null @@ -1,274 +0,0 @@ -using DownKyi.Core.Settings; -using DownKyi.Services.Download; -using DownKyi.Utils; -using DownKyi.ViewModels; -using DownKyi.ViewModels.Dialogs; -using DownKyi.ViewModels.DownloadManager; -using DownKyi.ViewModels.Friends; -using DownKyi.ViewModels.Settings; -using DownKyi.ViewModels.Toolbox; -using DownKyi.ViewModels.UserSpace; -using DownKyi.Views; -using DownKyi.Views.Dialogs; -using DownKyi.Views.DownloadManager; -using DownKyi.Views.Friends; -using DownKyi.Views.Settings; -using DownKyi.Views.Toolbox; -using DownKyi.Views.UserSpace; -using Prism.DryIoc; -using Prism.Ioc; -using Prism.Services.Dialogs; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Collections.Specialized; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; - -namespace DownKyi -{ - /// - /// Interaction logic for App.xaml - /// - public partial class App - { - public static Dictionary Dictionary = new Dictionary(); - public static ObservableCollection DownloadingList { get; set; } - public static ObservableCollection DownloadedList { get; set; } - - // 下载服务 - private IDownloadService downloadService; - - protected override Window CreateShell() - { - // 设置主题 - DictionaryResource.LoadTheme("ThemeDefault"); - //DictionaryResource.LoadTheme("ThemeDiy"); - - // 切换语言 - DictionaryResource.LoadLanguage("Default"); - //DictionaryResource.LoadLanguage("en_US"); - - // 初始化数据 - DownloadingList = new ObservableCollection(); - DownloadedList = new ObservableCollection(); - - // 下载数据存储服务 - DownloadStorageService downloadStorageService = new DownloadStorageService(); - - // 从数据库读取 - List downloadingItems = downloadStorageService.GetDownloading(); - List downloadedItems = downloadStorageService.GetDownloaded(); - DownloadingList.AddRange(downloadingItems); - DownloadedList.AddRange(downloadedItems); - - // 下载列表发生变化时执行的任务 - DownloadingList.CollectionChanged += new NotifyCollectionChangedEventHandler(async (object sender, NotifyCollectionChangedEventArgs e) => - { - await Task.Run(() => - { - if (e.Action == NotifyCollectionChangedAction.Add) - { - foreach (object item in e.NewItems) - { - if (item is DownloadingItem downloading) - { - //Console.WriteLine("DownloadingList添加"); - downloadStorageService.AddDownloading(downloading); - } - } - } - if (e.Action == NotifyCollectionChangedAction.Remove) - { - foreach (object item in e.OldItems) - { - if (item is DownloadingItem downloading) - { - //Console.WriteLine("DownloadingList移除"); - downloadStorageService.RemoveDownloading(downloading); - } - } - } - }); - }); - - // 下载完成列表发生变化时执行的任务 - DownloadedList.CollectionChanged += new NotifyCollectionChangedEventHandler(async (object sender, NotifyCollectionChangedEventArgs e) => - { - await Task.Run(() => - { - if (e.Action == NotifyCollectionChangedAction.Add) - { - foreach (object item in e.NewItems) - { - if (item is DownloadedItem downloaded) - { - //Console.WriteLine("DownloadedList添加"); - downloadStorageService.AddDownloaded(downloaded); - } - } - } - if (e.Action == NotifyCollectionChangedAction.Remove) - { - foreach (object item in e.OldItems) - { - if (item is DownloadedItem downloaded) - { - //Console.WriteLine("DownloadedList移除"); - downloadStorageService.RemoveDownloaded(downloaded); - } - } - } - }); - }); - - // 启动下载服务 - var download = SettingsManager.GetInstance().GetDownloader(); - switch (download) - { - case Downloader.NOT_SET: - break; - case Downloader.BUILT_IN: - downloadService = new BuiltinDownloadService(DownloadingList, DownloadedList, (IDialogService)Container.GetContainer().GetService(typeof(IDialogService))); - break; - case Downloader.ARIA: - downloadService = new AriaDownloadService(DownloadingList, DownloadedList, (IDialogService)Container.GetContainer().GetService(typeof(IDialogService))); - break; - case Downloader.CUSTOM_ARIA: - downloadService = new CustomAriaDownloadService(DownloadingList, DownloadedList, (IDialogService)Container.GetContainer().GetService(typeof(IDialogService))); - break; - } - downloadService?.Start(); - - return Container.Resolve(); - } - - protected override void OnStartup(StartupEventArgs e) - { - Thread thread = new Thread(() => - { - SplashWindow sw = new SplashWindow(); - // 储存 - Dictionary["SplashWindow"] = sw; - // 不能用Show - sw.ShowDialog(); - }); - // 设置单线程 - thread.SetApartmentState(ApartmentState.STA); - thread.Start(); - - base.OnStartup(e); - } - - protected override void OnExit(ExitEventArgs e) - { - // 关闭下载服务 - downloadService.End(); - - base.OnExit(e); - } - - protected override void RegisterTypes(IContainerRegistry containerRegistry) - { - // pages - containerRegistry.RegisterForNavigation(ViewIndexViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewLoginViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewVideoDetailViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewSettingsViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewToolboxViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewDownloadManagerViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewPublicFavoritesViewModel.Tag); - - containerRegistry.RegisterForNavigation(ViewUserSpaceViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewPublicationViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewModels.ViewChannelViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewModels.ViewSeasonsSeriesViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewFriendsViewModel.Tag); - - containerRegistry.RegisterForNavigation(ViewMySpaceViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewMyFavoritesViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewMyBangumiFollowViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewMyToViewVideoViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewMyHistoryViewModel.Tag); - - // downloadManager pages - containerRegistry.RegisterForNavigation(ViewDownloadingViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewDownloadFinishedViewModel.Tag); - - // Friend - containerRegistry.RegisterForNavigation(ViewFollowingViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewFollowerViewModel.Tag); - - // settings pages - containerRegistry.RegisterForNavigation(ViewBasicViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewNetworkViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewVideoViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewDanmakuViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewAboutViewModel.Tag); - - // tools pages - containerRegistry.RegisterForNavigation(ViewBiliHelperViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewDelogoViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewExtractMediaViewModel.Tag); - - // UserSpace - containerRegistry.RegisterForNavigation(ViewArchiveViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewModels.UserSpace.ViewChannelViewModel.Tag); - containerRegistry.RegisterForNavigation(ViewModels.UserSpace.ViewSeasonsSeriesViewModel.Tag); - - // dialogs - containerRegistry.RegisterDialog(ViewAlertDialogViewModel.Tag); - containerRegistry.RegisterDialog(ViewDownloadSetterViewModel.Tag); - containerRegistry.RegisterDialog(ViewParsingSelectorViewModel.Tag); - - } - - /// - /// 异步修改绑定到UI的属性 - /// - /// - public static void PropertyChangeAsync(Action callback) - { - if (Current == null) { return; } - - Current.Dispatcher.Invoke(callback); - } - - /// - /// 下载完成列表排序 - /// - /// - public static void SortDownloadedList(DownloadFinishedSort finishedSort) - { - List list = DownloadedList.ToList(); - switch (finishedSort) - { - case DownloadFinishedSort.DOWNLOAD: - // 按下载先后排序 - list.Sort((x, y) => { return x.Downloaded.FinishedTimestamp.CompareTo(y.Downloaded.FinishedTimestamp); }); - break; - case DownloadFinishedSort.NUMBER: - // 按序号排序 - list.Sort((x, y) => - { - int compare = x.MainTitle.CompareTo(y.MainTitle); - return compare == 0 ? x.Order.CompareTo(y.Order) : compare; - }); - break; - default: - break; - } - - // 更新下载完成列表 - // 如果有更好的方法再重写 - DownloadedList.Clear(); - foreach (DownloadedItem item in list) - { - DownloadedList.Add(item); - } - } - - } -} diff --git a/src/DownKyi/AppConstant.cs b/src/DownKyi/AppConstant.cs deleted file mode 100644 index cad527c..0000000 --- a/src/DownKyi/AppConstant.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace DownKyi -{ - public class AppConstant - { - public const string ClipboardId = "32ff00b1-1a09-4b25-9ca7-dcb6914b141c"; - } -} diff --git a/src/DownKyi/Converter/CountConverter.cs b/src/DownKyi/Converter/CountConverter.cs deleted file mode 100644 index d38fe78..0000000 --- a/src/DownKyi/Converter/CountConverter.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Globalization; -using System.Windows.Data; - -namespace DownKyi.Converter -{ - public class CountConverter : IValueConverter - { - public int Count { get; set; } - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - return ((int)value) > Count; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/src/DownKyi/CustomControl/CustomPager.xaml b/src/DownKyi/CustomControl/CustomPager.xaml deleted file mode 100644 index 2b512f2..0000000 --- a/src/DownKyi/CustomControl/CustomPager.xaml +++ /dev/null @@ -1,358 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/DownKyi/CustomControl/CustomPager.xaml.cs b/src/DownKyi/CustomControl/CustomPager.xaml.cs deleted file mode 100644 index 5aa31f5..0000000 --- a/src/DownKyi/CustomControl/CustomPager.xaml.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Windows.Controls; - -namespace DownKyi.CustomControl -{ - /// - /// CustomPager.xaml 的交互逻辑 - /// - public partial class CustomPager : UserControl - { - public CustomPager() - { - InitializeComponent(); - } - } -} diff --git a/src/DownKyi/CustomControl/CustomPagerViewModel.cs b/src/DownKyi/CustomControl/CustomPagerViewModel.cs deleted file mode 100644 index 363b962..0000000 --- a/src/DownKyi/CustomControl/CustomPagerViewModel.cs +++ /dev/null @@ -1,465 +0,0 @@ -using System.ComponentModel; -using System.Windows; - -namespace DownKyi.CustomControl -{ - public class CustomPagerViewModel : INotifyPropertyChanged - { - public CustomPagerViewModel(int current, int count) - { - Current = current; - Count = count; - - SetView(); - } - - public event PropertyChangedEventHandler PropertyChanged; - - // Current修改的回调 - public delegate bool CurrentChangedHandler(int old, int current); - public event CurrentChangedHandler CurrentChanged; - protected virtual bool OnCurrentChanged(int old, int current) - { - if (CurrentChanged == null) - { - return false; - } - else - { - return CurrentChanged.Invoke(old, current); - } - } - - // Count修改的回调 - public delegate void CountChangedHandler(int count); - public event CountChangedHandler CountChanged; - protected virtual void OnCountChanged(int count) - { - CountChanged?.Invoke(count); - } - - #region 绑定属性 - - private Visibility visibility; - public Visibility Visibility - { - get { return visibility; } - set - { - visibility = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Visibility")); - } - } - - private int count; - public int Count - { - get - { - return count; - } - set - { - if (value < Current || value < 0) - { - Visibility = Visibility.Hidden; - //throw new Exception("数值不在允许的范围内。"); - System.Console.WriteLine(value.ToString()); - } - else - { - count = value; - - if (count <= 1) { Visibility = Visibility.Hidden; } - else { Visibility = Visibility.Visible; } - - OnCountChanged(count); - - SetView(); - - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Count")); - } - } - } - - private int current; - public int Current - { - get - { - if (current < 1) { current = 1; } - return current; - } - set - { - if (Count > 0 && (value > Count || value < 1)) - { - //throw new Exception("数值不在允许的范围内。"); - } - else - { - bool isSuccess = OnCurrentChanged(current, value); - if (isSuccess) - { - current = value; - - SetView(); - - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Current")); - } - } - } - } - - private int first; - public int First - { - get { return first; } - set - { - first = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("First")); - } - } - - private int previousSecond; - public int PreviousSecond - { - get { return previousSecond; } - set - { - previousSecond = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("PreviousSecond")); - } - } - - private int previousFirst; - public int PreviousFirst - { - get { return previousFirst; } - set - { - previousFirst = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("PreviousFirst")); - } - } - - private int nextFirst; - public int NextFirst - { - get { return nextFirst; } - set - { - nextFirst = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("NextFirst")); - } - } - - private int nextSecond; - public int NextSecond - { - get { return nextSecond; } - set - { - nextSecond = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("NextSecond")); - } - } - - // 控制Current左边的控件 - private Visibility previousVisibility; - public Visibility PreviousVisibility - { - get { return previousVisibility; } - set - { - previousVisibility = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("PreviousVisibility")); - } - } - - private Visibility firstVisibility; - public Visibility FirstVisibility - { - get { return firstVisibility; } - set - { - firstVisibility = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("FirstVisibility")); - } - } - - private Visibility leftJumpVisibility; - public Visibility LeftJumpVisibility - { - get { return leftJumpVisibility; } - set - { - leftJumpVisibility = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("LeftJumpVisibility")); - } - } - - private Visibility previousSecondVisibility; - public Visibility PreviousSecondVisibility - { - get { return previousSecondVisibility; } - set - { - previousSecondVisibility = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("PreviousSecondVisibility")); - } - } - - private Visibility previousFirstVisibility; - public Visibility PreviousFirstVisibility - { - get { return previousFirstVisibility; } - set - { - previousFirstVisibility = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("PreviousFirstVisibility")); - } - } - - // 控制Current右边的控件 - private Visibility nextFirstVisibility; - public Visibility NextFirstVisibility - { - get { return nextFirstVisibility; } - set - { - nextFirstVisibility = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("NextFirstVisibility")); - } - } - - private Visibility nextSecondVisibility; - public Visibility NextSecondVisibility - { - get { return nextSecondVisibility; } - set - { - nextSecondVisibility = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("NextSecondVisibility")); - } - } - - private Visibility rightJumpVisibility; - public Visibility RightJumpVisibility - { - get { return rightJumpVisibility; } - set - { - rightJumpVisibility = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("RightJumpVisibility")); - } - } - - private Visibility lastVisibility; - public Visibility LastVisibility - { - get { return lastVisibility; } - set - { - lastVisibility = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("LastVisibility")); - } - } - - private Visibility nextVisibility; - public Visibility NextVisibility - { - get { return nextVisibility; } - set - { - nextVisibility = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("NextVisibility")); - } - } - - #endregion - - - private MyDelegateCommand previousCommand; - public MyDelegateCommand PreviousCommand => previousCommand ?? (previousCommand = new MyDelegateCommand(PreviousExecuted)); - - public void PreviousExecuted(object obj) - { - Current -= 1; - - SetView(); - } - - private MyDelegateCommand firstCommand; - public MyDelegateCommand FirstCommand => firstCommand ?? (firstCommand = new MyDelegateCommand(FirstExecuted)); - - public void FirstExecuted(object obj) - { - Current = 1; - - SetView(); - } - - private MyDelegateCommand previousSecondCommand; - public MyDelegateCommand PreviousSecondCommand => previousSecondCommand ?? (previousSecondCommand = new MyDelegateCommand(PreviousSecondExecuted)); - - public void PreviousSecondExecuted(object obj) - { - Current -= 2; - - SetView(); - } - - private MyDelegateCommand previousFirstCommand; - public MyDelegateCommand PreviousFirstCommand => previousFirstCommand ?? (previousFirstCommand = new MyDelegateCommand(PreviousFirstExecuted)); - - public void PreviousFirstExecuted(object obj) - { - Current -= 1; - - SetView(); - } - - private MyDelegateCommand nextFirstCommand; - public MyDelegateCommand NextFirstCommand => nextFirstCommand ?? (nextFirstCommand = new MyDelegateCommand(NextFirstExecuted)); - - public void NextFirstExecuted(object obj) - { - Current += 1; - - SetView(); - } - - private MyDelegateCommand nextSecondCommand; - public MyDelegateCommand NextSecondCommand => nextSecondCommand ?? (nextSecondCommand = new MyDelegateCommand(NextSecondExecuted)); - - public void NextSecondExecuted(object obj) - { - Current += 2; - - SetView(); - } - - private MyDelegateCommand lastCommand; - public MyDelegateCommand LastCommand => lastCommand ?? (lastCommand = new MyDelegateCommand(LastExecuted)); - - public void LastExecuted(object obj) - { - Current = Count; - - SetView(); - } - - private MyDelegateCommand nextCommand; - public MyDelegateCommand NextCommand => nextCommand ?? (nextCommand = new MyDelegateCommand(NextExecuted)); - - public void NextExecuted(object obj) - { - Current += 1; - - SetView(); - } - - /// - /// 控制显示,暴力实现,以后重构 - /// - private void SetView() - { - First = 1; - PreviousSecond = Current - 2; - PreviousFirst = Current - 1; - NextFirst = Current + 1; - NextSecond = Current + 2; - - // 控制Current左边的控件 - if (Current == 1) - { - PreviousVisibility = Visibility.Collapsed; - FirstVisibility = Visibility.Collapsed; - LeftJumpVisibility = Visibility.Collapsed; - PreviousSecondVisibility = Visibility.Collapsed; - PreviousFirstVisibility = Visibility.Collapsed; - } - else if (Current == 2) - { - PreviousVisibility = Visibility.Visible; - FirstVisibility = Visibility.Collapsed; - LeftJumpVisibility = Visibility.Collapsed; - PreviousSecondVisibility = Visibility.Collapsed; - PreviousFirstVisibility = Visibility.Visible; - } - else if (Current == 3) - { - PreviousVisibility = Visibility.Visible; - FirstVisibility = Visibility.Collapsed; - LeftJumpVisibility = Visibility.Collapsed; - PreviousSecondVisibility = Visibility.Visible; - PreviousFirstVisibility = Visibility.Visible; - } - else if (Current == 4) - { - PreviousVisibility = Visibility.Visible; - FirstVisibility = Visibility.Visible; - LeftJumpVisibility = Visibility.Collapsed; - PreviousSecondVisibility = Visibility.Visible; - PreviousFirstVisibility = Visibility.Visible; - } - else - { - PreviousVisibility = Visibility.Visible; - FirstVisibility = Visibility.Visible; - LeftJumpVisibility = Visibility.Visible; - PreviousSecondVisibility = Visibility.Visible; - PreviousFirstVisibility = Visibility.Visible; - } - - // 控制Current右边的控件 - if (Current == Count) - { - NextFirstVisibility = Visibility.Collapsed; - NextSecondVisibility = Visibility.Collapsed; - RightJumpVisibility = Visibility.Collapsed; - LastVisibility = Visibility.Collapsed; - NextVisibility = Visibility.Collapsed; - } - else if (Current == Count - 1) - { - NextFirstVisibility = Visibility.Visible; - NextSecondVisibility = Visibility.Collapsed; - RightJumpVisibility = Visibility.Collapsed; - LastVisibility = Visibility.Collapsed; - NextVisibility = Visibility.Visible; - } - else if (Current == Count - 2) - { - NextFirstVisibility = Visibility.Visible; - NextSecondVisibility = Visibility.Visible; - RightJumpVisibility = Visibility.Collapsed; - LastVisibility = Visibility.Collapsed; - NextVisibility = Visibility.Visible; - } - else if (Current == Count - 3) - { - NextFirstVisibility = Visibility.Visible; - NextSecondVisibility = Visibility.Visible; - RightJumpVisibility = Visibility.Collapsed; - LastVisibility = Visibility.Visible; - NextVisibility = Visibility.Visible; - } - else - { - NextFirstVisibility = Visibility.Visible; - NextSecondVisibility = Visibility.Visible; - RightJumpVisibility = Visibility.Visible; - LastVisibility = Visibility.Visible; - NextVisibility = Visibility.Visible; - } - } - - - - - - } -} diff --git a/src/DownKyi/CustomControl/GifImage.cs b/src/DownKyi/CustomControl/GifImage.cs deleted file mode 100644 index 402f5f5..0000000 --- a/src/DownKyi/CustomControl/GifImage.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.Drawing; -using System.Runtime.InteropServices; -using System.Windows.Interop; -using System.Windows.Media.Imaging; -using System.Windows.Threading; - -namespace DownKyi.CustomControl -{ - public class GifImage : System.Windows.Controls.Image - { - /// - /// gif动画的System.Drawing.Bitmap - /// - private Bitmap gifBitmap; - - /// - /// 用于显示每一帧的BitmapSource - /// - private BitmapSource bitmapSource; - - public GifImage(string gifPath) - { - gifBitmap = new Bitmap(gifPath); - bitmapSource = GetBitmapSource(); - Source = bitmapSource; - } - - public GifImage(Bitmap gifBitmap) - { - this.gifBitmap = gifBitmap; - bitmapSource = GetBitmapSource(); - Source = bitmapSource; - } - - /// - /// 从System.Drawing.Bitmap中获得用于显示的那一帧图像的BitmapSource - /// - /// - private BitmapSource GetBitmapSource() - { - IntPtr handle = IntPtr.Zero; - - try - { - handle = gifBitmap.GetHbitmap(); - bitmapSource = Imaging.CreateBitmapSourceFromHBitmap(handle, IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); - } - finally - { - if (handle != IntPtr.Zero) - { - DeleteObject(handle); - } - } - return bitmapSource; - } - - /// - /// Start animation - /// - public void StartAnimate() - { - ImageAnimator.Animate(gifBitmap, OnFrameChanged); - } - - /// - /// Stop animation - /// - public void StopAnimate() - { - ImageAnimator.StopAnimate(gifBitmap, OnFrameChanged); - } - - /// - /// Event handler for the frame changed - /// - private void OnFrameChanged(object sender, EventArgs e) - { - Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => - { - ImageAnimator.UpdateFrames(); // 更新到下一帧 - if (bitmapSource != null) - { - bitmapSource.Freeze(); - } - - //// Convert the bitmap to BitmapSource that can be display in WPF Visual Tree - bitmapSource = GetBitmapSource(); - Source = bitmapSource; - InvalidateVisual(); - })); - } - - /// - /// Delete local bitmap resource - /// Reference: http://msdn.microsoft.com/en-us/library/dd183539(VS.85).aspx - /// - [DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - static extern bool DeleteObject(IntPtr hObject); - } -} diff --git a/src/DownKyi/CustomControl/MyDelegateCommand.cs b/src/DownKyi/CustomControl/MyDelegateCommand.cs deleted file mode 100644 index 02f95be..0000000 --- a/src/DownKyi/CustomControl/MyDelegateCommand.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using System.Windows.Input; - -namespace DownKyi.CustomControl -{ - /// - /// 绑定命令的工具类 - /// - public class MyDelegateCommand : ICommand - { - - /// - /// 检查命令是否可以执行的事件,在UI事件发生导致控件状态或数据发生变化时触发 - /// - public event EventHandler CanExecuteChanged - { - add - { - if (_canExecute != null) - { - CommandManager.RequerySuggested += value; - } - } - remove - { - if (_canExecute != null) - { - CommandManager.RequerySuggested -= value; - } - } - } - - /// - /// 判断命令是否可以执行的方法 - /// - private Func _canExecute; - - /// - /// 命令需要执行的方法 - /// - private Action _execute; - - /// - /// 创建一个命令 - /// - /// 命令要执行的方法 - public MyDelegateCommand(Action execute) : this(execute, null) - { - } - - /// - /// 创建一个命令 - /// - /// 命令要执行的方法 - /// 判断命令是否能够执行的方法 - public MyDelegateCommand(Action execute, Func canExecute) - { - _execute = execute; - _canExecute = canExecute; - } - - /// - /// 判断命令是否可以执行 - /// - /// 命令传入的参数 - /// 是否可以执行 - public bool CanExecute(object parameter) - { - if (_canExecute == null) return true; - return _canExecute(parameter); - } - - /// - /// 执行命令 - /// - /// - public void Execute(object parameter) - { - if (_execute != null && CanExecute(parameter)) - { - _execute(parameter); - } - } - } -} diff --git a/src/DownKyi/DownKyi.csproj b/src/DownKyi/DownKyi.csproj deleted file mode 100644 index a4b3f02..0000000 --- a/src/DownKyi/DownKyi.csproj +++ /dev/null @@ -1,644 +0,0 @@ - - - - - Debug - AnyCPU - {97075FCD-6E8F-4FF9-B73A-994197F3765A} - WinExe - Properties - DownKyi - DownKyi - v4.7.2 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - PackageReference - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - Resources\favicon.ico - - - app.manifest - - - x64 - bin\x64\Debug\ - - - x64 - bin\x64\Release\ - - - x86 - bin\x86\Debug\ - - - x86 - bin\x86\Release\ - - - - - - - - - - - - - - - 4.0 - - - - - - - - MSBuild:Compile - Designer - - - - - CustomPager.xaml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ViewAlertDialog.xaml - - - ViewDownloadSetter.xaml - - - ViewParsingSelector.xaml - - - ViewDownloadFinished.xaml - - - ViewDownloading.xaml - - - ViewFollower.xaml - - - ViewFollowing.xaml - - - ViewAbout.xaml - - - ViewBasic.xaml - - - ViewDanmaku.xaml - - - ViewNetwork.xaml - - - ViewVideo.xaml - - - SplashWindow.xaml - - - ViewBiliHelper.xaml - - - ViewDelogo.xaml - - - ViewExtractMedia.xaml - - - ViewArchive.xaml - - - ViewSeasonsSeries.xaml - - - ViewChannel.xaml - - - ViewSeasonsSeries.xaml - - - ViewChannel.xaml - - - ViewDownloadManager.xaml - - - ViewFriends.xaml - - - ViewIndex.xaml - - - ViewLogin.xaml - - - ViewMyBangumiFollow.xaml - - - ViewMyFavorites.xaml - - - ViewMyHistory.xaml - - - ViewMySpace.xaml - - - ViewMyToViewVideo.xaml - - - ViewPublication.xaml - - - ViewPublicFavorites.xaml - - - ViewSettings.xaml - - - ViewToolbox.xaml - - - ViewUserSpace.xaml - - - ViewVideoDetail.xaml - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - App.xaml - Code - - - - - - - MainWindow.xaml - Code - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - 2.0.1 - - - 13.0.3 - - - - 1.0.112.2 - - - - - - - - - - - {3107CD63-E257-455E-AE81-1FD3582B067A} - Brotli.Core - - - {4fde0364-f65b-4812-bfe8-34e886624fbd} - DownKyi.Core - - - - - - - - - - - False - Microsoft .NET Framework 4.7.2 %28x86 和 x64%29 - true - - - False - .NET Framework 3.5 SP1 - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PreserveNewest - - - - - - - - \ No newline at end of file diff --git a/src/DownKyi/Events/MessageEvent.cs b/src/DownKyi/Events/MessageEvent.cs deleted file mode 100644 index 0375cb0..0000000 --- a/src/DownKyi/Events/MessageEvent.cs +++ /dev/null @@ -1,6 +0,0 @@ -using Prism.Events; - -namespace DownKyi.Events -{ - public class MessageEvent : PubSubEvent { } -} diff --git a/src/DownKyi/Events/NavigationEvent.cs b/src/DownKyi/Events/NavigationEvent.cs deleted file mode 100644 index 9a2ca03..0000000 --- a/src/DownKyi/Events/NavigationEvent.cs +++ /dev/null @@ -1,6 +0,0 @@ -using Prism.Events; - -namespace DownKyi.Events -{ - public class NavigationEvent : PubSubEvent { } -} diff --git a/src/DownKyi/Events/NavigationParam.cs b/src/DownKyi/Events/NavigationParam.cs deleted file mode 100644 index 42ad90b..0000000 --- a/src/DownKyi/Events/NavigationParam.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace DownKyi.Events -{ - public class NavigationParam - { - public string ViewName { get; set; } - public string ParentViewName { get; set; } - public object Parameter { get; set; } - } -} diff --git a/src/DownKyi/Images/ButtonIcon.cs b/src/DownKyi/Images/ButtonIcon.cs deleted file mode 100644 index e4a3c8a..0000000 --- a/src/DownKyi/Images/ButtonIcon.cs +++ /dev/null @@ -1,156 +0,0 @@ -namespace DownKyi.Images -{ - public class ButtonIcon - { - private static ButtonIcon instance; - public static ButtonIcon Instance() - { - if (instance == null) - { - instance = new ButtonIcon(); - } - return instance; - } - - public ButtonIcon() - { - GeneralSearch = new VectorImage - { - Height = 20, - Width = 20, - Data = @"M697.91 755.7 q-132.36 103.48 -290.59 98.06 q-158.23 -5.41 -278.56 -120.92 q-127.54 -133.56 -128.75 -304.43 - q-1.21 -170.86 120.33 -304.43 q127.55 -126.34 297.21 -123.94 q169.66 2.41 303.22 123.94 q110.71 114.31 122.14 263.52 - q11.43 149.21 -75.21 275.55 l238.25 239.45 q18.05 18.05 18.05 42.12 q0 24.06 -18.05 41.51 q-18.05 17.45 -42.12 17.45 - q-24.07 0 -42.12 -16.85 l-223.81 -231.03 ZM643.76 647.41 q92.66 -96.26 92.66 -219 q0 -122.73 -92.66 -218.99 q-96.26 -92.66 -219 -92.66 - q-122.74 0 -218.99 92.66 q-92.65 96.26 -92.65 218.99 q0 122.74 92.65 219 q96.26 92.65 218.99 90.25 q122.74 -2.4 219 -90.25 Z", - Fill = "#FF000000" - }; - - Settings = new VectorImage - { - Height = 32, - Width = 32, - Data = @"M19.4,13c0-0.3,0.1-0.6,0.1-1s0-0.7-0.1-1l2.1-1.7c0.2-0.2,0.2-0.4,0.1-0.6l-2-3.5C19.5,5,19.3,5,19,5l-2.5,1 - c-0.5-0.4-1.1-0.7-1.7-1l-0.4-2.7C14.5,2.2,14.3,2,14,2h-4C9.8,2,9.5,2.2,9.5,2.4L9.1,5.1C8.5,5.3,8,5.7,7.4,6L5,5 - C4.7,5,4.5,5,4.3,5.3l-2,3.5C2.2,9,2.3,9.2,2.5,9.4L4.6,11c0,0.3-0.1,0.6-0.1,1s0,0.7,0.1,1l-2.1,1.7c-0.2,0.1-0.2,0.4-0.1,0.6 - l2,3.5C4.5,19,4.7,19,5,19l2.5-1c0.5,0.4,1.1,0.7,1.7,1l0.4,2.7c0,0.2,0.2,0.4,0.5,0.4h4c0.3,0,0.5-0.2,0.5-0.4l0.4-2.7 - c0.6-0.3,1.2-0.6,1.7-1l2.5,1c0.2,0.1,0.5,0,0.6-0.2l2-3.5c0.1-0.2,0.1-0.5-0.1-0.6L19.4,13z M12,15.5c-1.9,0-3.5-1.6-3.5-3.5 - s1.6-3.5,3.5-3.5s3.5,1.6,3.5,3.5S13.9,15.5,12,15.5z", - Fill = "#FF000000" - }; - - DownloadManage = new VectorImage - { - Height = 27, - Width = 32, - //Height = 20, - //Width = 24, - Data = @"M24,34c-2.4,0-4.9,0-7.3,0c-2.8,0-4.6-1.9-4.6-4.7c0-3.5,0-7,0-10.5c0-2.9,1.9-4.7,4.6-4.7c1.3,0,2.6,0,3.9,0 - c1.1-0.1,2,0.4,2.7,1.3c1.1,1.7,2.6,2.3,4.6,2.1c1.3-0.2,2.6-0.1,4,0c2.5,0.2,4,1.7,4.2,4.3c0.2,2.7,0.2,5.5,0,8.3 - c-0.2,2.4-2,4-4.3,4C29,34,26.5,34,24,34L24,34z - M23.9,32.6c2.5,0,5,0,7.5,0c1.7,0,2.9-1,3-2.7c0.2-2.8,0.2-5.6,0-8.5 - c-0.1-1.5-1.1-2.4-2.5-2.6c-1.3-0.2-2.6-0.1-3.9-0.1c-4.1-0.1-3,0.5-6-2.6c-0.5-0.5-1-0.8-1.7-0.8c-1.3,0-2.5,0-3.8,0 - c-2,0-3.2,1.2-3.3,3.2c0,3.6,0,7.1,0,10.7c0,2,1.2,3.2,3.2,3.2C19,32.6,21.5,32.6,23.9,32.6L23.9,32.6z - M29.9,14.2h3.3c0.5,0,0.9,0,0.9,0.7c0,0.7-0.4,0.8-0.9,0.8c-2.2,0-4.5,0-6.7,0c-0.5,0-0.9-0.1-0.9-0.7 - s0.4-0.7,0.9-0.7C27.6,14.2,28.7,14.2,29.9,14.2L29.9,14.2z M23.3,27.6v-5.4c0-0.5,0-1.1,0.7-1.1c0.7,0,0.6,0.6,0.6,1v5.2 - c0.7-0.7,1.2-1.2,1.7-1.7c0.3-0.4,0.7-0.7,1.2-0.2c0.5,0.5,0.1,0.9-0.2,1.2c-0.9,1-1.8,1.9-2.7,2.8c-0.4,0.5-0.8,0.5-1.3,0.1 - c-1-1-2-2.1-3-3.1c-0.3-0.3-0.4-0.7-0.1-1c0.3-0.4,0.7-0.3,1,0.1C22,26.1,22.6,26.7,23.3,27.6L23.3,27.6z", - Fill = "#FF000000" - }; - - Toolbox = new VectorImage - { - Height = 28, // 21 - Width = 32, // 24 - Data = @"M20.2,14.5c-0.8,2.3-3.4,3.6-5.7,2.7c-1.3-0.5-2.3-1.5-2.7-2.7H5.5V13h21v1.5H20.2z M18.6,14.5h-5.2 - c0.8,1.4,2.7,1.9,4.1,1.1C18,15.3,18.3,15,18.6,14.5L18.6,14.5z M10,8.5V7c0-0.8,0.7-1.5,1.5-1.5h9C21.3,5.5,22,6.2,22,7v1.5h4.5 - c0.8,0,1.5,0.7,1.5,1.5v15c0,0.8-0.7,1.5-1.5,1.5l0,0h-21C4.7,26.5,4,25.8,4,25l0,0V10c0-0.8,0.7-1.5,1.5-1.5H10z M11.5,8.5h9V7h-9 - V8.5z M5.5,10v15h21V10H5.5z", - Fill = "#FF000000" - }; - - Trash = new VectorImage - { - Height = 20, - Width = 20, - Data = @"M683 85 q0 -27 -20.5 -55 q-20.5 -28 -65.5 -30 l-170 0 q-39 1 -62 23.5 q-23 22.5 -24 61.5 l-341 0 l0 86 l1024 0 l0 -86 - l-341 0 ZM341 256 l86 0 l0 597 l-86 0 l0 -597 ZM597 256 l86 0 l0 597 l-86 0 l0 -597 ZM853 853 q0 39 -23 62 - q-23 23 -62 24 l-512 0 q-39 -1 -62 -24 q-23 -23 -23 -62 l0 -597 l-86 0 l0 597 q2 73 50.5 121 q48.5 48 120.5 50 l512 0 - q72 -2 120.5 -50 q48.5 -48 50.5 -121 l0 -597 l-86 0 l0 597 Z", - Fill = "#FF000000" - }; - - Delete = new VectorImage - { - Height = 18, - Width = 18, - Data = @"M634.29 513.52 l364.34 -363.32 q25.37 -27.4 25.37 -60.89 q0 -33.49 -26.38 -59.88 q-26.38 -26.39 -59.88 -26.39 - q-33.49 0 -60.9 25.38 l-363.32 364.33 l-363.32 -372.45 q-28.42 -20.3 -65.46 -20.3 q-37.04 0 -64.44 20.3 - q-20.3 27.4 -20.3 64.44 q0 37.04 20.3 65.46 l372.45 363.32 l-364.33 363.32 q-25.38 27.41 -25.38 60.9 q0 33.49 26.39 59.88 - q26.39 26.38 59.88 26.38 q33.49 0 60.89 -25.37 l363.32 -364.34 l363.32 364.34 q27.41 25.37 60.9 25.37 q33.49 0 59.88 -26.38 - q26.38 -26.38 26.38 -59.88 q0 -33.49 -25.37 -60.9 l-364.34 -363.32 Z", - Fill = "#FF000000" - }; - - Start = new VectorImage - { - Height = 20, - Width = 17, - Data = @"M895.12 402.34 l-633.28 -383.81 q-30.16 -17.82 -64.43 -18.51 q-34.27 -0.69 -65.11 16.45 q-30.84 17.13 -47.97 47.29 - q-17.13 30.16 -17.13 64.42 l0 767.62 q0 34.27 17.13 63.74 q17.14 29.47 47.97 47.29 q30.84 17.82 65.11 17.13 - q34.27 -0.69 64.43 -18.5 l633.28 -383.81 q28.79 -17.82 45.24 -46.6 q16.45 -28.79 16.45 -63.06 q0 -34.27 -16.45 -63.05 - q-16.45 -28.79 -45.24 -46.61 Z", - Fill = "#FF000000" - }; - - Pause = new VectorImage - { - Height = 20, - Width = 15, - Data = @"M255.66 0 q-53.75 0 -90.97 37.21 q-37.21 37.21 -37.21 90.96 l0 769.04 q1.38 55.12 37.21 90.95 q35.84 35.84 90.28 35.84 - q54.44 0 90.96 -35.84 q36.52 -35.83 37.9 -90.95 l0 -769.04 q-1.38 -53.75 -38.59 -90.96 q-37.21 -37.21 -89.58 -37.21 - ZM768.34 0 q-52.37 0 -89.58 37.21 q-37.21 37.21 -38.59 90.96 l0 769.04 q1.38 55.12 37.9 90.95 q36.52 35.84 90.96 35.84 - q54.44 0 90.28 -35.84 q35.83 -35.83 37.21 -90.95 l0 -769.04 q0 -53.75 -37.21 -90.96 q-37.22 -37.21 -90.97 -37.21 Z", - Fill = "#FF000000" - }; - - Retry = new VectorImage - { - Height = 20, - Width = 20, - Data = @"M536.69 128.65 q-161.14 5.2 -270.3 113.71 q-109.15 108.5 -113.05 269.64 q3.9 161.14 113.05 269.64 - q109.16 108.5 270.3 113.71 q101.36 -1.3 185.82 -47.43 q84.47 -46.13 140.35 -129.3 q6.5 -14.3 22.09 -24.7 - q15.6 -10.39 31.19 -10.39 q28.59 0 47.44 18.85 q18.84 18.85 20.14 48.74 q0 11.69 -5.2 20.79 q0 3.9 0 7.8 l-3.9 5.19 - q-72.77 111.76 -185.82 174.78 q-113.06 63.03 -246.91 64.33 q-102.66 0 -196.22 -38.34 q-93.57 -38.33 -166.34 -111.11 - q-72.77 -72.77 -111.1 -166.34 q-38.33 -93.56 -38.33 -196.22 q0 -102.66 38.33 -196.23 q38.34 -93.56 111.1 -166.33 - q72.77 -72.77 166.34 -111.1 q93.56 -38.34 196.22 -38.34 q92.26 0 176.73 31.19 q84.47 31.19 152.04 89.66 l0 -25.99 - q1.3 -27.29 18.2 -44.83 q16.89 -17.54 42.88 -17.54 q25.99 0 44.18 18.19 q18.19 18.19 18.19 44.18 l0 189.73 - q0 24.69 -18.19 42.88 q-18.19 18.19 -42.88 18.19 l-191.03 0 q-24.69 0 -42.88 -18.19 q-18.2 -18.19 -18.2 -42.88 - q0 -28.59 16.25 -47.43 q16.25 -18.84 44.84 -20.13 l37.69 0 q-51.98 -42.89 -114.36 -65.63 q-62.38 -22.74 -128.65 -22.74 Z", - Fill = "#FF000000" - }; - - Folder = new VectorImage - { - Height = 16, - Width = 20, - Data = @"M18,2H10L8,0H2A2,2,0,0,0,0,2V14a2,2,0,0,0,2,2H18a2,2,0,0,0,2-2V4A2,2,0,0,0,18,2Zm0,12H2V4H18Z", - Fill = "#FF000000" - }; - - } - - public VectorImage GeneralSearch { get; private set; } - public VectorImage Settings { get; private set; } - public VectorImage DownloadManage { get; private set; } - public VectorImage Toolbox { get; private set; } - - public VectorImage Trash { get; private set; } - public VectorImage Delete { get; private set; } - public VectorImage Start { get; private set; } - public VectorImage Pause { get; private set; } - public VectorImage Retry { get; private set; } - public VectorImage Folder { get; private set; } - - } -} diff --git a/src/DownKyi/Images/LogoIcon.cs b/src/DownKyi/Images/LogoIcon.cs deleted file mode 100644 index 6e074bc..0000000 --- a/src/DownKyi/Images/LogoIcon.cs +++ /dev/null @@ -1,54 +0,0 @@ -namespace DownKyi.Images -{ - public class LogoIcon - { - private static LogoIcon instance; - public static LogoIcon Instance() - { - if (instance == null) - { - instance = new LogoIcon(); - } - return instance; - } - - private LogoIcon() - { - TextLogo = new VectorImage - { - Height = 100, - Width = 336, - Data = @"M602.247902 495.326917q0-146.045116 60.22479-219.820484a198.13956 198.13956 0 0 1 308.953174 0q61.73041 - 74.076492 62.031534 213.798005 0 150.561976-60.22479 225.54184a198.13956 198.13956 0 0 1-309.254298 0Q602.247902 640.468662 - 602.247902 495.326917z m80.098971 0A273.721671 273.721671 0 0 0 722.697482 657.331603a120.44958 120.44958 0 0 0 98.467532 - 53.298939 115.029349 115.029349 0 0 0 94.251797-53.901187 273.420548 273.420548 0 0 0 39.447238-161.703562 271.011556 - 271.011556 0 0 0-39.748362-162.004685 120.44958 120.44958 0 0 0-98.467532-53.29894A114.125977 114.125977 0 0 0 722.697482 - 333.322232a271.011556 271.011556 0 0 0-39.748361 161.703561zM1212.023903 776.275564L1070.194522 214.077147h80.701219l73.474244 - 324.611619 27.101155 120.449581 24.391041-116.836093L1349.035301 214.077147h80.701218l68.656261 326.117239 23.186545 107.501251 - 26.498907-108.705747L1626.069336 214.077147h76.184359l-143.335001 562.198417h-81.303466l-73.474244-336.656578-17.46519-95.757416L1294.832989 - 776.275564zM1768.500964 776.275564V214.077147h70.463005v79.496723a180.674371 180.674371 0 0 1 62.031534-69.258509 154.476587 - 154.476587 0 0 1 84.314706-22.88542 161.703562 161.703562 0 0 1 68.355137 14.45395 140.624885 140.624885 0 0 1 50.588824 - 38.242742 153.874339 153.874339 0 0 1 30.112395 60.22479 509.802849 509.802849 0 0 1 9.635966 - 115.330473v346.593668h-79.195599V433.897631a279.141903 279.141903 0 0 0-10.539338-90.337185 87.62707 87.62707 0 0 - 0-85.218078-60.22479 109.00687 109.00687 0 0 0-90.337186 41.856229q-33.424759 42.157353-33.424758 143.636125v307.447554zM2270.775715 - 776.275564V0.279142h84.314706v384.836409L2670.969446 0.279142h114.427101l-267.096945 314.674529 278.539655 - 461.321893h-111.114738l-225.842963-391.461137-104.791135 123.46082v268.903689zM2853.149436 993.98818l-8.732595-90.337185a146.34624 - 146.34624 0 0 0 44.566345 8.431471 78.292227 78.292227 0 0 0 41.253981-9.937091 76.786608 76.786608 0 0 0 26.498908-30.112395c2.710116-5.119107 - 12.94833-36.134874 30.112395-93.348425L2812.196579 214.077147h84.314706l96.359664 325.514991c12.044958 40.350609 - 22.88542 83.712458 33.123635 130.085547 9.033719-43.662973 19.573057-86.422574 31.919139-127.977679l98.467532-327.622859h78.292227l-174.953016 - 572.135507a1012.679847 1012.679847 0 0 1-54.202311 147.550736 141.227133 141.227133 0 0 1-45.168592 53.600063 103.285515 103.285515 0 0 - 1-56.912427 16.561818 132.494538 132.494538 0 0 1-50.2877-9.937091zM3300.318503 109.88826V0.279142h77.68998v109.609118z - m0 666.387304V214.077147h77.68998v562.198417zM0 776.275564V0.279142h219.51936a417.357796 417.357796 0 0 1 124.063068 - 14.152826 210.786766 210.786766 0 0 1 96.359664 67.752889 358.337502 358.337502 0 0 1 63.537154 124.364191 616.400728 616.400728 0 0 1 - 22.584296 177.362008 579.663606 579.663606 0 0 1-38.543865 223.735095 273.420548 273.420548 0 0 1-99.370904 130.386671 294.1981 - 294.1981 0 0 1-158.391198 38.242742zM463.730885 391.740278q10.840462-7.528099 - 0-16.260693l-51.79332-30.112395q-136.40915-82.507963-276.431787-150.561976l-13.249454-6.624727a22.283172 22.283172 - 0 0 0-16.561817 0v405.613962a18.669685 18.669685 0 0 0 14.755073-4.817983q148.152984-76.786608 296.607092-164.413677c15.357322-10.238214 - 31.015767-21.379801 46.674213-32.822511z", - Fill = "#FF000000" - }; - } - - public VectorImage TextLogo { get; private set; } - } -} diff --git a/src/DownKyi/Images/NavigationIcon.cs b/src/DownKyi/Images/NavigationIcon.cs deleted file mode 100644 index 235d37a..0000000 --- a/src/DownKyi/Images/NavigationIcon.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace DownKyi.Images -{ - public class NavigationIcon - { - private static NavigationIcon instance; - public static NavigationIcon Instance() - { - if (instance == null) - { - instance = new NavigationIcon(); - } - return instance; - } - - public NavigationIcon() - { - ArrowBack = new VectorImage - { - Height = 24, - Width = 24, - Data = @"M16.62 2.99c-.49-.49-1.28-.49-1.77 0L6.54 11.3c-.39.39-.39 1.02 0 1.41l8.31 8.31c.49.49 1.28.49 1.77 - 0s.49-1.28 0-1.77L9.38 12l7.25-7.25c.48-.48.48-1.28-.01-1.76z", - Fill = "#FF000000" - }; - - Logout = new VectorImage - { - Height = 18.75,//100, - Width = 24,//128, - Data = @"M21.5,11.3l-2.8-2.7c-0.2-0.2-0.2-0.4-0.2-0.7c0.1-0.3,0.2-0.4,0.5-0.5c0.3-0.1,0.5,0,0.7,0.2l4,3.9 - c0.1,0.1,0.2,0.3,0.2,0.5c0,0.2-0.1,0.4-0.2,0.5l-4,3.9c-0.2,0.2-0.4,0.2-0.7,0.2c-0.3-0.1-0.4-0.2-0.5-0.5c-0.1-0.3,0-0.5,0.2-0.7 - l2.8-2.7h-8.7c-0.2,0-0.4-0.1-0.5-0.2c-0.1-0.1-0.2-0.3-0.2-0.5c0-0.2,0.1-0.4,0.2-0.5c0.1-0.1,0.3-0.2,0.5-0.2 - C12.8,11.3,21.5,11.3,21.5,11.3z M16,18.2c0-0.2,0.1-0.4,0.2-0.5c0.1-0.1,0.3-0.2,0.5-0.2c0.2,0,0.4,0.1,0.5,0.2 - c0.1,0.1,0.2,0.3,0.2,0.5v0.4c0,0.8-0.3,1.5-0.9,2c-0.6,0.5-1.2,0.8-2,0.8H2.9c-0.8,0-1.5-0.3-2-0.8S0,19.3,0,18.5V5.4 - c0-0.8,0.3-1.5,0.8-2s1.2-0.8,2-0.8h11.7c0.8,0,1.5,0.3,2,0.8c0.5,0.5,0.8,1.2,0.8,2v0.4c0,0.3-0.1,0.5-0.4,0.6 - c-0.2,0.1-0.5,0.1-0.7,0C16.1,6.3,16,6.1,16,5.8V5.4c0-0.4-0.1-0.7-0.4-1c-0.3-0.3-0.6-0.4-1-0.4H2.9c-0.4,0-0.7,0.1-1,0.4 - C1.6,4.7,1.4,5,1.4,5.4v13.1c0,0.4,0.2,0.7,0.4,1c0.3,0.3,0.6,0.4,1,0.4h11.7c0.4,0,0.7-0.1,1-0.4c0.3-0.3,0.4-0.6,0.4-1L16,18.2 - L16,18.2z", - Fill = "#FF000000" - }; - } - - public VectorImage ArrowBack { get; private set; } - public VectorImage Logout { get; private set; } - } -} diff --git a/src/DownKyi/Images/NormalIcon.cs b/src/DownKyi/Images/NormalIcon.cs deleted file mode 100644 index 669c798..0000000 --- a/src/DownKyi/Images/NormalIcon.cs +++ /dev/null @@ -1,411 +0,0 @@ -using DownKyi.ViewModels.UserSpace; - -namespace DownKyi.Images -{ - public class NormalIcon - { - private static NormalIcon instance; - public static NormalIcon Instance() - { - if (instance == null) - { - instance = new NormalIcon(); - } - return instance; - } - - public NormalIcon() - { - Play = new VectorImage - { - Height = 16, - Width = 14.75, - Data = @"M869.03 707.93 l-465.29 281.31 q-86.66 49.32 -178.65 28.65 q-91.99 -20.66 -146.65 -103.31 q-36 -56 -36 -121.33 - l0 -562.61 q2.67 -97.32 69.33 -162.64 q66.66 -65.32 167.98 -67.99 q66.66 0 123.99 34.66 l465.29 281.31 - q83.99 53.33 105.99 143.32 q22 89.99 -30 173.98 q-29.33 46.66 -75.99 74.66 Z", - Fill = "#FF000000" - }; - - Like = new VectorImage - { - Height = 14, - Width = 16, - Data = @"M291.53 894.6 l0 -642.53 l4.66 0 l179.59 -220.4 q29.15 -29.15 69.97 -31.49 q40.81 -2.33 72.29 24.5 - q16.33 16.32 25.66 37.31 q9.33 20.99 7 45.48 l-7 144.6 l274.04 0 q25.65 0 48.39 11.08 q22.74 11.08 39.07 32.07 - q13.99 19.82 17.49 44.31 q3.5 24.49 -2.33 46.64 l-116.62 382.49 q-15.16 54.81 -57.14 88.63 q-41.98 33.81 -100.28 37.31 - l-454.79 0 ZM225.06 894.6 l-93.29 0 q-34.98 2.33 -65.3 -14 q-30.32 -16.33 -47.81 -47.81 q-17.49 -31.49 -18.66 -64.13 - l0 -385.99 q0 -36.15 17.49 -65.89 q17.49 -29.73 48.98 -46.05 q16.32 -8.17 32.65 -12.25 q16.33 -4.08 32.65 -6.41 l93.29 0 - l0 642.53 Z", - Fill = "#FF000000" - }; - - Favorite = new VectorImage - { - Height = 16, - Width = 16, - Data = @"M772.12 303.28 q-37.33 -5.83 -66.49 -28 q-29.16 -22.16 -44.32 -55.99 l-83.99 -176.13 q-22.16 -43.16 -65.91 -43.16 - q-43.74 0 -69.4 43.16 l-79.32 176.13 q-17.49 33.83 -46.07 55.99 q-28.58 22.17 -64.74 28 l-188.97 29.16 - q-45.49 9.33 -58.9 48.99 q-13.42 39.66 18.09 75.82 l142.31 146.98 q25.66 24.49 35.57 58.32 q9.91 33.83 5.25 69.99 - l-32.66 204.13 q-5.83 48.99 29.75 73.49 q35.57 24.5 79.9 3.5 l159.8 -87.48 q33.83 -19.83 71.74 -19.83 - q37.91 0 71.74 19.83 l160.97 87.48 q43.16 21 77.57 -3.5 q34.41 -24.5 32.08 -73.49 l-37.33 -204.13 - q-4.67 -36.16 5.25 -69.99 q9.91 -33.83 35.57 -58.32 l142.31 -146.98 q31.5 -36.16 18.09 -75.82 - q-13.42 -39.66 -58.91 -48.99 l-188.97 -29.16 Z", - Fill = "#FF000000" - }; - - Share = new VectorImage - { - Height = 14, - Width = 16, - Data = @"M453.23 283.64 l0 -219.44 q1.16 -26.85 18.67 -45.53 q17.51 -18.68 44.36 -18.68 q23.34 0 40.85 15.17 l441.21 375.85 - q25.68 22.18 25.68 56.61 q0 34.43 -25.68 57.78 l-441.21 375.85 q-19.84 16.34 -46.11 14 q-26.26 -2.34 -42.61 -22.18 - q-15.17 -18.67 -15.17 -42.02 l0 -201.93 q-156.41 0 -249.79 61.87 q-93.38 61.87 -178.58 183.25 q-4.67 5.84 -14.01 5.25 - q-9.34 -0.59 -10.51 -19.25 q-5.83 -241.62 87.54 -405.62 q93.38 -164 365.35 -171 Z", - Fill = "#FF000000" - }; - - CloudDownload = new VectorImage - { - Height = 32, - Width = 48, - Data = @"M19.4,10c-0.7-3.4-3.7-6-7.4-6C9.1,4,6.6,5.6,5.3,8C2.3,8.4,0,10.9,0,14c0,3.3,2.7,6,6,6h13c2.8,0,5-2.2,5-5 - C24,12.4,22,10.2,19.4,10z M19,18H6c-2.2,0-4-1.8-4-4c0-2.1,1.5-3.8,3.6-4l1.1-0.1L7.1,9C8.1,7.1,9.9,6,12,6c2.6,0,4.9,1.9,5.4,4.4 - l0.3,1.5l1.5,0.1c1.6,0.1,2.8,1.4,2.8,3C22,16.6,20.6,18,19,18z M13.4,10h-2.9v3H8l4,4l4-4h-2.6V10z", - Fill = "#FF000000" - }; - - Folder = new VectorImage - { - Height = 32, - Width = 40, - Data = @"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z", - Fill = "#FF000000" - }; - - Downloading = new VectorImage - { - Height = 16, - Width = 16, - Data = @"M1,11.7c0.6,0,1,0.5,1,1V24H1.4C0.6,24,0,23.4,0,22.6c0,0,0,0,0,0v-9.9C0,12.1,0.5,11.7,1,11.7C1,11.7,1,11.7,1,11.7z - M0,21.9h24v0.7c0,0.8-0.6,1.4-1.3,1.4H1.4C0.6,24,0,23.4,0,22.6V21.9z - M23,11.7c0.6,0,1,0.5,1,1v9.9c0,0.8-0.6,1.4-1.3,1.4H22V12.7C22,12.1,22.5,11.7,23,11.7C23,11.7,23,11.7,23,11.7z M13,17.4 - h-2V1c0-0.6,0.4-1,1-1s1,0.5,1,1c0,0,0,0,0,0V17.4z - M6.9,12.5c0.4-0.4,1-0.4,1.4,0l4.9,5.1L12.8,18c-0.5,0.5-1.4,0.5-1.9,0l-4-4.1C6.5,13.5,6.5,12.9,6.9,12.5L6.9,12.5z - M16.8,12.5c0.4,0.4,0.4,1.1,0,1.5l-4,4.1c-0.5,0.5-1.4,0.5-1.9,0l-0.5-0.5l4.9-5.1C15.8,12.1,16.4,12.1,16.8,12.5L16.8,12.5z", - Fill = "#FF000000" - }; - - DownloadFinished = new VectorImage - { - Height = 16, - Width = 16, - Data = @"M12,0C8.6,0.1,5.8,1.3,3.5,3.5S0.1,8.6,0,12c0.1,3.4,1.3,6.2,3.5,8.5S8.6,23.9,12,24c3.4-0.1,6.2-1.3,8.5-3.5 - s3.4-5.1,3.5-8.5c-0.1-3.4-1.3-6.2-3.5-8.5S15.4,0.1,12,0z M12,22.5c-3-0.1-5.5-1.1-7.4-3.1S1.6,15,1.5,12c0.1-3,1.1-5.5,3.1-7.4 - S9,1.6,12,1.5c3,0.1,5.5,1.1,7.4,3.1s3,4.4,3.1,7.4c-0.1,3-1.1,5.5-3.1,7.4S15,22.4,12,22.5z - M16.5,8.1c0.2-0.2,0.4-0.2,0.6-0.2c0.5,0,0.9,0.4,0.9,0.9c0,0.2-0.1,0.5-0.2,0.6l-6.5,6.5 - c-0.2,0.2-0.4,0.3-0.6,0.3c-0.2,0-0.5-0.1-0.7-0.3l-3.8-3.7C6.1,12,6,11.7,6,11.5c0-0.2,0.1-0.5,0.3-0.6c0.2-0.2,0.4-0.3,0.6-0.3 - c0.2,0,0.5,0.1,0.6,0.2l3.1,3.1L16.5,8.1L16.5,8.1z", - Fill = "#FF000000" - }; - - CoinIcon = new VectorImage - { - Height = 20, - Width = 20, - Data = @"M473.7 358.8 l0 -54.42 l-129.01 0 q-16.12 0 -27.21 -11.09 q-11.09 -11.09 -11.09 -27.72 q0 -16.63 11.09 -27.21 - q11.09 -10.58 27.21 -11.59 l334.62 0 q22.17 1.01 32.76 20.16 q10.58 19.15 0 37.8 q-10.59 18.64 -32.76 19.65 l-129.01 0 - l0 54.42 q93.73 16.13 153.7 83.66 q59.97 67.52 61.98 163.27 l0 23.18 q-1 17.14 -11.59 27.72 q-10.59 10.58 -27.22 10.58 - q-16.63 0 -27.72 -10.58 q-11.08 -10.58 -11.08 -27.72 l0 -23.18 q-1.01 -62.49 -39.31 -108.35 q-38.3 -45.86 -98.77 -59.96 - l0 332.6 q0 16.12 -11.09 27.2 q-11.08 11.09 -27.21 11.09 q-16.13 0 -27.22 -11.09 q-11.08 -11.08 -11.08 -27.2 l0 -332.6 - q-60.47 14.11 -98.77 59.96 q-38.3 45.86 -39.31 108.35 l0 23.18 q0 17.14 -11.09 27.72 q-11.08 10.58 -27.71 10.58 - q-16.63 0 -27.21 -10.58 q-10.59 -10.58 -11.59 -27.72 l0 -23.18 q2.01 -95.75 61.98 -163.27 q59.97 -67.53 153.7 -83.66 - ZM512 1024 q-217.7 -6.05 -361.82 -150.17 q-144.13 -144.13 -150.18 -361.83 q6.05 -217.7 150.18 -361.82 - q144.13 -144.13 361.82 -150.18 q217.7 6.05 361.83 150.18 q144.13 144.13 150.17 361.82 q-6.05 217.7 -150.17 361.83 - q-144.13 144.13 -361.83 150.17 ZM512 946.39 q184.44 -5.04 306.89 -127.5 q122.46 -122.45 127.5 -306.89 - q-5.04 -184.44 -127.5 -306.89 q-122.45 -122.46 -306.89 -127.5 q-184.44 5.04 -306.89 127.5 q-122.46 122.45 -127.5 306.89 - q5.04 184.44 127.5 306.89 q122.45 122.46 306.89 127.5 Z", - Fill = "#FF000000" - }; - - MoneyIcon = new VectorImage - { - Height = 20, - Width = 20, - Data = @"M409.2 444.47 l138.08 0 q28.22 -1.01 46.36 -19.15 q18.14 -18.14 18.14 -45.85 q0 -27.72 -18.14 -46.36 - q-18.14 -18.65 -46.36 -19.66 l-129.01 0 q-4.03 0 -6.55 3.03 q-2.52 3.02 -2.52 6.04 l0 121.95 ZM658.14 469.67 - q48.38 30.24 68.03 80.63 q19.66 50.39 4.03 105.32 q-15.63 54.93 -58.96 87.18 q-43.34 32.25 -99.78 33.25 l-153.19 0 - q-36.29 -1 -60.98 -25.19 q-24.69 -24.19 -25.7 -61.48 l0 -366.87 q1.01 -36.28 25.7 -60.47 q24.69 -24.19 60.98 -25.2 - l129.01 0 q42.33 0 76.6 21.67 q34.26 21.67 52.41 59.47 q18.14 37.79 13.11 78.11 q-5.04 40.31 -31.25 73.57 ZM571.46 522.08 - l-162.26 0 l0 167.31 q1 9.07 9.07 9.07 l153.19 0 q36.29 -1.01 60.48 -26.21 q24.19 -25.2 24.19 -61.99 q0 -36.79 -24.19 -61.48 - q-24.19 -24.7 -60.48 -26.71 ZM512 1024 q-217.7 -6.05 -361.82 -150.17 q-144.13 -144.13 -150.18 -361.83 - q6.05 -217.7 150.18 -361.82 q144.13 -144.13 361.82 -150.18 q217.7 6.05 361.83 150.18 q144.13 144.13 150.17 361.82 - q-6.05 217.7 -150.17 361.83 q-144.13 144.13 -361.83 150.17 ZM512 946.39 q184.44 -5.04 306.89 -127.5 - q122.46 -122.45 127.5 -306.89 q-5.04 -184.44 -127.5 -306.89 q-122.45 -122.46 -306.89 -127.5 q-184.44 5.04 -306.89 127.5 - q-122.46 122.45 -127.5 306.89 q5.04 184.44 127.5 306.89 q122.45 122.46 306.89 127.5 Z", - Fill = "#FF000000" - }; - - BindingEmail = new VectorImage - { - Height = 20, - Width = 20, - Data = @"M512 1024 q-218 -5 -362.5 -149.5 q-144.5 -144.5 -149.5 -362.5 q5 -218 149.5 -362.5 q144.5 -144.5 362.5 -149.5 - q218 5 362.5 149.5 q144.5 144.5 149.5 362.5 q-5 218 -149.5 362.5 q-144.5 144.5 -362.5 149.5 ZM282 278 l214 164 - q8 6 16 6 q8 0 16 -6 l214 -164 l0 257 l-230 77 l-230 -77 l0 -257 ZM305 232 q7 -2 15 -2 l384 0 q8 0 15 2 q-3 2 -5 4 - l-202 154 l-202 -154 q-2 -2 -5 -4 ZM794 518 l0 -262 q-1 -34 -27 -55 q-26 -21 -63 -22 l-384 0 q-37 1 -63 22 - q-26 21 -27 55 l0 262 l-9 -3 q-25 -8 -46 7 q-21 15 -21 41 l0 154 q1 43 29.5 72 q28.5 29 72.5 30 l512 0 q44 -1 72.5 -30 - q28.5 -29 29.5 -72 l0 -154 q0 -26 -21 -41 q-21 -15 -46 -7 l-9 3 ZM205 563 l307 103 l307 -103 l0 154 q0 21 -15 36 - q-15 15 -36 15 l-512 0 q-22 -1 -36.5 -15 q-14.5 -14 -14.5 -36 l0 -154 Z", - Fill = "#FF000000" - }; - - BindingPhone = new VectorImage - { - Height = 20, - Width = 20, - Data = @"M512 1024 q-218 -5 -362.5 -149.5 q-144.5 -144.5 -149.5 -362.5 q5 -218 149.5 -362.5 q144.5 -144.5 362.5 -149.5 - q218 5 362.5 149.5 q144.5 144.5 149.5 362.5 q-5 218 -149.5 362.5 q-144.5 144.5 -362.5 149.5 ZM307 614 l0 -307 - l410 0 l0 461 q0 21 -15 36 q-15 15 -36 15 l-308 0 q-21 0 -35.5 -14.5 q-14.5 -14.5 -15.5 -36.5 l0 -102 l333 0 - q11 -1 18 -8 q7 -7 7 -18 q0 -11 -7 -18 q-7 -7 -18 -8 l-333 0 ZM307 256 q0 -21 15 -36 q15 -15 36 -15 l308 0 - q21 0 36 15 q15 15 15 36 l-410 0 ZM358 154 q-43 1 -72 29.5 q-29 28.5 -30 72.5 l0 512 q1 44 30 72.5 q29 28.5 72 29.5 - l308 0 q43 -1 72 -29.5 q29 -28.5 30 -72.5 l0 -512 q-1 -44 -30 -72.5 q-29 -28.5 -72 -29.5 l-308 0 ZM512 794 - q22 -1 36.5 -15.5 q14.5 -14.5 14.5 -36 q0 -21.5 -14.5 -36 q-14.5 -14.5 -36.5 -14.5 q-22 0 -36.5 14.5 q-14.5 14.5 -14.5 36 - q0 21.5 14.5 36 q14.5 14.5 36.5 15.5 Z", - Fill = "#FF000000" - }; - - FavoriteOutline = new VectorImage - { - Height = 24, - Width = 24, - Data = @"M755.8 1021.89 q-13.98 -1 -28.45 -4.5 q-14.47 -3.5 -29.45 -8.49 l-146.74 -76.87 q-18.97 -13.97 -39.93 -13.97 - q-20.97 0 -35.94 13.97 l-146.75 76.87 q-33.94 14.97 -69.38 12.98 q-35.44 -2 -65.39 -25.96 q-23.96 -19.96 -35.44 -49.41 - q-11.48 -29.45 -2.5 -59.4 l31.95 -184.68 q3.99 -22.96 -3.49 -40.43 q-7.49 -17.47 -22.47 -36.43 l-126.77 -133.77 - q-24.96 -19.96 -32.45 -50.41 q-7.49 -30.45 6.49 -64.39 q9.98 -28.95 34.94 -49.91 q24.96 -20.97 54.9 -26.96 - l171.71 -24.95 q19.96 -1 36.93 -12.98 q16.97 -11.98 26.95 -31.94 l69.88 -159.73 q14.98 -33.94 45.42 -53.91 - q30.44 -19.97 69.38 -15.97 q34.94 0 60.39 20.96 q25.45 20.96 35.44 55.9 l76.86 152.74 q9.98 18.96 26.96 32.44 - q16.98 13.48 36.93 18.47 l172.7 25.95 q28.95 4.99 51.91 22.96 q22.96 17.97 36.93 46.92 q9.99 28.95 5 59.89 - q-5 30.95 -23.96 54.91 l-127.78 133.77 q-14.97 14.97 -22.46 33.94 q-7.49 18.97 -3.49 42.92 l31.94 184.68 - q4.99 34.94 -8.49 65.39 q-13.48 30.45 -42.43 50.41 q-13.98 8.98 -32.44 13.98 q-18.47 5 -37.44 5 ZM513.22 817.24 - q23.96 0 46.92 5.99 q22.96 5.99 42.93 19.97 l139.75 75.87 q9.99 4.99 15.48 2.99 q5.49 -2 10.48 -2.49 - q4.99 -0.5 7.99 -4.99 q3 -4.5 -2 -14.48 l-31.95 -184.68 q-4.99 -47.92 6.49 -87.35 q11.48 -39.43 44.42 -72.37 - l127.78 -133.77 q3.99 -4.99 2.5 -9.98 q-1.5 -4.99 -2 -9.48 q-0.5 -4.5 -4.49 -5.49 q-3.99 -1 -8.99 -1 l-171.7 -24.96 - q-43.92 -5.99 -79.86 -32.44 q-35.94 -26.45 -60.89 -70.38 l-69.88 -159.72 q0 -8.99 -4 -10.98 q-4 -2 -8.99 -2 - q-4.99 0 -9.48 2 q-4.49 1.99 -9.48 10.98 l-69.88 159.72 q-24.96 43.92 -61.39 70.38 q-36.44 26.45 -79.37 32.44 - l-172.7 24.96 q-4.99 0 -8.48 3.99 q-3.5 3.99 -3.99 8.98 q-0.49 5 0.5 8.99 q1 3.99 5.99 3.99 l127.78 133.77 - q32.94 33.94 44.42 71.88 q11.48 37.93 6.49 80.85 l-25.95 185.68 q0 4.99 1 9.49 q1 4.5 5.99 9.49 q5 4.99 13.48 4.99 - q8.49 0 18.47 -4.99 l139.76 -76.87 q10.98 -4.99 31.44 -11.48 q20.47 -6.49 45.42 -7.49 Z", - Fill = "#FF000000" - }; - - Subscription = new VectorImage - { - Height = 24, - Width = 24, - Data = @"M512 945.07 q-6.15 0 -13.53 -2.46 q-7.39 -2.46 -13.54 -4.92 q-43.07 -32 -190.74 -153.83 q-147.67 -121.83 -211.65 -200.59 - q-51.69 -68.91 -67.69 -119.97 q-16 -51.06 -14.77 -116.29 q3.69 -146.44 91.06 -244.88 q87.37 -98.45 220.27 -102.14 - q56.6 0 107.67 20.3 q51.07 20.3 92.91 58.46 q41.84 -38.15 92.91 -58.46 q51.07 -20.3 107.67 -20.3 - q132.9 3.69 220.27 102.14 q87.37 98.45 91.06 244.88 q1.23 61.53 -14.76 113.21 q-16 51.68 -67.68 123.05 - q-63.98 76.3 -212.88 199.36 q-148.9 123.06 -189.51 155.06 q-6.15 2.46 -13.54 4.92 q-7.38 2.46 -13.53 2.46 ZM322.49 78.76 - q-97.21 3.69 -168.58 85.52 q-71.37 81.83 -75.07 197.5 q-1.23 35.69 8 79.99 q9.23 44.3 51.07 105.83 q44.3 52.91 163.66 148.9 - l210.43 169.81 l210.43 -169.81 q119.36 -95.99 163.66 -148.9 q43.07 -61.53 52.3 -107.06 q9.23 -45.53 6.77 -78.76 - q-3.7 -115.67 -75.07 -197.5 q-71.37 -81.83 -168.58 -85.52 q-49.23 0 -87.38 21.53 q-38.14 21.53 -78.75 57.21 - q-11.07 8.62 -17.23 10.47 q-6.15 1.84 -6.15 1.84 l-4.92 -1.23 q-6.16 -1.23 -14.77 -7.39 q-43.07 -35.68 -81.83 -58.44 - q-38.76 -22.77 -87.99 -23.99 Z", - Fill = "#FF000000" - }; - - ToView = new VectorImage - { - Height = 24, - Width = 24, - Data = @"M837.18 92.91 q38.96 1 65.44 27.48 q26.48 26.48 27.48 65.43 l0 651.36 q-1 39.96 -27.48 65.94 - q-26.48 25.98 -65.44 26.98 l-651.36 0 q-38.96 -1 -65.43 -26.98 q-26.48 -25.98 -27.48 -65.94 l0 -651.36 - q1 -38.96 27.48 -65.43 q26.48 -26.48 65.43 -27.48 l651.36 0 ZM837.18 0 l-651.36 0 q-78.92 2 -131.37 54.45 - q-52.45 52.45 -54.45 131.37 l0 651.36 q2 78.93 54.45 131.38 q52.45 52.44 131.37 54.44 l651.36 0 q78.93 -2 131.88 -54.44 - q52.94 -52.45 54.94 -131.38 l0 -651.36 q-3 -78.92 -55.44 -131.37 q-52.45 -52.45 -131.38 -54.45 ZM697.32 744.27 - q-12.99 0 -24.98 -7.99 l-242.76 -159.84 q-20.98 -13.99 -20.98 -38.96 l0 -278.73 q0 -19.98 12.99 -33.47 - q12.99 -13.49 32.97 -13.49 q19.98 0 32.96 13.49 q12.99 13.49 13.99 33.47 l0 252.75 l221.78 143.86 - q17.99 7.99 24.98 24.98 q6.99 16.99 0 35.96 q-6.99 14.99 -20.98 22.48 q-13.99 7.49 -29.97 5.49 Z", - Fill = "#FF000000" - }; - - History = new VectorImage - { - Height = 24, - Width = 24, - Data = @"M512 0 q-217 6 -361.5 150.5 q-144.5 144.5 -150.5 361.5 q6 217 150.5 361.5 q144.5 144.5 361.5 150.5 - q217 -6 361.5 -150.5 q144.5 -144.5 150.5 -361.5 q-6 -217 -150.5 -361.5 q-144.5 -144.5 -361.5 -150.5 ZM512 939 - q-183 -5 -302.5 -124.5 q-119.5 -119.5 -124.5 -302.5 q5 -183 124.5 -302.5 q119.5 -119.5 302.5 -124.5 - q183 5 302.5 124.5 q119.5 119.5 124.5 302.5 q-5 183 -124.5 302.5 q-119.5 119.5 -302.5 124.5 ZM512 256 - l-85 0 l0 341 l341 0 l0 -85 l-256 0 l0 -256 Z", - Fill = "#FF000000" - }; - - VideoUp = new VectorImage - { - Height = 24, - Width = 24, - Data = @"M711,212.3l47-47c41.7-47.6-25-112.2-72-71l-107,106c-3.3,3.3-6,7-8,11H454c-1.3-2.7-3.3-5-6-7l-112-111 - c-21.3-17.3-51-17-71,3s-20.3,49.7-3,71l45,44H198c-56.7,0-105,48.3-105,105v417c0,56.7,48.3,105,105,105h57 - c-17.9,49.6,19.9,105,73.5,105c55.4,0,90.4-55.3,74.5-105h218c-15.9,49.7,19.1,105,74.5,105c53.6,0,91.4-55.4,73.5-105h57 - c56.7,0,105-48.3,105-105v-417c0-57.6-48.3-104-105-104H711L711,212.3z", - Fill = "#FF000000" - }; - - Channel = new VectorImage - { - Height = 24, - Width = 24, - Data = @"M921.6 211.41 q1.1 -6.61 7.15 -10.47 q6.05 -3.85 12.66 -0.54 q38.54 19.82 60.56 56.16 - q22.02 36.33 22.02 80.38 l0 329.22 q-1.1 64.96 -44.6 108.46 q-43.5 43.5 -108.45 44.6 - l-483.37 0 q-44.04 0 -80.38 -22.02 q-36.34 -22.02 -56.15 -61.66 q-3.31 -5.51 0.54 -11.57 - q3.85 -6.05 10.47 -7.15 l557.14 0 q44.04 -1.1 72.67 -29.73 q28.63 -28.63 29.73 -72.67 - l0 -402.99 ZM102.4 0 l666.15 0 q41.84 0 71.57 29.73 q29.73 29.73 30.83 72.67 l0 461.35 - q-1.1 41.84 -30.83 71.57 q-29.73 29.73 -71.57 30.83 l-666.15 0 q-42.94 -1.1 -72.67 -30.83 - q-29.73 -29.73 -29.73 -71.57 l0 -461.35 q0 -42.94 29.73 -72.67 q29.73 -29.73 72.67 -29.73 - ZM559.35 353.45 q9.91 -7.71 9.91 -20.93 q0 -13.21 -9.91 -20.92 l-186.09 -129.92 q-13.21 -8.81 -26.42 -1.66 - q-13.21 7.16 -14.32 22.57 l0 259.85 q1.11 15.42 14.32 22.57 q13.21 7.16 26.42 -1.65 l186.09 -129.92 Z", - Fill = "#FF000000" - }; - - Channel1 = new VectorImage - { - Height = 24, - Width = 24, - Data = @"M116.57 0 q-30.86 0 -57.71 16 q-26.85 16 -42.85 42.85 q-16 26.85 -16 57.71 l0 468.57 q0 30.86 16 57.72 - q16 26.86 42.85 42.86 q26.85 16 57.71 16 l643.43 0 q32 0 58.86 -16 q26.86 -16 42.86 -42.86 - q16 -26.86 16 -57.72 l0 -468.57 q0 -30.86 -16 -57.71 q-16 -26.85 -42.86 -42.85 q-26.86 -16 -58.86 -16 - l-643.43 0 ZM262.86 848 q-40 0 -72.57 -25.71 q-32.58 -25.72 -39.43 -62.29 l697.14 0 q36.57 0 62.29 -25.71 - q25.71 -25.72 25.71 -62.29 l0 -521.14 q37.71 11.43 62.86 42.28 q25.14 30.86 25.14 69.72 l0 468.57 - q0 30.86 -16 57.72 q-16 26.86 -42.86 42.86 q-26.86 16 -58.86 16 l-643.43 0 ZM88 174.86 - q0 -36.57 25.14 -62.29 q25.14 -25.71 61.72 -25.71 l526.85 0 q36.58 0 62.29 25.71 q25.71 25.72 25.71 62.29 - l0 350.85 q0 36.58 -25.71 62.29 q-25.71 25.71 -62.29 25.71 l-526.85 0 q-36.57 0 -61.72 -25.71 - q-25.14 -25.71 -25.14 -62.29 l0 -350.85 ZM609.14 374.86 q11.43 -6.86 11.43 -22.29 q0 -15.43 -11.43 -26.86 - l-214.85 -146.28 q-13.72 -10.29 -28.57 -1.72 q-14.86 8.58 -14.86 26.86 l0 297.14 q0 18.29 14.86 26.86 - q14.85 8.57 28.57 -2.86 l214.85 -150.85 Z", - Fill = "#FF000000" - }; - - SeasonsSeries = new VectorImage - { - Height = 24, - Width = 24, - Data = @"M974.2 382.22 l-401.47 177.37 q-28.88 13.75 -60.5 13.75 q-31.62 0 -60.5 -13.75 l-400.09 -177.37 - q-20.63 -11 -33 -30.25 q-12.38 -19.25 -13.06 -43.31 q-0.68 -24.06 10.32 -45.38 q11 -21.32 31.62 -35.07 - l402.85 -210.36 q28.87 -17.87 63.25 -17.87 q34.38 0 63.25 19.25 l398.72 207.61 q22 12.37 33.69 34.37 - q11.68 22 10.31 46.06 q-1.38 24.06 -13.06 44 q-11.69 19.94 -32.31 30.94 ZM939.83 292.86 l-400.1 -207.62 - q-11 -8.25 -24.75 -9.62 q-16.5 1.37 -30.25 9.62 l-400.1 207.62 q-2.75 6.87 -2.75 12.37 q0 5.5 4.13 9.62 - l397.35 175.99 q20.62 9.63 28.18 9.63 q7.56 0 26.81 -8.25 l404.22 -178.74 q1.38 -11 -4.12 -20.62 - l1.38 0 ZM20.01 512.84 q8.25 -4.12 19.25 -4.12 q11 0 19.25 5.5 q16.5 9.62 39.87 20.62 l413.85 186.99 - l394.6 -178.74 l60.49 -30.25 q9.63 -4.12 19.94 -4.12 q10.31 0 19.25 5.5 q8.94 5.5 13.75 15.12 - q4.81 9.63 3.43 19.25 q-1.37 23.37 -21.99 31.62 l-64.62 31.62 l-424.85 193.87 l-422.1 -192.49 - q-35.74 -12.38 -68.74 -33 q-9.63 -5.5 -15.13 -14.43 q-5.5 -8.94 -6.18 -19.25 q-0.69 -10.32 4.82 -19.25 - q5.5 -8.94 15.12 -14.44 l0 0 ZM58.51 732.83 q17.87 9.62 41.25 20.62 l412.47 186.99 l394.6 -178.74 - l60.49 -30.25 q9.63 -5.5 19.94 -4.81 q10.31 0.69 19.25 6.18 q8.94 5.5 13.75 15.12 q4.81 9.63 3.43 19.94 - q-1.37 10.32 -6.87 18.57 q-5.5 8.25 -15.12 12.37 l-64.62 31.62 l-424.85 192.49 l-422.1 -191.11 - q-35.74 -13.75 -68.74 -34.37 q-13.75 -6.88 -17.88 -22 q-4.13 -15.13 3.44 -28.87 q7.56 -13.75 22.68 -17.87 - q15.13 -4.13 28.88 4.13 Z", - Fill = "#FF000000" - }; - - PlatformIpad = new VectorImage - { - Height = 16, - Width = 16, - Data = @"M804.57 0 q40 0 73.72 19.43 q33.71 19.43 53.14 53.15 q19.43 33.72 19.43 73.71 l0 731.42 q0 40 -19.43 73.71 - q-19.43 33.72 -53.14 53.14 q-33.72 19.43 -73.72 19.43 l-585.14 0 q-40 0 -73.72 -19.43 q-33.72 -19.43 -53.15 -53.14 - q-19.43 -33.71 -19.43 -73.71 l0 -731.42 q0 -40 19.43 -73.71 q19.43 -33.72 53.15 -53.15 q33.72 -19.43 73.72 -19.43 - l585.14 0 ZM512 877.71 q-22.86 0 -38.86 16 q-16 16 -16 38.86 q0 22.86 16 38.86 q16 16 38.86 16 q22.86 0 38.86 -16 - q16 -16 16 -38.86 q0 -22.86 -16 -38.86 q-16 -16 -38.86 -16 ZM804.57 73.14 l-585.14 0 q-27.43 0 -48.57 18.28 - q-21.15 18.28 -24.57 46.86 l0 8 l0 621.71 q0 27.43 18.28 48.57 q18.29 21.14 46.86 24.57 l8 0 l585.14 0 - q27.43 0 48.57 -18.28 q21.14 -18.28 24.57 -46.86 l0 -8 l0 -621.71 q0 -30.86 -21.14 -52 q-21.14 -21.14 -52 -21.14 Z", - Fill = "#FF000000" - }; - - PlatformMobile = new VectorImage - { - Height = 16, - Width = 16, - Data = @"M694.86 0 q40 0 73.72 19.43 q33.71 19.43 53.14 53.15 q19.43 33.72 19.43 73.71 l0 731.42 q0 40 -19.43 73.71 - q-19.42 33.72 -53.14 53.14 q-33.72 19.43 -73.72 19.43 l-365.72 0 q-40 0 -73.71 -19.43 q-33.72 -19.43 -53.14 -53.14 - q-19.43 -33.71 -19.43 -73.71 l0 -731.42 q0 -40 19.43 -73.71 q19.42 -33.72 53.14 -53.15 q33.71 -19.43 73.71 -19.43 - l365.72 0 ZM512 877.71 q-22.86 0 -38.86 16 q-16 16 -16 38.86 q0 22.86 16 38.86 q16 16 38.86 16 q22.86 0 38.86 -16 - q16 -16 16 -38.86 q0 -22.86 -16 -38.86 q-16 -16 -38.86 -16 ZM694.86 73.14 l-365.72 0 q-27.43 0 -48.57 18.28 - q-21.14 18.28 -24.57 46.86 l0 8 l0 621.71 q0 27.43 18.28 48.57 q18.29 21.14 46.86 24.57 l8 0 l365.72 0 - q27.43 0 48.57 -18.28 q21.14 -18.28 24.57 -46.86 l0 -8 l0 -621.71 q0 -30.86 -21.14 -52 q-21.14 -21.14 -52 -21.14 Z", - Fill = "#FF000000" - }; - - PlatformPC = new VectorImage - { - Height = 16, - Width = 16, - Data = @"M694.86 804.57 q14.85 0 25.71 10.86 q10.86 10.86 10.86 25.71 q0 14.86 -10.86 25.71 q-10.86 10.86 -25.71 10.86 - l-365.72 0 q-14.85 0 -25.71 -10.86 q-10.86 -10.86 -10.86 -25.71 q0 -14.86 10.86 -25.71 q10.86 -10.86 25.71 -10.86 - l365.72 0 ZM877.71 0 q40 0 73.71 19.43 q33.72 19.43 53.14 53.15 q19.43 33.72 19.43 73.71 l0 438.85 q0 40 -19.43 73.72 - q-19.43 33.72 -53.14 53.14 q-33.71 19.43 -73.71 19.43 l-731.42 0 q-40 0 -73.71 -19.43 q-33.72 -19.43 -53.15 -53.14 - q-19.43 -33.72 -19.43 -73.72 l0 -438.85 q0 -40 19.43 -73.71 q19.43 -33.72 53.15 -53.15 q33.72 -19.43 73.71 -19.43 - l731.42 0 ZM877.71 73.14 l-731.42 0 q-27.43 0 -48.57 18.28 q-21.15 18.28 -24.58 46.86 l0 8 l0 438.85 - q0 27.43 18.28 48.58 q18.28 21.14 46.86 24.57 l8 0 l731.42 0 q27.43 0 48.57 -18.29 q21.14 -18.29 24.58 -46.86 - l0 -8 l0 -438.85 q0 -30.86 -21.14 -52 q-21.14 -21.14 -52 -21.14 ZM347.43 182.86 q34.28 0 63.99 17.14 - q29.72 17.14 46.86 46.85 q17.15 29.72 17.15 64 q0 34.28 -17.15 64 q-17.14 29.71 -46.86 46.86 - q-29.71 17.14 -63.99 17.14 l-91.43 0 l0 109.71 l-73.14 0 l0 -365.71 l164.57 0 ZM694.86 182.86 - q44.57 0 82.85 19.43 q38.29 19.42 63.43 53.71 l-60.57 41.14 q-22.86 -27.43 -56 -37.14 q-33.14 -9.71 -66.28 2.29 - q-33.14 12 -53.14 40.57 q-20 28.57 -20 62.86 q0 34.28 20 62.85 q20 28.57 53.14 40.57 q33.14 12 66.28 2.28 - q33.14 -9.71 56 -37.13 l60.57 41.14 q-38.85 51.43 -101.14 67.43 q-62.29 16 -121.14 -10.86 - q-58.86 -26.86 -87.42 -84.58 q-28.57 -57.71 -14.86 -120.57 q13.71 -62.86 64 -103.43 q50.28 -40.57 114.28 -40.57 - ZM347.43 256 l-91.43 0 l0 109.71 l91.43 0 q22.86 0 38.86 -16 q16 -16 16 -38.85 q0 -22.86 -16 -38.86 q-16 -16 -38.86 -16 Z", - Fill = "#FF000000" - }; - - PlatformTV = new VectorImage - { - Height = 16, - Width = 16, - Data = @"M768 804.57 q14.86 0 25.72 10.86 q10.86 10.86 10.86 25.71 q0 14.86 -10.86 25.71 q-10.86 10.86 -25.72 10.86 - l-512 0 q-14.86 0 -25.72 -10.86 q-10.85 -10.86 -10.85 -25.71 q0 -14.86 10.85 -25.71 q10.85 -10.86 25.72 -10.86 - l512 0 ZM877.71 0 q40 0 73.71 19.43 q33.72 19.43 53.14 53.15 q19.43 33.72 19.43 73.71 l0 438.85 q0 40 -19.43 73.72 - q-19.43 33.72 -53.14 53.14 q-33.71 19.43 -73.71 19.43 l-731.42 0 q-40 0 -73.71 -19.43 q-33.72 -19.43 -53.15 -53.14 - q-19.43 -33.72 -19.43 -73.72 l0 -438.85 q0 -40 19.43 -73.71 q19.43 -33.72 53.15 -53.15 q33.72 -19.43 73.71 -19.43 - l731.42 0 ZM877.71 73.14 l-731.42 0 q-27.43 0 -48.57 18.28 q-21.15 18.28 -24.58 46.86 l0 8 l0 438.85 - q0 27.43 18.28 48.58 q18.28 21.14 46.86 24.57 l8 0 l731.42 0 q27.43 0 48.57 -18.29 q21.14 -18.29 24.58 -46.86 - l0 -8 l0 -438.85 q0 -30.86 -21.14 -52 q-21.14 -21.14 -52 -21.14 ZM585.14 182.86 l109.72 274.28 l109.71 -274.28 - l73.14 0 l-146.28 365.71 l-73.14 0 l-116.58 -292.57 l-176 0 l0 292.57 l-73.14 0 l0 -292.57 l-146.28 0 l0 -73.14 l438.85 0 Z", - Fill = "#FF000000" - }; - - } - - public VectorImage Play { get; private set; } - public VectorImage Like { get; private set; } - public VectorImage Favorite { get; private set; } - public VectorImage Share { get; private set; } - - public VectorImage CloudDownload { get; private set; } - public VectorImage Folder { get; private set; } - public VectorImage Downloading { get; private set; } - public VectorImage DownloadFinished { get; private set; } - - public VectorImage CoinIcon { get; private set; } - public VectorImage MoneyIcon { get; private set; } - public VectorImage BindingEmail { get; private set; } - public VectorImage BindingPhone { get; private set; } - - public VectorImage FavoriteOutline { get; private set; } - public VectorImage Subscription { get; private set; } - public VectorImage ToView { get; private set; } - public VectorImage History { get; private set; } - - public VectorImage VideoUp { get; private set; } - public VectorImage Channel { get; private set; } - public VectorImage Channel1 { get; private set; } - public VectorImage SeasonsSeries { get; private set; } - - public VectorImage PlatformIpad { get; private set; } - public VectorImage PlatformMobile { get; private set; } - public VectorImage PlatformPC { get; private set; } - public VectorImage PlatformTV { get; private set; } - - } -} diff --git a/src/DownKyi/Images/SystemIcon.cs b/src/DownKyi/Images/SystemIcon.cs deleted file mode 100644 index b2b83cb..0000000 --- a/src/DownKyi/Images/SystemIcon.cs +++ /dev/null @@ -1,108 +0,0 @@ -namespace DownKyi.Images -{ - public class SystemIcon - { - private static SystemIcon instance; - public static SystemIcon Instance() - { - if (instance == null) - { - instance = new SystemIcon(); - } - return instance; - } - - private SystemIcon() - { - Close = new VectorImage - { - Height = 12, - Width = 12, - Data = @"M25,23.9l-6.6-6.6c-0.3-0.3-0.9-0.3-1.1,0c-0.3,0.3-0.3,0.9,0,1.1l0,0l6.6,6.6l-6.6,6.6c-0.3,0.3-0.3,0.9,0,1.1 - c0.3,0.3,0.9,0.3,1.1,0l0,0l6.6-6.6l6.6,6.6c0.3,0.3,0.9,0.3,1.1,0.1c0.3-0.3,0.3-0.9,0.1-1.1c0,0,0,0-0.1-0.1L26.1,25l6.6-6.6 - c0.3-0.3,0.3-0.9,0-1.1c-0.3-0.3-0.9-0.3-1.1,0l0,0L25,23.9L25,23.9z", - Fill = "#FF000000" - }; - - Maximize = new VectorImage - { - Height = 12, - Width = 12, - Data = @"M31.1,33H18.9c-1,0-1.9-0.9-1.9-1.9V18.9c0-1,0.9-1.9,1.9-1.9h12.3c1,0,1.9,0.9,1.9,1.9v12.3C33,32.1,32.1,33,31.1,33z - M18.9,18.3c-0.3,0-0.6,0.3-0.6,0.6v12.3c0,0.3,0.3,0.6,0.6,0.6h12.3c0.3,0,0.6-0.3,0.6-0.6V18.9c0-0.3-0.3-0.6-0.6-0.6 - C31.1,18.3,18.9,18.3,18.9,18.3z", - Fill = "#FF000000" - }; - - Minimize = new VectorImage - { - Height = 1.2, - Width = 12, - Data = @"M17.8,25.8c-0.5,0-0.8-0.3-0.8-0.8s0.3-0.8,0.8-0.8h14.4c0.5,0,0.8,0.3,0.8,0.8s-0.3,0.8-0.8,0.8H17.8z", - Fill = "#FF000000" - }; - - Restore = new VectorImage - { - Height = 12, - Width = 12, - Data = @"M29,33H18.3c-0.7,0-1.3-0.6-1.3-1.3V21c0-0.7,0.6-1.3,1.3-1.3H29c0.7,0,1.3,0.6,1.3,1.3v10.7C30.4,32.4,29.8,33,29,33z - M18.3,20.9c-0.1,0-0.1,0.1-0.1,0.1v10.7c0,0.1,0.1,0.1,0.1,0.1H29c0.1,0,0.1-0.1,0.1-0.1V21c0-0.1-0.1-0.1-0.1-0.1H18.3z - M31.7,30.4h-1.9v-1.2h1.9c0.1,0,0.1-0.1,0.1-0.1V18.3c0-0.1-0.1-0.1-0.1-0.1H21c-0.1,0-0.1,0.1-0.1,0.1v1.9h-1.2v-1.9 - c0-0.7,0.6-1.3,1.3-1.3h10.7c0.7,0,1.3,0.6,1.3,1.3v10.7C33,29.8,32.4,30.4,31.7,30.4z", - Fill = "#FF000000" - }; - - Skin = new VectorImage - { - Height = 12, - Width = 12, - Data = @"M29.1,18.1l2.7,3.2l-1.3,1.6c-0.1-0.1-0.3-0.1-0.5-0.1c-0.6,0-1,0.5-1,1.2v8.1h-8.2v-8.1c0-0.7-0.5-1.2-1-1.2 - c-0.1,0-0.3,0-0.5,0.1l-1.3-1.6l2.7-3.2h0.8c0.7,0.9,2.4,1.5,3.3,1.5c0.9,0,2.6-0.4,3.3-1.5H29.1 M29.2,17h-0.9 - c-0.2,0-0.5,0.1-0.7,0.4c-0.5,0.5-1.8,1.1-2.6,1.1c-0.8,0-2.2-0.5-2.6-1.2c-0.2-0.1-0.5-0.3-0.7-0.3h-0.9c-0.2,0-0.5,0.1-0.6,0.3 - l-3.1,3.6c-0.1,0.3-0.1,0.7,0,0.8l1.8,2.2C19,24,19.3,24,19.4,24s0.2,0,0.3-0.1v-0.1h0.1c0,0,0.1,0,0.1,0.1v8.2 - c0,0.5,0.3,0.9,0.8,0.9h8.6c0.5,0,0.8-0.4,0.8-0.9v-8.2c0-0.1,0-0.1,0.1-0.1h0.1l0.1,0.1c0.1,0.1,0.2,0.1,0.3,0.1s0.2,0,0.3-0.1 - l1.8-2.2c0-0.1,0-0.5-0.1-0.8l-3.1-3.6C29.7,17.1,29.5,17,29.2,17z", - Fill = "#FF000000" - }; - - Info = new VectorImage - { - Height = 20, - Width = 20, - Data = @"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 - 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z", - Fill = "#FF00bcf2" - }; - - Warning = new VectorImage - { - Height = 20, - Width = 20, - Data = @"M12 5.99L19.53 19H4.47L12 5.99M2.74 18c-.77 1.33.19 3 1.73 3h15.06c1.54 0 2.5-1.67 1.73-3L13.73 - 4.99c-.77-1.33-2.69-1.33-3.46 0L2.74 18zM11 11v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zm0 5h2v2h-2z", - Fill = "#FFffb900" - }; - - Error = new VectorImage - { - Height = 20, - Width = 20, - Data = @"M12 7c.55 0 1 .45 1 1v4c0 .55-.45 1-1 1s-1-.45-1-1V8c0-.55.45-1 1-1zm-.01-5C6.47 2 2 6.48 2 12s4.47 - 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 - 8-3.58 8-8 8zm1-3h-2v-2h2v2z", - Fill = "#FFd83b01" - }; - } - - public VectorImage Close { get; private set; } - public VectorImage Maximize { get; private set; } - public VectorImage Minimize { get; private set; } - public VectorImage Restore { get; private set; } - public VectorImage Skin { get; private set; } - - public VectorImage Info { get; private set; } - public VectorImage Warning { get; private set; } - public VectorImage Error { get; private set; } - } -} diff --git a/src/DownKyi/Images/VectorImage.cs b/src/DownKyi/Images/VectorImage.cs deleted file mode 100644 index 8e8fb9d..0000000 --- a/src/DownKyi/Images/VectorImage.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Prism.Mvvm; - -namespace DownKyi.Images -{ - public class VectorImage : BindableBase - { - private double width; - public double Width - { - get => width; - set => SetProperty(ref width, value); - } - - private double height; - public double Height - { - get => height; - set => SetProperty(ref height, value); - } - - private string data; - public string Data - { - get => data; - set => SetProperty(ref data, value); - } - - private string fill; - public string Fill - { - get => fill; - set => SetProperty(ref fill, value); - } - - } -} diff --git a/src/DownKyi/Languages/Default.xaml b/src/DownKyi/Languages/Default.xaml deleted file mode 100644 index 566dfbb..0000000 --- a/src/DownKyi/Languages/Default.xaml +++ /dev/null @@ -1,361 +0,0 @@ - - - - 哔哩下载姬 - 未知 - - - 关闭 - 最大化 - 最小化 - 还原 - 皮肤 - - - 登录 - 请输入B站网址链接或av、BV号等…… - 请输入B站视频播放地址…… - 设置 - 下载管理 - 工具箱 - - - 扫描二维码登录 - 请使用哔哩哔哩客户端 扫码登录 或扫码下载APP - 获取登录链接失败! - 密钥错误!尝试重新获取! - 已超时!尝试重新获取二维码! - 登录成功!(3秒后自动回到主页) - 未保存登录信息!(3秒后自动回到主页) - - - 我的个人空间 - 退出登录 - 请稍等,马上就好~ - 等级 - 关注数 - 悄悄关注数 - 粉丝数 - 黑名单数 - 节操值 - 封禁状态 - 收藏夹 - 我的订阅 - 稍后再看 - 历史记录 - - 正常 - 封停 - - - 个人空间 - 已关注 - 未关注 - 关注数 - 粉丝数 - 获赞数 - 播放数 - 阅读数 - 全部 - 投稿视频 - 频道 - 合集和列表 - 请稍等,马上就好~ - - - 收藏夹 - 个内容 - - - 播放: - 收藏: - UP主: - 投稿: - 收藏于: - - - 我的订阅 - 追番 - 追剧 - 尚未观看 - - - 历史记录 - 已看完 - 刚开始 - 看到 - - - 稍后再看 - - - 下载选中项 - 下载全部 - 请稍等,马上就好~ - - - 好友 - 关注 - 粉丝 - - 请稍等,马上就好~ - 请稍等,马上就好~ - - 全部关注 - 悄悄关注 - - - 复制封面图片 - 复制封面URL - 播放 - 弹幕 - 点赞 - 投币 - 收藏 - 分享 - 评论 - - 番剧 - 电影 - 纪录片 - 国创 - 电视剧 - 综艺 - 课程 - - 序号 - 名称 - 时长 - 音质 - 画质 - 视频编码 - - 全选 - 搜索 - 搜索视频名称 - 解析 - 解析视频 - 下载选中项 - 下载全部 - - 已经添加到下载列表~ - 已经下载完成~ - 该视频已经下载完成,是否重新下载? - 没有添加任何视频~ - 成功添加了 - 项~ - - - 正在下载 - 已下载 - 下载完成 - 音频 - 视频 - 弹幕 - 字幕 - 封面 - 正在解析…… - 下载中…… - 混流中…… - 暂停中…… - 等待中…… - 下载失败 - - 正在下载 - 个视频! - 全部暂停 - 全部开始 - 全部删除 - - 已下载 - 个视频! - 按下载先后排序 - 按序号排序 - 清空所有记录 - - 开始 - 暂停 - 重试 - 移除 - 打开文件夹 - 播放 - - - 按回车键应用设置 - - 基本 - 下载完成后的动作: - - 关闭程序 - 关闭计算机 - 监听剪贴板 - 视频自动解析 - 视频解析范围: - 解析后自动下载已解析视频 - - 网络 - 启用https(若下载器提示SSL错误,则关闭此项) - UserAgent: - 选择下载器(重启生效): - 内建下载器 - Aria2下载器 - 自定义Aria2下载器 - Aria服务器地址: - Aria服务器端口: - Aria服务器Token: - Aria日志等级: - Aria同时下载数: - Aria最大线程数: - Aria下载速度限制(KB/s) - 全局下载速度限制[0: 无限制] - 单任务下载速度限制[0: 无限制] - Aria文件预分配: - 使用Http代理 - 代理地址: - 端口: - 同时下载数: - 最大线程数: - - 视频 - 优先下载的视频编码: - 优先下载的视频画质: - 优先下载的视频音质: - 下载FLV视频后转码为mp4 - 使用默认下载目录 - 默认下载目录: - 默认将文件下载到该文件夹中 - 更改目录 - 文件命名格式 - 文件名: - 可选字段: - 序号 - 视频章节 - 视频标题 - 分P标题 - 视频分区 - 音质 - 画质 - 视频编码 - 视频发布时间 - 空格 - UP主ID - UP主昵称 - 恢复默认 - 时间格式: - 序号格式: - 自然数 - 前导零填充 - - 弹幕 - 按类型屏蔽 - 顶部 - 底部 - 滚动 - 分辨率: - 字体名称: - 字体大小: - 限制行数: - 布局算法: - 速度同步 - 每一条滚动弹幕的移动速度都是相同的 - 速度异步 - 弹幕滚动速度取决于它的文本长度 - - 关于 - 访问主页 - 当前版本: - 检查更新 - 意见反馈 - 接收测试版更新 - 启动时检查更新 - 设置已更新~ - 设置失败! - 第三方 - 名称 - 作者 - 版本 - 许可证 - 免责申明 - 1. 本软件只提供视频解析,不提供任何资源上传、存储到服务器的功能。 - 2. 本软件仅解析来自B站的内容,不会对解析到的音视频进行二次编码,部分视频会进行有限的格式转换、拼接等操作。 - 3. 本软件解析得到的所有内容均来自B站UP主上传、分享,其版权均归原作者所有。内容提供者、上传者(UP主)应对其提供、上传的内容承担全部责任。 - 4. 本软件提供的所有资源,仅可用作学习交流使用,未经原作者授权,禁止用于其他用途。请在下载24小时内删除。为尊重作者版权,请前往资源的原始发布网站观看,支持原创,谢谢。 - 5. 任何涉及商业盈利目的均不得使用,否则产生的一切后果将由您自己承担。 - 6. 因使用本软件产生的版权问题,软件作者概不负责。 - - - B站助手 - AV和BV互转 - AV号形如"av123",BV号形如"BVxxx"。 - AVID: - BVID: - 访问网页 - 弹幕中的userID: - 查询弹幕发送者-> - - 去水印 - 视频地址: - 选择视频 - 水印尺寸与位置(左上角为原点,单位:像素) - 宽: - 高: - X: - Y: - 请等待当前任务完成! - 没有选择视频! - 请输入正确的宽度(正整数)! - 请输入正确的高度(正整数)! - 请输入正确的X(正整数)! - 请输入正确的Y(正整数)! - 输出信息: - - 音视频分离 - 提取音频 - 提取视频 - - - 信息 - 警告 - 错误 - - 确定 - 取消 - - 此项需重启生效,您确定要重新启动吗? - 您确定要删除吗? - 请选择文件夹 - - 路径错误! - - - 下载设置 - 位置: - 浏览 - 盘剩余空间: - 下载内容: - 下载内容 - 所有 - 音频 - 视频 - 弹幕 - 字幕 - 封面 - 设此文件夹为默认下载文件夹 - 选中后下次将不会弹出此窗口 - 下载 - 文件夹路径不能为空 - 该磁盘不存在 - - - 选择解析项 - - 解析选中项 - 解析当前页视频 - 解析所有视频 - 设为默认,下次不再弹出 - - \ No newline at end of file diff --git a/src/DownKyi/Languages/en_US.xaml b/src/DownKyi/Languages/en_US.xaml deleted file mode 100644 index b1d5821..0000000 --- a/src/DownKyi/Languages/en_US.xaml +++ /dev/null @@ -1,175 +0,0 @@ - - - - DownKyi - Unknown - - - Close - Maximize - Minimize - Restore - Skin - - - Login - Please input the Bilibili url, av id, and BV id etc. - Settings - Download Manager - Toolbox - - - Scan to Login - 请使用哔哩哔哩客户端 扫码登录 或扫码下载APP - 获取登录链接失败! - 密钥错误!尝试重新获取! - 已超时!尝试重新获取二维码! - 登录成功!(3秒后自动回到主页) - 未保存登录信息!(3秒后自动回到主页) - - - 复制封面图片 - 复制封面URL - 播放 - 弹幕 - 点赞 - 投币 - 收藏 - 分享 - 评论 - - 番剧 - 电影 - 纪录片 - 国创 - 电视剧 - 综艺 - 课程 - - 序号 - 名称 - 时长 - 音质 - 画质 - 视频编码 - - 搜索 - 搜索视频名称 - 全选 - 解析 - 解析视频 - 下载选中项 - - - 正在下载 - 已下载 - 下载完成 - - 按回车键应用设置 - - 基本 - 下载完成后的动作: - - 关闭程序 - 关闭计算机 - 监听剪贴板 - 视频自动解析 - 视频解析范围: - - 网络 - Aria服务器端口: - Aria日志等级: - Aria同时下载数: - Aria最大线程数: - Aria下载速度限制(KB/s) - 全局下载速度限制[0: 无限制] - 单任务下载速度限制[0: 无限制] - 使用Http代理 - 代理地址: - 端口: - Aria文件预分配: - - 视频 - 优先下载的视频编码: - 优先下载的视频画质: - 启用视频编号 - 勾选后,将为下载完成的视频的文件名添加上序号 - 下载FLV视频后转码为mp4 - 使用默认下载目录 - 默认下载目录: - 默认将文件下载到该文件夹中 - 更改目录 - 为不同视频分别创建文件夹 - 在下载视频的同时下载弹幕 - 在下载视频的同时下载封面 - - 弹幕 - 按类型屏蔽 - 顶部 - 底部 - 滚动 - 分辨率: - 字体名称: - 字体大小: - 限制行数: - 布局算法: - 速度同步 - 每一条滚动弹幕的移动速度都是相同的 - 速度异步 - 弹幕滚动速度取决于它的文本长度 - - 关于 - 访问主页 - 当前版本: - 检查更新 - 意见反馈 - 接收测试版更新 - 启动时检查更新 - 设置已更新~ - 设置失败! - 第三方 - 名称 - 作者 - 版本 - 许可证 - 免责申明 - 1. 本软件只提供视频解析,不提供任何资源上传、存储到服务器的功能。 - 2. 本软件仅解析来自B站的内容,不会对解析到的音视频进行二次编码,部分视频会进行有限的格式转换、拼接等操作。 - 3. 本软件解析得到的所有内容均来自B站UP主上传、分享,其版权均归原作者所有。内容提供者、上传者(UP主)应对其提供、上传的内容承担全部责任。 - 4. 本软件提供的所有资源,仅可用作学习交流使用,未经原作者授权,禁止用于其他用途。请在下载24小时内删除。为尊重作者版权,请前往资源的原始发布网站观看,支持原创,谢谢。 - 5. 任何涉及商业盈利目的均不得使用,否则产生的一切后果将由您自己承担。 - 6. 因使用本软件产生的版权问题,软件作者概不负责。 - - - B站助手 - 去水印 - 音视频分离 - - - 取消 - 请选择文件夹 - - - 设置下载文件夹 - 位置: - 浏览 - 盘剩余空间: - 设此文件夹为默认下载文件夹 - 选中后下次将不会弹出此窗口 - 下载 - - 文件夹路径不能为空 - - - 选择解析项 - - 解析选中项 - 解析当前页视频 - 解析所有视频 - 设为默认,下次不再弹出 - - \ No newline at end of file diff --git a/src/DownKyi/Languages/zh_CN.xaml b/src/DownKyi/Languages/zh_CN.xaml deleted file mode 100644 index fa20c7b..0000000 --- a/src/DownKyi/Languages/zh_CN.xaml +++ /dev/null @@ -1,176 +0,0 @@ - - - - 哔哩下载姬 - 未知 - - - 关闭 - 最大化 - 最小化 - 还原 - 皮肤 - - - 登录 - 请输入B站网址链接或av、BV号等…… - 请输入B站视频播放地址…… - 设置 - 下载管理 - 工具箱 - - - 扫描二维码登录 - 请使用哔哩哔哩客户端 扫码登录 或扫码下载APP - 获取登录链接失败! - 密钥错误!尝试重新获取! - 已超时!尝试重新获取二维码! - 登录成功!(3秒后自动回到主页) - 未保存登录信息!(3秒后自动回到主页) - - - 复制封面图片 - 复制封面URL - 播放 - 弹幕 - 点赞 - 投币 - 收藏 - 分享 - 评论 - - 番剧 - 电影 - 纪录片 - 国创 - 电视剧 - 综艺 - 课程 - - 序号 - 名称 - 时长 - 音质 - 画质 - 视频编码 - - 搜索 - 搜索视频名称 - 全选 - 解析 - 解析视频 - 下载选中项 - - - 正在下载 - 已下载 - 下载完成 - - 按回车键应用设置 - - 基本 - 下载完成后的动作: - - 关闭程序 - 关闭计算机 - 监听剪贴板 - 视频自动解析 - 视频解析范围: - - 网络 - Aria服务器端口: - Aria日志等级: - Aria同时下载数: - Aria最大线程数: - Aria下载速度限制(KB/s) - 全局下载速度限制[0: 无限制] - 单任务下载速度限制[0: 无限制] - 使用Http代理 - 代理地址: - 端口: - Aria文件预分配: - - 视频 - 优先下载的视频编码: - 优先下载的视频画质: - 启用视频编号 - 勾选后,将为下载完成的视频的文件名添加上序号 - 下载FLV视频后转码为mp4 - 使用默认下载目录 - 默认下载目录: - 默认将文件下载到该文件夹中 - 更改目录 - 为不同视频分别创建文件夹 - 在下载视频的同时下载弹幕 - 在下载视频的同时下载封面 - - 弹幕 - 按类型屏蔽 - 顶部 - 底部 - 滚动 - 分辨率: - 字体名称: - 字体大小: - 限制行数: - 布局算法: - 速度同步 - 每一条滚动弹幕的移动速度都是相同的 - 速度异步 - 弹幕滚动速度取决于它的文本长度 - - 关于 - 访问主页 - 当前版本: - 检查更新 - 意见反馈 - 接收测试版更新 - 启动时检查更新 - 设置已更新~ - 设置失败! - 第三方 - 名称 - 作者 - 版本 - 许可证 - 免责申明 - 1. 本软件只提供视频解析,不提供任何资源上传、存储到服务器的功能。 - 2. 本软件仅解析来自B站的内容,不会对解析到的音视频进行二次编码,部分视频会进行有限的格式转换、拼接等操作。 - 3. 本软件解析得到的所有内容均来自B站UP主上传、分享,其版权均归原作者所有。内容提供者、上传者(UP主)应对其提供、上传的内容承担全部责任。 - 4. 本软件提供的所有资源,仅可用作学习交流使用,未经原作者授权,禁止用于其他用途。请在下载24小时内删除。为尊重作者版权,请前往资源的原始发布网站观看,支持原创,谢谢。 - 5. 任何涉及商业盈利目的均不得使用,否则产生的一切后果将由您自己承担。 - 6. 因使用本软件产生的版权问题,软件作者概不负责。 - - - B站助手 - 去水印 - 音视频分离 - - - 取消 - 请选择文件夹 - - - 设置下载文件夹 - 位置: - 浏览 - 盘剩余空间: - 设此文件夹为默认下载文件夹 - 选中后下次将不会弹出此窗口 - 下载 - - 文件夹路径不能为空 - - - 选择解析项 - - 解析选中项 - 解析当前页视频 - 解析所有视频 - 设为默认,下次不再弹出 - - \ No newline at end of file diff --git a/src/DownKyi/Languages/zh_TW.xaml b/src/DownKyi/Languages/zh_TW.xaml deleted file mode 100644 index fa20c7b..0000000 --- a/src/DownKyi/Languages/zh_TW.xaml +++ /dev/null @@ -1,176 +0,0 @@ - - - - 哔哩下载姬 - 未知 - - - 关闭 - 最大化 - 最小化 - 还原 - 皮肤 - - - 登录 - 请输入B站网址链接或av、BV号等…… - 请输入B站视频播放地址…… - 设置 - 下载管理 - 工具箱 - - - 扫描二维码登录 - 请使用哔哩哔哩客户端 扫码登录 或扫码下载APP - 获取登录链接失败! - 密钥错误!尝试重新获取! - 已超时!尝试重新获取二维码! - 登录成功!(3秒后自动回到主页) - 未保存登录信息!(3秒后自动回到主页) - - - 复制封面图片 - 复制封面URL - 播放 - 弹幕 - 点赞 - 投币 - 收藏 - 分享 - 评论 - - 番剧 - 电影 - 纪录片 - 国创 - 电视剧 - 综艺 - 课程 - - 序号 - 名称 - 时长 - 音质 - 画质 - 视频编码 - - 搜索 - 搜索视频名称 - 全选 - 解析 - 解析视频 - 下载选中项 - - - 正在下载 - 已下载 - 下载完成 - - 按回车键应用设置 - - 基本 - 下载完成后的动作: - - 关闭程序 - 关闭计算机 - 监听剪贴板 - 视频自动解析 - 视频解析范围: - - 网络 - Aria服务器端口: - Aria日志等级: - Aria同时下载数: - Aria最大线程数: - Aria下载速度限制(KB/s) - 全局下载速度限制[0: 无限制] - 单任务下载速度限制[0: 无限制] - 使用Http代理 - 代理地址: - 端口: - Aria文件预分配: - - 视频 - 优先下载的视频编码: - 优先下载的视频画质: - 启用视频编号 - 勾选后,将为下载完成的视频的文件名添加上序号 - 下载FLV视频后转码为mp4 - 使用默认下载目录 - 默认下载目录: - 默认将文件下载到该文件夹中 - 更改目录 - 为不同视频分别创建文件夹 - 在下载视频的同时下载弹幕 - 在下载视频的同时下载封面 - - 弹幕 - 按类型屏蔽 - 顶部 - 底部 - 滚动 - 分辨率: - 字体名称: - 字体大小: - 限制行数: - 布局算法: - 速度同步 - 每一条滚动弹幕的移动速度都是相同的 - 速度异步 - 弹幕滚动速度取决于它的文本长度 - - 关于 - 访问主页 - 当前版本: - 检查更新 - 意见反馈 - 接收测试版更新 - 启动时检查更新 - 设置已更新~ - 设置失败! - 第三方 - 名称 - 作者 - 版本 - 许可证 - 免责申明 - 1. 本软件只提供视频解析,不提供任何资源上传、存储到服务器的功能。 - 2. 本软件仅解析来自B站的内容,不会对解析到的音视频进行二次编码,部分视频会进行有限的格式转换、拼接等操作。 - 3. 本软件解析得到的所有内容均来自B站UP主上传、分享,其版权均归原作者所有。内容提供者、上传者(UP主)应对其提供、上传的内容承担全部责任。 - 4. 本软件提供的所有资源,仅可用作学习交流使用,未经原作者授权,禁止用于其他用途。请在下载24小时内删除。为尊重作者版权,请前往资源的原始发布网站观看,支持原创,谢谢。 - 5. 任何涉及商业盈利目的均不得使用,否则产生的一切后果将由您自己承担。 - 6. 因使用本软件产生的版权问题,软件作者概不负责。 - - - B站助手 - 去水印 - 音视频分离 - - - 取消 - 请选择文件夹 - - - 设置下载文件夹 - 位置: - 浏览 - 盘剩余空间: - 设此文件夹为默认下载文件夹 - 选中后下次将不会弹出此窗口 - 下载 - - 文件夹路径不能为空 - - - 选择解析项 - - 解析选中项 - 解析当前页视频 - 解析所有视频 - 设为默认,下次不再弹出 - - \ No newline at end of file diff --git a/src/DownKyi/Models/AppInfo.cs b/src/DownKyi/Models/AppInfo.cs deleted file mode 100644 index 1f5bf46..0000000 --- a/src/DownKyi/Models/AppInfo.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Text.RegularExpressions; - -namespace DownKyi.Models -{ - public class AppInfo - { - public string Name { get; } = "哔哩下载姬"; - public int VersionCode { get; } - public string VersionName { get; } - - const int a = 1; - const int b = 6; - const int c = 1; - - public AppInfo() - { - VersionCode = a * 10000 + b * 100 + c; - -#if DEBUG - VersionName = $"{a}.{b}.{c}-debug"; -#else - VersionName = $"{a}.{b}.{c}"; -#endif - } - - public static int VersionNameToCode(string versionName) - { - int code = 0; - - var isMatch = Regex.IsMatch(versionName, @"^v?([1-9]\d|\d).([1-9]\d|\d).([1-9]\d|\d)$"); - if (!isMatch) - { - return 0; - } - - string pattern = @"([1-9]\d|\d)"; - var m = Regex.Matches(versionName, pattern); - if (m.Count == 3) - { - int i = 2; - foreach (var item in m) - { - code += int.Parse(item.ToString()) * (int)Math.Pow(100, i); - i--; - } - } - - return code; - } - - } -} diff --git a/src/DownKyi/Models/DownloadBase.cs b/src/DownKyi/Models/DownloadBase.cs deleted file mode 100644 index 51b221e..0000000 --- a/src/DownKyi/Models/DownloadBase.cs +++ /dev/null @@ -1,75 +0,0 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using System; -using System.Collections.Generic; - -namespace DownKyi.Models -{ - [Serializable] - public class DownloadBase - { - public DownloadBase() - { - // 唯一id - Uuid = Guid.NewGuid().ToString("N"); - - // 初始化需要下载的内容 - NeedDownloadContent = new Dictionary - { - { "downloadAudio", true }, - { "downloadVideo", true }, - { "downloadDanmaku", true }, - { "downloadSubtitle", true }, - { "downloadCover", true } - }; - } - - // 此条下载项的id - public string Uuid { get; } - - // 需要下载的内容 - public Dictionary NeedDownloadContent { get; set; } - - // 视频的id - public string Bvid { get; set; } - public long Avid { get; set; } - public long Cid { get; set; } - public long EpisodeId { get; set; } - - // 视频封面的url - public string CoverUrl { get; set; } - - // 视频page的封面的url - public string PageCoverUrl { get; set; } - - // 分区id - public int ZoneId { get; set; } - - // 视频序号 - public int Order { get; set; } - - // 视频主标题 - public string MainTitle { get; set; } - - // 视频标题 - public string Name { get; set; } - - // 时长 - public string Duration { get; set; } - - // 视频编码名称,AVC、HEVC - public string VideoCodecName { get; set; } - - // 视频画质 - public Quality Resolution { get; set; } - - // 音频编码 - public Quality AudioCodec { get; set; } - - // 文件路径,不包含扩展名,所有内容均以此路径下载 - public string FilePath { get; set; } - - // 文件大小 - public string FileSize { get; set; } - - } -} diff --git a/src/DownKyi/Models/DownloadStatus.cs b/src/DownKyi/Models/DownloadStatus.cs deleted file mode 100644 index a9a0753..0000000 --- a/src/DownKyi/Models/DownloadStatus.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace DownKyi.Models -{ - public enum DownloadStatus - { - NOT_STARTED, // 未开始,从未开始下载 - WAIT_FOR_DOWNLOAD, // 等待下载,下载过,但是启动本次下载周期未开始,如重启程序后未开始 - PAUSE_STARTED, // 暂停启动下载 - PAUSE, // 暂停 - //PAUSE_TO_WAIT, // 暂停后等待 - DOWNLOADING, // 下载中 - DOWNLOAD_SUCCEED, // 下载成功 - DOWNLOAD_FAILED, // 下载失败 - } -} diff --git a/src/DownKyi/Models/Downloaded.cs b/src/DownKyi/Models/Downloaded.cs deleted file mode 100644 index 4c31142..0000000 --- a/src/DownKyi/Models/Downloaded.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; - -namespace DownKyi.Models -{ - [Serializable] - public class Downloaded// : DownloadBase - { - public Downloaded() : base() - { - } - - // 下载速度 - public string MaxSpeedDisplay { get; set; } - - // 完成时间戳 - public long FinishedTimestamp { get; set; } - public void SetFinishedTimestamp(long finishedTimestamp) - { - FinishedTimestamp = finishedTimestamp; - - DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 - DateTime dateTime = startTime.AddSeconds(finishedTimestamp); - FinishedTime = dateTime.ToString("yyyy-MM-dd HH:mm:ss"); - } - - // 完成时间 - public string FinishedTime { get; set; } - - } -} diff --git a/src/DownKyi/Models/Downloading.cs b/src/DownKyi/Models/Downloading.cs deleted file mode 100644 index 09fffdd..0000000 --- a/src/DownKyi/Models/Downloading.cs +++ /dev/null @@ -1,51 +0,0 @@ -using DownKyi.Core.BiliApi.VideoStream; -using System; -using System.Collections.Generic; - -namespace DownKyi.Models -{ - [Serializable] - public class Downloading// : DownloadBase - { - public Downloading() : base() - { - // 初始化下载的文件列表 - DownloadFiles = new Dictionary(); - DownloadedFiles = new List(); - } - - // Aria相关 - public string Gid { get; set; } - - // 下载的文件 - public Dictionary DownloadFiles { get; set; } - - // 已下载的文件 - public List DownloadedFiles { get; set; } - - // 视频类别 - public PlayStreamType PlayStreamType { get; set; } - - // 下载状态 - public DownloadStatus DownloadStatus { get; set; } - - // 正在下载内容(音频、视频、弹幕、字幕、封面) - public string DownloadContent { get; set; } - - // 下载状态显示 - public string DownloadStatusTitle { get; set; } - - // 下载进度 - public float Progress { get; set; } - - // 已下载大小/文件大小 - public string DownloadingFileSize { get; set; } - - // 下载的最高速度 - public long MaxSpeed { get; set; } - - // 下载速度 - public string SpeedDisplay { get; set; } - - } -} diff --git a/src/DownKyi/Models/OrderFormatDisplay.cs b/src/DownKyi/Models/OrderFormatDisplay.cs deleted file mode 100644 index 5e2a1a3..0000000 --- a/src/DownKyi/Models/OrderFormatDisplay.cs +++ /dev/null @@ -1,10 +0,0 @@ -using DownKyi.Core.Settings; - -namespace DownKyi.Models -{ - public class OrderFormatDisplay - { - public string Name { get; set; } - public OrderFormat OrderFormat { get; set; } - } -} diff --git a/src/DownKyi/Models/ParseScopeDisplay.cs b/src/DownKyi/Models/ParseScopeDisplay.cs deleted file mode 100644 index f7b81d5..0000000 --- a/src/DownKyi/Models/ParseScopeDisplay.cs +++ /dev/null @@ -1,10 +0,0 @@ -using DownKyi.Core.Settings; - -namespace DownKyi.Models -{ - public class ParseScopeDisplay - { - public string Name { get; set; } - public ParseScope ParseScope { get; set; } - } -} diff --git a/src/DownKyi/Properties/AssemblyInfo.cs b/src/DownKyi/Properties/AssemblyInfo.cs deleted file mode 100644 index 058fa91..0000000 --- a/src/DownKyi/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("DownKyi")] -[assembly: AssemblyDescription("DownKyi")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("DownKyi")] -[assembly: AssemblyProduct("DownKyi")] -[assembly: AssemblyCopyright("Copyright © Downkyi 2020-2023")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.6.1.0")] -[assembly: AssemblyFileVersion("1.6.1.0")] diff --git a/src/DownKyi/Properties/Resources.Designer.cs b/src/DownKyi/Properties/Resources.Designer.cs deleted file mode 100644 index fe85cfb..0000000 --- a/src/DownKyi/Properties/Resources.Designer.cs +++ /dev/null @@ -1,73 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 此代码由工具生成。 -// 运行时版本:4.0.30319.42000 -// -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 -// -//------------------------------------------------------------------------------ - -namespace DownKyi.Properties { - using System; - - - /// - /// 一个强类型的资源类,用于查找本地化的字符串等。 - /// - // 此类是由 StronglyTypedResourceBuilder - // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 - // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen - // (以 /str 作为命令选项),或重新生成 VS 项目。 - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// 返回此类使用的缓存的 ResourceManager 实例。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DownKyi.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// 重写当前线程的 CurrentUICulture 属性,对 - /// 使用此强类型资源类的所有资源查找执行重写。 - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// - internal static System.Drawing.Bitmap loading { - get { - object obj = ResourceManager.GetObject("loading", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - } -} diff --git a/src/DownKyi/Properties/Resources.resx b/src/DownKyi/Properties/Resources.resx deleted file mode 100644 index 34f9a23..0000000 --- a/src/DownKyi/Properties/Resources.resx +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - ..\resources\loading\loading.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - \ No newline at end of file diff --git a/src/DownKyi/Properties/Settings.Designer.cs b/src/DownKyi/Properties/Settings.Designer.cs deleted file mode 100644 index 8f48214..0000000 --- a/src/DownKyi/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace DownKyi.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/src/DownKyi/Properties/Settings.settings b/src/DownKyi/Properties/Settings.settings deleted file mode 100644 index 033d7a5..0000000 --- a/src/DownKyi/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/DownKyi/Resources/backgound/9-绿荫秘境.png b/src/DownKyi/Resources/backgound/9-绿荫秘境.png deleted file mode 100644 index dcc5c10..0000000 Binary files a/src/DownKyi/Resources/backgound/9-绿荫秘境.png and /dev/null differ diff --git a/src/DownKyi/Resources/channel.png b/src/DownKyi/Resources/channel.png deleted file mode 100644 index 9f532cb..0000000 Binary files a/src/DownKyi/Resources/channel.png and /dev/null differ diff --git a/src/DownKyi/Resources/checked.png b/src/DownKyi/Resources/checked.png deleted file mode 100644 index d011e83..0000000 Binary files a/src/DownKyi/Resources/checked.png and /dev/null differ diff --git a/src/DownKyi/Resources/default_header.jpg b/src/DownKyi/Resources/default_header.jpg deleted file mode 100644 index 5e5ea0b..0000000 Binary files a/src/DownKyi/Resources/default_header.jpg and /dev/null differ diff --git a/src/DownKyi/Resources/favicon.ico b/src/DownKyi/Resources/favicon.ico deleted file mode 100644 index 0145cb9..0000000 Binary files a/src/DownKyi/Resources/favicon.ico and /dev/null differ diff --git a/src/DownKyi/Resources/level/lv0.png b/src/DownKyi/Resources/level/lv0.png deleted file mode 100644 index e7a5ae1..0000000 Binary files a/src/DownKyi/Resources/level/lv0.png and /dev/null differ diff --git a/src/DownKyi/Resources/level/lv1.png b/src/DownKyi/Resources/level/lv1.png deleted file mode 100644 index 510b9b2..0000000 Binary files a/src/DownKyi/Resources/level/lv1.png and /dev/null differ diff --git a/src/DownKyi/Resources/level/lv2.png b/src/DownKyi/Resources/level/lv2.png deleted file mode 100644 index bf66798..0000000 Binary files a/src/DownKyi/Resources/level/lv2.png and /dev/null differ diff --git a/src/DownKyi/Resources/level/lv3.png b/src/DownKyi/Resources/level/lv3.png deleted file mode 100644 index f08ca24..0000000 Binary files a/src/DownKyi/Resources/level/lv3.png and /dev/null differ diff --git a/src/DownKyi/Resources/level/lv4.png b/src/DownKyi/Resources/level/lv4.png deleted file mode 100644 index 1e09484..0000000 Binary files a/src/DownKyi/Resources/level/lv4.png and /dev/null differ diff --git a/src/DownKyi/Resources/level/lv5.png b/src/DownKyi/Resources/level/lv5.png deleted file mode 100644 index 8276e09..0000000 Binary files a/src/DownKyi/Resources/level/lv5.png and /dev/null differ diff --git a/src/DownKyi/Resources/level/lv6.png b/src/DownKyi/Resources/level/lv6.png deleted file mode 100644 index f2e6645..0000000 Binary files a/src/DownKyi/Resources/level/lv6.png and /dev/null differ diff --git a/src/DownKyi/Resources/level/lv7.png b/src/DownKyi/Resources/level/lv7.png deleted file mode 100644 index 224ff01..0000000 Binary files a/src/DownKyi/Resources/level/lv7.png and /dev/null differ diff --git a/src/DownKyi/Resources/level/lv8.png b/src/DownKyi/Resources/level/lv8.png deleted file mode 100644 index 9eca702..0000000 Binary files a/src/DownKyi/Resources/level/lv8.png and /dev/null differ diff --git a/src/DownKyi/Resources/level/lv9.png b/src/DownKyi/Resources/level/lv9.png deleted file mode 100644 index 8aac354..0000000 Binary files a/src/DownKyi/Resources/level/lv9.png and /dev/null differ diff --git a/src/DownKyi/Resources/loading/loading.gif b/src/DownKyi/Resources/loading/loading.gif deleted file mode 100644 index 31f8504..0000000 Binary files a/src/DownKyi/Resources/loading/loading.gif and /dev/null differ diff --git a/src/DownKyi/Resources/login/login_top_bar.png b/src/DownKyi/Resources/login/login_top_bar.png deleted file mode 100644 index 68dc5d3..0000000 Binary files a/src/DownKyi/Resources/login/login_top_bar.png and /dev/null differ diff --git a/src/DownKyi/Resources/login/qrcode_login_2233.png b/src/DownKyi/Resources/login/qrcode_login_2233.png deleted file mode 100644 index 3d9ff56..0000000 Binary files a/src/DownKyi/Resources/login/qrcode_login_2233.png and /dev/null differ diff --git a/src/DownKyi/Resources/login/qrcode_login_tip.png b/src/DownKyi/Resources/login/qrcode_login_tip.png deleted file mode 100644 index 177018b..0000000 Binary files a/src/DownKyi/Resources/login/qrcode_login_tip.png and /dev/null differ diff --git a/src/DownKyi/Resources/login/scan_succeed.png b/src/DownKyi/Resources/login/scan_succeed.png deleted file mode 100644 index 2e3f72e..0000000 Binary files a/src/DownKyi/Resources/login/scan_succeed.png and /dev/null differ diff --git a/src/DownKyi/Resources/no-data.png b/src/DownKyi/Resources/no-data.png deleted file mode 100644 index 7f1b5c4..0000000 Binary files a/src/DownKyi/Resources/no-data.png and /dev/null differ diff --git a/src/DownKyi/Resources/nodata02.png b/src/DownKyi/Resources/nodata02.png deleted file mode 100644 index 301f3df..0000000 Binary files a/src/DownKyi/Resources/nodata02.png and /dev/null differ diff --git a/src/DownKyi/Resources/play.png b/src/DownKyi/Resources/play.png deleted file mode 100644 index 6377dca..0000000 Binary files a/src/DownKyi/Resources/play.png and /dev/null differ diff --git a/src/DownKyi/Resources/sex/female.png b/src/DownKyi/Resources/sex/female.png deleted file mode 100644 index abffaa5..0000000 Binary files a/src/DownKyi/Resources/sex/female.png and /dev/null differ diff --git a/src/DownKyi/Resources/sex/male.png b/src/DownKyi/Resources/sex/male.png deleted file mode 100644 index 3c3044c..0000000 Binary files a/src/DownKyi/Resources/sex/male.png and /dev/null differ diff --git a/src/DownKyi/Resources/time.png b/src/DownKyi/Resources/time.png deleted file mode 100644 index 25c18ed..0000000 Binary files a/src/DownKyi/Resources/time.png and /dev/null differ diff --git a/src/DownKyi/Resources/video-placeholder.png b/src/DownKyi/Resources/video-placeholder.png deleted file mode 100644 index 157a110..0000000 Binary files a/src/DownKyi/Resources/video-placeholder.png and /dev/null differ diff --git a/src/DownKyi/Services/AlertService.cs b/src/DownKyi/Services/AlertService.cs deleted file mode 100644 index 72d0021..0000000 --- a/src/DownKyi/Services/AlertService.cs +++ /dev/null @@ -1,83 +0,0 @@ -using DownKyi.Images; -using DownKyi.Utils; -using DownKyi.ViewModels.Dialogs; -using Prism.Services.Dialogs; - -namespace DownKyi.Services -{ - public class AlertService - { - private readonly IDialogService dialogService; - - public AlertService(IDialogService dialogService) - { - this.dialogService = dialogService; - } - - /// - /// 显示一个信息弹窗 - /// - /// - /// - /// - public ButtonResult ShowInfo(string message, int buttonNumber = 2) - { - VectorImage image = SystemIcon.Instance().Info; - string title = DictionaryResource.GetString("Info"); - return ShowMessage(image, title, message, buttonNumber); - } - - /// - /// 显示一个警告弹窗 - /// - /// - /// - /// - public ButtonResult ShowWarning(string message, int buttonNumber = 1) - { - VectorImage image = SystemIcon.Instance().Warning; - string title = DictionaryResource.GetString("Warning"); - return ShowMessage(image, title, message, buttonNumber); - } - - /// - /// 显示一个错误弹窗 - /// - /// - /// - public ButtonResult ShowError(string message) - { - VectorImage image = SystemIcon.Instance().Error; - string title = DictionaryResource.GetString("Error"); - return ShowMessage(image, title, message, 1); - } - - public ButtonResult ShowMessage(VectorImage image, string type, string message, int buttonNumber) - { - ButtonResult result = ButtonResult.None; - if (dialogService == null) - { - return result; - } - - DialogParameters param = new DialogParameters - { - { "image", image }, - { "title", type }, - { "message", message }, - { "button_number", buttonNumber } - }; - - App.PropertyChangeAsync(() => - { - dialogService.ShowDialog(ViewAlertDialogViewModel.Tag, param, buttonResult => - { - result = buttonResult.Result; - }); - }); - - return result; - } - - } -} diff --git a/src/DownKyi/Services/BangumiInfoService.cs b/src/DownKyi/Services/BangumiInfoService.cs deleted file mode 100644 index 69f1c6d..0000000 --- a/src/DownKyi/Services/BangumiInfoService.cs +++ /dev/null @@ -1,310 +0,0 @@ -using DownKyi.Core.BiliApi.Bangumi; -using DownKyi.Core.BiliApi.Bangumi.Models; -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Core.BiliApi.VideoStream; -using DownKyi.Core.BiliApi.VideoStream.Models; -using DownKyi.Core.Settings; -using DownKyi.Core.Storage; -using DownKyi.Core.Utils; -using DownKyi.Utils; -using DownKyi.ViewModels.PageViewModels; -using System; -using System.Collections.Generic; -using System.Text.RegularExpressions; -using System.Windows.Media.Imaging; - -namespace DownKyi.Services -{ - public class BangumiInfoService : IInfoService - { - private readonly BangumiSeason bangumiSeason; - - public BangumiInfoService(string input) - { - if (input == null) - { - return; - } - - if (ParseEntrance.IsBangumiSeasonId(input) || ParseEntrance.IsBangumiSeasonUrl(input)) - { - long seasonId = ParseEntrance.GetBangumiSeasonId(input); - bangumiSeason = BangumiInfo.BangumiSeasonInfo(seasonId); - } - - if (ParseEntrance.IsBangumiEpisodeId(input) || ParseEntrance.IsBangumiEpisodeUrl(input)) - { - long episodeId = ParseEntrance.GetBangumiEpisodeId(input); - bangumiSeason = BangumiInfo.BangumiSeasonInfo(-1, episodeId); - } - - if (ParseEntrance.IsBangumiMediaId(input) || ParseEntrance.IsBangumiMediaUrl(input)) - { - long mediaId = ParseEntrance.GetBangumiMediaId(input); - BangumiMedia bangumiMedia = BangumiInfo.BangumiMediaInfo(mediaId); - bangumiSeason = BangumiInfo.BangumiSeasonInfo(bangumiMedia.SeasonId); - } - } - - /// - /// 获取视频剧集 - /// - /// - public List GetVideoPages() - { - List pages = new List(); - if (bangumiSeason == null) { return pages; } - if (bangumiSeason.Episodes == null) { return pages; } - if (bangumiSeason.Episodes.Count == 0) { return pages; } - - int order = 0; - foreach (BangumiEpisode episode in bangumiSeason.Episodes) - { - order++; - - // 标题 - string name; - - // 判断title是否为数字,如果是,则将share_copy作为name,否则将title作为name - //if (int.TryParse(episode.Title, out int result)) - //{ - // name = Regex.Replace(episode.ShareCopy, @"《.*?》", ""); - // //name = episode.ShareCopy; - //} - //else - //{ - // if (episode.LongTitle != null && episode.LongTitle != "") - // { - // name = $"{episode.Title} {episode.LongTitle}"; - // } - // else - // { - // name = episode.Title; - // } - //} - - // 将share_copy作为name,删除《》中的标题 - name = Regex.Replace(episode.ShareCopy, @"^《.*?》", ""); - - // 删除前后空白符 - name = name.Trim(); - - VideoPage page = new VideoPage - { - Avid = episode.Aid, - Bvid = episode.Bvid, - Cid = episode.Cid, - EpisodeId = -1, - FirstFrame = episode.Cover, - Order = order, - Name = name, - Duration = "N/A" - }; - - // UP主信息 - if (bangumiSeason.UpInfo != null) - { - page.Owner = new Core.BiliApi.Models.VideoOwner - { - Name = bangumiSeason.UpInfo.Name, - Face = bangumiSeason.UpInfo.Avatar, - Mid = bangumiSeason.UpInfo.Mid, - }; - } - else - { - page.Owner = new Core.BiliApi.Models.VideoOwner - { - Name = "", - Face = "", - Mid = -1, - }; - } - - // 文件命名中的时间格式 - string timeFormat = SettingsManager.GetInstance().GetFileNamePartTimeFormat(); - // 视频发布时间 - DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 - DateTime dateTime = startTime.AddSeconds(episode.PubTime); - page.PublishTime = dateTime.ToString(timeFormat); - - pages.Add(page); - } - - return pages; - } - - /// - /// 获取视频章节与剧集 - /// - /// - public List GetVideoSections(bool noUgc = false) - { - if (bangumiSeason == null) { return null; } - - List videoSections = new List - { - new VideoSection - { - Id = bangumiSeason.Positive.Id, - Title = bangumiSeason.Positive.Title, - IsSelected = true, - VideoPages = GetVideoPages() - } - }; - - // 不需要其他季或花絮内容 - if (noUgc) - { - return videoSections; - } - - if (bangumiSeason.Section == null) { return null; } - if (bangumiSeason.Section.Count == 0) { return null; } - - foreach (BangumiSection section in bangumiSeason.Section) - { - List pages = new List(); - int order = 0; - foreach (BangumiEpisode episode in section.Episodes) - { - order++; - - // 标题 - string name = episode.LongTitle != null && episode.LongTitle != "" ? $"{episode.Title} {episode.LongTitle}" : episode.Title; - VideoPage page = new VideoPage - { - Avid = episode.Aid, - Bvid = episode.Bvid, - Cid = episode.Cid, - EpisodeId = -1, - FirstFrame = episode.Cover, - Order = order, - Name = name, - Duration = "N/A" - }; - - // UP主信息 - if (bangumiSeason.UpInfo != null) - { - page.Owner = new Core.BiliApi.Models.VideoOwner - { - Name = bangumiSeason.UpInfo.Name, - Face = bangumiSeason.UpInfo.Avatar, - Mid = bangumiSeason.UpInfo.Mid, - }; - } - else - { - page.Owner = new Core.BiliApi.Models.VideoOwner - { - Name = "", - Face = "", - Mid = -1, - }; - } - - // 文件命名中的时间格式 - string timeFormat = SettingsManager.GetInstance().GetFileNamePartTimeFormat(); - // 视频发布时间 - DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 - DateTime dateTime = startTime.AddSeconds(episode.PubTime); - page.PublishTime = dateTime.ToString(timeFormat); - - pages.Add(page); - } - - VideoSection videoSection = new VideoSection - { - Id = section.Id, - Title = section.Title, - VideoPages = pages - }; - videoSections.Add(videoSection); - } - - return videoSections; - } - - /// - /// 获取视频流的信息,从VideoPage返回 - /// - /// - public void GetVideoStream(VideoPage page) - { - PlayUrl playUrl = VideoStream.GetBangumiPlayUrl(page.Avid, page.Bvid, page.Cid); - Utils.VideoPageInfo(playUrl, page); - } - - /// - /// 获取视频信息 - /// - /// - public VideoInfoView GetVideoView() - { - if (bangumiSeason == null) { return null; } - - // 查询、保存封面 - // 将SeasonId保存到avid字段中 - // 每集封面的cid保存到cid字段,EpisodeId保存到bvid字段中 - StorageCover storageCover = new StorageCover(); - string coverUrl = bangumiSeason.Cover; - string cover = storageCover.GetCover(bangumiSeason.SeasonId, "bangumi", -1, coverUrl); - - // 获取用户头像 - string upName; - string header; - if (bangumiSeason.UpInfo != null) - { - upName = bangumiSeason.UpInfo.Name; - - StorageHeader storageHeader = new StorageHeader(); - header = storageHeader.GetHeader(bangumiSeason.UpInfo.Mid, bangumiSeason.UpInfo.Name, bangumiSeason.UpInfo.Avatar); - } - else - { - upName = ""; - header = null; - } - - // 为videoInfoView赋值 - VideoInfoView videoInfoView = new VideoInfoView(); - App.PropertyChangeAsync(new Action(() => - { - videoInfoView.CoverUrl = coverUrl; - - videoInfoView.Cover = cover == null ? null : new BitmapImage(new Uri(cover)); - videoInfoView.Title = bangumiSeason.Title; - - // 分区id - videoInfoView.TypeId = BangumiType.TypeId[bangumiSeason.Type]; - - videoInfoView.VideoZone = DictionaryResource.GetString(BangumiType.Type[bangumiSeason.Type]); - - videoInfoView.PlayNumber = Format.FormatNumber(bangumiSeason.Stat.Views); - videoInfoView.DanmakuNumber = Format.FormatNumber(bangumiSeason.Stat.Danmakus); - videoInfoView.LikeNumber = Format.FormatNumber(bangumiSeason.Stat.Likes); - videoInfoView.CoinNumber = Format.FormatNumber(bangumiSeason.Stat.Coins); - videoInfoView.FavoriteNumber = Format.FormatNumber(bangumiSeason.Stat.Favorites); - videoInfoView.ShareNumber = Format.FormatNumber(bangumiSeason.Stat.Share); - videoInfoView.ReplyNumber = Format.FormatNumber(bangumiSeason.Stat.Reply); - videoInfoView.Description = bangumiSeason.Evaluate; - - videoInfoView.UpName = upName; - if (header != null) - { - StorageHeader storageHeader = new StorageHeader(); - videoInfoView.UpHeader = storageHeader.GetHeaderThumbnail(header, 48, 48); - - videoInfoView.UpperMid = bangumiSeason.UpInfo.Mid; - } - else - { - videoInfoView.UpHeader = null; - } - })); - - return videoInfoView; - } - } -} diff --git a/src/DownKyi/Services/CheeseInfoService.cs b/src/DownKyi/Services/CheeseInfoService.cs deleted file mode 100644 index 62b5520..0000000 --- a/src/DownKyi/Services/CheeseInfoService.cs +++ /dev/null @@ -1,196 +0,0 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Core.BiliApi.Cheese; -using DownKyi.Core.BiliApi.Cheese.Models; -using DownKyi.Core.BiliApi.VideoStream; -using DownKyi.Core.BiliApi.VideoStream.Models; -using DownKyi.Core.Settings; -using DownKyi.Core.Storage; -using DownKyi.Core.Utils; -using DownKyi.Utils; -using DownKyi.ViewModels.PageViewModels; -using System; -using System.Collections.Generic; -using System.Windows.Media.Imaging; - -namespace DownKyi.Services -{ - public class CheeseInfoService : IInfoService - { - private readonly CheeseView cheeseView; - - public CheeseInfoService(string input) - { - if (input == null) - { - return; - } - - if (ParseEntrance.IsCheeseSeasonUrl(input)) - { - long seasonId = ParseEntrance.GetCheeseSeasonId(input); - cheeseView = CheeseInfo.CheeseViewInfo(seasonId); - } - - if (ParseEntrance.IsCheeseEpisodeUrl(input)) - { - long episodeId = ParseEntrance.GetCheeseEpisodeId(input); - cheeseView = CheeseInfo.CheeseViewInfo(-1, episodeId); - } - } - - /// - /// 获取视频剧集 - /// - /// - public List GetVideoPages() - { - List pages = new List(); - if (cheeseView == null) { return pages; } - if (cheeseView.Episodes == null) { return pages; } - if (cheeseView.Episodes.Count == 0) { return pages; } - - int order = 0; - foreach (CheeseEpisode episode in cheeseView.Episodes) - { - order++; - string name = episode.Title; - - string duration = Format.FormatDuration(episode.Duration - 1); - - VideoPage page = new VideoPage - { - Avid = episode.Aid, - Bvid = null, - Cid = episode.Cid, - EpisodeId = episode.Id, - FirstFrame = episode.Cover, - Order = order, - Name = name, - Duration = "N/A" - }; - - // UP主信息 - if (cheeseView.UpInfo != null) - { - page.Owner = new Core.BiliApi.Models.VideoOwner - { - Name = cheeseView.UpInfo.Name, - Face = cheeseView.UpInfo.Avatar, - Mid = cheeseView.UpInfo.Mid, - }; - } - else - { - page.Owner = new Core.BiliApi.Models.VideoOwner - { - Name = "", - Face = "", - Mid = -1, - }; - } - - // 文件命名中的时间格式 - string timeFormat = SettingsManager.GetInstance().GetFileNamePartTimeFormat(); - // 视频发布时间 - DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 - DateTime dateTime = startTime.AddSeconds(episode.ReleaseDate); - page.PublishTime = dateTime.ToString(timeFormat); - - pages.Add(page); - } - - return pages; - } - - /// - /// 获取视频章节与剧集 - /// - /// - public List GetVideoSections(bool noUgc = false) - { - return null; - } - - /// - /// 获取视频流的信息,从VideoPage返回 - /// - /// - public void GetVideoStream(VideoPage page) - { - PlayUrl playUrl = VideoStream.GetCheesePlayUrl(page.Avid, page.Bvid, page.Cid, page.EpisodeId); - Utils.VideoPageInfo(playUrl, page); - } - - /// - /// 获取视频信息 - /// - /// - public VideoInfoView GetVideoView() - { - if (cheeseView == null) { return null; } - - // 查询、保存封面 - // 将SeasonId保存到avid字段中 - // 每集封面的cid保存到cid字段,EpisodeId保存到bvid字段中 - StorageCover storageCover = new StorageCover(); - string coverUrl = cheeseView.Cover; - string cover = storageCover.GetCover(cheeseView.SeasonId, "cheese", -1, coverUrl); - - // 获取用户头像 - string upName; - string header; - if (cheeseView.UpInfo != null) - { - upName = cheeseView.UpInfo.Name; - StorageHeader storageHeader = new StorageHeader(); - header = storageHeader.GetHeader(cheeseView.UpInfo.Mid, cheeseView.UpInfo.Name, cheeseView.UpInfo.Avatar); - } - else - { - upName = ""; - header = null; - } - - // 为videoInfoView赋值 - VideoInfoView videoInfoView = new VideoInfoView(); - App.PropertyChangeAsync(new Action(() => - { - videoInfoView.CoverUrl = coverUrl; - - videoInfoView.Cover = cover == null ? null : new BitmapImage(new Uri(cover)); - videoInfoView.Title = cheeseView.Title; - - // 分区id - // 课堂的type id B站没有定义,这里自定义为-10 - videoInfoView.TypeId = -10; - - videoInfoView.VideoZone = DictionaryResource.GetString("Cheese"); - videoInfoView.CreateTime = ""; - - videoInfoView.PlayNumber = Format.FormatNumber(cheeseView.Stat.Play); - videoInfoView.DanmakuNumber = Format.FormatNumber(0); - videoInfoView.LikeNumber = Format.FormatNumber(0); - videoInfoView.CoinNumber = Format.FormatNumber(0); - videoInfoView.FavoriteNumber = Format.FormatNumber(0); - videoInfoView.ShareNumber = Format.FormatNumber(0); - videoInfoView.ReplyNumber = Format.FormatNumber(0); - videoInfoView.Description = cheeseView.Subtitle; - - videoInfoView.UpName = upName; - if (header != null) - { - StorageHeader storageHeader = new StorageHeader(); - videoInfoView.UpHeader = storageHeader.GetHeaderThumbnail(header, 48, 48); - - videoInfoView.UpperMid = cheeseView.UpInfo.Mid; - } - else - { - videoInfoView.UpHeader = null; - } - })); - - return videoInfoView; - } - } -} diff --git a/src/DownKyi/Services/Download/AddToDownloadService.cs b/src/DownKyi/Services/Download/AddToDownloadService.cs deleted file mode 100644 index 8133af9..0000000 --- a/src/DownKyi/Services/Download/AddToDownloadService.cs +++ /dev/null @@ -1,452 +0,0 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Core.BiliApi.VideoStream; -using DownKyi.Core.BiliApi.Zone; -using DownKyi.Core.FileName; -using DownKyi.Core.Logging; -using DownKyi.Core.Settings; -using DownKyi.Core.Settings.Models; -using DownKyi.Core.Utils; -using DownKyi.Events; -using DownKyi.Models; -using DownKyi.Utils; -using DownKyi.ViewModels.Dialogs; -using DownKyi.ViewModels.DownloadManager; -using DownKyi.ViewModels.PageViewModels; -using Prism.Events; -using Prism.Services.Dialogs; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading; - -namespace DownKyi.Services.Download -{ - /// - /// 添加到下载列表服务 - /// - public class AddToDownloadService - { - private readonly string Tag = "AddToDownloadService"; - private IInfoService videoInfoService; - private VideoInfoView videoInfoView; - private List videoSections; - - // 下载内容 - private bool downloadAudio = true; - private bool downloadVideo = true; - private bool downloadDanmaku = true; - private bool downloadSubtitle = true; - private bool downloadCover = true; - - /// - /// 添加下载 - /// - /// - public AddToDownloadService(PlayStreamType streamType) - { - switch (streamType) - { - case PlayStreamType.VIDEO: - videoInfoService = new VideoInfoService(null); - break; - case PlayStreamType.BANGUMI: - videoInfoService = new BangumiInfoService(null); - break; - case PlayStreamType.CHEESE: - videoInfoService = new CheeseInfoService(null); - break; - default: - break; - } - } - - /// - /// 添加下载 - /// - /// - /// - public AddToDownloadService(string id, PlayStreamType streamType) - { - switch (streamType) - { - case PlayStreamType.VIDEO: - videoInfoService = new VideoInfoService(id); - break; - case PlayStreamType.BANGUMI: - videoInfoService = new BangumiInfoService(id); - break; - case PlayStreamType.CHEESE: - videoInfoService = new CheeseInfoService(id); - break; - default: - break; - } - } - - public void SetVideoInfoService(IInfoService videoInfoService) - { - this.videoInfoService = videoInfoService; - } - - public void GetVideo(VideoInfoView videoInfoView, List videoSections) - { - this.videoInfoView = videoInfoView; - this.videoSections = videoSections; - } - - public void GetVideo() - { - videoInfoView = videoInfoService.GetVideoView(); - if (videoInfoView == null) - { - LogManager.Debug(Tag, "VideoInfoView is null."); - return; - } - - videoSections = videoInfoService.GetVideoSections(true); - if (videoSections == null) - { - LogManager.Debug(Tag, "videoSections is not exist."); - - videoSections = new List - { - new VideoSection - { - Id = 0, - Title = "default", - IsSelected = true, - VideoPages = videoInfoService.GetVideoPages() - } - }; - } - - // 将所有视频设置为选中 - foreach (VideoSection section in videoSections) - { - foreach (var item in section.VideoPages) - { - item.IsSelected = true; - } - } - } - - /// - /// 解析视频流 - /// - /// - public void ParseVideo(IInfoService videoInfoService) - { - if (videoSections == null) { return; } - - foreach (VideoSection section in videoSections) - { - foreach (VideoPage page in section.VideoPages) - { - // 执行解析任务 - videoInfoService.GetVideoStream(page); - } - } - } - - /// - /// 选择文件夹和下载项 - /// - /// - public string SetDirectory(IDialogService dialogService) - { - // 选择的下载文件夹 - string directory = string.Empty; - - // 是否使用默认下载目录 - if (SettingsManager.GetInstance().IsUseSaveVideoRootPath() == AllowStatus.YES) - { - // 下载内容 - VideoContentSettings videoContent = SettingsManager.GetInstance().GetVideoContent(); - downloadAudio = videoContent.DownloadAudio; - downloadVideo = videoContent.DownloadVideo; - downloadDanmaku = videoContent.DownloadDanmaku; - downloadSubtitle = videoContent.DownloadSubtitle; - downloadCover = videoContent.DownloadCover; - - directory = SettingsManager.GetInstance().GetSaveVideoRootPath(); - } - else - { - // 打开文件夹选择器 - dialogService.ShowDialog(ViewDownloadSetterViewModel.Tag, null, result => - { - if (result.Result == ButtonResult.OK) - { - // 选择的下载文件夹 - directory = result.Parameters.GetValue("directory"); - - // 下载内容 - downloadAudio = result.Parameters.GetValue("downloadAudio"); - downloadVideo = result.Parameters.GetValue("downloadVideo"); - downloadDanmaku = result.Parameters.GetValue("downloadDanmaku"); - downloadSubtitle = result.Parameters.GetValue("downloadSubtitle"); - downloadCover = result.Parameters.GetValue("downloadCover"); - } - }); - } - - // 下载设置dialog中如果点击取消或者关闭窗口, - // 会返回空字符串, - // 这时直接退出 - if (string.IsNullOrEmpty(directory)) { return null; } - - if (!Directory.Exists(Directory.GetDirectoryRoot(directory))) - { - var alert = new AlertService(dialogService); - alert.ShowError(DictionaryResource.GetString("DriveNotFound")); - - directory = string.Empty; - } - - - // 文件夹不存在则创建 - if (!Directory.Exists(directory)) - { - Directory.CreateDirectory(directory); - } - - return directory; - } - - /// - /// 添加到下载列表 - /// - /// 传递事件的对象 - /// 下载路径 - /// 是否下载所有,包括未选中项 - /// 添加的数量 - public int AddToDownload(IEventAggregator eventAggregator, IDialogService dialogService, string directory, bool isAll = false) - { - if (directory == null || directory == string.Empty) { return -1; } - if (videoSections == null) { return -1; } - - // 视频计数 - int i = 0; - - // 添加到下载 - foreach (VideoSection section in videoSections) - { - if (section.VideoPages == null) { continue; } - - foreach (VideoPage page in section.VideoPages) - { - // 只下载选中项,跳过未选中项 - if (!isAll && !page.IsSelected) { continue; } - - // 没有解析的也跳过 - if (page.PlayUrl == null) { continue; } - - // 判断VideoQuality - int retry = 0; - while (page.VideoQuality == null && retry < 5) - { - // 执行解析任务 - videoInfoService.GetVideoStream(page); - retry++; - } - if (page.VideoQuality == null) { continue; } - - // 判断是否同一个视频,需要cid、画质、音质、视频编码都相同 - - // 如果存在正在下载列表,则跳过,并提示 - bool isDownloading = false; - foreach (DownloadingItem item in App.DownloadingList) - { - if (item.DownloadBase == null) { continue; } - - if (item.DownloadBase.Cid == page.Cid && item.Resolution.Id == page.VideoQuality.Quality && item.AudioCodec.Name == page.AudioQualityFormat && item.VideoCodecName == page.VideoQuality.SelectedVideoCodec) - { - eventAggregator.GetEvent().Publish($"{page.Name}{DictionaryResource.GetString("TipAlreadyToAddDownloading")}"); - isDownloading = true; - break; - } - } - if (isDownloading) { continue; } - - // 如果存在下载完成列表,弹出选择框是否再次下载 - bool isDownloaded = false; - foreach (DownloadedItem item in App.DownloadedList) - { - if (item.DownloadBase == null) { continue; } - - if (item.DownloadBase.Cid == page.Cid && item.Resolution.Id == page.VideoQuality.Quality && item.AudioCodec.Name == page.AudioQualityFormat && item.VideoCodecName == page.VideoQuality.SelectedVideoCodec) - { - //eventAggregator.GetEvent().Publish($"{page.Name}{DictionaryResource.GetString("TipAlreadyToAddDownloaded")}"); - //isDownloaded = true; - - AlertService alertService = new AlertService(dialogService); - ButtonResult result = alertService.ShowInfo(DictionaryResource.GetString("TipAlreadyToAddDownloaded2")); - if (result == ButtonResult.OK) - { - App.PropertyChangeAsync(() => - { - App.DownloadedList.Remove(item); - }); - - isDownloaded = false; - } - else - { - isDownloaded = true; - } - - break; - } - } - if (isDownloaded) { continue; } - - // 视频分区 - int zoneId = -1; - List zoneList = VideoZone.Instance().GetZones(); - ZoneAttr zone = zoneList.Find(it => it.Id == videoInfoView.TypeId); - if (zone != null) - { - if (zone.ParentId == 0) - { - zoneId = zone.Id; - } - else - { - ZoneAttr zoneParent = zoneList.Find(it => it.Id == zone.ParentId); - if (zoneParent != null) - { - zoneId = zoneParent.Id; - } - } - } - - // 如果只有一个视频章节,则不在命名中出现 - string sectionName = string.Empty; - if (videoSections.Count > 1) - { - sectionName = section.Title; - } - - // 文件路径 - List fileNameParts = SettingsManager.GetInstance().GetFileNameParts(); - FileName fileName = FileName.Builder(fileNameParts) - .SetSection(Format.FormatFileName(sectionName)) - .SetMainTitle(Format.FormatFileName(videoInfoView.Title)) - .SetPageTitle(Format.FormatFileName(page.Name)) - .SetVideoZone(videoInfoView.VideoZone.Split('>')[0]) - .SetAudioQuality(page.AudioQualityFormat) - .SetVideoQuality(page.VideoQuality == null ? "" : page.VideoQuality.QualityFormat) - .SetVideoCodec(page.VideoQuality == null ? "" : page.VideoQuality.SelectedVideoCodec.Contains("AVC") ? "AVC" : page.VideoQuality.SelectedVideoCodec.Contains("HEVC") ? "HEVC" : page.VideoQuality.SelectedVideoCodec.Contains("Dolby") ? "Dolby Vision" : page.VideoQuality.SelectedVideoCodec.Contains("AV1") ? "AV1" : "") - .SetVideoPublishTime(page.PublishTime) - .SetAvid(page.Avid) - .SetBvid(page.Bvid) - .SetCid(page.Cid) - .SetUpMid(page.Owner.Mid) - .SetUpName(Format.FormatFileName(page.Owner.Name)); - - // 序号设置 - OrderFormat orderFormat = SettingsManager.GetInstance().GetOrderFormat(); - switch (orderFormat) - { - case OrderFormat.NATURAL: - fileName.SetOrder(page.Order); - break; - case OrderFormat.LEADING_ZEROS: - fileName.SetOrder(page.Order, section.VideoPages.Count); - break; - } - - // 合成绝对路径 - string filePath = Path.Combine(directory, fileName.RelativePath()); - - // 视频类别 - PlayStreamType playStreamType; - switch (videoInfoView.TypeId) - { - case -10: - playStreamType = PlayStreamType.CHEESE; - break; - case 13: - case 23: - case 177: - case 167: - case 11: - playStreamType = PlayStreamType.BANGUMI; - break; - case 1: - case 3: - case 129: - case 4: - case 36: - case 188: - case 234: - case 223: - case 160: - case 211: - case 217: - case 119: - case 155: - case 202: - case 5: - case 181: - default: - playStreamType = PlayStreamType.VIDEO; - break; - } - - // 添加到下载列表 - App.PropertyChangeAsync(new Action(() => - { - // 如果不存在,直接添加到下载列表 - DownloadBase downloadBase = new DownloadBase - { - Bvid = page.Bvid, - Avid = page.Avid, - Cid = page.Cid, - EpisodeId = page.EpisodeId, - CoverUrl = videoInfoView.CoverUrl, - PageCoverUrl = page.FirstFrame, - ZoneId = zoneId, - FilePath = filePath, - - Order = page.Order, - MainTitle = videoInfoView.Title, - Name = page.Name, - Duration = page.Duration, - VideoCodecName = page.VideoQuality.SelectedVideoCodec, - Resolution = new Quality { Name = page.VideoQuality.QualityFormat, Id = page.VideoQuality.Quality }, - AudioCodec = Constant.GetAudioQualities().FirstOrDefault(t => { return t.Name == page.AudioQualityFormat; }), - }; - Downloading downloading = new Downloading - { - PlayStreamType = playStreamType, - DownloadStatus = DownloadStatus.NOT_STARTED, - }; - - // 需要下载的内容 - downloadBase.NeedDownloadContent["downloadAudio"] = downloadAudio; - downloadBase.NeedDownloadContent["downloadVideo"] = downloadVideo; - downloadBase.NeedDownloadContent["downloadDanmaku"] = downloadDanmaku; - downloadBase.NeedDownloadContent["downloadSubtitle"] = downloadSubtitle; - downloadBase.NeedDownloadContent["downloadCover"] = downloadCover; - - DownloadingItem downloadingItem = new DownloadingItem - { - DownloadBase = downloadBase, - Downloading = downloading, - PlayUrl = page.PlayUrl, - }; - - App.DownloadingList.Add(downloadingItem); - Thread.Sleep(10); - })); - i++; - } - } - - return i; - } - - } -} \ No newline at end of file diff --git a/src/DownKyi/Services/Download/AriaDownloadService.cs b/src/DownKyi/Services/Download/AriaDownloadService.cs deleted file mode 100644 index 460ae98..0000000 --- a/src/DownKyi/Services/Download/AriaDownloadService.cs +++ /dev/null @@ -1,512 +0,0 @@ -using DownKyi.Core.Aria2cNet; -using DownKyi.Core.Aria2cNet.Client; -using DownKyi.Core.Aria2cNet.Client.Entity; -using DownKyi.Core.Aria2cNet.Server; -using DownKyi.Core.BiliApi.Login; -using DownKyi.Core.BiliApi.VideoStream.Models; -using DownKyi.Core.Logging; -using DownKyi.Core.Settings; -using DownKyi.Core.Utils; -using DownKyi.Images; -using DownKyi.Models; -using DownKyi.Utils; -using DownKyi.ViewModels.DownloadManager; -using Prism.Services.Dialogs; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.IO; -using System.Linq; -using System.Threading.Tasks; - -namespace DownKyi.Services.Download -{ - /// - /// 音视频采用Aria下载,其余采用WebClient下载 - /// - public class AriaDownloadService : DownloadService, IDownloadService - { - public AriaDownloadService( - ObservableCollection downloadingList, - ObservableCollection downloadedList, - IDialogService dialogService) : - base(downloadingList, downloadedList, dialogService) - { - Tag = "AriaDownloadService"; - } - - #region 音视频 - - /// - /// 下载音频,返回下载文件路径 - /// - /// - /// - public override string DownloadAudio(DownloadingItem downloading) - { - PlayUrlDashVideo downloadAudio = BaseDownloadAudio(downloading); - - return DownloadVideo(downloading, downloadAudio); - } - - /// - /// 下载视频,返回下载文件路径 - /// - /// - /// - public override string DownloadVideo(DownloadingItem downloading) - { - PlayUrlDashVideo downloadVideo = BaseDownloadVideo(downloading); - - return DownloadVideo(downloading, downloadVideo); - } - - /// - /// 将下载音频和视频的函数中相同代码抽象出来 - /// - /// - /// - /// - private string DownloadVideo(DownloadingItem downloading, PlayUrlDashVideo downloadVideo) - { - // 如果为空,说明没有匹配到可下载的音频视频 - if (downloadVideo == null) { return null; } - - // 下载链接 - List urls = new List(); - if (downloadVideo.BaseUrl != null) { urls.Add(downloadVideo.BaseUrl); } - if (downloadVideo.BackupUrl != null) { urls.AddRange(downloadVideo.BackupUrl); } - - // 路径 - downloading.DownloadBase.FilePath = downloading.DownloadBase.FilePath.Replace("\\", "/"); - string[] temp = downloading.DownloadBase.FilePath.Split('/'); - //string path = downloading.DownloadBase.FilePath.Replace(temp[temp.Length - 1], ""); - string path = downloading.DownloadBase.FilePath.TrimEnd(temp[temp.Length - 1].ToCharArray()); - - // 下载文件名 - string fileName = Guid.NewGuid().ToString("N"); - string key = $"{downloadVideo.Id}_{downloadVideo.Codecs}"; - - // 老版本数据库没有这一项,会变成null - if (downloading.Downloading.DownloadedFiles == null) - { - downloading.Downloading.DownloadedFiles = new List(); - } - - if (downloading.Downloading.DownloadFiles.ContainsKey(key)) - { - // 如果存在,表示下载过, - // 则继续使用上次下载的文件名 - fileName = downloading.Downloading.DownloadFiles[key]; - - // 还要检查一下文件有没有被人删掉,删掉的话重新下载 - // 如果下载视频之后音频文件被人删了。此时gid还是视频的,会下错文件 - if (downloading.Downloading.DownloadedFiles.Contains(key) && File.Exists(Path.Combine(path, fileName))) - { - return Path.Combine(path, fileName); - } - } - else - { - // 记录本次下载的文件 - try - { - downloading.Downloading.DownloadFiles.Add(key, fileName); - } - catch (ArgumentException) { } - // Gid最好能是每个文件单独存储,现在复用有可能会混 - // 不过好消息是下载是按固定顺序的,而且下载了两个音频会混流不过 - downloading.Downloading.Gid = null; - } - - // 启用https - AllowStatus useSSL = SettingsManager.GetInstance().UseSSL(); - if (useSSL == AllowStatus.YES) - { - for (int i = 0; i < urls.Count; i++) - { - string url = urls[i]; - if (url.StartsWith("http://")) - { - urls[i] = url.Replace("http://", "https://"); - } - } - } - else - { - for (int i = 0; i < urls.Count; i++) - { - string url = urls[i]; - if (url.StartsWith("https://")) - { - urls[i] = url.Replace("https://", "http://"); - } - } - } - - // 开始下载 - DownloadResult downloadStatus = DownloadByAria(downloading, urls, path, fileName); - switch (downloadStatus) - { - case DownloadResult.SUCCESS: - downloading.Downloading.DownloadedFiles.Add(key); - downloading.Downloading.Gid = null; - return Path.Combine(path, fileName); - case DownloadResult.FAILED: - case DownloadResult.ABORT: - default: - return nullMark; - } - } - - #endregion - - /// - /// 下载封面 - /// - /// - public override string DownloadCover(DownloadingItem downloading, string coverUrl, string fileName) - { - return BaseDownloadCover(downloading, coverUrl, fileName); - } - - /// - /// 下载弹幕 - /// - /// - public override string DownloadDanmaku(DownloadingItem downloading) - { - return BaseDownloadDanmaku(downloading); - } - - /// - /// 下载字幕 - /// - /// - public override List DownloadSubtitle(DownloadingItem downloading) - { - return BaseDownloadSubtitle(downloading); - } - - /// - /// 混流音频和视频 - /// - /// - /// - /// - /// - public override string MixedFlow(DownloadingItem downloading, string audioUid, string videoUid) - { - if (videoUid == nullMark) - { - return null; - } - return BaseMixedFlow(downloading, audioUid, videoUid); - } - - /// - /// 解析视频流的下载链接 - /// - /// - public override void Parse(DownloadingItem downloading) - { - BaseParse(downloading); - } - - /// - /// 停止下载服务(转换await和Task.Wait两种调用形式) - /// - private async Task EndTask() - { - // 停止基本任务 - await BaseEndTask(); - - // 关闭Aria服务器 - await CloseAriaServer(); - } - - /// - /// 停止下载服务 - /// - public void End() - { - Task.Run(EndTask).Wait(); - } - - /// - /// 启动下载服务 - /// - public void Start() - { - // 设置aria token - AriaClient.SetToken(); - // 设置aria host - AriaClient.SetHost(); - // 设置aria listenPort - AriaClient.SetListenPort(); - - // 启动Aria服务器 - StartAriaServer(); - - // 启动基本服务 - BaseStart(); - } - - /// - /// 强制暂停 - /// - /// - /// - protected override void Pause(DownloadingItem downloading) - { - cancellationToken.ThrowIfCancellationRequested(); - - downloading.DownloadStatusTitle = DictionaryResource.GetString("Pausing"); - if (downloading.Downloading.DownloadStatus == DownloadStatus.PAUSE) - { - throw new OperationCanceledException("Stop thread by pause"); - } - // 是否存在 - var isExist = IsExist(downloading); - if (!isExist.Result) - { - throw new OperationCanceledException("Task is deleted"); - } - } - - /// - /// 是否存在于下载列表中 - /// - /// - /// - private async Task IsExist(DownloadingItem downloading) - { - bool isExist = downloadingList.Contains(downloading); - if (isExist) - { - return true; - } - else - { - // 先恢复为waiting状态,暂停状态下Remove会导致文件重新下载,原因暂不清楚 - await AriaClient.UnpauseAsync(downloading.Downloading.Gid); - // 移除下载项 - var ariaRemove = await AriaClient.RemoveAsync(downloading.Downloading.Gid); - if (ariaRemove == null || ariaRemove.Result == downloading.Downloading.Gid) - { - // 从内存中删除下载项 - await AriaClient.RemoveDownloadResultAsync(downloading.Downloading.Gid); - } - - return false; - } - } - - /// - /// 启动Aria服务器 - /// - private async void StartAriaServer() - { - List header = new List - { - $"Cookie: {LoginHelper.GetLoginInfoCookiesString()}", - $"Origin: https://www.bilibili.com", - $"Referer: https://www.bilibili.com", - $"User-Agent: {SettingsManager.GetInstance().GetUserAgent()}" - }; - - AriaConfig config = new AriaConfig() - { - ListenPort = SettingsManager.GetInstance().GetAriaListenPort(), - Token = "downkyi", - LogLevel = SettingsManager.GetInstance().GetAriaLogLevel(), - MaxConcurrentDownloads = SettingsManager.GetInstance().GetMaxCurrentDownloads(), - MaxConnectionPerServer = 8, // 最大取16 - Split = SettingsManager.GetInstance().GetAriaSplit(), - //MaxTries = 5, - MinSplitSize = 10, // 10MB - MaxOverallDownloadLimit = SettingsManager.GetInstance().GetAriaMaxOverallDownloadLimit() * 1024L, // 输入的单位是KB/s,所以需要乘以1024 - MaxDownloadLimit = SettingsManager.GetInstance().GetAriaMaxDownloadLimit() * 1024L, // 输入的单位是KB/s,所以需要乘以1024 - MaxOverallUploadLimit = 0, - MaxUploadLimit = 0, - ContinueDownload = true, - FileAllocation = SettingsManager.GetInstance().GetAriaFileAllocation(), - Headers = header - }; - - string errorMessage = null; - var task = await AriaServer.StartServerAsync(config, new Action((output) => - { - errorMessage += output + "\n"; - })); - if (task) { Console.WriteLine("Start ServerAsync Completed"); } - - // 显示错误信息 - if (errorMessage != null && errorMessage.Contains("ERROR")) - { - AlertService alertService = new AlertService(dialogService); - ButtonResult result = alertService.ShowMessage(SystemIcon.Instance().Error, - $"Aria2 {DictionaryResource.GetString("Error")}", - errorMessage, - 1); - return; - } - - for (int i = 0; i < 10; i++) - { - var globOpt = await AriaClient.GetGlobalOptionAsync(); - if (globOpt != null) - break; - await Task.Delay(1000); - } - Console.WriteLine("Start ServerAsync end"); - } - - /// - /// 关闭Aria服务器 - /// - private async Task CloseAriaServer() - { - // 暂停所有下载 - var ariaPause = await AriaClient.PauseAllAsync(); -#if DEBUG - Core.Utils.Debugging.Console.PrintLine(ariaPause.ToString()); -#endif - - // 关闭服务器 - bool close = AriaServer.CloseServer(); -#if DEBUG - Core.Utils.Debugging.Console.PrintLine(close); -#endif - } - - /// - /// 采用Aria下载文件 - /// - /// - /// - private DownloadResult DownloadByAria(DownloadingItem downloading, List urls, string path, string localFileName) - { - // path已斜杠结尾,去掉斜杠 - path = path.TrimEnd('/').TrimEnd('\\'); - - //检查gid对应任务,如果已创建那么直接使用 - //但是代理设置会出现不能随时更新的问题 - - if (downloading.Downloading.Gid != null) - { - Task status = AriaClient.TellStatus(downloading.Downloading.Gid); - if (status == null || status.Result == null) - downloading.Downloading.Gid = null; - else if (status.Result.Result == null && status.Result.Error != null) - { - if (status.Result.Error.Message.Contains("is not found")) - { - downloading.Downloading.Gid = null; - } - } - - } - - if (downloading.Downloading.Gid == null) - { - AriaSendOption option = new AriaSendOption - { - //HttpProxy = $"http://{Settings.GetAriaHttpProxy()}:{Settings.GetAriaHttpProxyListenPort()}", - Dir = path, - Out = localFileName, - //Header = $"cookie: {LoginHelper.GetLoginInfoCookiesString()}\nreferer: https://www.bilibili.com", - //UseHead = "true", - UserAgent = SettingsManager.GetInstance().GetUserAgent(), - }; - - // 如果设置了代理,则增加HttpProxy - if (SettingsManager.GetInstance().IsAriaHttpProxy() == AllowStatus.YES) - { - option.HttpProxy = $"http://{SettingsManager.GetInstance().GetAriaHttpProxy()}:{SettingsManager.GetInstance().GetAriaHttpProxyListenPort()}"; - } - - // 添加一个下载 - Task ariaAddUri = AriaClient.AddUriAsync(urls, option); - if (ariaAddUri == null || ariaAddUri.Result == null || ariaAddUri.Result.Result == null) - { - return DownloadResult.FAILED; - } - - // 保存gid - string gid = ariaAddUri.Result.Result; - downloading.Downloading.Gid = gid; - } - else - { - Task ariaUnpause = AriaClient.UnpauseAsync(downloading.Downloading.Gid); - } - - // 管理下载 - AriaManager ariaManager = new AriaManager(); - ariaManager.TellStatus += AriaTellStatus; - ariaManager.DownloadFinish += AriaDownloadFinish; - return ariaManager.GetDownloadStatus(downloading.Downloading.Gid, new Action(() => - { - cancellationToken.ThrowIfCancellationRequested(); - switch (downloading.Downloading.DownloadStatus) - { - case DownloadStatus.PAUSE: - Task ariaPause = AriaClient.PauseAsync(downloading.Downloading.Gid); - // 通知UI,并阻塞当前线程 - Pause(downloading); - break; - case DownloadStatus.DOWNLOADING: - break; - } - })); - } - - private void AriaTellStatus(long totalLength, long completedLength, long speed, string gid) - { - // 当前的下载视频 - DownloadingItem video = null; - try - { - video = downloadingList.FirstOrDefault(it => it.Downloading.Gid == gid); - } - catch (InvalidOperationException e) - { - Core.Utils.Debugging.Console.PrintLine("AriaTellStatus()发生异常: {0}", e); - LogManager.Error("AriaTellStatus()", e); - } - - if (video == null) { return; } - - // 下载进度百分比 - float percent = 0; - if (totalLength != 0) - { - percent = (float)completedLength / totalLength * 100; - } - - // 根据进度判断本次是否需要更新UI - if (Math.Abs(percent - video.Progress) < 0.01) { return; } - - // 下载进度 - video.Progress = percent; - - // 下载大小 - video.DownloadingFileSize = Format.FormatFileSize(completedLength) + "/" + Format.FormatFileSize(totalLength); - - // 下载速度 - video.SpeedDisplay = Format.FormatSpeed(speed); - - // 最大下载速度 - if (video.Downloading.MaxSpeed < speed) - { - video.Downloading.MaxSpeed = speed; - } - } - - private void AriaDownloadFinish(bool isSuccess, string downloadPath, string gid, string msg) - { - //throw new NotImplementedException(); - } - } -} diff --git a/src/DownKyi/Services/Download/BuiltinDownloadService.cs b/src/DownKyi/Services/Download/BuiltinDownloadService.cs deleted file mode 100644 index 1870b63..0000000 --- a/src/DownKyi/Services/Download/BuiltinDownloadService.cs +++ /dev/null @@ -1,402 +0,0 @@ -using DownKyi.Core.BiliApi.Login; -using DownKyi.Core.BiliApi.VideoStream.Models; -using DownKyi.Core.Downloader; -using DownKyi.Core.Logging; -using DownKyi.Core.Settings; -using DownKyi.Core.Utils; -using DownKyi.Models; -using DownKyi.Utils; -using DownKyi.ViewModels.DownloadManager; -using Prism.Services.Dialogs; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.IO; -using System.Net; -using System.Threading; -using System.Threading.Tasks; - -namespace DownKyi.Services.Download -{ - public class BuiltinDownloadService : DownloadService, IDownloadService - { - public BuiltinDownloadService(ObservableCollection downloadingList, - ObservableCollection downloadedList, - IDialogService dialogService - ) : base(downloadingList, downloadedList, dialogService) - { - Tag = "BuiltinDownloadService"; - } - - #region 音视频 - - /// - /// 下载音频,返回下载文件路径 - /// - /// - /// - public override string DownloadAudio(DownloadingItem downloading) - { - PlayUrlDashVideo downloadAudio = BaseDownloadAudio(downloading); - - return DownloadVideo(downloading, downloadAudio); - } - - /// - /// 下载视频,返回下载文件路径 - /// - /// - /// - public override string DownloadVideo(DownloadingItem downloading) - { - PlayUrlDashVideo downloadVideo = BaseDownloadVideo(downloading); - - return DownloadVideo(downloading, downloadVideo); - } - - /// - /// 将下载音频和视频的函数中相同代码抽象出来 - /// - /// - /// - /// - private string DownloadVideo(DownloadingItem downloading, PlayUrlDashVideo downloadVideo) - { - // 如果为空,说明没有匹配到可下载的音频视频 - if (downloadVideo == null) { return null; } - - // 下载链接 - List urls = new List(); - if (downloadVideo.BaseUrl != null) { urls.Add(downloadVideo.BaseUrl); } - if (downloadVideo.BackupUrl != null) { urls.AddRange(downloadVideo.BackupUrl); } - - // 路径 - downloading.DownloadBase.FilePath = downloading.DownloadBase.FilePath.Replace("\\", "/"); - string[] temp = downloading.DownloadBase.FilePath.Split('/'); - //string path = downloading.DownloadBase.FilePath.Replace(temp[temp.Length - 1], ""); - string path = downloading.DownloadBase.FilePath.TrimEnd(temp[temp.Length - 1].ToCharArray()); - - // 下载文件名 - string fileName = Guid.NewGuid().ToString("N"); - string key = $"{downloadVideo.Id}_{downloadVideo.Codecs}"; - - // 老版本数据库没有这一项,会变成null - if (downloading.Downloading.DownloadedFiles == null) - { - downloading.Downloading.DownloadedFiles = new List(); - } - - if (downloading.Downloading.DownloadFiles.ContainsKey(key)) - { - // 如果存在,表示下载过, - // 则继续使用上次下载的文件名 - fileName = downloading.Downloading.DownloadFiles[key]; - - // 还要检查一下文件有没有被人删掉,删掉的话重新下载 - // 如果下载视频之后音频文件被人删了。此时gid还是视频的,会下错文件 - if (downloading.Downloading.DownloadedFiles.Contains(key) && File.Exists(Path.Combine(path, fileName))) - { - return Path.Combine(path, fileName); - } - } - else - { - // 记录本次下载的文件 - try - { - downloading.Downloading.DownloadFiles.Add(key, fileName); - } - catch (ArgumentException) { } - // Gid最好能是每个文件单独存储,现在复用有可能会混 - // 不过好消息是下载是按固定顺序的,而且下载了两个音频会混流不过 - downloading.Downloading.Gid = null; - } - - // 启用https - AllowStatus useSSL = SettingsManager.GetInstance().UseSSL(); - if (useSSL == AllowStatus.YES) - { - for (int i = 0; i < urls.Count; i++) - { - string url = urls[i]; - if (url.StartsWith("http://")) - { - urls[i] = url.Replace("http://", "https://"); - } - } - } - else - { - for (int i = 0; i < urls.Count; i++) - { - string url = urls[i]; - if (url.StartsWith("https://")) - { - urls[i] = url.Replace("https://", "http://"); - } - } - } - - // 开始下载 - try - { - var downloadStatus = DownloadByBuiltin(downloading, urls, path, fileName); - if (downloadStatus) - { - downloading.Downloading.DownloadedFiles.Add(key); - downloading.Downloading.Gid = null; - return Path.Combine(path, fileName); - } - else - { - return nullMark; - } - } - catch (FileNotFoundException e) - { - Core.Utils.Debugging.Console.PrintLine("BuiltinDownloadService.DownloadVideo()发生异常: {0}", e); - LogManager.Error("BuiltinDownloadService.DownloadVideo()", e); - - return nullMark; - } - } - - #endregion - - /// - /// 下载封面 - /// - /// - /// - /// - /// - public override string DownloadCover(DownloadingItem downloading, string coverUrl, string fileName) - { - return BaseDownloadCover(downloading, coverUrl, fileName); - } - - /// - /// 下载弹幕 - /// - /// - /// - public override string DownloadDanmaku(DownloadingItem downloading) - { - return BaseDownloadDanmaku(downloading); - } - - /// - /// 下载字幕 - /// - /// - /// - public override List DownloadSubtitle(DownloadingItem downloading) - { - return BaseDownloadSubtitle(downloading); - } - - /// - /// 混流音频和视频 - /// - /// - /// - /// - /// - public override string MixedFlow(DownloadingItem downloading, string audioUid, string videoUid) - { - return BaseMixedFlow(downloading, audioUid, videoUid); - } - - /// - /// 解析视频流的下载链接 - /// - /// - public override void Parse(DownloadingItem downloading) - { - BaseParse(downloading); - } - - /// - /// 停止下载服务(转换await和Task.Wait两种调用形式) - /// - private async Task EndTask() - { - // 停止基本任务 - await BaseEndTask(); - } - - /// - /// 停止下载服务 - /// - public void End() - { - Task.Run(EndTask).Wait(); - } - - public void Start() - { - // 启动基本服务 - BaseStart(); - } - - /// - /// 强制暂停 - /// - /// - /// - protected override void Pause(DownloadingItem downloading) - { - cancellationToken.ThrowIfCancellationRequested(); - - downloading.DownloadStatusTitle = DictionaryResource.GetString("Pausing"); - if (downloading.Downloading.DownloadStatus == DownloadStatus.PAUSE) - { - throw new OperationCanceledException("Stop thread by pause"); - } - // 是否存在 - var isExist = IsExist(downloading); - if (!isExist) - { - throw new OperationCanceledException("Task is deleted"); - } - } - - /// - /// 是否存在于下载列表中 - /// - /// - /// - private bool IsExist(DownloadingItem downloading) - { - bool isExist = downloadingList.Contains(downloading); - if (isExist) - { - return true; - } - else - { - return false; - } - } - - #region 内建下载器 - - /// - /// 下载文件 - /// - /// - /// - /// - /// - /// - private bool DownloadByBuiltin(DownloadingItem downloading, List urls, string path, string localFileName) - { - // path已斜杠结尾,去掉斜杠 - path = path.TrimEnd('/').TrimEnd('\\'); - - foreach (var url in urls) - { - // 创建下载器 - var mtd = new MultiThreadDownloader(url, - Environment.GetEnvironmentVariable("temp"), - Path.Combine(path, localFileName), - SettingsManager.GetInstance().GetSplit()); - // 配置网络请求 - mtd.Configure(req => - { - req.CookieContainer = LoginHelper.GetLoginInfoCookies(); - req.UserAgent = SettingsManager.GetInstance().GetUserAgent(); - req.Referer = "https://www.bilibili.com"; - req.Headers.Add("Origin", "https://www.bilibili.com"); - - if (SettingsManager.GetInstance().IsHttpProxy() == AllowStatus.YES) - { - req.Proxy = new WebProxy(SettingsManager.GetInstance().GetHttpProxy(), - SettingsManager.GetInstance().GetHttpProxyListenPort()); - } - }); - - // 下载进度回调 - mtd.TotalProgressChanged += (sender, e) => - { - try - { - // 状态更新 - var downloader = sender as MultiThreadDownloader; - - // 下载进度百分比 - float percent = downloader.TotalProgress; - - // 根据进度判断本次是否需要更新UI - if (Math.Abs(percent - downloading.Progress) < 0.01) { return; } - if (Math.Abs(percent - downloading.Progress) > 5) { return; } - - // 下载进度 - downloading.Progress = percent; - - // 下载大小 - downloading.DownloadingFileSize = Format.FormatFileSize(downloader.TotalBytesReceived) + "/" + Format.FormatFileSize(downloader.Size); - - // 下载速度 - long speed = (long)downloader.TotalSpeedInBytes; - - // 下载速度显示 - downloading.SpeedDisplay = Format.FormatSpeed(speed); - - // 最大下载速度 - if (downloading.Downloading.MaxSpeed < speed) - { - downloading.Downloading.MaxSpeed = speed; - } - } - catch (InvalidOperationException ex) - { - Core.Utils.Debugging.Console.PrintLine($"{Tag}.DownloadByBuiltin()发生InvalidOperationException异常: {0}", ex); - LogManager.Error($"{Tag}.DownloadByBuiltin()", ex); - } - catch (Exception ex) - { - Core.Utils.Debugging.Console.PrintLine($"{Tag}.DownloadByBuiltin()发生异常: {0}", ex); - LogManager.Error($"{Tag}.DownloadByBuiltin()", ex); - } - }; - - // 文件合并完成回调 - bool isComplete = false; - mtd.FileMergedComplete += (sender, e) => - { - // 跳出循环 - if (File.Exists(Path.Combine(path, localFileName))) { isComplete = true; } - }; - - // 开始下载 - mtd.Start(); - - // 阻塞当前任务,监听暂停事件 - while (!isComplete) - { - cancellationToken.ThrowIfCancellationRequested(); - switch (downloading.Downloading.DownloadStatus) - { - case DownloadStatus.PAUSE: - // 暂停下载 - mtd.Pause(); - // 通知UI,并阻塞当前线程 - Pause(downloading); - break; - case DownloadStatus.DOWNLOADING: - break; - } - - Thread.Sleep(100); - } - return isComplete; - } - - return false; - } - - #endregion - - } -} diff --git a/src/DownKyi/Services/Download/CustomAriaDownloadService.cs b/src/DownKyi/Services/Download/CustomAriaDownloadService.cs deleted file mode 100644 index 9b62701..0000000 --- a/src/DownKyi/Services/Download/CustomAriaDownloadService.cs +++ /dev/null @@ -1,446 +0,0 @@ -using DownKyi.Core.Aria2cNet; -using DownKyi.Core.Aria2cNet.Client; -using DownKyi.Core.Aria2cNet.Client.Entity; -using DownKyi.Core.Aria2cNet.Server; -using DownKyi.Core.BiliApi.VideoStream.Models; -using DownKyi.Core.Logging; -using DownKyi.Core.Settings; -using DownKyi.Core.Utils; -using DownKyi.Models; -using DownKyi.Utils; -using DownKyi.ViewModels.DownloadManager; -using Prism.Services.Dialogs; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.IO; -using System.Linq; -using System.Threading.Tasks; - -namespace DownKyi.Services.Download -{ - /// - /// 音视频采用Aria下载,其余采用WebClient下载 - /// - public class CustomAriaDownloadService : DownloadService, IDownloadService - { - public CustomAriaDownloadService(ObservableCollection downloadingList, - ObservableCollection downloadedList, - IDialogService dialogService - ) : base(downloadingList, downloadedList, dialogService) - { - Tag = "AriaDownloadService"; - } - - #region 音视频 - - /// - /// 下载音频,返回下载文件路径 - /// - /// - /// - public override string DownloadAudio(DownloadingItem downloading) - { - PlayUrlDashVideo downloadAudio = BaseDownloadAudio(downloading); - - return DownloadVideo(downloading, downloadAudio); - } - - /// - /// 下载视频,返回下载文件路径 - /// - /// - /// - public override string DownloadVideo(DownloadingItem downloading) - { - PlayUrlDashVideo downloadVideo = BaseDownloadVideo(downloading); - - return DownloadVideo(downloading, downloadVideo); - } - - /// - /// 将下载音频和视频的函数中相同代码抽象出来 - /// - /// - /// - /// - private string DownloadVideo(DownloadingItem downloading, PlayUrlDashVideo downloadVideo) - { - // 如果为空,说明没有匹配到可下载的音频视频 - if (downloadVideo == null) { return null; } - - // 下载链接 - List urls = new List(); - if (downloadVideo.BaseUrl != null) { urls.Add(downloadVideo.BaseUrl); } - if (downloadVideo.BackupUrl != null) { urls.AddRange(downloadVideo.BackupUrl); } - - // 路径 - downloading.DownloadBase.FilePath = downloading.DownloadBase.FilePath.Replace("\\", "/"); - string[] temp = downloading.DownloadBase.FilePath.Split('/'); - //string path = downloading.DownloadBase.FilePath.Replace(temp[temp.Length - 1], ""); - string path = downloading.DownloadBase.FilePath.TrimEnd(temp[temp.Length - 1].ToCharArray()); - - // 下载文件名 - string fileName = Guid.NewGuid().ToString("N"); - string key = $"{downloadVideo.Id}_{downloadVideo.Codecs}"; - - // 老版本数据库没有这一项,会变成null - if (downloading.Downloading.DownloadedFiles == null) - { - downloading.Downloading.DownloadedFiles = new List(); - } - - if (downloading.Downloading.DownloadFiles.ContainsKey(key)) - { - // 如果存在,表示下载过, - // 则继续使用上次下载的文件名 - fileName = downloading.Downloading.DownloadFiles[key]; - - // 还要检查一下文件有没有被人删掉,删掉的话重新下载 - // 如果下载视频之后音频文件被人删了。此时gid还是视频的,会下错文件 - if (downloading.Downloading.DownloadedFiles.Contains(key) && File.Exists(Path.Combine(path, fileName))) - { - return Path.Combine(path, fileName); - } - } - else - { - // 记录本次下载的文件 - try - { - downloading.Downloading.DownloadFiles.Add(key, fileName); - } - catch (ArgumentException) { } - // Gid最好能是每个文件单独存储,现在复用有可能会混 - // 不过好消息是下载是按固定顺序的,而且下载了两个音频会混流不过 - downloading.Downloading.Gid = null; - } - - // 启用https - AllowStatus useSSL = SettingsManager.GetInstance().UseSSL(); - if (useSSL == AllowStatus.YES) - { - for (int i = 0; i < urls.Count; i++) - { - string url = urls[i]; - if (url.StartsWith("http://")) - { - urls[i] = url.Replace("http://", "https://"); - } - } - } - else - { - for (int i = 0; i < urls.Count; i++) - { - string url = urls[i]; - if (url.StartsWith("https://")) - { - urls[i] = url.Replace("https://", "http://"); - } - } - } - - // 开始下载 - DownloadResult downloadStatus = DownloadByAria(downloading, urls, path, fileName); - switch (downloadStatus) - { - case DownloadResult.SUCCESS: - downloading.Downloading.DownloadedFiles.Add(key); - downloading.Downloading.Gid = null; - return Path.Combine(path, fileName); - case DownloadResult.FAILED: - case DownloadResult.ABORT: - default: - return nullMark; - } - } - - #endregion - - /// - /// 下载封面 - /// - /// - public override string DownloadCover(DownloadingItem downloading, string coverUrl, string fileName) - { - return BaseDownloadCover(downloading, coverUrl, fileName); - } - - /// - /// 下载弹幕 - /// - /// - public override string DownloadDanmaku(DownloadingItem downloading) - { - return BaseDownloadDanmaku(downloading); - } - - /// - /// 下载字幕 - /// - /// - public override List DownloadSubtitle(DownloadingItem downloading) - { - return BaseDownloadSubtitle(downloading); - } - - /// - /// 混流音频和视频 - /// - /// - /// - /// - /// - public override string MixedFlow(DownloadingItem downloading, string audioUid, string videoUid) - { - if (videoUid == nullMark) - { - return null; - } - return BaseMixedFlow(downloading, audioUid, videoUid); - } - - /// - /// 解析视频流的下载链接 - /// - /// - public override void Parse(DownloadingItem downloading) - { - BaseParse(downloading); - } - - /// - /// 停止下载服务(转换await和Task.Wait两种调用形式) - /// - private async Task EndTask() - { - // 停止基本任务 - await BaseEndTask(); - - // 关闭Aria服务器 - await CloseAriaServer(); - } - - /// - /// 停止下载服务 - /// - public void End() - { - Task.Run(EndTask).Wait(); - } - - /// - /// 启动下载服务 - /// - public void Start() - { - // 设置aria token - AriaClient.SetToken(SettingsManager.GetInstance().GetAriaToken()); - // 设置aria host - AriaClient.SetHost(SettingsManager.GetInstance().GetAriaHost()); - // 设置aria listenPort - AriaClient.SetListenPort(SettingsManager.GetInstance().GetAriaListenPort()); - - // 启动基本服务 - BaseStart(); - } - - /// - /// 强制暂停 - /// - /// - /// - protected override void Pause(DownloadingItem downloading) - { - cancellationToken.ThrowIfCancellationRequested(); - - downloading.DownloadStatusTitle = DictionaryResource.GetString("Pausing"); - if (downloading.Downloading.DownloadStatus == DownloadStatus.PAUSE) - { - throw new OperationCanceledException("Stop thread by pause"); - } - // 是否存在 - var isExist = IsExist(downloading); - if (!isExist.Result) - { - throw new OperationCanceledException("Task is deleted"); - } - } - - /// - /// 是否存在于下载列表中 - /// - /// - /// - private async Task IsExist(DownloadingItem downloading) - { - bool isExist = downloadingList.Contains(downloading); - if (isExist) - { - return true; - } - else - { - // 先恢复为waiting状态,暂停状态下Remove会导致文件重新下载,原因暂不清楚 - await AriaClient.UnpauseAsync(downloading.Downloading.Gid); - // 移除下载项 - var ariaRemove = await AriaClient.RemoveAsync(downloading.Downloading.Gid); - if (ariaRemove == null || ariaRemove.Result == downloading.Downloading.Gid) - { - // 从内存中删除下载项 - await AriaClient.RemoveDownloadResultAsync(downloading.Downloading.Gid); - } - - return false; - } - } - - /// - /// 关闭Aria服务器 - /// - private async Task CloseAriaServer() - { - // 暂停所有下载 - var ariaPause = await AriaClient.PauseAllAsync(); -#if DEBUG - Core.Utils.Debugging.Console.PrintLine(ariaPause.ToString()); -#endif - - // 关闭服务器 - bool close = AriaServer.CloseServer(); -#if DEBUG - Core.Utils.Debugging.Console.PrintLine(close); -#endif - } - - /// - /// 采用Aria下载文件 - /// - /// - /// - private DownloadResult DownloadByAria(DownloadingItem downloading, List urls, string path, string localFileName) - { - // path已斜杠结尾,去掉斜杠 - path = path.TrimEnd('/').TrimEnd('\\'); - - //检查gid对应任务,如果已创建那么直接使用 - //但是代理设置会出现不能随时更新的问题 - - if (downloading.Downloading.Gid != null) - { - Task status = AriaClient.TellStatus(downloading.Downloading.Gid); - if (status == null || status.Result == null) - downloading.Downloading.Gid = null; - else if (status.Result.Result == null && status.Result.Error != null) - { - if (status.Result.Error.Message.Contains("is not found")) - { - downloading.Downloading.Gid = null; - } - } - - } - - if (downloading.Downloading.Gid == null) - { - AriaSendOption option = new AriaSendOption - { - //HttpProxy = $"http://{Settings.GetAriaHttpProxy()}:{Settings.GetAriaHttpProxyListenPort()}", - Dir = path, - Out = localFileName, - //Header = $"cookie: {LoginHelper.GetLoginInfoCookiesString()}\nreferer: https://www.bilibili.com", - //UseHead = "true", - UserAgent = SettingsManager.GetInstance().GetUserAgent(), - }; - - //// 如果设置了代理,则增加HttpProxy - //if (SettingsManager.GetInstance().IsAriaHttpProxy() == AllowStatus.YES) - //{ - // option.HttpProxy = $"http://{SettingsManager.GetInstance().GetAriaHttpProxy()}:{SettingsManager.GetInstance().GetAriaHttpProxyListenPort()}"; - //} - - // 添加一个下载 - Task ariaAddUri = AriaClient.AddUriAsync(urls, option); - if (ariaAddUri == null || ariaAddUri.Result == null || ariaAddUri.Result.Result == null) - { - return DownloadResult.FAILED; - } - - // 保存gid - string gid = ariaAddUri.Result.Result; - downloading.Downloading.Gid = gid; - } - else - { - Task ariaUnpause = AriaClient.UnpauseAsync(downloading.Downloading.Gid); - } - - // 管理下载 - AriaManager ariaManager = new AriaManager(); - ariaManager.TellStatus += AriaTellStatus; - ariaManager.DownloadFinish += AriaDownloadFinish; - return ariaManager.GetDownloadStatus(downloading.Downloading.Gid, new Action(() => - { - cancellationToken.ThrowIfCancellationRequested(); - switch (downloading.Downloading.DownloadStatus) - { - case DownloadStatus.PAUSE: - Task ariaPause = AriaClient.PauseAsync(downloading.Downloading.Gid); - // 通知UI,并阻塞当前线程 - Pause(downloading); - break; - case DownloadStatus.DOWNLOADING: - break; - } - })); - } - - private void AriaTellStatus(long totalLength, long completedLength, long speed, string gid) - { - // 当前的下载视频 - DownloadingItem video = null; - try - { - video = downloadingList.FirstOrDefault(it => it.Downloading.Gid == gid); - } - catch (InvalidOperationException e) - { - Core.Utils.Debugging.Console.PrintLine("AriaTellStatus()发生异常: {0}", e); - LogManager.Error("AriaTellStatus()", e); - } - - if (video == null) { return; } - - // 下载进度百分比 - float percent = 0; - if (totalLength != 0) - { - percent = (float)completedLength / totalLength * 100; - } - - // 根据进度判断本次是否需要更新UI - if (Math.Abs(percent - video.Progress) < 0.01) { return; } - - // 下载进度 - video.Progress = percent; - - // 下载大小 - video.DownloadingFileSize = Format.FormatFileSize(completedLength) + "/" + Format.FormatFileSize(totalLength); - - // 下载速度 - video.SpeedDisplay = Format.FormatSpeed(speed); - - // 最大下载速度 - if (video.Downloading.MaxSpeed < speed) - { - video.Downloading.MaxSpeed = speed; - } - } - - private void AriaDownloadFinish(bool isSuccess, string downloadPath, string gid, string msg) - { - //throw new NotImplementedException(); - } - } -} diff --git a/src/DownKyi/Services/Download/DownloadService.cs b/src/DownKyi/Services/Download/DownloadService.cs deleted file mode 100644 index 8e569b7..0000000 --- a/src/DownKyi/Services/Download/DownloadService.cs +++ /dev/null @@ -1,825 +0,0 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Core.BiliApi.VideoStream; -using DownKyi.Core.BiliApi.VideoStream.Models; -using DownKyi.Core.Danmaku2Ass; -using DownKyi.Core.FFmpeg; -using DownKyi.Core.Logging; -using DownKyi.Core.Settings; -using DownKyi.Core.Storage; -using DownKyi.Core.Utils; -using DownKyi.Images; -using DownKyi.Models; -using DownKyi.Utils; -using DownKyi.ViewModels.DownloadManager; -using Hardcodet.Wpf.TaskbarNotification; -using Prism.Services.Dialogs; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using System.Windows.Media.Imaging; - -namespace DownKyi.Services.Download -{ - public abstract class DownloadService - { - protected string Tag = "DownloadService"; - protected TaskbarIcon _notifyIcon; - protected IDialogService dialogService; - protected ObservableCollection downloadingList; - protected ObservableCollection downloadedList; - - protected Task workTask; - protected CancellationTokenSource tokenSource; - protected CancellationToken cancellationToken; - protected List downloadingTasks = new List(); - - protected readonly int retry = 5; - protected readonly string nullMark = ""; - - /// - /// 初始化 - /// - /// - /// - public DownloadService(ObservableCollection downloadingList, - ObservableCollection downloadedList, - IDialogService dialogService) - { - this.downloadingList = downloadingList; - this.downloadedList = downloadedList; - this.dialogService = dialogService; - } - - protected PlayUrlDashVideo BaseDownloadAudio(DownloadingItem downloading) - { - // 更新状态显示 - downloading.DownloadStatusTitle = DictionaryResource.GetString("WhileDownloading"); - downloading.DownloadContent = DictionaryResource.GetString("DownloadingAudio"); - // 下载大小 - downloading.DownloadingFileSize = string.Empty; - downloading.Progress = 0; - // 下载速度 - downloading.SpeedDisplay = string.Empty; - - // 如果没有Dash,返回null - if (downloading.PlayUrl == null || downloading.PlayUrl.Dash == null) { return null; } - - // 如果audio列表没有内容,则返回null - if (downloading.PlayUrl.Dash.Audio == null) { return null; } - else if (downloading.PlayUrl.Dash.Audio.Count == 0) { return null; } - - // 根据音频id匹配 - PlayUrlDashVideo downloadAudio = null; - foreach (PlayUrlDashVideo audio in downloading.PlayUrl.Dash.Audio) - { - if (audio.Id == downloading.AudioCodec.Id) - { - downloadAudio = audio; - break; - } - } - - // 避免Dolby==null及其它未知情况,直接使用异常捕获 - try - { - // Dolby Atmos - if (downloading.AudioCodec.Id == 30250) - { - downloadAudio = downloading.PlayUrl.Dash.Dolby.Audio[0]; - } - // Hi-Res无损 - if (downloading.AudioCodec.Id == 30251) - { - downloadAudio = downloading.PlayUrl.Dash.Flac.Audio; - } - } - catch (Exception) { } - - return downloadAudio; - } - - protected PlayUrlDashVideo BaseDownloadVideo(DownloadingItem downloading) - { - // 更新状态显示 - downloading.DownloadStatusTitle = DictionaryResource.GetString("WhileDownloading"); - downloading.DownloadContent = DictionaryResource.GetString("DownloadingVideo"); - // 下载大小 - downloading.DownloadingFileSize = string.Empty; - downloading.Progress = 0; - // 下载速度 - downloading.SpeedDisplay = string.Empty; - - // 如果没有Dash,返回null - if (downloading.PlayUrl == null || downloading.PlayUrl.Dash == null) { return null; } - - // 如果Video列表没有内容,则返回null - if (downloading.PlayUrl.Dash.Video == null) { return null; } - else if (downloading.PlayUrl.Dash.Video.Count == 0) { return null; } - - // 根据视频编码匹配 - PlayUrlDashVideo downloadVideo = null; - foreach (PlayUrlDashVideo video in downloading.PlayUrl.Dash.Video) - { - Quality codecs = Constant.GetCodecIds().FirstOrDefault(t => t.Id == video.CodecId); - if (video.Id == downloading.Resolution.Id && codecs.Name == downloading.VideoCodecName) - { - downloadVideo = video; - break; - } - } - - return downloadVideo; - } - - protected string BaseDownloadCover(DownloadingItem downloading, string coverUrl, string fileName) - { - // 更新状态显示 - downloading.DownloadStatusTitle = DictionaryResource.GetString("WhileDownloading"); - downloading.DownloadContent = DictionaryResource.GetString("DownloadingCover"); - // 下载大小 - downloading.DownloadingFileSize = string.Empty; - // 下载速度 - downloading.SpeedDisplay = string.Empty; - - // 查询、保存封面 - StorageCover storageCover = new StorageCover(); - string cover = storageCover.GetCover(downloading.DownloadBase.Avid, downloading.DownloadBase.Bvid, downloading.DownloadBase.Cid, coverUrl); - if (cover == null) - { - return null; - } - - // 复制图片到指定位置 - try - { - File.Copy(cover, fileName, true); - - // 记录本次下载的文件 - if (!downloading.Downloading.DownloadFiles.ContainsKey(coverUrl)) - { - downloading.Downloading.DownloadFiles.Add(coverUrl, fileName); - } - - return fileName; - } - catch (Exception e) - { - Core.Utils.Debugging.Console.PrintLine($"{Tag}.DownloadCover()发生异常: {0}", e); - LogManager.Error($"{Tag}.DownloadCover()", e); - } - - return null; - } - - protected string BaseDownloadDanmaku(DownloadingItem downloading) - { - // 更新状态显示 - downloading.DownloadStatusTitle = DictionaryResource.GetString("WhileDownloading"); - downloading.DownloadContent = DictionaryResource.GetString("DownloadingDanmaku"); - // 下载大小 - downloading.DownloadingFileSize = string.Empty; - // 下载速度 - downloading.SpeedDisplay = string.Empty; - - string title = $"{downloading.Name}"; - string assFile = $"{downloading.DownloadBase.FilePath}.ass"; - - // 记录本次下载的文件 - if (!downloading.Downloading.DownloadFiles.ContainsKey("danmaku")) - { - downloading.Downloading.DownloadFiles.Add("danmaku", assFile); - } - - int screenWidth = SettingsManager.GetInstance().GetDanmakuScreenWidth(); - int screenHeight = SettingsManager.GetInstance().GetDanmakuScreenHeight(); - //if (SettingsManager.GetInstance().IsCustomDanmakuResolution() != AllowStatus.YES) - //{ - // if (downloadingEntity.Width > 0 && downloadingEntity.Height > 0) - // { - // screenWidth = downloadingEntity.Width; - // screenHeight = downloadingEntity.Height; - // } - //} - - // 字幕配置 - Config subtitleConfig = new Config - { - Title = title, - ScreenWidth = screenWidth, - ScreenHeight = screenHeight, - FontName = SettingsManager.GetInstance().GetDanmakuFontName(), - BaseFontSize = SettingsManager.GetInstance().GetDanmakuFontSize(), - LineCount = SettingsManager.GetInstance().GetDanmakuLineCount(), - LayoutAlgorithm = SettingsManager.GetInstance().GetDanmakuLayoutAlgorithm().ToString("G").ToLower(), // async/sync - TuneDuration = 0, - DropOffset = 0, - BottomMargin = 0, - CustomOffset = 0 - }; - - Core.Danmaku2Ass.Bilibili.GetInstance() - .SetTopFilter(SettingsManager.GetInstance().GetDanmakuTopFilter() == AllowStatus.YES) - .SetBottomFilter(SettingsManager.GetInstance().GetDanmakuBottomFilter() == AllowStatus.YES) - .SetScrollFilter(SettingsManager.GetInstance().GetDanmakuScrollFilter() == AllowStatus.YES) - .Create(downloading.DownloadBase.Avid, downloading.DownloadBase.Cid, subtitleConfig, assFile); - - return assFile; - } - - protected List BaseDownloadSubtitle(DownloadingItem downloading) - { - // 更新状态显示 - downloading.DownloadStatusTitle = DictionaryResource.GetString("WhileDownloading"); - downloading.DownloadContent = DictionaryResource.GetString("DownloadingSubtitle"); - // 下载大小 - downloading.DownloadingFileSize = string.Empty; - // 下载速度 - downloading.SpeedDisplay = string.Empty; - - List srtFiles = new List(); - - var subRipTexts = VideoStream.GetSubtitle(downloading.DownloadBase.Avid, downloading.DownloadBase.Bvid, downloading.DownloadBase.Cid); - if (subRipTexts == null) - { - return null; - } - - foreach (var subRip in subRipTexts) - { - string srtFile = $"{downloading.DownloadBase.FilePath}_{subRip.LanDoc}.srt"; - try - { - File.WriteAllText(srtFile, subRip.SrtString); - - // 记录本次下载的文件 - if (!downloading.Downloading.DownloadFiles.ContainsKey("subtitle")) - { - downloading.Downloading.DownloadFiles.Add("subtitle", srtFile); - } - - srtFiles.Add(srtFile); - } - catch (Exception e) - { - Core.Utils.Debugging.Console.PrintLine($"{Tag}.DownloadSubtitle()发生异常: {0}", e); - LogManager.Error($"{Tag}.DownloadSubtitle()", e); - } - } - - return srtFiles; - } - - protected string BaseMixedFlow(DownloadingItem downloading, string audioUid, string videoUid) - { - // 更新状态显示 - downloading.DownloadStatusTitle = DictionaryResource.GetString("MixedFlow"); - downloading.DownloadContent = DictionaryResource.GetString("DownloadingVideo"); - // 下载大小 - downloading.DownloadingFileSize = string.Empty; - // 下载速度 - downloading.SpeedDisplay = string.Empty; - - //if (videoUid == nullMark) - //{ - // return null; - //} - - string finalFile = $"{downloading.DownloadBase.FilePath}.mp4"; - if (videoUid == null) - { - finalFile = $"{downloading.DownloadBase.FilePath}.aac"; - } - - // 合并音视频 - FFmpegHelper.MergeVideo(audioUid, videoUid, finalFile); - - // 获取文件大小 - if (File.Exists(finalFile)) - { - FileInfo info = new FileInfo(finalFile); - downloading.FileSize = Format.FormatFileSize(info.Length); - } - else - { - downloading.FileSize = Format.FormatFileSize(0); - } - - return finalFile; - } - - protected void BaseParse(DownloadingItem downloading) - { - // 更新状态显示 - downloading.DownloadStatusTitle = DictionaryResource.GetString("Parsing"); - downloading.DownloadContent = string.Empty; - // 下载大小 - downloading.DownloadingFileSize = string.Empty; - downloading.Progress = 0; - // 下载速度 - downloading.SpeedDisplay = string.Empty; - - if (downloading.PlayUrl != null && downloading.Downloading.DownloadStatus == DownloadStatus.NOT_STARTED) - { - // 设置下载状态 - downloading.Downloading.DownloadStatus = DownloadStatus.DOWNLOADING; - - return; - } - - // 设置下载状态 - downloading.Downloading.DownloadStatus = DownloadStatus.DOWNLOADING; - - // 解析 - switch (downloading.Downloading.PlayStreamType) - { - case PlayStreamType.VIDEO: - downloading.PlayUrl = VideoStream.GetVideoPlayUrl(downloading.DownloadBase.Avid, downloading.DownloadBase.Bvid, downloading.DownloadBase.Cid); - break; - case PlayStreamType.BANGUMI: - downloading.PlayUrl = VideoStream.GetBangumiPlayUrl(downloading.DownloadBase.Avid, downloading.DownloadBase.Bvid, downloading.DownloadBase.Cid); - break; - case PlayStreamType.CHEESE: - downloading.PlayUrl = VideoStream.GetCheesePlayUrl(downloading.DownloadBase.Avid, downloading.DownloadBase.Bvid, downloading.DownloadBase.Cid, downloading.DownloadBase.EpisodeId); - break; - default: - break; - } - } - - /// - /// 执行任务 - /// - protected async Task DoWork() - { - // 上次循环时正在下载的数量 - int lastDownloadingCount = 0; - - while (true) - { - int maxDownloading = SettingsManager.GetInstance().GetMaxCurrentDownloads(); - int downloadingCount = 0; - - try - { - downloadingTasks.RemoveAll((m) => m.IsCompleted); - foreach (DownloadingItem downloading in downloadingList) - { - if (downloading.Downloading.DownloadStatus == DownloadStatus.DOWNLOADING) - { - downloadingCount++; - } - } - - foreach (DownloadingItem downloading in downloadingList) - { - if (downloadingCount >= maxDownloading) - { - break; - } - - // 开始下载 - if (downloading.Downloading.DownloadStatus == DownloadStatus.NOT_STARTED || downloading.Downloading.DownloadStatus == DownloadStatus.WAIT_FOR_DOWNLOAD) - { - //这里需要立刻设置状态,否则如果SingleDownload没有及时执行,会重复创建任务 - downloading.Downloading.DownloadStatus = DownloadStatus.DOWNLOADING; - downloadingTasks.Add(SingleDownload(downloading)); - downloadingCount++; - } - } - } - catch (InvalidOperationException e) - { - Core.Utils.Debugging.Console.PrintLine($"{Tag}.DoWork()发生InvalidOperationException异常: {0}", e); - LogManager.Error($"{Tag}.DoWork() InvalidOperationException", e); - } - catch (Exception e) - { - Core.Utils.Debugging.Console.PrintLine($"{Tag}.DoWork()发生异常: {0}", e); - LogManager.Error($"{Tag}.DoWork()", e); - } - - // 判断是否该结束线程,若为true,跳出while循环 - if (cancellationToken.IsCancellationRequested) - { - Core.Utils.Debugging.Console.PrintLine($"{Tag}.DoWork() 下载服务结束,跳出while循环"); - LogManager.Debug($"{Tag}.DoWork()", "下载服务结束"); - break; - } - - // 判断下载列表中的视频是否全部下载完成 - if (lastDownloadingCount > 0 && downloadingList.Count == 0 && downloadedList.Count > 0) - { - AfterDownload(); - } - lastDownloadingCount = downloadingList.Count; - - // 降低CPU占用 - await Task.Delay(500); - } - - await Task.WhenAny(Task.WhenAll(downloadingTasks), Task.Delay(30000)); - foreach (Task tsk in downloadingTasks.FindAll((m) => !m.IsCompleted)) - { - Core.Utils.Debugging.Console.PrintLine($"{Tag}.DoWork() 任务结束超时"); - LogManager.Debug($"{Tag}.DoWork()", "任务结束超时"); - } - } - - /// - /// 下载一个视频 - /// - /// - /// - private async Task SingleDownload(DownloadingItem downloading) - { - // 路径 - downloading.DownloadBase.FilePath = downloading.DownloadBase.FilePath.Replace("\\", "/"); - string[] temp = downloading.DownloadBase.FilePath.Split('/'); - //string path = downloading.DownloadBase.FilePath.Replace(temp[temp.Length - 1], ""); - string path = downloading.DownloadBase.FilePath.TrimEnd(temp[temp.Length - 1].ToCharArray()); - - // 路径不存在则创建 - if (!Directory.Exists(path)) - { - try - { - Directory.CreateDirectory(path); - } - catch (Exception e) - { - Core.Utils.Debugging.Console.PrintLine(Tag, e.ToString()); - LogManager.Debug(Tag, e.Message); - - AlertService alertService = new AlertService(dialogService); - ButtonResult result = alertService.ShowError($"{path}{DictionaryResource.GetString("DirectoryError")}"); - - return; - } - } - - try - { - await Task.Run(new Action(() => - { - // 初始化 - downloading.DownloadStatusTitle = string.Empty; - downloading.DownloadContent = string.Empty; - //downloading.Downloading.DownloadFiles.Clear(); - - // 解析并依次下载音频、视频、弹幕、字幕、封面等内容 - Parse(downloading); - - // 暂停 - Pause(downloading); - - string audioUid = null; - // 如果需要下载音频 - if (downloading.DownloadBase.NeedDownloadContent["downloadAudio"]) - { - //audioUid = DownloadAudio(downloading); - for (int i = 0; i < retry; i++) - { - audioUid = DownloadAudio(downloading); - if (audioUid != null && audioUid != nullMark) - { - break; - } - } - } - if (audioUid == nullMark) - { - DownloadFailed(downloading); - return; - } - - // 暂停 - Pause(downloading); - - string videoUid = null; - // 如果需要下载视频 - if (downloading.DownloadBase.NeedDownloadContent["downloadVideo"]) - { - //videoUid = DownloadVideo(downloading); - for (int i = 0; i < retry; i++) - { - videoUid = DownloadVideo(downloading); - if (videoUid != null && videoUid != nullMark) - { - break; - } - } - } - if (videoUid == nullMark) - { - DownloadFailed(downloading); - return; - } - - // 暂停 - Pause(downloading); - - string outputDanmaku = null; - // 如果需要下载弹幕 - if (downloading.DownloadBase.NeedDownloadContent["downloadDanmaku"]) - { - outputDanmaku = DownloadDanmaku(downloading); - } - - // 暂停 - Pause(downloading); - - List outputSubtitles = null; - // 如果需要下载字幕 - if (downloading.DownloadBase.NeedDownloadContent["downloadSubtitle"]) - { - outputSubtitles = DownloadSubtitle(downloading); - } - - // 暂停 - Pause(downloading); - - string outputCover = null; - string outputPageCover = null; - // 如果需要下载封面 - if (downloading.DownloadBase.NeedDownloadContent["downloadCover"]) - { - // page的封面 - string pageCoverFileName = $"{downloading.DownloadBase.FilePath}.{GetImageExtension(downloading.DownloadBase.PageCoverUrl)}"; - outputPageCover = DownloadCover(downloading, downloading.DownloadBase.PageCoverUrl, pageCoverFileName); - - - string coverFileName = $"{downloading.DownloadBase.FilePath}.Cover.{GetImageExtension(downloading.DownloadBase.CoverUrl)}"; - // 封面 - //outputCover = DownloadCover(downloading, downloading.DownloadBase.CoverUrl, $"{path}/Cover.{GetImageExtension(downloading.DownloadBase.CoverUrl)}"); - outputCover = DownloadCover(downloading, downloading.DownloadBase.CoverUrl, coverFileName); - } - - // 暂停 - Pause(downloading); - - // 混流 - string outputMedia = string.Empty; - if (downloading.DownloadBase.NeedDownloadContent["downloadAudio"] || downloading.DownloadBase.NeedDownloadContent["downloadVideo"]) - { - outputMedia = MixedFlow(downloading, audioUid, videoUid); - } - - // 这里本来只有IsExist,没有pause,不知道怎么处理 - // 是否存在 - //isExist = IsExist(downloading); - //if (!isExist.Result) - //{ - // return; - //} - - // 检测音频、视频是否下载成功 - bool isMediaSuccess = true; - if (downloading.DownloadBase.NeedDownloadContent["downloadAudio"] || downloading.DownloadBase.NeedDownloadContent["downloadVideo"]) - { - // 只有下载音频不下载视频时才输出aac - // 只要下载视频就输出mp4 - if (File.Exists(outputMedia)) - { - // 成功 - isMediaSuccess = true; - } - else - { - isMediaSuccess = false; - } - } - - // 检测弹幕是否下载成功 - bool isDanmakuSuccess = true; - if (downloading.DownloadBase.NeedDownloadContent["downloadDanmaku"]) - { - if (File.Exists(outputDanmaku)) - { - // 成功 - isDanmakuSuccess = true; - } - else - { - isDanmakuSuccess = false; - } - } - - // 检测字幕是否下载成功 - bool isSubtitleSuccess = true; - if (downloading.DownloadBase.NeedDownloadContent["downloadSubtitle"]) - { - if (outputSubtitles == null) - { - // 为null时表示不存在字幕 - } - else - { - foreach (string subtitle in outputSubtitles) - { - if (!File.Exists(subtitle)) - { - // 如果有一个不存在则失败 - isSubtitleSuccess = false; - } - } - } - } - - // 检测封面是否下载成功 - bool isCover = true; - if (downloading.DownloadBase.NeedDownloadContent["downloadCover"]) - { - if (File.Exists(outputCover) || File.Exists(outputPageCover)) - { - // 成功 - isCover = true; - } - else - { - isCover = false; - } - } - - if (!isMediaSuccess || !isDanmakuSuccess || !isSubtitleSuccess || !isCover) - { - DownloadFailed(downloading); - return; - } - - // 下载完成后处理 - Downloaded downloaded = new Downloaded - { - MaxSpeedDisplay = Format.FormatSpeed(downloading.Downloading.MaxSpeed), - }; - // 设置完成时间 - downloaded.SetFinishedTimestamp(new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds()); - - DownloadedItem downloadedItem = new DownloadedItem - { - DownloadBase = downloading.DownloadBase, - Downloaded = downloaded - }; - - App.PropertyChangeAsync(new Action(() => - { - // 加入到下载完成list中,并从下载中list去除 - downloadedList.Add(downloadedItem); - downloadingList.Remove(downloading); - - // 下载完成列表排序 - DownloadFinishedSort finishedSort = SettingsManager.GetInstance().GetDownloadFinishedSort(); - App.SortDownloadedList(finishedSort); - })); - _notifyIcon.ShowBalloonTip(DictionaryResource.GetString("DownloadSuccess"), $"{downloadedItem.DownloadBase.Name}", BalloonIcon.Info); - })); - } - catch (OperationCanceledException e) - { - Core.Utils.Debugging.Console.PrintLine(Tag, e.ToString()); - LogManager.Debug(Tag, e.Message); - } - } - - /// - /// 下载失败后的处理 - /// - /// - protected void DownloadFailed(DownloadingItem downloading) - { - downloading.DownloadStatusTitle = DictionaryResource.GetString("DownloadFailed"); - downloading.DownloadContent = string.Empty; - downloading.DownloadingFileSize = string.Empty; - downloading.SpeedDisplay = string.Empty; - downloading.Progress = 0; - - downloading.Downloading.DownloadStatus = DownloadStatus.DOWNLOAD_FAILED; - downloading.StartOrPause = ButtonIcon.Instance().Retry; - downloading.StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary"); - } - - /// - /// 获取图片的扩展名 - /// - /// - /// - protected string GetImageExtension(string coverUrl) - { - if (coverUrl == null) - { - return string.Empty; - } - - // 图片的扩展名 - string[] temp = coverUrl.Split('.'); - string fileExtension = temp[temp.Length - 1]; - return fileExtension; - } - - /// - /// 下载完成后的操作 - /// - protected void AfterDownload() - { - AfterDownloadOperation operation = SettingsManager.GetInstance().GetAfterDownloadOperation(); - switch (operation) - { - case AfterDownloadOperation.NONE: - // 没有操作 - break; - case AfterDownloadOperation.OPEN_FOLDER: - // 打开文件夹 - break; - case AfterDownloadOperation.CLOSE_APP: - // 关闭程序 - App.PropertyChangeAsync(() => - { - System.Windows.Application.Current.Shutdown(); - }); - break; - case AfterDownloadOperation.CLOSE_SYSTEM: - // 关机 - System.Diagnostics.Process.Start("shutdown.exe", "-s"); - break; - default: - break; - } - } - - /// - /// 停止基本下载服务(转换await和Task.Wait两种调用形式) - /// - protected async Task BaseEndTask() - { - // 结束任务 - tokenSource.Cancel(); - - await workTask; - - //先简单等待一下 - - // 下载数据存储服务 - DownloadStorageService downloadStorageService = new DownloadStorageService(); - // 保存数据 - foreach (DownloadingItem item in downloadingList) - { - switch (item.Downloading.DownloadStatus) - { - case DownloadStatus.NOT_STARTED: - break; - case DownloadStatus.WAIT_FOR_DOWNLOAD: - break; - case DownloadStatus.PAUSE_STARTED: - break; - case DownloadStatus.PAUSE: - break; - case DownloadStatus.DOWNLOADING: - // TODO 添加设置让用户选择重启后是否自动开始下载 - item.Downloading.DownloadStatus = DownloadStatus.WAIT_FOR_DOWNLOAD; - //item.Downloading.DownloadStatus = DownloadStatus.PAUSE; - break; - case DownloadStatus.DOWNLOAD_SUCCEED: - case DownloadStatus.DOWNLOAD_FAILED: - break; - default: - break; - } - - item.Progress = 0; - - downloadStorageService.UpdateDownloading(item); - } - foreach (DownloadedItem item in downloadedList) - { - downloadStorageService.UpdateDownloaded(item); - } - } - /// - /// 启动基本下载服务 - /// - protected void BaseStart() - { - tokenSource = new CancellationTokenSource(); - cancellationToken = tokenSource.Token; - _notifyIcon = new TaskbarIcon(); - _notifyIcon.IconSource = new BitmapImage(new Uri("pack://application:,,,/Resources/favicon.ico")); - - workTask = Task.Run(DoWork); - } - - #region 抽象接口函数 - public abstract void Parse(DownloadingItem downloading); - public abstract string DownloadAudio(DownloadingItem downloading); - public abstract string DownloadVideo(DownloadingItem downloading); - public abstract string DownloadDanmaku(DownloadingItem downloading); - public abstract List DownloadSubtitle(DownloadingItem downloading); - public abstract string DownloadCover(DownloadingItem downloading, string coverUrl, string fileName); - public abstract string MixedFlow(DownloadingItem downloading, string audioUid, string videoUid); - - protected abstract void Pause(DownloadingItem downloading); - #endregion - } -} diff --git a/src/DownKyi/Services/Download/DownloadStorageService.cs b/src/DownKyi/Services/Download/DownloadStorageService.cs deleted file mode 100644 index 5421aa9..0000000 --- a/src/DownKyi/Services/Download/DownloadStorageService.cs +++ /dev/null @@ -1,247 +0,0 @@ -using DownKyi.Core.Storage.Database.Download; -using DownKyi.Models; -using DownKyi.ViewModels.DownloadManager; -using System.Collections.Generic; - -namespace DownKyi.Services.Download -{ - public class DownloadStorageService - { - ~DownloadStorageService() - { - DownloadingDb downloadingDb = new DownloadingDb(); - downloadingDb.Close(); - DownloadedDb downloadedDb = new DownloadedDb(); - downloadedDb.Close(); - DownloadBaseDb downloadBaseDb = new DownloadBaseDb(); - downloadBaseDb.Close(); - } - - #region 下载中数据 - - /// - /// 添加下载中数据 - /// - /// - public void AddDownloading(DownloadingItem downloadingItem) - { - if (downloadingItem == null || downloadingItem.DownloadBase == null) { return; } - - AddDownloadBase(downloadingItem.DownloadBase); - - DownloadingDb downloadingDb = new DownloadingDb(); - object obj = downloadingDb.QueryById(downloadingItem.DownloadBase.Uuid); - if (obj == null) - { - downloadingDb.Insert(downloadingItem.DownloadBase.Uuid, downloadingItem.Downloading); - } - //downloadingDb.Close(); - } - - /// - /// 删除下载中数据 - /// - /// - public void RemoveDownloading(DownloadingItem downloadingItem) - { - if (downloadingItem == null || downloadingItem.DownloadBase == null) { return; } - - RemoveDownloadBase(downloadingItem.DownloadBase.Uuid); - - DownloadingDb downloadingDb = new DownloadingDb(); - downloadingDb.Delete(downloadingItem.DownloadBase.Uuid); - //downloadingDb.Close(); - } - - /// - /// 获取所有的下载中数据 - /// - /// - public List GetDownloading() - { - // 从数据库获取数据 - DownloadingDb downloadingDb = new DownloadingDb(); - Dictionary dic = downloadingDb.QueryAll(); - //downloadingDb.Close(); - - // 遍历 - List list = new List(); - foreach (KeyValuePair item in dic) - { - if (item.Value is Downloading downloading) - { - DownloadingItem downloadingItem = new DownloadingItem - { - DownloadBase = GetDownloadBase(item.Key), - Downloading = downloading - }; - - if (downloadingItem.DownloadBase == null) { continue; } - list.Add(downloadingItem); - } - } - - return list; - } - - /// - /// 修改下载中数据 - /// - /// - public void UpdateDownloading(DownloadingItem downloadingItem) - { - if (downloadingItem == null || downloadingItem.DownloadBase == null) { return; } - - UpdateDownloadBase(downloadingItem.DownloadBase); - - DownloadingDb downloadingDb = new DownloadingDb(); - downloadingDb.Update(downloadingItem.DownloadBase.Uuid, downloadingItem.Downloading); - //downloadingDb.Close(); - } - - #endregion - - #region 下载完成数据 - - /// - /// 添加下载完成数据 - /// - /// - public void AddDownloaded(DownloadedItem downloadedItem) - { - if (downloadedItem == null || downloadedItem.DownloadBase == null) { return; } - - AddDownloadBase(downloadedItem.DownloadBase); - - DownloadedDb downloadedDb = new DownloadedDb(); - object obj = downloadedDb.QueryById(downloadedItem.DownloadBase.Uuid); - if (obj == null) - { - downloadedDb.Insert(downloadedItem.DownloadBase.Uuid, downloadedItem.Downloaded); - } - //downloadedDb.Close(); - } - - /// - /// 删除下载完成数据 - /// - /// - public void RemoveDownloaded(DownloadedItem downloadedItem) - { - if (downloadedItem == null || downloadedItem.DownloadBase == null) { return; } - - RemoveDownloadBase(downloadedItem.DownloadBase.Uuid); - - DownloadedDb downloadedDb = new DownloadedDb(); - downloadedDb.Delete(downloadedItem.DownloadBase.Uuid); - //downloadedDb.Close(); - } - - /// - /// 获取所有的下载完成数据 - /// - /// - public List GetDownloaded() - { - // 从数据库获取数据 - DownloadedDb downloadedDb = new DownloadedDb(); - Dictionary dic = downloadedDb.QueryAll(); - //downloadedDb.Close(); - - // 遍历 - List list = new List(); - foreach (KeyValuePair item in dic) - { - if (item.Value is Downloaded downloaded) - { - DownloadedItem downloadedItem = new DownloadedItem - { - DownloadBase = GetDownloadBase(item.Key), - Downloaded = downloaded - }; - - if (downloadedItem.DownloadBase == null) { continue; } - list.Add(downloadedItem); - } - } - - return list; - } - - /// - /// 修改下载完成数据 - /// - /// - public void UpdateDownloaded(DownloadedItem downloadedItem) - { - if (downloadedItem == null || downloadedItem.DownloadBase == null) { return; } - - UpdateDownloadBase(downloadedItem.DownloadBase); - - DownloadedDb downloadedDb = new DownloadedDb(); - downloadedDb.Update(downloadedItem.DownloadBase.Uuid, downloadedItem.Downloaded); - //downloadedDb.Close(); - } - - #endregion - - #region DownloadBase - - /// - /// 向数据库添加DownloadBase - /// - /// - private void AddDownloadBase(DownloadBase downloadBase) - { - if (downloadBase == null) { return; } - - DownloadBaseDb downloadBaseDb = new DownloadBaseDb(); - object obj = downloadBaseDb.QueryById(downloadBase.Uuid); - if (obj == null) - { - downloadBaseDb.Insert(downloadBase.Uuid, downloadBase); - } - //downloadBaseDb.Close(); - } - - /// - /// 从数据库删除DownloadBase - /// - /// - private void RemoveDownloadBase(string uuid) - { - DownloadBaseDb downloadBaseDb = new DownloadBaseDb(); - downloadBaseDb.Delete(uuid); - //downloadBaseDb.Close(); - } - - /// - /// 从数据库获取所有的DownloadBase - /// - /// - private DownloadBase GetDownloadBase(string uuid) - { - DownloadBaseDb downloadBaseDb = new DownloadBaseDb(); - object obj = downloadBaseDb.QueryById(uuid); - //downloadBaseDb.Close(); - - return obj is DownloadBase downloadBase ? downloadBase : null; - } - - /// - /// 从数据库修改DownloadBase - /// - /// - private void UpdateDownloadBase(DownloadBase downloadBase) - { - if (downloadBase == null) { return; } - - DownloadBaseDb downloadBaseDb = new DownloadBaseDb(); - downloadBaseDb.Update(downloadBase.Uuid, downloadBase); - //downloadBaseDb.Close(); - } - - #endregion - - } -} diff --git a/src/DownKyi/Services/Download/IDownloadService.cs b/src/DownKyi/Services/Download/IDownloadService.cs deleted file mode 100644 index fea9835..0000000 --- a/src/DownKyi/Services/Download/IDownloadService.cs +++ /dev/null @@ -1,19 +0,0 @@ -using DownKyi.ViewModels.DownloadManager; -using System.Collections.Generic; - -namespace DownKyi.Services.Download -{ - public interface IDownloadService - { - void Parse(DownloadingItem downloading); - string DownloadAudio(DownloadingItem downloading); - string DownloadVideo(DownloadingItem downloading); - string DownloadDanmaku(DownloadingItem downloading); - List DownloadSubtitle(DownloadingItem downloading); - string DownloadCover(DownloadingItem downloading, string coverUrl, string fileName); - string MixedFlow(DownloadingItem downloading, string audioUid, string videoUid); - - void Start(); - void End(); - } -} diff --git a/src/DownKyi/Services/FavoritesService.cs b/src/DownKyi/Services/FavoritesService.cs deleted file mode 100644 index 05df126..0000000 --- a/src/DownKyi/Services/FavoritesService.cs +++ /dev/null @@ -1,232 +0,0 @@ -using DownKyi.Core.BiliApi.Favorites; -using DownKyi.Core.Storage; -using DownKyi.Core.Utils; -using DownKyi.ViewModels.PageViewModels; -using Prism.Events; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Threading; -using System.Windows.Media.Imaging; - -namespace DownKyi.Services -{ - public class FavoritesService : IFavoritesService - { - /// - /// 获取收藏夹元数据 - /// - /// - /// - public Favorites GetFavorites(long mediaId) - { - var favoritesMetaInfo = FavoritesInfo.GetFavoritesInfo(mediaId); - if (favoritesMetaInfo == null) { return null; } - - // 查询、保存封面 - StorageCover storageCover = new StorageCover(); - string coverUrl = favoritesMetaInfo.Cover; - BitmapImage cover = storageCover.GetCoverThumbnail(favoritesMetaInfo.Id, "Favorites", favoritesMetaInfo.Mid, coverUrl, 300, 188); - - // 获取用户头像 - string upName; - string header; - if (favoritesMetaInfo.Upper != null) - { - upName = favoritesMetaInfo.Upper.Name; - StorageHeader storageHeader = new StorageHeader(); - header = storageHeader.GetHeader(favoritesMetaInfo.Upper.Mid, favoritesMetaInfo.Upper.Name, favoritesMetaInfo.Upper.Face); - } - else - { - upName = ""; - header = null; - } - - // 为Favorites赋值 - Favorites favorites = new Favorites(); - App.PropertyChangeAsync(new Action(() => - { - favorites.CoverUrl = coverUrl; - - favorites.Cover = cover; - favorites.Title = favoritesMetaInfo.Title; - - DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 - DateTime dateTime = startTime.AddSeconds(favoritesMetaInfo.Ctime); - favorites.CreateTime = dateTime.ToString("yyyy-MM-dd HH:mm:ss"); - - favorites.PlayNumber = Format.FormatNumber(favoritesMetaInfo.CntInfo.Play); - favorites.LikeNumber = Format.FormatNumber(favoritesMetaInfo.CntInfo.ThumbUp); - favorites.FavoriteNumber = Format.FormatNumber(favoritesMetaInfo.CntInfo.Collect); - favorites.ShareNumber = Format.FormatNumber(favoritesMetaInfo.CntInfo.Share); - favorites.Description = favoritesMetaInfo.Intro; - favorites.MediaCount = favoritesMetaInfo.MediaCount; - - favorites.UpName = upName; - if (header != null) - { - StorageHeader storageHeader = new StorageHeader(); - favorites.UpHeader = storageHeader.GetHeaderThumbnail(header, 48, 48); - - favorites.UpperMid = favoritesMetaInfo.Upper.Mid; - } - else - { - favorites.UpHeader = null; - } - })); - - return favorites; - } - - ///// - ///// 获取收藏夹所有内容明细列表 - ///// - ///// - ///// - ///// - //public void GetFavoritesMediaList(long mediaId, ObservableCollection result, IEventAggregator eventAggregator, CancellationToken cancellationToken) - //{ - // List medias = FavoritesResource.GetAllFavoritesMedia(mediaId); - // if (medias.Count == 0) { return; } - - // GetFavoritesMediaList(medias, result, eventAggregator, cancellationToken); - //} - - ///// - ///// 获取收藏夹指定页的内容明细列表 - ///// - ///// - ///// - ///// - ///// - ///// - //public void GetFavoritesMediaList(long mediaId, int pn, int ps, ObservableCollection result, IEventAggregator eventAggregator, CancellationToken cancellationToken) - //{ - // List medias = FavoritesResource.GetFavoritesMedia(mediaId, pn, ps); - // if (medias.Count == 0) { return; } - - // GetFavoritesMediaList(medias, result, eventAggregator, cancellationToken); - //} - - /// - /// 获取收藏夹内容明细列表 - /// - /// - /// - /// - public void GetFavoritesMediaList(List medias, ObservableCollection result, IEventAggregator eventAggregator, CancellationToken cancellationToken) - { - int order = 0; - foreach (var media in medias) - { - if (media.Title == "已失效视频") { continue; } - - order++; - - // 查询、保存封面 - StorageCover storageCover = new StorageCover(); - string coverUrl = media.Cover; - BitmapImage cover = storageCover.GetCoverThumbnail(media.Id, media.Bvid, -1, coverUrl, 200, 125); - - // 当地时区 - DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); - - // 创建时间 - DateTime dateCTime = startTime.AddSeconds(media.Ctime); - string ctime = dateCTime.ToString("yyyy-MM-dd"); - - // 收藏时间 - DateTime dateFavTime = startTime.AddSeconds(media.FavTime); - string favTime = dateFavTime.ToString("yyyy-MM-dd"); - - App.PropertyChangeAsync(new Action(() => - { - FavoritesMedia newMedia = new FavoritesMedia(eventAggregator) - { - Avid = media.Id, - Bvid = media.Bvid, - Order = order, - Cover = cover, - Title = media.Title, - PlayNumber = media.CntInfo != null ? Format.FormatNumber(media.CntInfo.Play) : "0", - DanmakuNumber = media.CntInfo != null ? Format.FormatNumber(media.CntInfo.Danmaku) : "0", - FavoriteNumber = media.CntInfo != null ? Format.FormatNumber(media.CntInfo.Collect) : "0", - Duration = Format.FormatDuration2(media.Duration), - UpName = media.Upper != null ? media.Upper.Name : string.Empty, - UpMid = media.Upper != null ? media.Upper.Mid : -1, - CreateTime = ctime, - FavTime = favTime - }; - - if (!result.ToList().Exists(t => t.Avid == newMedia.Avid)) - { - result.Add(newMedia); - Thread.Sleep(10); - } - })); - - // 判断是否该结束线程,若为true,跳出循环 - if (cancellationToken.IsCancellationRequested) - { - break; - } - } - } - - /// - /// 更新我创建的收藏夹列表 - /// - /// - /// - public void GetCreatedFavorites(long mid, ObservableCollection tabHeaders, CancellationToken cancellationToken) - { - var favorites = FavoritesInfo.GetAllCreatedFavorites(mid); - if (favorites.Count == 0) { return; } - - foreach (var item in favorites) - { - //cancellationToken.ThrowIfCancellationRequested(); - - // 判断是否该结束线程,若为true,跳出循环 - if (cancellationToken.IsCancellationRequested) - { - break; - } - - App.PropertyChangeAsync(new Action(() => - { - tabHeaders.Add(new TabHeader { Id = item.Id, Title = item.Title, SubTitle = item.MediaCount.ToString() }); - })); - } - } - - /// - /// 更新我收藏的收藏夹列表 - /// - /// - /// - public void GetCollectedFavorites(long mid, ObservableCollection tabHeaders, CancellationToken cancellationToken) - { - var favorites = FavoritesInfo.GetAllCollectedFavorites(mid); - if (favorites.Count == 0) { return; } - - foreach (var item in favorites) - { - // 判断是否该结束线程,若为true,跳出循环 - if (cancellationToken.IsCancellationRequested) - { - break; - } - - App.PropertyChangeAsync(new Action(() => - { - tabHeaders.Add(new TabHeader { Id = item.Id, Title = item.Title, SubTitle = item.MediaCount.ToString() }); - })); - } - } - - } -} diff --git a/src/DownKyi/Services/IFavoritesService.cs b/src/DownKyi/Services/IFavoritesService.cs deleted file mode 100644 index 9770e92..0000000 --- a/src/DownKyi/Services/IFavoritesService.cs +++ /dev/null @@ -1,19 +0,0 @@ -using DownKyi.ViewModels.PageViewModels; -using Prism.Events; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Threading; - -namespace DownKyi.Services -{ - public interface IFavoritesService - { - Favorites GetFavorites(long mediaId); - //void GetFavoritesMediaList(long mediaId, ObservableCollection result, IEventAggregator eventAggregator, CancellationToken cancellationToken); - //void GetFavoritesMediaList(long mediaId, int pn, int ps, ObservableCollection result, IEventAggregator eventAggregator, CancellationToken cancellationToken); - void GetFavoritesMediaList(List medias, ObservableCollection result, IEventAggregator eventAggregator, CancellationToken cancellationToken); - - void GetCreatedFavorites(long mid, ObservableCollection tabHeaders, CancellationToken cancellationToken); - void GetCollectedFavorites(long mid, ObservableCollection tabHeaders, CancellationToken cancellationToken); - } -} diff --git a/src/DownKyi/Services/IInfoService.cs b/src/DownKyi/Services/IInfoService.cs deleted file mode 100644 index 43bd09b..0000000 --- a/src/DownKyi/Services/IInfoService.cs +++ /dev/null @@ -1,16 +0,0 @@ -using DownKyi.ViewModels.PageViewModels; -using System.Collections.Generic; - -namespace DownKyi.Services -{ - public interface IInfoService - { - VideoInfoView GetVideoView(); - - List GetVideoSections(bool noUgc); - - List GetVideoPages(); - - void GetVideoStream(VideoPage page); - } -} diff --git a/src/DownKyi/Services/SearchService.cs b/src/DownKyi/Services/SearchService.cs deleted file mode 100644 index 5e600d9..0000000 --- a/src/DownKyi/Services/SearchService.cs +++ /dev/null @@ -1,118 +0,0 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Utils; -using DownKyi.ViewModels; -using Prism.Events; - -namespace DownKyi.Services -{ - public class SearchService - { - /// - /// 解析支持的输入, - /// 支持的格式有: - /// av号:av170001, AV170001, https://www.bilibili.com/video/av170001 - /// BV号:BV17x411w7KC, https://www.bilibili.com/video/BV17x411w7KC, https://b23.tv/BV17x411w7KC - /// 番剧(电影、电视剧)ss号:ss32982, SS32982, https://www.bilibili.com/bangumi/play/ss32982 - /// 番剧(电影、电视剧)ep号:ep317925, EP317925, https://www.bilibili.com/bangumi/play/ep317925 - /// 番剧(电影、电视剧)md号:md28228367, MD28228367, https://www.bilibili.com/bangumi/media/md28228367 - /// 课程ss号:https://www.bilibili.com/cheese/play/ss205 - /// 课程ep号:https://www.bilibili.com/cheese/play/ep3489 - /// 收藏夹:ml1329019876, ML1329019876, https://www.bilibili.com/medialist/detail/ml1329019876, https://www.bilibili.com/medialist/play/ml1329019876/ - /// 用户空间:uid928123, UID928123, uid:928123, UID:928123, https://space.bilibili.com/928123 - /// - /// - /// - /// - /// - public bool BiliInput(string input, string parentViewName, IEventAggregator eventAggregator) - { - // 移除剪贴板id - string justId = input.Replace(AppConstant.ClipboardId, ""); - - // 视频 - if (ParseEntrance.IsAvId(justId)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, $"{ParseEntrance.VideoUrl}{input.ToLower()}"); - } - else if (ParseEntrance.IsAvUrl(justId)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, input); - } - else if (ParseEntrance.IsBvId(justId)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, $"{ParseEntrance.VideoUrl}{input}"); - } - else if (ParseEntrance.IsBvUrl(justId)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, input); - } - // 番剧(电影、电视剧) - else if (ParseEntrance.IsBangumiSeasonId(justId)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, $"{ParseEntrance.BangumiUrl}{input.ToLower()}"); - } - else if (ParseEntrance.IsBangumiSeasonUrl(justId)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, input); - } - else if (ParseEntrance.IsBangumiEpisodeId(justId)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, $"{ParseEntrance.BangumiUrl}{input.ToLower()}"); - } - else if (ParseEntrance.IsBangumiEpisodeUrl(justId)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, input); - } - else if (ParseEntrance.IsBangumiMediaId(justId)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, $"{ParseEntrance.BangumiMediaUrl}{input.ToLower()}"); - } - else if (ParseEntrance.IsBangumiMediaUrl(justId)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, input); - } - // 课程 - else if (ParseEntrance.IsCheeseSeasonUrl(justId) - || ParseEntrance.IsCheeseEpisodeUrl(justId)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, input); - } - // 用户(参数传入mid) - else if (ParseEntrance.IsUserId(justId)) - { - NavigateToView.NavigateToViewUserSpace(eventAggregator, ViewIndexViewModel.Tag, ParseEntrance.GetUserId(input)); - } - else if (ParseEntrance.IsUserUrl(justId)) - { - NavigateToView.NavigateToViewUserSpace(eventAggregator, ViewIndexViewModel.Tag, ParseEntrance.GetUserId(input)); - } - // 收藏夹 - else if (ParseEntrance.IsFavoritesId(justId)) - { - NavigateToView.NavigationView(eventAggregator, ViewPublicFavoritesViewModel.Tag, parentViewName, ParseEntrance.GetFavoritesId(input)); - } - else if (ParseEntrance.IsFavoritesUrl(justId)) - { - NavigateToView.NavigationView(eventAggregator, ViewPublicFavoritesViewModel.Tag, parentViewName, ParseEntrance.GetFavoritesId(input)); - } - else - { - return false; - } - return true; - } - - /// - /// 搜索关键词 - /// - /// - /// - /// - public void SearchKey(string key, string parentViewName, IEventAggregator eventAggregator) - { - // TODO - } - - - } -} diff --git a/src/DownKyi/Services/Utils.cs b/src/DownKyi/Services/Utils.cs deleted file mode 100644 index 16ceeb9..0000000 --- a/src/DownKyi/Services/Utils.cs +++ /dev/null @@ -1,265 +0,0 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Core.BiliApi.VideoStream.Models; -using DownKyi.Core.Settings; -using DownKyi.Core.Settings.Models; -using DownKyi.Core.Utils; -using DownKyi.ViewModels.PageViewModels; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; - -namespace DownKyi.Services -{ - internal static class Utils - { - /// - /// 从视频流更新VideoPage - /// - /// - /// - internal static void VideoPageInfo(PlayUrl playUrl, VideoPage page) - { - if (playUrl == null) - { - return; - } - - // 视频流信息 - page.PlayUrl = playUrl; - - // 获取设置 - UserInfoSettings userInfo = SettingsManager.GetInstance().GetUserInfo(); - int defaultQuality = SettingsManager.GetInstance().GetQuality(); - int videoCodecs = SettingsManager.GetInstance().GetVideoCodecs(); - int defaultAudioQuality = SettingsManager.GetInstance().GetAudioQuality(); - - // 未登录时,最高仅720P - if (userInfo.Mid == -1) - { - if (defaultQuality > 64) - { - defaultQuality = 64; - } - } - - // 非大会员账户登录时,如果设置的画质高于1080P,则这里限制为1080P - if (!userInfo.IsVip) - { - if (defaultQuality > 80) - { - defaultQuality = 80; - } - } - - if (playUrl.Durl != null) - { - // 音质 - - // 画质 - - // 视频编码 - - // 时长 - - return; - } - - if (playUrl.Dash != null) - { - // 如果video列表或者audio列表没有内容,则返回false - if (playUrl.Dash.Video == null) { return; } - if (playUrl.Dash.Video.Count == 0) { return; } - - // 音质 - page.AudioQualityFormatList = GetAudioQualityFormatList(playUrl, defaultAudioQuality); - if (page.AudioQualityFormatList.Count > 0) - { - page.AudioQualityFormat = page.AudioQualityFormatList[0]; - } - - // 画质 & 视频编码 - page.VideoQualityList = GetVideoQualityList(playUrl, userInfo, defaultQuality, videoCodecs); - if (page.VideoQualityList.Count > 0) - { - page.VideoQuality = page.VideoQualityList[0]; - } - - // 时长 - page.Duration = Format.FormatDuration(playUrl.Dash.Duration); - - return; - } - } - - /// - /// 设置音质 - /// - /// - /// - /// - private static ObservableCollection GetAudioQualityFormatList(PlayUrl playUrl, int defaultAudioQuality) - { - List audioQualityFormatList = new List(); - List sortList = new List(); - List audioQualities = Constant.GetAudioQualities(); - - if (playUrl.Dash.Audio != null && playUrl.Dash.Audio.Count > 0) - { - foreach (PlayUrlDashVideo audio in playUrl.Dash.Audio) - { - // 音质id大于设置音质时,跳过 - if (audio.Id > defaultAudioQuality) { continue; } - - Quality audioQuality = audioQualities.FirstOrDefault(t => { return t.Id == audio.Id; }); - if (audioQuality != null) - { - ListHelper.AddUnique(audioQualityFormatList, audioQuality.Name); - } - } - } - - if (audioQualities[3].Id <= defaultAudioQuality - 1000 && playUrl.Dash.Dolby != null) - { - if (playUrl.Dash.Dolby.Audio != null && playUrl.Dash.Dolby.Audio.Count > 0) - { - ListHelper.AddUnique(audioQualityFormatList, audioQualities[3].Name); - } - } - - if (audioQualities[4].Id <= defaultAudioQuality - 1000 && playUrl.Dash.Flac != null) - { - if (playUrl.Dash.Flac.Audio != null) - { - ListHelper.AddUnique(audioQualityFormatList, audioQualities[4].Name); - } - } - - //audioQualityFormatList.Sort(new StringLogicalComparer()); - //audioQualityFormatList.Reverse(); - - foreach (var item in audioQualities) - { - if (audioQualityFormatList.Contains(item.Name)) - { - sortList.Add(item.Name); - } - } - sortList.Reverse(); - - return new ObservableCollection(sortList); - } - - /// - /// 设置画质 & 视频编码 - /// - /// - /// - /// - /// - /// - private static List GetVideoQualityList(PlayUrl playUrl, UserInfoSettings userInfo, int defaultQuality, int videoCodecs) - { - List videoQualityList = new List(); - List codeIds = Constant.GetCodecIds(); - - if (playUrl.Dash.Video == null) - { - return videoQualityList; - } - - foreach (PlayUrlDashVideo video in playUrl.Dash.Video) - { - // 画质id大于设置画质时,跳过 - if (video.Id > defaultQuality) { continue; } - - // 非大会员账户登录时 - if (!userInfo.IsVip) - { - // 如果画质为720P60,跳过 - if (video.Id == 74) { continue; } - } - - string qualityFormat = string.Empty; - PlayUrlSupportFormat selectedQuality = playUrl.SupportFormats.FirstOrDefault(t => t.Quality == video.Id); - if (selectedQuality != null) - { - qualityFormat = selectedQuality.NewDescription; - } - - // 寻找是否已存在这个画质 - // 不存在则添加,存在则修改 - //string codecName = GetVideoCodecName(video.Codecs); - string codecName = codeIds.FirstOrDefault(t => t.Id == video.CodecId).Name; - VideoQuality videoQualityExist = videoQualityList.FirstOrDefault(t => t.Quality == video.Id); - if (videoQualityExist == null) - { - List videoCodecList = new List(); - if (codecName != string.Empty) - { - ListHelper.AddUnique(videoCodecList, codecName); - } - - VideoQuality videoQuality = new VideoQuality() - { - Quality = video.Id, - QualityFormat = qualityFormat, - VideoCodecList = videoCodecList - }; - videoQualityList.Add(videoQuality); - } - else - { - if (!videoQualityList[videoQualityList.IndexOf(videoQualityExist)].VideoCodecList.Exists(t => t.Equals(codecName))) - { - if (codecName != string.Empty) - { - videoQualityList[videoQualityList.IndexOf(videoQualityExist)].VideoCodecList.Add(codecName); - } - } - } - - // 设置选中的视频编码 - VideoQuality selectedVideoQuality = videoQualityList.FirstOrDefault(t => t.Quality == video.Id); - if (selectedVideoQuality == null) { continue; } - - // 设置选中的视频编码 - string videoCodecsName = codeIds.FirstOrDefault(t => t.Id == videoCodecs).Name; - if (videoQualityList[videoQualityList.IndexOf(selectedVideoQuality)].VideoCodecList.Contains(videoCodecsName)) - { - videoQualityList[videoQualityList.IndexOf(selectedVideoQuality)].SelectedVideoCodec = videoCodecsName; - } - else - { - // 当获取的视频没有设置的视频编码时 - foreach (Quality codec in codeIds) - { - if (videoQualityList[videoQualityList.IndexOf(selectedVideoQuality)].VideoCodecList.Contains(codec.Name)) - { - videoQualityList[videoQualityList.IndexOf(selectedVideoQuality)].SelectedVideoCodec = codec.Name; - } - - if (codec.Id == videoCodecs) - { - break; - } - } - - // 若默认编码为AVC,但画质为杜比视界时, - // 上面的foreach不会选中HEVC编码, - // 而杜比视界只有HEVC编码, - // 因此这里再判断并设置一次 - if (videoQualityList[videoQualityList.IndexOf(selectedVideoQuality)].SelectedVideoCodec == null && - videoQualityList[videoQualityList.IndexOf(selectedVideoQuality)].VideoCodecList.Count() > 0) - { - videoQualityList[videoQualityList.IndexOf(selectedVideoQuality)].SelectedVideoCodec = - videoQualityList[videoQualityList.IndexOf(selectedVideoQuality)].VideoCodecList[0]; - } - } - - } - - return videoQualityList; - } - - } -} diff --git a/src/DownKyi/Services/VideoInfoService.cs b/src/DownKyi/Services/VideoInfoService.cs deleted file mode 100644 index ed9738b..0000000 --- a/src/DownKyi/Services/VideoInfoService.cs +++ /dev/null @@ -1,303 +0,0 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Core.BiliApi.Video; -using DownKyi.Core.BiliApi.Video.Models; -using DownKyi.Core.BiliApi.VideoStream; -using DownKyi.Core.Settings; -using DownKyi.Core.Storage; -using DownKyi.Core.Utils; -using DownKyi.ViewModels.PageViewModels; -using System; -using System.Collections.Generic; -using System.Windows.Media.Imaging; - -namespace DownKyi.Services -{ - public class VideoInfoService : IInfoService - { - private readonly VideoView videoView; - - public VideoInfoService(string input) - { - if (input == null) - { - return; - } - - if (ParseEntrance.IsAvId(input) || ParseEntrance.IsAvUrl(input)) - { - long avid = ParseEntrance.GetAvId(input); - videoView = VideoInfo.VideoViewInfo(null, avid); - } - - if (ParseEntrance.IsBvId(input) || ParseEntrance.IsBvUrl(input)) - { - string bvid = ParseEntrance.GetBvId(input); - videoView = VideoInfo.VideoViewInfo(bvid); - } - } - - /// - /// 获取视频剧集 - /// - /// - public List GetVideoPages() - { - if (videoView == null) { return null; } - if (videoView.Pages == null) { return null; } - if (videoView.Pages.Count == 0) { return null; } - - List videoPages = new List(); - - int order = 0; - foreach (var page in videoView.Pages) - { - order++; - - // 标题 - string name; - if (videoView.Pages.Count == 1) - { - name = videoView.Title; - } - else - { - //name = page.part; - if (page.Part == "") - { - // 如果page.part为空字符串 - name = $"{videoView.Title}-P{order}"; - } - else - { - name = page.Part; - } - } - - ViewModels.PageViewModels.VideoPage videoPage = new ViewModels.PageViewModels.VideoPage - { - Avid = videoView.Aid, - Bvid = videoView.Bvid, - Cid = page.Cid, - EpisodeId = -1, - FirstFrame = page.FirstFrame, - Order = order, - Name = name, - Duration = "N/A" - }; - - // UP主信息 - videoPage.Owner = videoView.Owner; - if (videoPage.Owner == null) - { - videoPage.Owner = new Core.BiliApi.Models.VideoOwner - { - Name = "", - Face = "", - Mid = -1, - }; - } - - // 文件命名中的时间格式 - string timeFormat = SettingsManager.GetInstance().GetFileNamePartTimeFormat(); - // 视频发布时间 - DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 - DateTime dateTime = startTime.AddSeconds(videoView.Pubdate); - videoPage.PublishTime = dateTime.ToString(timeFormat); - - videoPages.Add(videoPage); - } - - return videoPages; - } - - /// - /// 获取视频章节与剧集 - /// - /// - public List GetVideoSections(bool noUgc = false) - { - if (videoView == null) { return null; } - - List videoSections = new List(); - - // 不需要ugc内容 - if (noUgc) - { - videoSections.Add(new VideoSection - { - Id = 0, - Title = "default", - IsSelected = true, - VideoPages = GetVideoPages() - }); - - return videoSections; - } - - if (videoView.UgcSeason == null) { return null; } - if (videoView.UgcSeason.Sections == null) { return null; } - if (videoView.UgcSeason.Sections.Count == 0) { return null; } - - foreach (UgcSection section in videoView.UgcSeason.Sections) - { - List pages = new List(); - int order = 0; - foreach (var episode in section.Episodes) - { - order++; - ViewModels.PageViewModels.VideoPage page = new ViewModels.PageViewModels.VideoPage - { - Avid = episode.Aid, - Bvid = episode.Bvid, - Cid = episode.Cid, - EpisodeId = -1, - FirstFrame = episode.Page.FirstFrame, - Order = order, - Name = episode.Title, - Duration = "N/A" - }; - - // UP主信息 - page.Owner = videoView.Owner; - if (page.Owner == null) - { - page.Owner = new Core.BiliApi.Models.VideoOwner - { - Name = "", - Face = "", - Mid = -1, - }; - } - - // 文件命名中的时间格式 - string timeFormat = SettingsManager.GetInstance().GetFileNamePartTimeFormat(); - // 视频发布时间 - DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 - DateTime dateTime = startTime.AddSeconds(videoView.Pubdate); - page.PublishTime = dateTime.ToString(timeFormat); - // 这里的发布时间有问题, - // 如果是合集,也会执行这里, - // 但是发布时间是入口视频的,不是所有视频的 - // TODO 修复 - - pages.Add(page); - } - - VideoSection videoSection = new VideoSection - { - Id = section.Id, - Title = section.Title, - VideoPages = pages - }; - videoSections.Add(videoSection); - } - - videoSections[0].IsSelected = true; - - return videoSections; - } - - /// - /// 获取视频流的信息,从VideoPage返回 - /// - /// - public void GetVideoStream(ViewModels.PageViewModels.VideoPage page) - { - var playUrl = VideoStream.GetVideoPlayUrl(page.Avid, page.Bvid, page.Cid); - Utils.VideoPageInfo(playUrl, page); - } - - /// - /// 获取视频信息 - /// - /// - public VideoInfoView GetVideoView() - { - if (videoView == null) { return null; } - - // 查询、保存封面 - StorageCover storageCover = new StorageCover(); - string coverUrl = videoView.Pic; - string cover = storageCover.GetCover(videoView.Aid, videoView.Bvid, videoView.Cid, coverUrl); - - // 分区 - string videoZone = string.Empty; - var zoneList = Core.BiliApi.Zone.VideoZone.Instance().GetZones(); - var zone = zoneList.Find(it => it.Id == videoView.Tid); - if (zone != null) - { - var zoneParent = zoneList.Find(it => it.Id == zone.ParentId); - if (zoneParent != null) - { - videoZone = zoneParent.Name + ">" + zone.Name; - } - else - { - videoZone = zone.Name; - } - } - else - { - videoZone = videoView.Tname; - } - - // 获取用户头像 - string upName; - string header; - if (videoView.Owner != null) - { - upName = videoView.Owner.Name; - StorageHeader storageHeader = new StorageHeader(); - header = storageHeader.GetHeader(videoView.Owner.Mid, videoView.Owner.Name, videoView.Owner.Face); - } - else - { - upName = ""; - header = null; - } - - // 为videoInfoView赋值 - VideoInfoView videoInfoView = new VideoInfoView(); - App.PropertyChangeAsync(new Action(() => - { - videoInfoView.CoverUrl = coverUrl; - - videoInfoView.Cover = cover == null ? null : new BitmapImage(new Uri(cover)); - videoInfoView.Title = videoView.Title; - - // 分区id - videoInfoView.TypeId = videoView.Tid; - - videoInfoView.VideoZone = videoZone; - - DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 - DateTime dateTime = startTime.AddSeconds(videoView.Pubdate); - videoInfoView.CreateTime = dateTime.ToString("yyyy-MM-dd HH:mm:ss"); - - videoInfoView.PlayNumber = Format.FormatNumber(videoView.Stat.View); - videoInfoView.DanmakuNumber = Format.FormatNumber(videoView.Stat.Danmaku); - videoInfoView.LikeNumber = Format.FormatNumber(videoView.Stat.Like); - videoInfoView.CoinNumber = Format.FormatNumber(videoView.Stat.Coin); - videoInfoView.FavoriteNumber = Format.FormatNumber(videoView.Stat.Favorite); - videoInfoView.ShareNumber = Format.FormatNumber(videoView.Stat.Share); - videoInfoView.ReplyNumber = Format.FormatNumber(videoView.Stat.Reply); - videoInfoView.Description = videoView.Desc; - - videoInfoView.UpName = upName; - if (header != null) - { - StorageHeader storageHeader = new StorageHeader(); - videoInfoView.UpHeader = storageHeader.GetHeaderThumbnail(header, 48, 48); - - videoInfoView.UpperMid = videoView.Owner.Mid; - } - else - { - videoInfoView.UpHeader = null; - } - })); - - return videoInfoView; - } - } -} diff --git a/src/DownKyi/Themes/ColorBrush.xaml b/src/DownKyi/Themes/ColorBrush.xaml deleted file mode 100644 index 71ec9be..0000000 --- a/src/DownKyi/Themes/ColorBrush.xaml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/DownKyi/Themes/Colors/ColorDefault.xaml b/src/DownKyi/Themes/Colors/ColorDefault.xaml deleted file mode 100644 index b02719f..0000000 --- a/src/DownKyi/Themes/Colors/ColorDefault.xaml +++ /dev/null @@ -1,63 +0,0 @@ - - - Black - Black - white - - white - black - #FF6ECEF8 - #FF30B8F6 - #FFE81123 - #FFF1707A - - #FFFF4D3C - - #FF00A1D6 - #C800A1D6 - #7F00A1D6 - #3300A1D6 - - #FFFB7299 - - #FF00A1D6 - #FFFFFFFF - #FFFFFFFF - #FF00A1D6 - #FFBDBDBD - #FFE4E4E4 - #FFBDBDBD - #C8BDBDBD - #7FBDBDBD - #33BDBDBD - - #7F000000 - #33999999 - - #FFF4F4F4 - - #FFF4F4F4 - - #FF999999 - #7F999999 - #99000000 - - #7FD0D0D0 - #7FFFFFFF - #7FD0D0D0 - - #FFE4E4E4 - #FFF3CB85 - - white - black - #FF999999 - #FF757575 - - #FFFFAE00 - #FF02B5DA - - \ No newline at end of file diff --git a/src/DownKyi/Themes/Colors/ColorDiy.xaml b/src/DownKyi/Themes/Colors/ColorDiy.xaml deleted file mode 100644 index 268726e..0000000 --- a/src/DownKyi/Themes/Colors/ColorDiy.xaml +++ /dev/null @@ -1,29 +0,0 @@ - - - Black - Black - #7FD0D0D0 - - white - black - #FF6ECEF8 - #FF30B8F6 - #FFF1707A - #FFE81123 - - #FF00A1D6 - #FF00A1D6 - #FFFFFFFF - #FFFFFFFF - #FF00A1D6 - - #7FD0D0D0 - #7FD0D0D0 - - white - black - - \ No newline at end of file diff --git a/src/DownKyi/Themes/Styles/StyleBtn.xaml b/src/DownKyi/Themes/Styles/StyleBtn.xaml deleted file mode 100644 index dd31b21..0000000 --- a/src/DownKyi/Themes/Styles/StyleBtn.xaml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/DownKyi/Themes/Styles/StyleCheckBox.xaml b/src/DownKyi/Themes/Styles/StyleCheckBox.xaml deleted file mode 100644 index 306c924..0000000 --- a/src/DownKyi/Themes/Styles/StyleCheckBox.xaml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/DownKyi/Themes/Styles/StyleImageBtn.xaml b/src/DownKyi/Themes/Styles/StyleImageBtn.xaml deleted file mode 100644 index be1214b..0000000 --- a/src/DownKyi/Themes/Styles/StyleImageBtn.xaml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/DownKyi/Themes/Styles/StyleListBox.xaml b/src/DownKyi/Themes/Styles/StyleListBox.xaml deleted file mode 100644 index 9db2e98..0000000 --- a/src/DownKyi/Themes/Styles/StyleListBox.xaml +++ /dev/null @@ -1,221 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/DownKyi/Themes/Styles/StyleListView.xaml b/src/DownKyi/Themes/Styles/StyleListView.xaml deleted file mode 100644 index cf96bc8..0000000 --- a/src/DownKyi/Themes/Styles/StyleListView.xaml +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/src/DownKyi/Themes/Styles/StyleRadio.xaml b/src/DownKyi/Themes/Styles/StyleRadio.xaml deleted file mode 100644 index 4b1ea85..0000000 --- a/src/DownKyi/Themes/Styles/StyleRadio.xaml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/DownKyi/Themes/Styles/StyleSystemBtn.xaml b/src/DownKyi/Themes/Styles/StyleSystemBtn.xaml deleted file mode 100644 index 3e623e8..0000000 --- a/src/DownKyi/Themes/Styles/StyleSystemBtn.xaml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/DownKyi/Themes/ThemeDefault.xaml b/src/DownKyi/Themes/ThemeDefault.xaml deleted file mode 100644 index 69411e4..0000000 --- a/src/DownKyi/Themes/ThemeDefault.xaml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/DownKyi/Themes/ThemeDiy.xaml b/src/DownKyi/Themes/ThemeDiy.xaml deleted file mode 100644 index 284db2a..0000000 --- a/src/DownKyi/Themes/ThemeDiy.xaml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/DownKyi/Utils/ClipboardHooker.cs b/src/DownKyi/Utils/ClipboardHooker.cs deleted file mode 100644 index 60048c9..0000000 --- a/src/DownKyi/Utils/ClipboardHooker.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Windows; -using System.Windows.Interop; - -namespace DownKyi.Utils -{ - public class ClipboardHooker : IDisposable - { - private const int WM_CLIPBOARDUPDATE = 0x031D; - - [DllImport("User32.dll")] - private static extern bool AddClipboardFormatListener(IntPtr hwnd); - - private readonly HwndSource _hwndSource = null; - - public void Dispose() - { - _hwndSource?.Dispose(); - } - - public ClipboardHooker(Window window) - { - WindowInteropHelper helper = new WindowInteropHelper(window); - _hwndSource = HwndSource.FromHwnd(helper.Handle); - bool r = AddClipboardFormatListener(_hwndSource.Handle); - if (r) - { - _hwndSource.AddHook(new HwndSourceHook(OnHooked)); - } - } - - private IntPtr OnHooked(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) - { - if (msg == WM_CLIPBOARDUPDATE) - { - ClipboardUpdated?.Invoke(this, EventArgs.Empty); - return IntPtr.Zero; - } - return IntPtr.Zero; - } - - public event EventHandler ClipboardUpdated; - } -} diff --git a/src/DownKyi/Utils/DialogUtils.cs b/src/DownKyi/Utils/DialogUtils.cs deleted file mode 100644 index 9852eb4..0000000 --- a/src/DownKyi/Utils/DialogUtils.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Windows.Forms; - -namespace DownKyi.Utils -{ - public static class DialogUtils - { - - /// - /// 弹出选择文件夹弹窗 - /// - /// - public static string SetDownloadDirectory() - { - // 选择文件夹 - FolderBrowserDialog dialog = new FolderBrowserDialog - { - Description = DictionaryResource.GetString("SelectDirectory") - }; - - DialogResult showDialog = dialog.ShowDialog(); - return showDialog == DialogResult.OK || showDialog == DialogResult.Yes - ? string.IsNullOrEmpty(dialog.SelectedPath) ? "" : dialog.SelectedPath : ""; - } - - /// - /// 选择视频dialog - /// - /// - public static string SelectVideoFile() - { - // 选择文件 - var dialog = new Microsoft.Win32.OpenFileDialog - { - Filter = "mp4 (*.mp4)|*.mp4" - }; - var showDialog = dialog.ShowDialog(); - return showDialog == true ? dialog.FileName : ""; - } - - - /// - /// 选择多个视频dialog - /// - /// - public static string[] SelectMultiVideoFile() - { - // 选择文件 - var dialog = new Microsoft.Win32.OpenFileDialog - { - Filter = "mp4 (*.mp4)|*.mp4", - Multiselect = true - }; - var showDialog = dialog.ShowDialog(); - return showDialog == true ? dialog.FileNames : new string[0]; - } - } -} diff --git a/src/DownKyi/Utils/DictionaryResource.cs b/src/DownKyi/Utils/DictionaryResource.cs deleted file mode 100644 index 4d9b8a8..0000000 --- a/src/DownKyi/Utils/DictionaryResource.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Windows; -using System.Windows.Media; - -namespace DownKyi.Utils -{ - public static class DictionaryResource - { - - /// - /// 从资源获取颜色的16进制字符串 - /// - /// - /// - public static string GetColor(string resourceKey) - { - return Application.Current == null ? "#00000000" : ((Color)Application.Current.Resources[resourceKey]).ToString(); - } - - /// - /// 从资源获取字符串 - /// - /// - /// - public static string GetString(string resourceKey) - { - return Application.Current == null ? "" : (string)Application.Current.Resources[resourceKey]; - } - - /// - /// 根据languageCode切换界面语言 - /// - /// 语言-国家代码 - public static void LoadLanguage(string languageCode) - { - LoadXamlDictionary(languageCode, "Languages"); - } - - /// - /// 切换主题 - /// - /// 主题 - public static void LoadTheme(string theme) - { - LoadXamlDictionary(theme, "Themes"); - } - - /// - /// 更换xaml资源字典 - /// - /// xaml文件名,不包含扩展名 - /// 文件所在包(路径) - private static void LoadXamlDictionary(string fileName, string package) - { - if (string.IsNullOrEmpty(fileName) == false) - { - var dictionariesToRemove = new List(); - - foreach (var dictionary in Application.Current.Resources.MergedDictionaries) - { - if (dictionary.Source.ToString().Contains($"{package}")) - { - dictionariesToRemove.Add(dictionary); - } - } - - foreach (var item in dictionariesToRemove) - { - Application.Current.Resources.MergedDictionaries.Remove(item); - } - - var languageDictionary = new ResourceDictionary() - { - Source = new Uri($"pack://application:,,,/DownKyi;component/{package}/{fileName}.xaml") - }; - - Application.Current.Resources.MergedDictionaries.Add(languageDictionary); - } - } - } -} diff --git a/src/DownKyi/Utils/NavigateToView.cs b/src/DownKyi/Utils/NavigateToView.cs deleted file mode 100644 index 5f126c0..0000000 --- a/src/DownKyi/Utils/NavigateToView.cs +++ /dev/null @@ -1,52 +0,0 @@ -using DownKyi.Core.Logging; -using DownKyi.Core.Settings; -using DownKyi.Core.Settings.Models; -using DownKyi.Events; -using DownKyi.ViewModels; -using Prism.Events; - -namespace DownKyi.Utils -{ - public static class NavigateToView - { - public static string Tag = "NavigateToView"; - - /// - /// 导航到用户空间, - /// 如果传入的mid与本地登录的mid一致, - /// 则进入我的用户空间。 - /// - /// - public static void NavigateToViewUserSpace(IEventAggregator eventAggregator, string parentViewName, long mid) - { - UserInfoSettings userInfo = SettingsManager.GetInstance().GetUserInfo(); - if (userInfo != null && userInfo.Mid == mid) - { - NavigationView(eventAggregator, ViewMySpaceViewModel.Tag, parentViewName, mid); - } - else - { - NavigationView(eventAggregator, ViewUserSpaceViewModel.Tag, parentViewName, mid); - } - } - - /// - /// 导航到其他页面 - /// - /// - /// - public static void NavigationView(IEventAggregator eventAggregator, string viewName, string parentViewName, object param) - { - LogManager.Debug(Tag, $"NavigationView: {viewName}, Parameter: {param}"); - - NavigationParam parameter = new NavigationParam - { - ViewName = viewName, - ParentViewName = parentViewName, - Parameter = param - }; - eventAggregator.GetEvent().Publish(parameter); - } - - } -} diff --git a/src/DownKyi/Utils/WindowAdaptation.cs b/src/DownKyi/Utils/WindowAdaptation.cs deleted file mode 100644 index 355be0d..0000000 --- a/src/DownKyi/Utils/WindowAdaptation.cs +++ /dev/null @@ -1,146 +0,0 @@ -using System; -using System.Drawing; -using System.Windows; -using System.Windows.Forms; -using System.Windows.Interop; - -namespace DownKyi.Utils -{ - /// - /// 为窗口添加附加属性的辅助类 - /// - /// https://www.cnblogs.com/kybs0/p/9834023.html - /// - public class WindowAdaptation - { - #region 窗口宽度比例 - /// - /// 窗口宽度比例 单位:小数(0 - 1.0] - /// 窗口实际宽度=使用屏幕可显示区域(屏幕高度-任务栏高度)* 窗口宽度比例 - /// - public static readonly DependencyProperty WidthByScreenRatioProperty = DependencyProperty.RegisterAttached( - "WidthByScreenRatio", typeof(double), typeof(WindowAdaptation), new PropertyMetadata(1.0, OnWidthByScreenRatioPropertyChanged)); - - private static void OnWidthByScreenRatioPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - if (d is Window window && e.NewValue is double widthByScreenRatio) - { - if (widthByScreenRatio <= 0 || widthByScreenRatio > 1) - { - throw new ArgumentException($"屏幕比例不支持{widthByScreenRatio}"); - } - - var screenDisplayArea = GetScreenSize(window); - var screenRatioWidth = screenDisplayArea.Width * widthByScreenRatio; - - //if (!double.IsNaN(window.Width) && screenDisplayArea.Width > window.Width) - //{ - // window.Width = window.Width; - //} - //else - //{ - // window.Width = screenRatioWidth; - //} - - if (!double.IsNaN(window.Width) && screenRatioWidth > window.Width) - { - window.Width = window.Width; - } - else if (!double.IsNaN(window.MinWidth) && screenRatioWidth < window.MinWidth) - { - window.Width = screenDisplayArea.Width; - } - else - { - window.Width = screenRatioWidth; - } - } - } - - public static void SetWidthByScreenRatio(DependencyObject element, double value) - { - element.SetValue(WidthByScreenRatioProperty, value); - } - - public static double GetWidthByScreenRatio(DependencyObject element) - { - return (double)element.GetValue(WidthByScreenRatioProperty); - } - - #endregion - - #region 窗口高度比例 - /// - /// 窗口宽度比例 单位:小数(0 - 1.0] - /// 窗口实际宽度=使用屏幕可显示区域(屏幕高度-任务栏高度)* 窗口宽度比例 - /// - public static readonly DependencyProperty HeightByScreenRatioProperty = DependencyProperty.RegisterAttached( - "HeightByScreenRatio", typeof(double), typeof(WindowAdaptation), new PropertyMetadata(1.0, OnHeightByScreenRatioPropertyChanged)); - - private static void OnHeightByScreenRatioPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - if (d is Window window && e.NewValue is double heightByScreenRatio) - { - if (heightByScreenRatio <= 0 || heightByScreenRatio > 1) - { - throw new ArgumentException($"屏幕比例不支持{heightByScreenRatio}"); - } - - var screenDisplayArea = GetScreenSize(window); - var screenRatioHeight = screenDisplayArea.Height * heightByScreenRatio; - - if (!double.IsNaN(window.Height) && screenDisplayArea.Height > window.Height) - { - window.Height = window.Height; - } - else - { - window.Height = screenRatioHeight; - } - - //if (!double.IsNaN(window.Height) && screenRatioHeight > window.Height) - //{ - // window.Height = window.Height; - //} - //else if (!double.IsNaN(window.MinHeight) && screenRatioHeight < window.MinHeight) - //{ - // window.Height = screenDisplayArea.Height; - //} - //else - //{ - // window.Height = screenRatioHeight; - //} - } - } - - public static void SetHeightByScreenRatio(DependencyObject element, double value) - { - element.SetValue(HeightByScreenRatioProperty, value); - } - - public static double GetHeightByScreenRatio(DependencyObject element) - { - return (double)element.GetValue(HeightByScreenRatioProperty); - } - - #endregion - - const int DpiPercent = 96; - private static dynamic GetScreenSize(Window window) - { - var intPtr = new WindowInteropHelper(window).Handle;//获取当前窗口的句柄 - var screen = Screen.FromHandle(intPtr);//获取当前屏幕 - using (Graphics currentGraphics = Graphics.FromHwnd(intPtr)) - { - //分别获取当前屏幕X/Y方向的DPI - double dpiXRatio = currentGraphics.DpiX / DpiPercent; - double dpiYRatio = currentGraphics.DpiY / DpiPercent; - - var width = screen.WorkingArea.Width / dpiXRatio; - var height = screen.WorkingArea.Height / dpiYRatio; - - return new { Width = width, Height = height }; - } - } - } -} diff --git a/src/DownKyi/ViewModels/BaseViewModel.cs b/src/DownKyi/ViewModels/BaseViewModel.cs deleted file mode 100644 index b8a3081..0000000 --- a/src/DownKyi/ViewModels/BaseViewModel.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Prism.Events; -using Prism.Mvvm; -using Prism.Regions; -using Prism.Services.Dialogs; -using System; -using System.Windows; - -namespace DownKyi.ViewModels -{ - public class BaseViewModel : BindableBase, INavigationAware - { - protected readonly IEventAggregator eventAggregator; - protected IDialogService dialogService; - protected string ParentView = string.Empty; - - public BaseViewModel(IEventAggregator eventAggregator) - { - this.eventAggregator = eventAggregator; - } - - public BaseViewModel(IEventAggregator eventAggregator, IDialogService dialogService) - { - this.eventAggregator = eventAggregator; - this.dialogService = dialogService; - } - - public bool IsNavigationTarget(NavigationContext navigationContext) - { - return true; - } - - public virtual void OnNavigatedFrom(NavigationContext navigationContext) - { - } - - public virtual void OnNavigatedTo(NavigationContext navigationContext) - { - string viewName = navigationContext.Parameters.GetValue("Parent"); - if (viewName != null) - { - ParentView = viewName; - } - } - - - /// - /// 异步修改绑定到UI的属性 - /// - /// - protected void PropertyChangeAsync(Action callback) - { - if (Application.Current == null) { return; } - - Application.Current.Dispatcher.Invoke(callback); - } - - } -} diff --git a/src/DownKyi/ViewModels/Dialogs/BaseDialogViewModel.cs b/src/DownKyi/ViewModels/Dialogs/BaseDialogViewModel.cs deleted file mode 100644 index 287d65b..0000000 --- a/src/DownKyi/ViewModels/Dialogs/BaseDialogViewModel.cs +++ /dev/null @@ -1,134 +0,0 @@ -using DownKyi.Images; -using DownKyi.Models; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Mvvm; -using Prism.Services.Dialogs; -using System; - -namespace DownKyi.ViewModels.Dialogs -{ - public class BaseDialogViewModel : BindableBase, IDialogAware - { - #region 页面属性申明 - - private string title; - public string Title - { - get { return title; } - set { SetProperty(ref title, value); } - } - - private VectorImage closeIcon; - public VectorImage CloseIcon - { - get { return closeIcon; } - set { SetProperty(ref closeIcon, value); } - } - - #endregion - - public BaseDialogViewModel() - { - #region 属性初始化 - - Title = new AppInfo().Name; - CloseIcon = new VectorImage - { - Height = SystemIcon.Instance().Close.Height, - Width = SystemIcon.Instance().Close.Width, - Data = SystemIcon.Instance().Close.Data, - Fill = SystemIcon.Instance().Close.Fill - }; - - #endregion - - } - - - #region 命令申明 - - // 鼠标进入关闭按钮事件 - private DelegateCommand closeEnterCommand; - public DelegateCommand CloseEnterCommand => closeEnterCommand ?? (closeEnterCommand = new DelegateCommand(ExecuteCloseEnterCommand)); - - /// - /// 鼠标进入关闭按钮事件 - /// - private void ExecuteCloseEnterCommand() - { - SetEnterStyle(CloseIcon); - } - - // 鼠标离开关闭按钮事件 - private DelegateCommand closeLeaveCommand; - public DelegateCommand CloseLeaveCommand => closeLeaveCommand ?? (closeLeaveCommand = new DelegateCommand(ExecuteCloseLeaveCommand)); - - /// - /// 鼠标离开关闭按钮事件 - /// - private void ExecuteCloseLeaveCommand() - { - SetLeaveStyle(CloseIcon); - } - - // 关闭窗口事件 - private DelegateCommand closeCommand; - public DelegateCommand CloseCommand => closeCommand ?? (closeCommand = new DelegateCommand(ExecuteCloseCommand)); - - /// - /// 关闭窗口事件 - /// - private void ExecuteCloseCommand() - { - ButtonResult result = ButtonResult.Cancel; - RaiseRequestClose(new DialogResult(result)); - } - - #endregion - - /// - /// 鼠标进入系统按钮时的图标样式 - /// - /// 图标 - private void SetEnterStyle(VectorImage icon) - { - icon.Fill = DictionaryResource.GetColor("ColorSystemBtnTint"); - } - - /// - /// 鼠标离开系统按钮时的图标样式 - /// - /// 图标 - private void SetLeaveStyle(VectorImage icon) - { - icon.Fill = DictionaryResource.GetColor("ColorSystemBtnTintDark"); - } - - #region 接口实现 - - //触发窗体关闭事件 - public virtual void RaiseRequestClose(IDialogResult dialogResult) - { - RequestClose?.Invoke(dialogResult); - } - - public event Action RequestClose; - - public virtual bool CanCloseDialog() - { - return true; - } - - public virtual void OnDialogClosed() - { - } - - public virtual void OnDialogOpened(IDialogParameters parameters) - { - } - - #endregion - - } -} diff --git a/src/DownKyi/ViewModels/Dialogs/ViewAlertDialogViewModel.cs b/src/DownKyi/ViewModels/Dialogs/ViewAlertDialogViewModel.cs deleted file mode 100644 index 02ba1ee..0000000 --- a/src/DownKyi/ViewModels/Dialogs/ViewAlertDialogViewModel.cs +++ /dev/null @@ -1,98 +0,0 @@ -using DownKyi.Images; -using Prism.Commands; -using Prism.Services.Dialogs; -using System.Windows; - -namespace DownKyi.ViewModels.Dialogs -{ - public class ViewAlertDialogViewModel : BaseDialogViewModel - { - public const string Tag = "DialogAlert"; - - #region 页面属性申明 - - private VectorImage image; - public VectorImage Image - { - get => image; - set => SetProperty(ref image, value); - } - - private string message; - public string Message - { - get => message; - set => SetProperty(ref message, value); - } - - - private Visibility aloneButton; - public Visibility AloneButton - { - get => aloneButton; - set => SetProperty(ref aloneButton, value); - } - - private Visibility twoButton; - public Visibility TwoButton - { - get => twoButton; - set => SetProperty(ref twoButton, value); - } - - #endregion - - public ViewAlertDialogViewModel() - { - - } - - #region 命令申明 - - // 确认事件 - private DelegateCommand allowCommand; - public DelegateCommand AllowCommand => allowCommand ?? (allowCommand = new DelegateCommand(ExecuteAllowCommand)); - - /// - /// 确认事件 - /// - private void ExecuteAllowCommand() - { - ButtonResult result = ButtonResult.OK; - RaiseRequestClose(new DialogResult(result)); - } - - #endregion - - #region 接口实现 - - public override void OnDialogOpened(IDialogParameters parameters) - { - base.OnDialogOpened(parameters); - - Image = parameters.GetValue("image"); - Title = parameters.GetValue("title"); - Message = parameters.GetValue("message"); - int number = parameters.GetValue("button_number"); - - switch (number) - { - case 1: - AloneButton = Visibility.Visible; - TwoButton = Visibility.Collapsed; - break; - case 2: - AloneButton = Visibility.Collapsed; - TwoButton = Visibility.Visible; - break; - default: - AloneButton = Visibility.Collapsed; - TwoButton = Visibility.Visible; - break; - } - } - - #endregion - - } -} diff --git a/src/DownKyi/ViewModels/Dialogs/ViewDownloadSetterViewModel.cs b/src/DownKyi/ViewModels/Dialogs/ViewDownloadSetterViewModel.cs deleted file mode 100644 index d806a42..0000000 --- a/src/DownKyi/ViewModels/Dialogs/ViewDownloadSetterViewModel.cs +++ /dev/null @@ -1,430 +0,0 @@ -using DownKyi.Core.Settings; -using DownKyi.Core.Settings.Models; -using DownKyi.Core.Utils; -using DownKyi.Events; -using DownKyi.Images; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Services.Dialogs; -using System.Collections.Generic; - -namespace DownKyi.ViewModels.Dialogs -{ - public class ViewDownloadSetterViewModel : BaseDialogViewModel - { - public const string Tag = "DialogDownloadSetter"; - private readonly IEventAggregator eventAggregator; - - // 历史文件夹的数量 - private readonly int maxDirectoryListCount = 20; - - #region 页面属性申明 - - private VectorImage cloudDownloadIcon; - public VectorImage CloudDownloadIcon - { - get { return cloudDownloadIcon; } - set { SetProperty(ref cloudDownloadIcon, value); } - } - - private VectorImage folderIcon; - public VectorImage FolderIcon - { - get { return folderIcon; } - set { SetProperty(ref folderIcon, value); } - } - - private bool isDefaultDownloadDirectory; - public bool IsDefaultDownloadDirectory - { - get { return isDefaultDownloadDirectory; } - set { SetProperty(ref isDefaultDownloadDirectory, value); } - } - - private List directoryList; - public List DirectoryList - { - get { return directoryList; } - set { SetProperty(ref directoryList, value); } - } - - private string directory; - public string Directory - { - get { return directory; } - set - { - SetProperty(ref directory, value); - - if (directory != null && directory != string.Empty) - { - DriveName = directory.Substring(0, 1).ToUpper(); - DriveNameFreeSpace = Format.FormatFileSize(HardDisk.GetHardDiskFreeSpace(DriveName)); - } - } - } - - private string driveName; - public string DriveName - { - get { return driveName; } - set { SetProperty(ref driveName, value); } - } - - private string driveNameFreeSpace; - public string DriveNameFreeSpace - { - get { return driveNameFreeSpace; } - set { SetProperty(ref driveNameFreeSpace, value); } - } - - private bool downloadAll; - public bool DownloadAll - { - get { return downloadAll; } - set { SetProperty(ref downloadAll, value); } - } - - private bool downloadAudio; - public bool DownloadAudio - { - get { return downloadAudio; } - set { SetProperty(ref downloadAudio, value); } - } - - private bool downloadVideo; - public bool DownloadVideo - { - get { return downloadVideo; } - set { SetProperty(ref downloadVideo, value); } - } - - private bool downloadDanmaku; - public bool DownloadDanmaku - { - get { return downloadDanmaku; } - set { SetProperty(ref downloadDanmaku, value); } - } - - private bool downloadSubtitle; - public bool DownloadSubtitle - { - get { return downloadSubtitle; } - set { SetProperty(ref downloadSubtitle, value); } - } - - private bool downloadCover; - public bool DownloadCover - { - get { return downloadCover; } - set { SetProperty(ref downloadCover, value); } - } - - #endregion - - public ViewDownloadSetterViewModel(IEventAggregator eventAggregator) - { - this.eventAggregator = eventAggregator; - - #region 属性初始化 - - Title = DictionaryResource.GetString("DownloadSetter"); - - CloudDownloadIcon = NormalIcon.Instance().CloudDownload; - CloudDownloadIcon.Fill = DictionaryResource.GetColor("ColorPrimary"); - - FolderIcon = NormalIcon.Instance().Folder; - FolderIcon.Fill = DictionaryResource.GetColor("ColorPrimary"); - - // 下载内容 - VideoContentSettings videoContent = SettingsManager.GetInstance().GetVideoContent(); - - DownloadAudio = videoContent.DownloadAudio; - DownloadVideo = videoContent.DownloadVideo; - DownloadDanmaku = videoContent.DownloadDanmaku; - DownloadSubtitle = videoContent.DownloadSubtitle; - DownloadCover = videoContent.DownloadCover; - - if (DownloadAudio && DownloadVideo && DownloadDanmaku && DownloadSubtitle && DownloadCover) - { - DownloadAll = true; - } - else - { - DownloadAll = false; - } - - // 历史下载目录 - DirectoryList = SettingsManager.GetInstance().GetHistoryVideoRootPaths(); - string directory = SettingsManager.GetInstance().GetSaveVideoRootPath(); - if (!DirectoryList.Contains(directory)) - { - ListHelper.InsertUnique(DirectoryList, directory, 0); - } - Directory = directory; - - // 是否使用默认下载目录 - IsDefaultDownloadDirectory = SettingsManager.GetInstance().IsUseSaveVideoRootPath() == AllowStatus.YES; - - #endregion - - } - - #region 命令申明 - - // 浏览文件夹事件 - private DelegateCommand browseCommand; - public DelegateCommand BrowseCommand => browseCommand ?? (browseCommand = new DelegateCommand(ExecuteBrowseCommand)); - - /// - /// 浏览文件夹事件 - /// - private void ExecuteBrowseCommand() - { - string directory = SetDirectory(); - - if (directory == null) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("WarningNullDirectory")); - Directory = string.Empty; - } - else - { - ListHelper.InsertUnique(DirectoryList, directory, 0); - Directory = directory; - - if (DirectoryList.Count > maxDirectoryListCount) - { - DirectoryList.RemoveAt(maxDirectoryListCount); - } - } - } - - // 所有内容选择事件 - private DelegateCommand downloadAllCommand; - public DelegateCommand DownloadAllCommand => downloadAllCommand ?? (downloadAllCommand = new DelegateCommand(ExecuteDownloadAllCommand)); - - /// - /// 所有内容选择事件 - /// - private void ExecuteDownloadAllCommand() - { - if (DownloadAll) - { - DownloadAudio = true; - DownloadVideo = true; - DownloadDanmaku = true; - DownloadSubtitle = true; - DownloadCover = true; - } - else - { - DownloadAudio = false; - DownloadVideo = false; - DownloadDanmaku = false; - DownloadSubtitle = false; - DownloadCover = false; - } - - SetVideoContent(); - } - - // 音频选择事件 - private DelegateCommand downloadAudioCommand; - public DelegateCommand DownloadAudioCommand => downloadAudioCommand ?? (downloadAudioCommand = new DelegateCommand(ExecuteDownloadAudioCommand)); - - /// - /// 音频选择事件 - /// - private void ExecuteDownloadAudioCommand() - { - if (!DownloadAudio) - { - DownloadAll = false; - } - - if (DownloadAudio && DownloadVideo && DownloadDanmaku && DownloadSubtitle && DownloadCover) - { - DownloadAll = true; - } - - SetVideoContent(); - } - - // 视频选择事件 - private DelegateCommand downloadVideoCommand; - public DelegateCommand DownloadVideoCommand => downloadVideoCommand ?? (downloadVideoCommand = new DelegateCommand(ExecuteDownloadVideoCommand)); - - /// - /// 视频选择事件 - /// - private void ExecuteDownloadVideoCommand() - { - if (!DownloadVideo) - { - DownloadAll = false; - } - - if (DownloadAudio && DownloadVideo && DownloadDanmaku && DownloadSubtitle && DownloadCover) - { - DownloadAll = true; - } - - SetVideoContent(); - } - - // 弹幕选择事件 - private DelegateCommand downloadDanmakuCommand; - public DelegateCommand DownloadDanmakuCommand => downloadDanmakuCommand ?? (downloadDanmakuCommand = new DelegateCommand(ExecuteDownloadDanmakuCommand)); - - /// - /// 弹幕选择事件 - /// - private void ExecuteDownloadDanmakuCommand() - { - if (!DownloadDanmaku) - { - DownloadAll = false; - } - - if (DownloadAudio && DownloadVideo && DownloadDanmaku && DownloadSubtitle && DownloadCover) - { - DownloadAll = true; - } - - SetVideoContent(); - } - - // 字幕选择事件 - private DelegateCommand downloadSubtitleCommand; - public DelegateCommand DownloadSubtitleCommand => downloadSubtitleCommand ?? (downloadSubtitleCommand = new DelegateCommand(ExecuteDownloadSubtitleCommand)); - - /// - /// 字幕选择事件 - /// - private void ExecuteDownloadSubtitleCommand() - { - if (!DownloadSubtitle) - { - DownloadAll = false; - } - - if (DownloadAudio && DownloadVideo && DownloadDanmaku && DownloadSubtitle && DownloadCover) - { - DownloadAll = true; - } - - SetVideoContent(); - } - - // 封面选择事件 - private DelegateCommand downloadCoverCommand; - public DelegateCommand DownloadCoverCommand => downloadCoverCommand ?? (downloadCoverCommand = new DelegateCommand(ExecuteDownloadCoverCommand)); - - /// - /// 封面选择事件 - /// - private void ExecuteDownloadCoverCommand() - { - if (!DownloadCover) - { - DownloadAll = false; - } - - if (DownloadAudio && DownloadVideo && DownloadDanmaku && DownloadSubtitle && DownloadCover) - { - DownloadAll = true; - } - - SetVideoContent(); - } - - // 确认下载事件 - private DelegateCommand downloadCommand; - public DelegateCommand DownloadCommand => downloadCommand ?? (downloadCommand = new DelegateCommand(ExecuteDownloadCommand)); - - /// - /// 确认下载事件 - /// - private void ExecuteDownloadCommand() - { - if (Directory == null || Directory == string.Empty) - { - return; - } - - // 设此文件夹为默认下载文件夹 - if (IsDefaultDownloadDirectory) - { - SettingsManager.GetInstance().IsUseSaveVideoRootPath(AllowStatus.YES); - } - else - { - SettingsManager.GetInstance().IsUseSaveVideoRootPath(AllowStatus.NO); - } - - // 将Directory移动到第一项 - // 如果直接在ComboBox中选择的就需要 - // 否则选中项不会在下次出现在第一项 - ListHelper.InsertUnique(DirectoryList, Directory, 0); - - // 将更新后的DirectoryList写入历史中 - SettingsManager.GetInstance().SetSaveVideoRootPath(Directory); - SettingsManager.GetInstance().SetHistoryVideoRootPaths(DirectoryList); - - // 返回数据 - ButtonResult result = ButtonResult.OK; - IDialogParameters parameters = new DialogParameters - { - { "directory", Directory }, - { "downloadAudio", DownloadAudio }, - { "downloadVideo", DownloadVideo }, - { "downloadDanmaku", DownloadDanmaku }, - { "downloadSubtitle", DownloadSubtitle }, - { "downloadCover", DownloadCover } - }; - - RaiseRequestClose(new DialogResult(result, parameters)); - } - - #endregion - - /// - /// 保存下载视频内容到设置 - /// - private void SetVideoContent() - { - VideoContentSettings videoContent = new VideoContentSettings - { - DownloadAudio = DownloadAudio, - DownloadVideo = DownloadVideo, - DownloadDanmaku = DownloadDanmaku, - DownloadSubtitle = DownloadSubtitle, - DownloadCover = DownloadCover - }; - - SettingsManager.GetInstance().SetVideoContent(videoContent); - } - - /// - /// 设置下载路径 - /// - /// - private string SetDirectory() - { - // 下载目录 - string path; - - // 弹出选择下载目录的窗口 - path = DialogUtils.SetDownloadDirectory(); - if (path == null || path == string.Empty) - { - return null; - } - - return path; - } - - } -} diff --git a/src/DownKyi/ViewModels/Dialogs/ViewParsingSelectorViewModel.cs b/src/DownKyi/ViewModels/Dialogs/ViewParsingSelectorViewModel.cs deleted file mode 100644 index 737c599..0000000 --- a/src/DownKyi/ViewModels/Dialogs/ViewParsingSelectorViewModel.cs +++ /dev/null @@ -1,120 +0,0 @@ -using DownKyi.Core.Settings; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Services.Dialogs; -using System; -using System.Windows; - -namespace DownKyi.ViewModels.Dialogs -{ - public class ViewParsingSelectorViewModel : BaseDialogViewModel - { - public const string Tag = "DialogParsingSelector"; - - #region 页面属性申明 - - private bool isParseDefault; - public bool IsParseDefault - { - get { return isParseDefault; } - set { SetProperty(ref isParseDefault, value); } - } - - #endregion - - public ViewParsingSelectorViewModel() - { - #region 属性初始化 - - Title = DictionaryResource.GetString("ParsingSelector"); - - // 解析范围 - ParseScope parseScope = SettingsManager.GetInstance().GetParseScope(); - IsParseDefault = parseScope != ParseScope.NONE; - - #endregion - - } - - #region 命令申明 - - // 解析当前项事件 - private DelegateCommand parseSelectedItemCommand; - public DelegateCommand ParseSelectedItemCommand => parseSelectedItemCommand ?? (parseSelectedItemCommand = new DelegateCommand(ExecuteParseSelectedItemCommand)); - - /// - /// 解析当前项事件 - /// - private void ExecuteParseSelectedItemCommand() - { - SetParseScopeSetting(ParseScope.SELECTED_ITEM); - - ButtonResult result = ButtonResult.OK; - IDialogParameters parameters = new DialogParameters - { - { "parseScope", ParseScope.SELECTED_ITEM } - }; - - RaiseRequestClose(new DialogResult(result, parameters)); - } - - // 解析当前页视频事件 - private DelegateCommand parseCurrentSectionCommand; - public DelegateCommand ParseCurrentSectionCommand => parseCurrentSectionCommand ?? (parseCurrentSectionCommand = new DelegateCommand(ExecuteParseCurrentSectionCommand)); - - /// - /// 解析当前页视频事件 - /// - private void ExecuteParseCurrentSectionCommand() - { - SetParseScopeSetting(ParseScope.CURRENT_SECTION); - - ButtonResult result = ButtonResult.OK; - IDialogParameters parameters = new DialogParameters - { - { "parseScope", ParseScope.CURRENT_SECTION } - }; - - RaiseRequestClose(new DialogResult(result, parameters)); - } - - // 解析所有视频事件 - private DelegateCommand parseAllCommand; - public DelegateCommand ParseAllCommand => parseAllCommand ?? (parseAllCommand = new DelegateCommand(ExecuteParseAllCommand)); - - /// - /// 解析所有视频事件 - /// - private void ExecuteParseAllCommand() - { - SetParseScopeSetting(ParseScope.ALL); - - ButtonResult result = ButtonResult.OK; - IDialogParameters parameters = new DialogParameters - { - { "parseScope", ParseScope.ALL } - }; - - RaiseRequestClose(new DialogResult(result, parameters)); - } - - #endregion - - /// - /// 写入设置 - /// - /// - private void SetParseScopeSetting(ParseScope parseScope) - { - if (IsParseDefault) - { - SettingsManager.GetInstance().SetParseScope(parseScope); - } - else - { - SettingsManager.GetInstance().SetParseScope(ParseScope.NONE); - } - } - - } -} diff --git a/src/DownKyi/ViewModels/DownloadManager/DownloadBaseItem.cs b/src/DownKyi/ViewModels/DownloadManager/DownloadBaseItem.cs deleted file mode 100644 index d1f1b30..0000000 --- a/src/DownKyi/ViewModels/DownloadManager/DownloadBaseItem.cs +++ /dev/null @@ -1,138 +0,0 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Core.BiliApi.Zone; -using DownKyi.Models; -using Prism.Mvvm; -using Prism.Services.Dialogs; -using System.Windows; -using System.Windows.Media; - -namespace DownKyi.ViewModels.DownloadManager -{ - public class DownloadBaseItem : BindableBase - { - public IDialogService DialogService; - - public DownloadBaseItem() - { - DialogService = null; - } - - public DownloadBaseItem(IDialogService dialogService) - { - DialogService = dialogService; - } - - // model数据 - private DownloadBase downloadBase; - public DownloadBase DownloadBase - { - get => downloadBase; - set - { - downloadBase = value; - - if (value != null) - { - ZoneImage = (DrawingImage)Application.Current.Resources[VideoZoneIcon.Instance().GetZoneImageKey(DownloadBase.ZoneId)]; - } - } - } - - // 视频分区image - private DrawingImage zoneImage; - public DrawingImage ZoneImage - { - get => zoneImage; - set => SetProperty(ref zoneImage, value); - } - - // 视频序号 - public int Order - { - get => DownloadBase == null ? 0 : DownloadBase.Order; - set - { - DownloadBase.Order = value; - RaisePropertyChanged("Order"); - } - } - - // 视频主标题 - public string MainTitle - { - get => DownloadBase == null ? "" : DownloadBase.MainTitle; - set - { - DownloadBase.MainTitle = value; - RaisePropertyChanged("MainTitle"); - } - } - - // 视频标题 - public string Name - { - get => DownloadBase == null ? "" : DownloadBase.Name; - set - { - DownloadBase.Name = value; - RaisePropertyChanged("Name"); - } - } - - // 时长 - public string Duration - { - get => DownloadBase == null ? "" : DownloadBase.Duration; - set - { - DownloadBase.Duration = value; - RaisePropertyChanged("Duration"); - } - } - - // 视频编码名称,AVC、HEVC - public string VideoCodecName - { - get => DownloadBase == null ? "" : DownloadBase.VideoCodecName; - set - { - DownloadBase.VideoCodecName = value; - RaisePropertyChanged("VideoCodecName"); - } - } - - // 视频画质 - public Quality Resolution - { - get => DownloadBase == null ? null : DownloadBase.Resolution; - set - { - DownloadBase.Resolution = value; - RaisePropertyChanged("Resolution"); - } - } - - // 音频编码 - public Quality AudioCodec - { - get => DownloadBase == null ? null : DownloadBase.AudioCodec; - set - { - DownloadBase.AudioCodec = value; - RaisePropertyChanged("AudioCodec"); - } - } - - // 文件大小 - public string FileSize - { - get => DownloadBase == null ? "" : DownloadBase.FileSize; - set - { - DownloadBase.FileSize = value; - RaisePropertyChanged("FileSize"); - } - } - - } -} diff --git a/src/DownKyi/ViewModels/DownloadManager/DownloadedItem.cs b/src/DownKyi/ViewModels/DownloadManager/DownloadedItem.cs deleted file mode 100644 index 244459c..0000000 --- a/src/DownKyi/ViewModels/DownloadManager/DownloadedItem.cs +++ /dev/null @@ -1,170 +0,0 @@ -using DownKyi.Images; -using DownKyi.Models; -using DownKyi.Services; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Services.Dialogs; -using System.IO; -using System.Linq; - -namespace DownKyi.ViewModels.DownloadManager -{ - public class DownloadedItem : DownloadBaseItem - { - public DownloadedItem() : this(null) - { - } - - public DownloadedItem(IDialogService dialogService) : base(dialogService) - { - // 打开文件夹按钮 - OpenFolder = ButtonIcon.Instance().Folder; - OpenFolder.Fill = DictionaryResource.GetColor("ColorPrimary"); - - // 打开视频按钮 - OpenVideo = ButtonIcon.Instance().Start; - OpenVideo.Fill = DictionaryResource.GetColor("ColorPrimary"); - - // 删除按钮 - RemoveVideo = ButtonIcon.Instance().Trash; - RemoveVideo.Fill = DictionaryResource.GetColor("ColorWarning"); - } - - // model数据 - public Downloaded Downloaded { get; set; } - - // 下载速度 - public string MaxSpeedDisplay - { - get => Downloaded.MaxSpeedDisplay; - set - { - Downloaded.MaxSpeedDisplay = value; - RaisePropertyChanged("MaxSpeedDisplay"); - } - } - - // 完成时间 - public string FinishedTime - { - get => Downloaded.FinishedTime; - set - { - Downloaded.FinishedTime = value; - RaisePropertyChanged("FinishedTime"); - } - } - - #region 控制按钮 - - private VectorImage openFolder; - public VectorImage OpenFolder - { - get => openFolder; - set => SetProperty(ref openFolder, value); - } - - private VectorImage openVideo; - public VectorImage OpenVideo - { - get => openVideo; - set => SetProperty(ref openVideo, value); - } - - private VectorImage removeVideo; - public VectorImage RemoveVideo - { - get => removeVideo; - set => SetProperty(ref removeVideo, value); - } - - #endregion - - #region 命令申明 - - // 打开文件夹事件 - private DelegateCommand openFolderCommand; - public DelegateCommand OpenFolderCommand => openFolderCommand ?? (openFolderCommand = new DelegateCommand(ExecuteOpenFolderCommand)); - - /// - /// 打开文件夹事件 - /// - private void ExecuteOpenFolderCommand() - { - if (DownloadBase == null) { return; } - //TODO:这里不光有mp4视频文件,也可能存在音频文件、字幕,或者其他文件类型 - //fix bug:Issues #709 - //这里根据需要下载的类型判断,具体对应的文件后缀名 - var downLoadContents = DownloadBase.NeedDownloadContent.Where(e => e.Value == true).Select(e => e.Key); - string fileSuffix = string.Empty; - if (downLoadContents.Contains("downloadVideo")) - { - fileSuffix = ".mp4"; - } - else if (downLoadContents.Contains("downloadAudio")) - { - fileSuffix = ".aac"; - } - else if (downLoadContents.Contains("downloadCover")) - { - fileSuffix = ".jpg"; - } - string videoPath = $"{DownloadBase.FilePath}{fileSuffix}"; - FileInfo fileInfo = new FileInfo(videoPath); - if (File.Exists(fileInfo.FullName)) - { - System.Diagnostics.Process.Start("Explorer", "/select," + fileInfo.FullName); - } - else - { - //eventAggregator.GetEvent().Publish("没有找到视频文件,可能被删除或移动!"); - } - } - - // 打开视频事件 - private DelegateCommand openVideoCommand; - public DelegateCommand OpenVideoCommand => openVideoCommand ?? (openVideoCommand = new DelegateCommand(ExecuteOpenVideoCommand)); - - /// - /// 打开视频事件 - /// - private void ExecuteOpenVideoCommand() - { - if (DownloadBase == null) { return; } - - string videoPath = $"{DownloadBase.FilePath}.mp4"; - var fileInfo = new FileInfo(videoPath); - if (File.Exists(fileInfo.FullName)) - { - System.Diagnostics.Process.Start(fileInfo.FullName); - } - else - { - //eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipAddDownloadingZero")); - //eventAggregator.GetEvent().Publish("没有找到视频文件,可能被删除或移动!"); - } - } - - // 删除事件 - private DelegateCommand removeVideoCommand; - public DelegateCommand RemoveVideoCommand => removeVideoCommand ?? (removeVideoCommand = new DelegateCommand(ExecuteRemoveVideoCommand)); - - /// - /// 删除事件 - /// - private void ExecuteRemoveVideoCommand() - { - AlertService alertService = new AlertService(DialogService); - ButtonResult result = alertService.ShowWarning(DictionaryResource.GetString("ConfirmDelete"), 2); - if (result != ButtonResult.OK) - { - return; - } - - App.DownloadedList.Remove(this); - } - - #endregion - - } -} diff --git a/src/DownKyi/ViewModels/DownloadManager/DownloadingItem.cs b/src/DownKyi/ViewModels/DownloadManager/DownloadingItem.cs deleted file mode 100644 index 7e54bf2..0000000 --- a/src/DownKyi/ViewModels/DownloadManager/DownloadingItem.cs +++ /dev/null @@ -1,233 +0,0 @@ -using DownKyi.Core.BiliApi.VideoStream.Models; -using DownKyi.Images; -using DownKyi.Models; -using DownKyi.Services; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Services.Dialogs; - -namespace DownKyi.ViewModels.DownloadManager -{ - public class DownloadingItem : DownloadBaseItem - { - public DownloadingItem() : this(null) - { - } - - public DownloadingItem(IDialogService dialogService) : base(dialogService) - { - // 暂停继续按钮 - StartOrPause = ButtonIcon.Instance().Pause; - StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary"); - - // 删除按钮 - Delete = ButtonIcon.Instance().Delete; - Delete.Fill = DictionaryResource.GetColor("ColorPrimary"); - } - - // model数据 - private Downloading downloading; - public Downloading Downloading - { - get => downloading; - set - { - downloading = value; - - switch (value.DownloadStatus) - { - case DownloadStatus.NOT_STARTED: - case DownloadStatus.WAIT_FOR_DOWNLOAD: - StartOrPause = ButtonIcon.Instance().Pause; - break; - case DownloadStatus.PAUSE_STARTED: - StartOrPause = ButtonIcon.Instance().Start; - break; - case DownloadStatus.PAUSE: - StartOrPause = ButtonIcon.Instance().Start; - break; - case DownloadStatus.DOWNLOADING: - StartOrPause = ButtonIcon.Instance().Pause; - break; - case DownloadStatus.DOWNLOAD_SUCCEED: - // 下载成功后会从下载列表中删除 - // 不会出现此分支 - break; - case DownloadStatus.DOWNLOAD_FAILED: - StartOrPause = ButtonIcon.Instance().Retry; - break; - default: - break; - } - StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary"); - } - } - - // 视频流链接 - public PlayUrl PlayUrl { get; set; } - - // 正在下载内容(音频、视频、弹幕、字幕、封面) - public string DownloadContent - { - get => Downloading.DownloadContent; - set - { - Downloading.DownloadContent = value; - RaisePropertyChanged("DownloadContent"); - } - } - - // 下载状态显示 - public string DownloadStatusTitle - { - get => Downloading.DownloadStatusTitle; - set - { - Downloading.DownloadStatusTitle = value; - RaisePropertyChanged("DownloadStatusTitle"); - } - } - - // 下载进度 - public float Progress - { - get => Downloading.Progress; - set - { - Downloading.Progress = value; - RaisePropertyChanged("Progress"); - } - } - - // 已下载大小/文件大小 - public string DownloadingFileSize - { - get => Downloading.DownloadingFileSize; - set - { - Downloading.DownloadingFileSize = value; - RaisePropertyChanged("DownloadingFileSize"); - } - } - - // 下载速度 - public string SpeedDisplay - { - get => Downloading.SpeedDisplay; - set - { - Downloading.SpeedDisplay = value; - RaisePropertyChanged("SpeedDisplay"); - } - } - - // 操作提示 - private string operationTip; - public string OperationTip - { - get => operationTip; - set => SetProperty(ref operationTip, value); - } - - #region 控制按钮 - - private VectorImage startOrPause; - public VectorImage StartOrPause - { - get => startOrPause; - set - { - SetProperty(ref startOrPause, value); - - OperationTip = value.Equals(ButtonIcon.Instance().Start) ? DictionaryResource.GetString("StartDownload") - : value.Equals(ButtonIcon.Instance().Pause) ? DictionaryResource.GetString("PauseDownload") - : value.Equals(ButtonIcon.Instance().Retry) ? DictionaryResource.GetString("RetryDownload") : null; - } - } - - private VectorImage delete; - public VectorImage Delete - { - get => delete; - set => SetProperty(ref delete, value); - } - - #endregion - - #region 命令申明 - - // 下载列表暂停继续事件 - private DelegateCommand startOrPauseCommand; - public DelegateCommand StartOrPauseCommand => startOrPauseCommand ?? (startOrPauseCommand = new DelegateCommand(ExecuteStartOrPauseCommand)); - - /// - /// 下载列表暂停继续事件 - /// - private void ExecuteStartOrPauseCommand() - { - switch (Downloading.DownloadStatus) - { - case DownloadStatus.NOT_STARTED: - case DownloadStatus.WAIT_FOR_DOWNLOAD: - Downloading.DownloadStatus = DownloadStatus.PAUSE_STARTED; - DownloadStatusTitle = DictionaryResource.GetString("Pausing"); - StartOrPause = ButtonIcon.Instance().Start; - StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary"); - break; - case DownloadStatus.PAUSE_STARTED: - Downloading.DownloadStatus = DownloadStatus.WAIT_FOR_DOWNLOAD; - DownloadStatusTitle = DictionaryResource.GetString("Waiting"); - StartOrPause = ButtonIcon.Instance().Pause; - StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary"); - break; - case DownloadStatus.PAUSE: - Downloading.DownloadStatus = DownloadStatus.WAIT_FOR_DOWNLOAD; - DownloadStatusTitle = DictionaryResource.GetString("Waiting"); - StartOrPause = ButtonIcon.Instance().Pause; - StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary"); - break; - //case DownloadStatus.PAUSE_TO_WAIT: - case DownloadStatus.DOWNLOADING: - Downloading.DownloadStatus = DownloadStatus.PAUSE; - DownloadStatusTitle = DictionaryResource.GetString("Pausing"); - StartOrPause = ButtonIcon.Instance().Start; - StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary"); - break; - case DownloadStatus.DOWNLOAD_SUCCEED: - // 下载成功后会从下载列表中删除 - // 不会出现此分支 - break; - case DownloadStatus.DOWNLOAD_FAILED: - Downloading.DownloadStatus = DownloadStatus.WAIT_FOR_DOWNLOAD; - DownloadStatusTitle = DictionaryResource.GetString("Waiting"); - StartOrPause = ButtonIcon.Instance().Pause; - StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary"); - break; - default: - break; - } - } - - // 下载列表删除事件 - private DelegateCommand deleteCommand; - public DelegateCommand DeleteCommand => deleteCommand ?? (deleteCommand = new DelegateCommand(ExecuteDeleteCommand)); - - /// - /// 下载列表删除事件 - /// - private void ExecuteDeleteCommand() - { - AlertService alertService = new AlertService(DialogService); - ButtonResult result = alertService.ShowWarning(DictionaryResource.GetString("ConfirmDelete"), 2); - if (result != ButtonResult.OK) - { - return; - } - - App.DownloadingList.Remove(this); - } - - #endregion - - } -} diff --git a/src/DownKyi/ViewModels/DownloadManager/ViewDownloadFinishedViewModel.cs b/src/DownKyi/ViewModels/DownloadManager/ViewDownloadFinishedViewModel.cs deleted file mode 100644 index 6ec73b7..0000000 --- a/src/DownKyi/ViewModels/DownloadManager/ViewDownloadFinishedViewModel.cs +++ /dev/null @@ -1,168 +0,0 @@ -using DownKyi.Core.Logging; -using DownKyi.Core.Settings; -using DownKyi.Services; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using Prism.Services.Dialogs; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Collections.Specialized; -using System.Linq; -using System.Threading.Tasks; - -namespace DownKyi.ViewModels.DownloadManager -{ - public class ViewDownloadFinishedViewModel : BaseViewModel - { - public const string Tag = "PageDownloadManagerDownloadFinished"; - - #region 页面属性申明 - - private ObservableCollection downloadedList; - public ObservableCollection DownloadedList - { - get => downloadedList; - set => SetProperty(ref downloadedList, value); - } - - private int finishedSortBy; - public int FinishedSortBy - { - get => finishedSortBy; - set => SetProperty(ref finishedSortBy, value); - } - - #endregion - - public ViewDownloadFinishedViewModel(IEventAggregator eventAggregator, IDialogService dialogService) : base(eventAggregator, dialogService) - { - // 初始化DownloadedList - DownloadedList = App.DownloadedList; - DownloadedList.CollectionChanged += new NotifyCollectionChangedEventHandler((sender, e) => - { - if (e.Action == NotifyCollectionChangedAction.Add) - { - SetDialogService(); - } - }); - SetDialogService(); - - DownloadFinishedSort finishedSort = SettingsManager.GetInstance().GetDownloadFinishedSort(); - switch (finishedSort) - { - case DownloadFinishedSort.DOWNLOAD: - FinishedSortBy = 0; - break; - case DownloadFinishedSort.NUMBER: - FinishedSortBy = 1; - break; - default: - FinishedSortBy = 0; - break; - } - App.SortDownloadedList(finishedSort); - } - - #region 命令申明 - - // 下载完成列表排序事件 - private DelegateCommand finishedSortCommand; - public DelegateCommand FinishedSortCommand => finishedSortCommand ?? (finishedSortCommand = new DelegateCommand(ExecuteFinishedSortCommand)); - - /// - /// 下载完成列表排序事件 - /// - /// - private void ExecuteFinishedSortCommand(object parameter) - { - if (!(parameter is int index)) { return; } - - switch (index) - { - case 0: - App.SortDownloadedList(DownloadFinishedSort.DOWNLOAD); - // 更新设置 - SettingsManager.GetInstance().SetDownloadFinishedSort(DownloadFinishedSort.DOWNLOAD); - break; - case 1: - App.SortDownloadedList(DownloadFinishedSort.NUMBER); - // 更新设置 - SettingsManager.GetInstance().SetDownloadFinishedSort(DownloadFinishedSort.NUMBER); - break; - default: - App.SortDownloadedList(DownloadFinishedSort.DOWNLOAD); - // 更新设置 - SettingsManager.GetInstance().SetDownloadFinishedSort(DownloadFinishedSort.DOWNLOAD); - break; - } - } - - // 清空下载完成列表事件 - private DelegateCommand clearAllDownloadedCommand; - public DelegateCommand ClearAllDownloadedCommand => clearAllDownloadedCommand ?? (clearAllDownloadedCommand = new DelegateCommand(ExecuteClearAllDownloadedCommand)); - - /// - /// 清空下载完成列表事件 - /// - private async void ExecuteClearAllDownloadedCommand() - { - AlertService alertService = new AlertService(dialogService); - ButtonResult result = alertService.ShowWarning(DictionaryResource.GetString("ConfirmDelete")); - if (result != ButtonResult.OK) - { - return; - } - - // 使用Clear()不能触发NotifyCollectionChangedAction.Remove事件 - // 因此遍历删除 - // DownloadingList中元素被删除后不能继续遍历 - await Task.Run(() => - { - List list = DownloadedList.ToList(); - foreach (DownloadedItem item in list) - { - App.PropertyChangeAsync(new Action(() => - { - App.DownloadedList.Remove(item); - })); - } - }); - } - - #endregion - - private async void SetDialogService() - { - try - { - await Task.Run(() => - { - List list = DownloadedList.ToList(); - foreach (var item in list) - { - if (item != null && item.DialogService == null) - { - item.DialogService = dialogService; - } - } - }); - } - catch (Exception e) - { - Core.Utils.Debugging.Console.PrintLine("SetDialogService()发生异常: {0}", e); - LogManager.Error($"{Tag}.SetDialogService()", e); - } - } - - public override void OnNavigatedFrom(NavigationContext navigationContext) - { - base.OnNavigatedFrom(navigationContext); - - SetDialogService(); - } - - } -} diff --git a/src/DownKyi/ViewModels/DownloadManager/ViewDownloadingViewModel.cs b/src/DownKyi/ViewModels/DownloadManager/ViewDownloadingViewModel.cs deleted file mode 100644 index 7d2e826..0000000 --- a/src/DownKyi/ViewModels/DownloadManager/ViewDownloadingViewModel.cs +++ /dev/null @@ -1,206 +0,0 @@ -using DownKyi.Core.Logging; -using DownKyi.Images; -using DownKyi.Models; -using DownKyi.Services; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using Prism.Services.Dialogs; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Collections.Specialized; -using System.Linq; -using System.Threading.Tasks; - -namespace DownKyi.ViewModels.DownloadManager -{ - public class ViewDownloadingViewModel : BaseViewModel - { - public const string Tag = "PageDownloadManagerDownloading"; - - #region 页面属性申明 - - private ObservableCollection downloadingList; - public ObservableCollection DownloadingList - { - get => downloadingList; - set => SetProperty(ref downloadingList, value); - } - - #endregion - - public ViewDownloadingViewModel(IEventAggregator eventAggregator, IDialogService dialogService) : base(eventAggregator, dialogService) - { - // 初始化DownloadingList - DownloadingList = App.DownloadingList; - DownloadingList.CollectionChanged += new NotifyCollectionChangedEventHandler((sender, e) => - { - if (e.Action == NotifyCollectionChangedAction.Add) - { - SetDialogService(); - } - }); - SetDialogService(); - - } - - #region 命令申明 - - // 暂停所有下载事件 - private DelegateCommand pauseAllDownloadingCommand; - public DelegateCommand PauseAllDownloadingCommand => pauseAllDownloadingCommand ?? (pauseAllDownloadingCommand = new DelegateCommand(ExecutePauseAllDownloadingCommand)); - - /// - /// 暂停所有下载事件 - /// - private void ExecutePauseAllDownloadingCommand() - { - foreach (DownloadingItem downloading in downloadingList) - { - switch (downloading.Downloading.DownloadStatus) - { - case DownloadStatus.NOT_STARTED: - case DownloadStatus.WAIT_FOR_DOWNLOAD: - downloading.Downloading.DownloadStatus = DownloadStatus.PAUSE; - downloading.DownloadStatusTitle = DictionaryResource.GetString("Pausing"); - downloading.StartOrPause = ButtonIcon.Instance().Start; - downloading.StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary"); - break; - case DownloadStatus.PAUSE_STARTED: - break; - case DownloadStatus.PAUSE: - break; - //case DownloadStatus.PAUSE_TO_WAIT: - case DownloadStatus.DOWNLOADING: - downloading.Downloading.DownloadStatus = DownloadStatus.PAUSE; - downloading.DownloadStatusTitle = DictionaryResource.GetString("Pausing"); - downloading.StartOrPause = ButtonIcon.Instance().Start; - downloading.StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary"); - break; - case DownloadStatus.DOWNLOAD_SUCCEED: - // 下载成功后会从下载列表中删除 - // 不会出现此分支 - break; - case DownloadStatus.DOWNLOAD_FAILED: - break; - default: - break; - } - } - } - - // 继续所有下载事件 - private DelegateCommand continueAllDownloadingCommand; - public DelegateCommand ContinueAllDownloadingCommand => continueAllDownloadingCommand ?? (continueAllDownloadingCommand = new DelegateCommand(ExecuteContinueAllDownloadingCommand)); - - /// - /// 继续所有下载事件 - /// - private void ExecuteContinueAllDownloadingCommand() - { - foreach (DownloadingItem downloading in downloadingList) - { - switch (downloading.Downloading.DownloadStatus) - { - case DownloadStatus.NOT_STARTED: - case DownloadStatus.WAIT_FOR_DOWNLOAD: - downloading.Downloading.DownloadStatus = DownloadStatus.WAIT_FOR_DOWNLOAD; - downloading.DownloadStatusTitle = DictionaryResource.GetString("Waiting"); - break; - case DownloadStatus.PAUSE_STARTED: - downloading.Downloading.DownloadStatus = DownloadStatus.WAIT_FOR_DOWNLOAD; - downloading.DownloadStatusTitle = DictionaryResource.GetString("Waiting"); - break; - case DownloadStatus.PAUSE: - downloading.Downloading.DownloadStatus = DownloadStatus.WAIT_FOR_DOWNLOAD; - downloading.DownloadStatusTitle = DictionaryResource.GetString("Waiting"); - break; - //case DownloadStatus.PAUSE_TO_WAIT: - // break; - case DownloadStatus.DOWNLOADING: - break; - case DownloadStatus.DOWNLOAD_SUCCEED: - // 下载成功后会从下载列表中删除 - // 不会出现此分支 - break; - case DownloadStatus.DOWNLOAD_FAILED: - downloading.Downloading.DownloadStatus = DownloadStatus.WAIT_FOR_DOWNLOAD; - downloading.DownloadStatusTitle = DictionaryResource.GetString("Waiting"); - break; - default: - break; - } - - downloading.StartOrPause = ButtonIcon.Instance().Pause; - downloading.StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary"); - } - } - - // 删除所有下载事件 - private DelegateCommand deleteAllDownloadingCommand; - public DelegateCommand DeleteAllDownloadingCommand => deleteAllDownloadingCommand ?? (deleteAllDownloadingCommand = new DelegateCommand(ExecuteDeleteAllDownloadingCommand)); - - /// - /// 删除所有下载事件 - /// - private async void ExecuteDeleteAllDownloadingCommand() - { - AlertService alertService = new AlertService(dialogService); - ButtonResult result = alertService.ShowWarning(DictionaryResource.GetString("ConfirmDelete")); - if (result != ButtonResult.OK) - { - return; - } - - // 使用Clear()不能触发NotifyCollectionChangedAction.Remove事件 - // 因此遍历删除 - // DownloadingList中元素被删除后不能继续遍历 - await Task.Run(() => - { - List list = DownloadingList.ToList(); - foreach (DownloadingItem item in list) - { - App.PropertyChangeAsync(new Action(() => - { - App.DownloadingList.Remove(item); - })); - } - }); - } - - #endregion - - private async void SetDialogService() - { - try - { - await Task.Run(() => - { - List list = DownloadingList.ToList(); - foreach (var item in list) - { - if (item != null && item.DialogService == null) - { - item.DialogService = dialogService; - } - } - }); - } - catch (Exception e) - { - Core.Utils.Debugging.Console.PrintLine("SetDialogService()发生异常: {0}", e); - LogManager.Error($"{Tag}.SetDialogService()", e); - } - } - - public override void OnNavigatedFrom(NavigationContext navigationContext) - { - base.OnNavigatedFrom(navigationContext); - - SetDialogService(); - } - - } -} diff --git a/src/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs b/src/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs deleted file mode 100644 index 5e91eaa..0000000 --- a/src/DownKyi/ViewModels/Friends/ViewFollowerViewModel.cs +++ /dev/null @@ -1,239 +0,0 @@ -using DownKyi.Core.BiliApi.Users; -using DownKyi.Core.BiliApi.Users.Models; -using DownKyi.Core.Settings.Models; -using DownKyi.Core.Settings; -using DownKyi.Core.Storage; -using DownKyi.CustomControl; -using DownKyi.ViewModels.PageViewModels; -using Prism.Events; -using Prism.Regions; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels.Friends -{ - public class ViewFollowerViewModel : BaseViewModel - { - public const string Tag = "PageFriendsFollower"; - - // mid - private long mid = -1; - - // 每页数量,暂时在此写死,以后在设置中增加选项 - private readonly int NumberInPage = 20; - - public bool IsEnabled = true; - - #region 页面属性申明 - - private string pageName = ViewFriendsViewModel.Tag; - public string PageName - { - get => pageName; - set => SetProperty(ref pageName, value); - } - - private Visibility contentVisibility; - public Visibility ContentVisibility - { - get => contentVisibility; - set => SetProperty(ref contentVisibility, value); - } - - private GifImage loading; - public GifImage Loading - { - get => loading; - set => SetProperty(ref loading, value); - } - - private Visibility loadingVisibility; - public Visibility LoadingVisibility - { - get => loadingVisibility; - set => SetProperty(ref loadingVisibility, value); - } - - private Visibility noDataVisibility; - public Visibility NoDataVisibility - { - get => noDataVisibility; - set => SetProperty(ref noDataVisibility, value); - } - - private CustomPagerViewModel pager; - public CustomPagerViewModel Pager - { - get => pager; - set => SetProperty(ref pager, value); - } - - private ObservableCollection contents; - public ObservableCollection Contents - { - get => contents; - set => SetProperty(ref contents, value); - } - - #endregion - - public ViewFollowerViewModel(IEventAggregator eventAggregator) : base(eventAggregator) - { - #region 属性初始化 - - // 初始化loading gif - Loading = new GifImage(Properties.Resources.loading); - Loading.StartAnimate(); - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - - Contents = new ObservableCollection(); - - #endregion - } - - #region 命令申明 - - #endregion - - private void LoadContent(List contents) - { - ContentVisibility = Visibility.Visible; - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - foreach (var item in contents) - { - StorageHeader storageHeader = new StorageHeader(); - BitmapImage header = storageHeader.GetHeaderThumbnail(item.Mid, item.Name, item.Face, 64, 64); - App.PropertyChangeAsync(new Action(() => - { - Contents.Add(new FriendInfo(eventAggregator) { Mid = item.Mid, Header = header, Name = item.Name, Sign = item.Sign }); - })); - } - } - - private async void UpdateContent(int current) - { - // 是否正在获取数据 - // 在所有的退出分支中都需要设为true - IsEnabled = false; - - Contents.Clear(); - ContentVisibility = Visibility.Collapsed; - LoadingVisibility = Visibility.Visible; - NoDataVisibility = Visibility.Collapsed; - - RelationFollow data = null; - List contents = null; - await Task.Run(() => - { - data = UserRelation.GetFollowers(mid, current, NumberInPage); - if (data != null && data.List != null && data.List.Count > 0) - { - contents = data.List; - } - if (contents == null) { return; } - - LoadContent(contents); - }); - - if (data == null || contents == null) - { - ContentVisibility = Visibility.Collapsed; - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Visible; - } - else - { - UserInfoSettings userInfo = SettingsManager.GetInstance().GetUserInfo(); - if (userInfo != null && userInfo.Mid == mid) - { - Pager.Count = (int)Math.Ceiling((double)data.Total / NumberInPage); - } - else - { - int page = (int)Math.Ceiling((double)data.Total / NumberInPage); - if (page > 5) - { - Pager.Count = 5; - } - else - { - Pager.Count = page; - } - } - - ContentVisibility = Visibility.Visible; - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - } - - IsEnabled = true; - } - - private void OnCountChanged_Pager(int count) { } - - private bool OnCurrentChanged_Pager(int old, int current) - { - if (!IsEnabled) - { - //Pager.Current = old; - return false; - } - - UpdateContent(current); - - return true; - } - - /// - /// 初始化页面数据 - /// - private void InitView() - { - ContentVisibility = Visibility.Collapsed; - LoadingVisibility = Visibility.Visible; - NoDataVisibility = Visibility.Collapsed; - - Contents.Clear(); - } - - /// - /// 导航到页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - // 传入mid - long parameter = navigationContext.Parameters.GetValue("mid"); - if (parameter == 0) - { - return; - } - mid = parameter; - - // 是否是从PageFriends的headerTable的item点击进入的 - // true表示加载PageFriends后第一次进入此页面 - // false表示从headerTable的item点击进入的 - bool isFirst = navigationContext.Parameters.GetValue("isFirst"); - if (isFirst) - { - InitView(); - - //UpdateContent(1); - - // 页面选择 - Pager = new CustomPagerViewModel(1, (int)Math.Ceiling((double)1 / NumberInPage)); - Pager.CurrentChanged += OnCurrentChanged_Pager; - Pager.CountChanged += OnCountChanged_Pager; - Pager.Current = 1; - } - } - } -} diff --git a/src/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs b/src/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs deleted file mode 100644 index 061f766..0000000 --- a/src/DownKyi/ViewModels/Friends/ViewFollowingViewModel.cs +++ /dev/null @@ -1,415 +0,0 @@ -using DownKyi.Core.BiliApi.Users; -using DownKyi.Core.BiliApi.Users.Models; -using DownKyi.Core.Settings; -using DownKyi.Core.Settings.Models; -using DownKyi.Core.Storage; -using DownKyi.CustomControl; -using DownKyi.Utils; -using DownKyi.ViewModels.PageViewModels; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels.Friends -{ - public class ViewFollowingViewModel : BaseViewModel - { - public const string Tag = "PageFriendsFollowing"; - - // mid - private long mid = -1; - - // 每页数量,暂时在此写死,以后在设置中增加选项 - private readonly int NumberInPage = 20; - - #region 页面属性申明 - - private string pageName = ViewFriendsViewModel.Tag; - public string PageName - { - get => pageName; - set => SetProperty(ref pageName, value); - } - - private Visibility contentVisibility; - public Visibility ContentVisibility - { - get => contentVisibility; - set => SetProperty(ref contentVisibility, value); - } - - private Visibility innerContentVisibility; - public Visibility InnerContentVisibility - { - get => innerContentVisibility; - set => SetProperty(ref innerContentVisibility, value); - } - - private GifImage loading; - public GifImage Loading - { - get => loading; - set => SetProperty(ref loading, value); - } - - private Visibility loadingVisibility; - public Visibility LoadingVisibility - { - get => loadingVisibility; - set => SetProperty(ref loadingVisibility, value); - } - - private Visibility noDataVisibility; - public Visibility NoDataVisibility - { - get => noDataVisibility; - set => SetProperty(ref noDataVisibility, value); - } - - private GifImage contentLoading; - public GifImage ContentLoading - { - get => contentLoading; - set => SetProperty(ref contentLoading, value); - } - - private Visibility contentLoadingVisibility; - public Visibility ContentLoadingVisibility - { - get => contentLoadingVisibility; - set => SetProperty(ref contentLoadingVisibility, value); - } - - private Visibility contentNoDataVisibility; - public Visibility ContentNoDataVisibility - { - get => contentNoDataVisibility; - set => SetProperty(ref contentNoDataVisibility, value); - } - - private ObservableCollection tabHeaders; - public ObservableCollection TabHeaders - { - get => tabHeaders; - set => SetProperty(ref tabHeaders, value); - } - - private int selectTabId; - public int SelectTabId - { - get => selectTabId; - set => SetProperty(ref selectTabId, value); - } - - private bool isEnabled = true; - public bool IsEnabled - { - get => isEnabled; - set => SetProperty(ref isEnabled, value); - } - - private CustomPagerViewModel pager; - public CustomPagerViewModel Pager - { - get => pager; - set => SetProperty(ref pager, value); - } - - private ObservableCollection contents; - public ObservableCollection Contents - { - get => contents; - set => SetProperty(ref contents, value); - } - - #endregion - - public ViewFollowingViewModel(IEventAggregator eventAggregator) : base(eventAggregator) - { - #region 属性初始化 - - // 初始化loading gif - Loading = new GifImage(Properties.Resources.loading); - Loading.StartAnimate(); - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - - ContentLoading = new GifImage(Properties.Resources.loading); - ContentLoading.StartAnimate(); - ContentLoadingVisibility = Visibility.Collapsed; - ContentNoDataVisibility = Visibility.Collapsed; - - TabHeaders = new ObservableCollection(); - Contents = new ObservableCollection(); - - #endregion - } - - #region 命令申明 - - // 左侧tab点击事件 - private DelegateCommand leftTabHeadersCommand; - public DelegateCommand LeftTabHeadersCommand => leftTabHeadersCommand ?? (leftTabHeadersCommand = new DelegateCommand(ExecuteLeftTabHeadersCommand, CanExecuteLeftTabHeadersCommand)); - - /// - /// 左侧tab点击事件 - /// - /// - private void ExecuteLeftTabHeadersCommand(object parameter) - { - if (!(parameter is TabHeader tabHeader)) { return; } - - // 页面选择 - Pager = new CustomPagerViewModel(1, (int)Math.Ceiling(double.Parse(tabHeader.SubTitle) / NumberInPage)); - Pager.CurrentChanged += OnCurrentChanged_Pager; - Pager.CountChanged += OnCountChanged_Pager; - Pager.Current = 1; - } - - /// - /// 左侧tab点击事件是否允许执行 - /// - /// - /// - private bool CanExecuteLeftTabHeadersCommand(object parameter) - { - return IsEnabled; - } - - #endregion - - /// - /// 初始化页面数据 - /// - private void InitView() - { - ContentVisibility = Visibility.Collapsed; - InnerContentVisibility = Visibility.Collapsed; - LoadingVisibility = Visibility.Visible; - NoDataVisibility = Visibility.Collapsed; - ContentLoadingVisibility = Visibility.Collapsed; - ContentNoDataVisibility = Visibility.Collapsed; - - TabHeaders.Clear(); - Contents.Clear(); - SelectTabId = -1; - } - - /// - /// 初始化左侧列表 - /// - private async void InitLeftTable() - { - TabHeaders.Clear(); - - UserInfoSettings userInfo = SettingsManager.GetInstance().GetUserInfo(); - if (userInfo != null && userInfo.Mid == mid) - { - // 用户的关系状态数 - UserRelationStat relationStat = null; - await Task.Run(() => - { - relationStat = UserStatus.GetUserRelationStat(mid); - }); - if (relationStat != null) - { - TabHeaders.Add(new TabHeader { Id = -1, Title = DictionaryResource.GetString("AllFollowing"), SubTitle = relationStat.Following.ToString() }); - TabHeaders.Add(new TabHeader { Id = -2, Title = DictionaryResource.GetString("WhisperFollowing"), SubTitle = relationStat.Whisper.ToString() }); - } - - // 用户的关注分组 - List followingGroup = null; - await Task.Run(() => - { - followingGroup = UserRelation.GetFollowingGroup(); - }); - if (followingGroup != null) - { - foreach (FollowingGroup tag in followingGroup) - { - TabHeaders.Add(new TabHeader { Id = tag.TagId, Title = tag.Name, SubTitle = tag.Count.ToString() }); - } - } - } - else - { - // 用户的关系状态数 - UserRelationStat relationStat = null; - await Task.Run(() => - { - relationStat = UserStatus.GetUserRelationStat(mid); - }); - if (relationStat != null) - { - TabHeaders.Add(new TabHeader { Id = -1, Title = DictionaryResource.GetString("AllFollowing"), SubTitle = relationStat.Following.ToString() }); - } - } - - ContentVisibility = Visibility.Visible; - LoadingVisibility = Visibility.Collapsed; - } - - private void LoadContent(List contents) - { - InnerContentVisibility = Visibility.Visible; - ContentLoadingVisibility = Visibility.Collapsed; - ContentNoDataVisibility = Visibility.Collapsed; - foreach (var item in contents) - { - StorageHeader storageHeader = new StorageHeader(); - BitmapImage header = storageHeader.GetHeaderThumbnail(item.Mid, item.Name, item.Face, 64, 64); - App.PropertyChangeAsync(new Action(() => - { - Contents.Add(new FriendInfo(eventAggregator) { Mid = item.Mid, Header = header, Name = item.Name, Sign = item.Sign }); - })); - } - } - - private async Task LoadAllFollowings(int pn, int ps) - { - List contents = null; - await Task.Run(() => - { - RelationFollow data = UserRelation.GetFollowings(mid, pn, ps); - if (data != null && data.List != null && data.List.Count > 0) - { - contents = data.List; - } - if (contents == null) { return; } - - LoadContent(contents); - }); - - if (contents == null) { return false; } - return true; - } - - private async Task LoadWhispers(int pn, int ps) - { - List contents = null; - await Task.Run(() => - { - contents = UserRelation.GetWhispers(pn, ps); - if (contents == null) { return; } - - LoadContent(contents); - }); - - if (contents == null) { return false; } - return true; - } - - private async Task LoadFollowingGroupContent(long tagId, int pn, int ps) - { - List contents = null; - await Task.Run(() => - { - contents = UserRelation.GetFollowingGroupContent(tagId, pn, ps); - if (contents == null) { return; } - - LoadContent(contents); - }); - - if (contents == null) { return false; } - return true; - } - - private async void UpdateContent(int current) - { - // 是否正在获取数据 - // 在所有的退出分支中都需要设为true - IsEnabled = false; - - Contents.Clear(); - InnerContentVisibility = Visibility.Collapsed; - ContentLoadingVisibility = Visibility.Visible; - ContentNoDataVisibility = Visibility.Collapsed; - - TabHeader tab = TabHeaders[SelectTabId]; - - bool isSucceed; - switch (tab.Id) - { - case -1: - isSucceed = await LoadAllFollowings(current, NumberInPage); - break; - case -2: - isSucceed = await LoadWhispers(current, NumberInPage); - break; - default: - isSucceed = await LoadFollowingGroupContent(tab.Id, current, NumberInPage); - break; - } - - if (isSucceed) - { - InnerContentVisibility = Visibility.Visible; - ContentLoadingVisibility = Visibility.Collapsed; - ContentNoDataVisibility = Visibility.Collapsed; - } - else - { - InnerContentVisibility = Visibility.Collapsed; - ContentLoadingVisibility = Visibility.Collapsed; - ContentNoDataVisibility = Visibility.Visible; - } - - IsEnabled = true; - } - - private void OnCountChanged_Pager(int count) { } - - private bool OnCurrentChanged_Pager(int old, int current) - { - if (!IsEnabled) - { - //Pager.Current = old; - return false; - } - - UpdateContent(current); - - return true; - } - - /// - /// 导航到页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - // 传入mid - long parameter = navigationContext.Parameters.GetValue("mid"); - if (parameter == 0) - { - return; - } - mid = parameter; - - // 是否是从PageFriends的headerTable的item点击进入的 - // true表示加载PageFriends后第一次进入此页面 - // false表示从headerTable的item点击进入的 - bool isFirst = navigationContext.Parameters.GetValue("isFirst"); - if (isFirst) - { - InitView(); - - // 初始化左侧列表 - InitLeftTable(); - - // 进入页面时显示的设置项 - SelectTabId = 0; - - } - } - - } -} diff --git a/src/DownKyi/ViewModels/MainWindowViewModel.cs b/src/DownKyi/ViewModels/MainWindowViewModel.cs deleted file mode 100644 index 47714da..0000000 --- a/src/DownKyi/ViewModels/MainWindowViewModel.cs +++ /dev/null @@ -1,363 +0,0 @@ -using DownKyi.Core.Logging; -using DownKyi.Core.Settings; -using DownKyi.Events; -using DownKyi.Images; -using DownKyi.Services; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Mvvm; -using Prism.Regions; -using System; -using System.Threading; -using System.Windows; -using System.Windows.Threading; - -namespace DownKyi.ViewModels -{ - public class MainWindowViewModel : BindableBase - { - private readonly IEventAggregator eventAggregator; - private ClipboardHooker clipboardHooker; - - #region 页面属性申明 - - private string title; - public string Title - { - get { return title; } - set { SetProperty(ref title, value); } - } - - private WindowState winState; - public WindowState WinState - { - get { return winState; } - set - { - if (value == WindowState.Maximized) - { - ResizeIcon = SystemIcon.Instance().Restore; - } - else - { - ResizeIcon = SystemIcon.Instance().Maximize; - } - SetLeaveStyle(ResizeIcon); - - SetProperty(ref winState, value); - } - } - - private VectorImage minimizeIcon; - public VectorImage MinimizeIcon - { - get { return minimizeIcon; } - set { SetProperty(ref minimizeIcon, value); } - } - - private VectorImage resizeIcon; - public VectorImage ResizeIcon - { - get { return resizeIcon; } - set { SetProperty(ref resizeIcon, value); } - } - - private VectorImage closeIcon; - public VectorImage CloseIcon - { - get { return closeIcon; } - set { SetProperty(ref closeIcon, value); } - } - - private VectorImage skinIcon; - public VectorImage SkinIcon - { - get { return skinIcon; } - set { SetProperty(ref skinIcon, value); } - } - - private Visibility messageVisibility = Visibility.Hidden; - public Visibility MessageVisibility - { - get { return messageVisibility; } - set { SetProperty(ref messageVisibility, value); } - } - - private string message; - public string Message - { - get { return message; } - set { SetProperty(ref message, value); } - } - - #endregion - - public MainWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator) - { - this.eventAggregator = eventAggregator; - - #region 属性初始化 - - Window mainWindow = Application.Current.MainWindow; - - WinState = WindowState.Normal; - - MinimizeIcon = SystemIcon.Instance().Minimize; - ResizeIcon = SystemIcon.Instance().Maximize; - CloseIcon = SystemIcon.Instance().Close; - SkinIcon = SystemIcon.Instance().Skin; - - #endregion - - #region 订阅 - - // 订阅导航事件 - eventAggregator.GetEvent().Subscribe((view) => - { - var param = new NavigationParameters - { - { "Parent", view.ParentViewName }, - { "Parameter", view.Parameter } - }; - regionManager.RequestNavigate("ContentRegion", view.ViewName, param); - }); - - // 订阅消息发送事件 - string oldMessage; - eventAggregator.GetEvent().Subscribe((message) => - { - MessageVisibility = Visibility.Visible; - - oldMessage = Message; - Message = message; - int sleep = 2000; - if (oldMessage == Message) { sleep = 1500; } - - Thread.Sleep(sleep); - - MessageVisibility = Visibility.Hidden; - }, ThreadOption.BackgroundThread); - - #endregion - - #region 命令定义 - - // window加载后执行的事件 - LoadedCommand = new DelegateCommand(() => - { - clipboardHooker = new ClipboardHooker(Application.Current.MainWindow); - clipboardHooker.ClipboardUpdated += OnClipboardUpdated; - - // 进入首页 - var param = new NavigationParameters - { - { "Parent", "" }, - { "Parameter", "start" } - }; - regionManager.RequestNavigate("ContentRegion", ViewIndexViewModel.Tag, param); - - // 关闭欢迎页 - if (App.Dictionary.ContainsKey("SplashWindow")) - { - Views.SplashWindow sw = App.Dictionary["SplashWindow"] as Views.SplashWindow; - // 在sw的线程上关闭SplashWindow - sw.Dispatcher.Invoke(() => sw.Close()); - } - - // 设置焦点 - Application.Current.MainWindow.Activate(); - }); - - // 顶部caption栏的点击事件,包括双击和拖动 - int times = 0; - DragMoveCommand = new DelegateCommand(() => - { - // caption 双击事件 - times += 1; - DispatcherTimer timer = new DispatcherTimer - { - Interval = new TimeSpan(0, 0, 0, 0, 300) - }; - timer.Tick += (s, e) => { timer.IsEnabled = false; times = 0; }; - timer.IsEnabled = true; - - if (times % 2 == 0) - { - timer.IsEnabled = false; - times = 0; - WinState = WinState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; - } - - // caption 拖动事件 - try - { - mainWindow.DragMove(); - } - catch { } - }); - - // 最小化窗口事件 - MinimizeCommand = new DelegateCommand(() => - { - mainWindow.WindowState = WindowState.Minimized; - }); - MinimizeEnterCommand = new DelegateCommand(() => - { - SetEnterStyle(MinimizeIcon); - }); - MinimizeLeaveCommand = new DelegateCommand(() => - { - SetLeaveStyle(MinimizeIcon); - }); - - // 最大化/还原窗口事件 - ResizeCommand = new DelegateCommand(() => - { - WinState = WinState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; - }); - ResizeEnterCommand = new DelegateCommand(() => - { - SetEnterStyle(ResizeIcon); - }); - ResizeLeaveCommand = new DelegateCommand(() => - { - SetLeaveStyle(ResizeIcon); - }); - - // 关闭窗口事件 - CloseCommand = new DelegateCommand(() => - { - if (clipboardHooker != null) - { - clipboardHooker.ClipboardUpdated -= OnClipboardUpdated; - clipboardHooker.Dispose(); - } - - mainWindow.Close(); - }); - CloseEnterCommand = new DelegateCommand(() => - { - SetEnterStyle(CloseIcon); - }); - CloseLeaveCommand = new DelegateCommand(() => - { - SetLeaveStyle(CloseIcon); - }); - - // 皮肤按钮点击事件 - SkinCommand = new DelegateCommand(() => - { - // 设置主题 - DictionaryResource.LoadTheme("ThemeDiy"); - - // 切换语言 - DictionaryResource.LoadLanguage("en_US"); - }); - SkinEnterCommand = new DelegateCommand(() => - { - SetEnterStyle(SkinIcon); - }); - SkinLeaveCommand = new DelegateCommand(() => - { - SetLeaveStyle(SkinIcon); - }); - - #endregion - - } - - #region 命令申明 - - public DelegateCommand LoadedCommand { get; private set; } - public DelegateCommand DragMoveCommand { get; private set; } - public DelegateCommand MinimizeCommand { get; private set; } - public DelegateCommand MinimizeEnterCommand { get; private set; } - public DelegateCommand MinimizeLeaveCommand { get; private set; } - public DelegateCommand ResizeCommand { get; private set; } - public DelegateCommand ResizeEnterCommand { get; private set; } - public DelegateCommand ResizeLeaveCommand { get; private set; } - public DelegateCommand CloseCommand { get; private set; } - public DelegateCommand CloseEnterCommand { get; private set; } - public DelegateCommand CloseLeaveCommand { get; private set; } - public DelegateCommand SkinCommand { get; private set; } - public DelegateCommand SkinEnterCommand { get; private set; } - public DelegateCommand SkinLeaveCommand { get; private set; } - - #endregion - - /// - /// 鼠标进入系统按钮时的图标样式 - /// - /// 图标 - private void SetEnterStyle(VectorImage icon) - { - icon.Fill = DictionaryResource.GetColor("ColorSystemBtnTint"); - } - - /// - /// 鼠标离开系统按钮时的图标样式 - /// - /// 图标 - private void SetLeaveStyle(VectorImage icon) - { - icon.Fill = DictionaryResource.GetColor("ColorSystemBtnTintDark"); - } - - #region 剪贴板 - - private int times = 0; - - /// - /// 监听剪贴板更新事件,会执行两遍以上 - /// - /// - /// - private void OnClipboardUpdated(object sender, EventArgs e) - { - #region 执行第二遍时跳过 - times += 1; - DispatcherTimer timer = new DispatcherTimer - { - Interval = new TimeSpan(0, 0, 0, 0, 300) - }; - timer.Tick += (s, ex) => { timer.IsEnabled = false; times = 0; }; - timer.IsEnabled = true; - - if (times % 2 == 0) - { - timer.IsEnabled = false; - times = 0; - return; - } - - #endregion - - AllowStatus isListenClipboard = SettingsManager.GetInstance().IsListenClipboard(); - if (isListenClipboard != AllowStatus.YES) - { - return; - } - - string input; - try - { - IDataObject data = Clipboard.GetDataObject(); - string[] fs = data.GetFormats(); - input = data.GetData(fs[0]).ToString(); - } - catch (Exception exc) - { - Console.WriteLine("OnClipboardUpdated()发生异常: {0}", exc); - LogManager.Error("OnClipboardUpdated", exc); - return; - } - - SearchService searchService = new SearchService(); - searchService.BiliInput(input + AppConstant.ClipboardId, ViewIndexViewModel.Tag, eventAggregator); - } - - #endregion - - } -} diff --git a/src/DownKyi/ViewModels/PageViewModels/BangumiFollowMedia.cs b/src/DownKyi/ViewModels/PageViewModels/BangumiFollowMedia.cs deleted file mode 100644 index 60bbf15..0000000 --- a/src/DownKyi/ViewModels/PageViewModels/BangumiFollowMedia.cs +++ /dev/null @@ -1,121 +0,0 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Mvvm; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels.PageViewModels -{ - public class BangumiFollowMedia : BindableBase - { - protected readonly IEventAggregator eventAggregator; - - public BangumiFollowMedia(IEventAggregator eventAggregator) - { - this.eventAggregator = eventAggregator; - } - - // media id - public long MediaId { get; set; } - - // season id - public long SeasonId { get; set; } - - #region 页面属性申明 - - // 是否选中 - private bool isSelected; - public bool IsSelected - { - get => isSelected; - set => SetProperty(ref isSelected, value); - } - - // 封面 - private BitmapImage cover; - public BitmapImage Cover - { - get => cover; - set => SetProperty(ref cover, value); - } - - // 视频标题 - private string title; - public string Title - { - get => title; - set => SetProperty(ref title, value); - } - - // 视频类型名称 - private string seasonTypeName; - public string SeasonTypeName - { - get => seasonTypeName; - set => SetProperty(ref seasonTypeName, value); - } - - // 地区 - private string area; - public string Area - { - get => area; - set => SetProperty(ref area, value); - } - - // 标记是否会员 - private string badge; - public string Badge - { - get => badge; - set => SetProperty(ref badge, value); - } - - // 简介 - private string evaluate; - public string Evaluate - { - get => evaluate; - set => SetProperty(ref evaluate, value); - } - - // 视频更新进度 - private string indexShow; - public string IndexShow - { - get => indexShow; - set => SetProperty(ref indexShow, value); - } - - // 观看进度 - private string progress; - public string Progress - { - get => progress; - set => SetProperty(ref progress, value); - } - - #endregion - - #region 命令申明 - - // 视频标题点击事件 - private DelegateCommand titleCommand; - public DelegateCommand TitleCommand => titleCommand ?? (titleCommand = new DelegateCommand(ExecuteTitleCommand)); - - /// - /// 视频标题点击事件 - /// - /// - private void ExecuteTitleCommand(object parameter) - { - if (!(parameter is string tag)) { return; } - - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, tag, $"{ParseEntrance.BangumiMediaUrl}md{MediaId}"); - } - - #endregion - - } -} diff --git a/src/DownKyi/ViewModels/PageViewModels/ChannelMedia.cs b/src/DownKyi/ViewModels/PageViewModels/ChannelMedia.cs deleted file mode 100644 index 5fd54ff..0000000 --- a/src/DownKyi/ViewModels/PageViewModels/ChannelMedia.cs +++ /dev/null @@ -1,90 +0,0 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Mvvm; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels.PageViewModels -{ - public class ChannelMedia : BindableBase - { - protected readonly IEventAggregator eventAggregator; - - public ChannelMedia(IEventAggregator eventAggregator) - { - this.eventAggregator = eventAggregator; - } - - public long Avid { get; set; } - public string Bvid { get; set; } - - #region 页面属性申明 - - private bool isSelected; - public bool IsSelected - { - get => isSelected; - set => SetProperty(ref isSelected, value); - } - - private BitmapImage cover; - public BitmapImage Cover - { - get => cover; - set => SetProperty(ref cover, value); - } - - private string title; - public string Title - { - get => title; - set => SetProperty(ref title, value); - } - - private string duration; - public string Duration - { - get => duration; - set => SetProperty(ref duration, value); - } - - private string playNumber; - public string PlayNumber - { - get => playNumber; - set => SetProperty(ref playNumber, value); - } - - private string createTime; - public string CreateTime - { - get => createTime; - set => SetProperty(ref createTime, value); - } - - #endregion - - #region 命令申明 - - // 视频标题点击事件 - private DelegateCommand titleCommand; - public DelegateCommand TitleCommand => titleCommand ?? (titleCommand = new DelegateCommand(ExecuteTitleCommand)); - - /// - /// 视频标题点击事件 - /// - /// - private void ExecuteTitleCommand(object parameter) - { - if (!(parameter is string tag)) { return; } - - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, tag, $"{ParseEntrance.VideoUrl}{Bvid}"); - //string url = "https://www.bilibili.com/video/" + tag; - //System.Diagnostics.Process.Start(url); - } - - #endregion - - } -} diff --git a/src/DownKyi/ViewModels/PageViewModels/Favorites.cs b/src/DownKyi/ViewModels/PageViewModels/Favorites.cs deleted file mode 100644 index ae77f79..0000000 --- a/src/DownKyi/ViewModels/PageViewModels/Favorites.cs +++ /dev/null @@ -1,138 +0,0 @@ -using DownKyi.Images; -using DownKyi.Utils; -using Prism.Mvvm; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels.PageViewModels -{ - public class Favorites : BindableBase - { - public string CoverUrl { get; set; } - public long UpperMid { get; set; } - - private BitmapImage cover; - public BitmapImage Cover - { - get => cover; - set => SetProperty(ref cover, value); - } - - private string title; - public string Title - { - get => title; - set => SetProperty(ref title, value); - } - - private string createTime; - public string CreateTime - { - get => createTime; - set => SetProperty(ref createTime, value); - } - - private string playNumber; - public string PlayNumber - { - get => playNumber; - set => SetProperty(ref playNumber, value); - } - - private string likeNumber; - public string LikeNumber - { - get => likeNumber; - set => SetProperty(ref likeNumber, value); - } - - private string favoriteNumber; - public string FavoriteNumber - { - get => favoriteNumber; - set => SetProperty(ref favoriteNumber, value); - } - - private string shareNumber; - public string ShareNumber - { - get => shareNumber; - set => SetProperty(ref shareNumber, value); - } - - private VectorImage play; - public VectorImage Play - { - get => play; - set => SetProperty(ref play, value); - } - - private VectorImage like; - public VectorImage Like - { - get => like; - set => SetProperty(ref like, value); - } - - private VectorImage favorite; - public VectorImage Favorite - { - get => favorite; - set => SetProperty(ref favorite, value); - } - - private VectorImage share; - public VectorImage Share - { - get => share; - set => SetProperty(ref share, value); - } - - private string description; - public string Description - { - get => description; - set => SetProperty(ref description, value); - } - - private int mediaCount; - public int MediaCount - { - get => mediaCount; - set => SetProperty(ref mediaCount, value); - } - - private string upName; - public string UpName - { - get => upName; - set => SetProperty(ref upName, value); - } - - private BitmapImage upHeader; - public BitmapImage UpHeader - { - get => upHeader; - set => SetProperty(ref upHeader, value); - } - - public Favorites() - { - #region 属性初始化 - - Play = NormalIcon.Instance().Play; - Play.Fill = DictionaryResource.GetColor("ColorTextGrey2"); - - Like = NormalIcon.Instance().Like; - Like.Fill = DictionaryResource.GetColor("ColorTextGrey2"); - - Favorite = NormalIcon.Instance().Favorite; - Favorite.Fill = DictionaryResource.GetColor("ColorTextGrey2"); - - Share = NormalIcon.Instance().Share; - Share.Fill = DictionaryResource.GetColor("ColorTextGrey2"); - - #endregion - } - - } -} diff --git a/src/DownKyi/ViewModels/PageViewModels/FavoritesMedia.cs b/src/DownKyi/ViewModels/PageViewModels/FavoritesMedia.cs deleted file mode 100644 index 4c8e56a..0000000 --- a/src/DownKyi/ViewModels/PageViewModels/FavoritesMedia.cs +++ /dev/null @@ -1,139 +0,0 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Mvvm; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels.PageViewModels -{ - public class FavoritesMedia : BindableBase - { - protected readonly IEventAggregator eventAggregator; - - public FavoritesMedia(IEventAggregator eventAggregator) - { - this.eventAggregator = eventAggregator; - } - - public long Avid { get; set; } - public string Bvid { get; set; } - public long UpMid { get; set; } - - #region 页面属性申明 - - private bool isSelected; - public bool IsSelected - { - get => isSelected; - set => SetProperty(ref isSelected, value); - } - - private int order; - public int Order - { - get => order; - set => SetProperty(ref order, value); - } - - private BitmapImage cover; - public BitmapImage Cover - { - get => cover; - set => SetProperty(ref cover, value); - } - - private string title; - public string Title - { - get => title; - set => SetProperty(ref title, value); - } - - private string playNumber; - public string PlayNumber - { - get => playNumber; - set => SetProperty(ref playNumber, value); - } - - private string danmakuNumber; - public string DanmakuNumber - { - get => danmakuNumber; - set => SetProperty(ref danmakuNumber, value); - } - - private string favoriteNumber; - public string FavoriteNumber - { - get => favoriteNumber; - set => SetProperty(ref favoriteNumber, value); - } - - private string duration; - public string Duration - { - get => duration; - set => SetProperty(ref duration, value); - } - - private string upName; - public string UpName - { - get => upName; - set => SetProperty(ref upName, value); - } - - private string createTime; - public string CreateTime - { - get => createTime; - set => SetProperty(ref createTime, value); - } - - private string favTime; - public string FavTime - { - get => favTime; - set => SetProperty(ref favTime, value); - } - - #endregion - - #region 命令申明 - - // 视频标题点击事件 - private DelegateCommand titleCommand; - public DelegateCommand TitleCommand => titleCommand ?? (titleCommand = new DelegateCommand(ExecuteTitleCommand)); - - /// - /// 视频标题点击事件 - /// - /// - private void ExecuteTitleCommand(object parameter) - { - if (!(parameter is string tag)) { return; } - - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, tag, $"{ParseEntrance.VideoUrl}{Bvid}"); - } - - // 视频的UP主点击事件 - private DelegateCommand videoUpperCommand; - public DelegateCommand VideoUpperCommand => videoUpperCommand ?? (videoUpperCommand = new DelegateCommand(ExecuteVideoUpperCommand)); - - /// - /// 视频的UP主点击事件 - /// - /// - private void ExecuteVideoUpperCommand(object parameter) - { - if (!(parameter is string tag)) { return; } - - NavigateToView.NavigateToViewUserSpace(eventAggregator, tag, UpMid); - } - - #endregion - - } -} diff --git a/src/DownKyi/ViewModels/PageViewModels/FriendInfo.cs b/src/DownKyi/ViewModels/PageViewModels/FriendInfo.cs deleted file mode 100644 index f4ace41..0000000 --- a/src/DownKyi/ViewModels/PageViewModels/FriendInfo.cs +++ /dev/null @@ -1,65 +0,0 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Mvvm; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels.PageViewModels -{ - public class FriendInfo : BindableBase - { - protected readonly IEventAggregator eventAggregator; - - public FriendInfo(IEventAggregator eventAggregator) - { - this.eventAggregator = eventAggregator; - } - - public long Mid { get; set; } - - #region 页面属性申明 - - private BitmapImage header; - public BitmapImage Header - { - get => header; - set => SetProperty(ref header, value); - } - - private string name; - public string Name - { - get => name; - set => SetProperty(ref name, value); - } - - private string sign; - public string Sign - { - get => sign; - set => SetProperty(ref sign, value); - } - - #endregion - - #region 命令申明 - - // 视频标题点击事件 - private DelegateCommand userCommand; - public DelegateCommand UserCommand => userCommand ?? (userCommand = new DelegateCommand(ExecuteUserCommand)); - - /// - /// 视频标题点击事件 - /// - /// - private void ExecuteUserCommand(object parameter) - { - if (!(parameter is string tag)) { return; } - - NavigateToView.NavigationView(eventAggregator, ViewUserSpaceViewModel.Tag, tag, Mid); - } - - #endregion - } -} diff --git a/src/DownKyi/ViewModels/PageViewModels/HistoryMedia.cs b/src/DownKyi/ViewModels/PageViewModels/HistoryMedia.cs deleted file mode 100644 index 36d1a9b..0000000 --- a/src/DownKyi/ViewModels/PageViewModels/HistoryMedia.cs +++ /dev/null @@ -1,175 +0,0 @@ -using DownKyi.Images; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Mvvm; -using System.Windows; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels.PageViewModels -{ - public class HistoryMedia : BindableBase - { - protected readonly IEventAggregator eventAggregator; - - public HistoryMedia(IEventAggregator eventAggregator) - { - this.eventAggregator = eventAggregator; - } - - // bvid - public string Bvid { get; set; } - - // 播放url - public string Url { get; set; } - - // UP主的mid - public long UpMid { get; set; } - - // 类型 - public string Business { get; set; } - - #region 页面属性申明 - - // 是否选中 - private bool isSelected; - public bool IsSelected - { - get => isSelected; - set => SetProperty(ref isSelected, value); - } - - // 封面 - private BitmapImage cover; - public BitmapImage Cover - { - get => cover; - set => SetProperty(ref cover, value); - } - - // 视频标题 - private string title; - public string Title - { - get => title; - set => SetProperty(ref title, value); - } - - // 分P的标题 - private string subTitle; - public string SubTitle - { - get => subTitle; - set => SetProperty(ref subTitle, value); - } - - // 时长 - private long duration; - public long Duration - { - get => duration; - set => SetProperty(ref duration, value); - } - - // tag标签 - private string tagName; - public string TagName - { - get => tagName; - set => SetProperty(ref tagName, value); - } - - // new_desc 剧集或分P描述 - private string partdesc; - public string Partdesc - { - get => partdesc; - set => SetProperty(ref partdesc, value); - } - - // 观看进度 - private string progress; - public string Progress - { - get => progress; - set => SetProperty(ref progress, value); - } - - // 观看平台 - private VectorImage platform; - public VectorImage Platform - { - get => platform; - set => SetProperty(ref platform, value); - } - - // UP主的昵称 - private string upName; - public string UpName - { - get => upName; - set => SetProperty(ref upName, value); - } - - // UP主的头像 - private BitmapImage upHeader; - public BitmapImage UpHeader - { - get => upHeader; - set => SetProperty(ref upHeader, value); - } - - // 是否显示Partdesc - private Visibility partdescVisibility; - public Visibility PartdescVisibility - { - get => partdescVisibility; - set => SetProperty(ref partdescVisibility, value); - } - - // 是否显示UP主信息和分区信息 - private Visibility upAndTagVisibility; - public Visibility UpAndTagVisibility - { - get => upAndTagVisibility; - set => SetProperty(ref upAndTagVisibility, value); - } - - #endregion - - #region 命令申明 - - // 视频标题点击事件 - private DelegateCommand titleCommand; - public DelegateCommand TitleCommand => titleCommand ?? (titleCommand = new DelegateCommand(ExecuteTitleCommand)); - - /// - /// 视频标题点击事件 - /// - /// - private void ExecuteTitleCommand(object parameter) - { - if (!(parameter is string tag)) { return; } - - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, tag, Url); - } - - // UP主头像点击事件 - private DelegateCommand upCommand; - public DelegateCommand UpCommand => upCommand ?? (upCommand = new DelegateCommand(ExecuteUpCommand)); - - /// - /// UP主头像点击事件 - /// - /// - private void ExecuteUpCommand(object parameter) - { - if (!(parameter is string tag)) { return; } - - NavigateToView.NavigateToViewUserSpace(eventAggregator, tag, UpMid); - } - - #endregion - - } -} diff --git a/src/DownKyi/ViewModels/PageViewModels/PublicationMedia.cs b/src/DownKyi/ViewModels/PageViewModels/PublicationMedia.cs deleted file mode 100644 index ad6fdcf..0000000 --- a/src/DownKyi/ViewModels/PageViewModels/PublicationMedia.cs +++ /dev/null @@ -1,90 +0,0 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Mvvm; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels.PageViewModels -{ - public class PublicationMedia : BindableBase - { - protected readonly IEventAggregator eventAggregator; - - public PublicationMedia(IEventAggregator eventAggregator) - { - this.eventAggregator = eventAggregator; - } - - public long Avid { get; set; } - public string Bvid { get; set; } - - #region 页面属性申明 - - private bool isSelected; - public bool IsSelected - { - get => isSelected; - set => SetProperty(ref isSelected, value); - } - - private BitmapImage cover; - public BitmapImage Cover - { - get => cover; - set => SetProperty(ref cover, value); - } - - private string title; - public string Title - { - get => title; - set => SetProperty(ref title, value); - } - - private string duration; - public string Duration - { - get => duration; - set => SetProperty(ref duration, value); - } - - private string playNumber; - public string PlayNumber - { - get => playNumber; - set => SetProperty(ref playNumber, value); - } - - private string createTime; - public string CreateTime - { - get => createTime; - set => SetProperty(ref createTime, value); - } - - #endregion - - #region 命令申明 - - // 视频标题点击事件 - private DelegateCommand titleCommand; - public DelegateCommand TitleCommand => titleCommand ?? (titleCommand = new DelegateCommand(ExecuteTitleCommand)); - - /// - /// 视频标题点击事件 - /// - /// - private void ExecuteTitleCommand(object parameter) - { - if (!(parameter is string tag)) { return; } - - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, tag, $"{ParseEntrance.VideoUrl}{Bvid}"); - //string url = "https://www.bilibili.com/video/" + tag; - //System.Diagnostics.Process.Start(url); - } - - #endregion - - } -} diff --git a/src/DownKyi/ViewModels/PageViewModels/SpaceItem.cs b/src/DownKyi/ViewModels/PageViewModels/SpaceItem.cs deleted file mode 100644 index 8eb149c..0000000 --- a/src/DownKyi/ViewModels/PageViewModels/SpaceItem.cs +++ /dev/null @@ -1,36 +0,0 @@ -using DownKyi.Images; -using Prism.Mvvm; - -namespace DownKyi.ViewModels.PageViewModels -{ - public class SpaceItem : BindableBase - { - private bool isEnabled; - public bool IsEnabled - { - get => isEnabled; - set => SetProperty(ref isEnabled, value); - } - - private VectorImage image; - public VectorImage Image - { - get => image; - set => SetProperty(ref image, value); - } - - private string title; - public string Title - { - get => title; - set => SetProperty(ref title, value); - } - - private string subtitle; - public string Subtitle - { - get => subtitle; - set => SetProperty(ref subtitle, value); - } - } -} diff --git a/src/DownKyi/ViewModels/PageViewModels/TabHeader.cs b/src/DownKyi/ViewModels/PageViewModels/TabHeader.cs deleted file mode 100644 index f2d54b0..0000000 --- a/src/DownKyi/ViewModels/PageViewModels/TabHeader.cs +++ /dev/null @@ -1,37 +0,0 @@ -using DownKyi.Images; -using Prism.Mvvm; - -namespace DownKyi.ViewModels.PageViewModels -{ - public class TabHeader : BindableBase - { - private long id; - public long Id - { - get => id; - set => SetProperty(ref id, value); - } - - private VectorImage image; - public VectorImage Image - { - get => image; - set => SetProperty(ref image, value); - } - - private string title; - public string Title - { - get => title; - set => SetProperty(ref title, value); - } - - private string subTitle; - public string SubTitle - { - get => subTitle; - set => SetProperty(ref subTitle, value); - } - - } -} diff --git a/src/DownKyi/ViewModels/PageViewModels/ToViewMedia.cs b/src/DownKyi/ViewModels/PageViewModels/ToViewMedia.cs deleted file mode 100644 index 143caac..0000000 --- a/src/DownKyi/ViewModels/PageViewModels/ToViewMedia.cs +++ /dev/null @@ -1,107 +0,0 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Mvvm; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels.PageViewModels -{ - public class ToViewMedia : BindableBase - { - protected readonly IEventAggregator eventAggregator; - - public ToViewMedia(IEventAggregator eventAggregator) - { - this.eventAggregator = eventAggregator; - } - - // aid - public long Aid { get; set; } - - // bvid - public string Bvid { get; set; } - - // UP主的mid - public long UpMid { get; set; } - - #region 页面属性申明 - - // 是否选中 - private bool isSelected; - public bool IsSelected - { - get => isSelected; - set => SetProperty(ref isSelected, value); - } - - // 封面 - private BitmapImage cover; - public BitmapImage Cover - { - get => cover; - set => SetProperty(ref cover, value); - } - - // 视频标题 - private string title; - public string Title - { - get => title; - set => SetProperty(ref title, value); - } - - // UP主的昵称 - private string upName; - public string UpName - { - get => upName; - set => SetProperty(ref upName, value); - } - - // UP主的头像 - private BitmapImage upHeader; - public BitmapImage UpHeader - { - get => upHeader; - set => SetProperty(ref upHeader, value); - } - - #endregion - - #region 命令申明 - - // 视频标题点击事件 - private DelegateCommand titleCommand; - public DelegateCommand TitleCommand => titleCommand ?? (titleCommand = new DelegateCommand(ExecuteTitleCommand)); - - /// - /// 视频标题点击事件 - /// - /// - private void ExecuteTitleCommand(object parameter) - { - if (!(parameter is string tag)) { return; } - - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, tag, $"{ParseEntrance.VideoUrl}{Bvid}"); - } - - // UP主头像点击事件 - private DelegateCommand upCommand; - public DelegateCommand UpCommand => upCommand ?? (upCommand = new DelegateCommand(ExecuteUpCommand)); - - /// - /// UP主头像点击事件 - /// - /// - private void ExecuteUpCommand(object parameter) - { - if (!(parameter is string tag)) { return; } - - NavigateToView.NavigateToViewUserSpace(eventAggregator, tag, UpMid); - } - - #endregion - - } -} diff --git a/src/DownKyi/ViewModels/PageViewModels/VideoInfoView.cs b/src/DownKyi/ViewModels/PageViewModels/VideoInfoView.cs deleted file mode 100644 index c4f93a3..0000000 --- a/src/DownKyi/ViewModels/PageViewModels/VideoInfoView.cs +++ /dev/null @@ -1,111 +0,0 @@ -using Prism.Mvvm; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels.PageViewModels -{ - public class VideoInfoView : BindableBase - { - public string CoverUrl { get; set; } - public long UpperMid { get; set; } - public int TypeId { get; set; } - - private BitmapImage cover; - public BitmapImage Cover - { - get => cover; - set => SetProperty(ref cover, value); - } - - private string title; - public string Title - { - get => title; - set => SetProperty(ref title, value); - } - - private string videoZone; - public string VideoZone - { - get => videoZone; - set => SetProperty(ref videoZone, value); - } - - private string createTime; - public string CreateTime - { - get => createTime; - set => SetProperty(ref createTime, value); - } - - private string playNumber; - public string PlayNumber - { - get => playNumber; - set => SetProperty(ref playNumber, value); - } - - private string danmakuNumber; - public string DanmakuNumber - { - get => danmakuNumber; - set => SetProperty(ref danmakuNumber, value); - } - - private string likeNumber; - public string LikeNumber - { - get => likeNumber; - set => SetProperty(ref likeNumber, value); - } - - private string coinNumber; - public string CoinNumber - { - get => coinNumber; - set => SetProperty(ref coinNumber, value); - } - - private string favoriteNumber; - public string FavoriteNumber - { - get => favoriteNumber; - set => SetProperty(ref favoriteNumber, value); - } - - private string shareNumber; - public string ShareNumber - { - get => shareNumber; - set => SetProperty(ref shareNumber, value); - } - - private string replyNumber; - public string ReplyNumber - { - get => replyNumber; - set => SetProperty(ref replyNumber, value); - } - - private string description; - public string Description - { - get => description; - set => SetProperty(ref description, value); - } - - private string upName; - public string UpName - { - get => upName; - set => SetProperty(ref upName, value); - } - - private BitmapImage upHeader; - public BitmapImage UpHeader - { - get => upHeader; - set => SetProperty(ref upHeader, value); - } - - } -} diff --git a/src/DownKyi/ViewModels/PageViewModels/VideoPage.cs b/src/DownKyi/ViewModels/PageViewModels/VideoPage.cs deleted file mode 100644 index 2eb1b07..0000000 --- a/src/DownKyi/ViewModels/PageViewModels/VideoPage.cs +++ /dev/null @@ -1,125 +0,0 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Core.BiliApi.Models; -using DownKyi.Core.BiliApi.VideoStream.Models; -using DownKyi.Core.Logging; -using DownKyi.Core.Utils; -using Prism.Commands; -using Prism.Mvvm; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; - -namespace DownKyi.ViewModels.PageViewModels -{ - public class VideoPage : BindableBase - { - public PlayUrl PlayUrl { get; set; } - - public long Avid { get; set; } - public string Bvid { get; set; } - public long Cid { get; set; } - public long EpisodeId { get; set; } - public VideoOwner Owner { get; set; } - public string PublishTime { get; set; } - - public string FirstFrame { get; set; } - - private bool isSelected; - public bool IsSelected - { - get => isSelected; - set => SetProperty(ref isSelected, value); - } - - private int order; - public int Order - { - get => order; - set => SetProperty(ref order, value); - } - - private string name; - public string Name - { - get => name; - set => SetProperty(ref name, value); - } - - private string duration; - public string Duration - { - get => duration; - set => SetProperty(ref duration, value); - } - - private ObservableCollection audioQualityFormatList; - public ObservableCollection AudioQualityFormatList - { - get => audioQualityFormatList; - set => SetProperty(ref audioQualityFormatList, value); - } - - private string audioQualityFormat; - public string AudioQualityFormat - { - get => audioQualityFormat; - set => SetProperty(ref audioQualityFormat, value); - } - - private List videoQualityList; - public List VideoQualityList - { - get => videoQualityList; - set => SetProperty(ref videoQualityList, value); - } - - private VideoQuality videoQuality; - public VideoQuality VideoQuality - { - get => videoQuality; - set => SetProperty(ref videoQuality, value); - } - - #region - - // 视频画质选择事件 - private DelegateCommand videoQualitySelectedCommand; - public DelegateCommand VideoQualitySelectedCommand => videoQualitySelectedCommand ?? (videoQualitySelectedCommand = new DelegateCommand(ExecuteVideoQualitySelectedCommand)); - - /// - /// 视频画质选择事件 - /// - private void ExecuteVideoQualitySelectedCommand() - { - //// 杜比视界 - //string dolby = string.Empty; - //try - //{ - // var qualities = Constant.GetAudioQualities(); - // dolby = qualities[3].Name; - //} - //catch (Exception e) - //{ - // Core.Utils.Debugging.Console.PrintLine("ExecuteVideoQualitySelectedCommand()发生异常: {0}", e); - // LogManager.Error("ExecuteVideoQualitySelectedCommand", e); - //} - - //if (VideoQuality != null && VideoQuality.Quality == 126 && PlayUrl != null && PlayUrl.Dash != null && PlayUrl.Dash.Dolby != null) - //{ - // ListHelper.AddUnique(AudioQualityFormatList, dolby); - // AudioQualityFormat = dolby; - //} - //else - //{ - // if (AudioQualityFormatList.Contains(dolby)) - // { - // AudioQualityFormatList.Remove(dolby); - // AudioQualityFormat = AudioQualityFormatList[0]; - // } - //} - } - - #endregion - - } -} diff --git a/src/DownKyi/ViewModels/PageViewModels/VideoQuality.cs b/src/DownKyi/ViewModels/PageViewModels/VideoQuality.cs deleted file mode 100644 index da4bfe2..0000000 --- a/src/DownKyi/ViewModels/PageViewModels/VideoQuality.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Prism.Mvvm; -using System.Collections.Generic; - -namespace DownKyi.ViewModels.PageViewModels -{ - public class VideoQuality : BindableBase - { - private int quality; - public int Quality - { - get => quality; - set => SetProperty(ref quality, value); - } - - private string qualityFormat; - public string QualityFormat - { - get => qualityFormat; - set => SetProperty(ref qualityFormat, value); - } - - private List videoCodecList; - public List VideoCodecList - { - get => videoCodecList; - set => SetProperty(ref videoCodecList, value); - } - - private string selectedVideoCodec; - public string SelectedVideoCodec - { - get => selectedVideoCodec; - set => SetProperty(ref selectedVideoCodec, value); - } - } -} diff --git a/src/DownKyi/ViewModels/PageViewModels/VideoSection.cs b/src/DownKyi/ViewModels/PageViewModels/VideoSection.cs deleted file mode 100644 index 5fd4d09..0000000 --- a/src/DownKyi/ViewModels/PageViewModels/VideoSection.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Prism.Mvvm; -using System.Collections.Generic; - -namespace DownKyi.ViewModels.PageViewModels -{ - public class VideoSection : BindableBase - { - public long Id { get; set; } - - private string title; - public string Title - { - get => title; - set => SetProperty(ref title, value); - } - - private bool isSelected; - public bool IsSelected - { - get => isSelected; - set => SetProperty(ref isSelected, value); - } - - private List videoPages; - public List VideoPages - { - get => videoPages; - set => SetProperty(ref videoPages, value); - } - } -} diff --git a/src/DownKyi/ViewModels/Settings/DisplayFileNamePart.cs b/src/DownKyi/ViewModels/Settings/DisplayFileNamePart.cs deleted file mode 100644 index 70dcf58..0000000 --- a/src/DownKyi/ViewModels/Settings/DisplayFileNamePart.cs +++ /dev/null @@ -1,17 +0,0 @@ -using DownKyi.Core.FileName; -using Prism.Mvvm; - -namespace DownKyi.ViewModels.Settings -{ - public class DisplayFileNamePart : BindableBase - { - public FileNamePart Id { get; set; } - - private string title; - public string Title - { - get => title; - set => SetProperty(ref title, value); - } - } -} diff --git a/src/DownKyi/ViewModels/Settings/ViewAboutViewModel.cs b/src/DownKyi/ViewModels/Settings/ViewAboutViewModel.cs deleted file mode 100644 index f41ee26..0000000 --- a/src/DownKyi/ViewModels/Settings/ViewAboutViewModel.cs +++ /dev/null @@ -1,270 +0,0 @@ -using DownKyi.Core.Settings; -using DownKyi.Events; -using DownKyi.Models; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using Prism.Services.Dialogs; - -namespace DownKyi.ViewModels.Settings -{ - public class ViewAboutViewModel : BaseViewModel - { - public const string Tag = "PageSettingsAbout"; - - private bool isOnNavigatedTo; - - #region 页面属性申明 - - private string appName; - public string AppName - { - get { return appName; } - set { SetProperty(ref appName, value); } - } - - private string appVersion; - public string AppVersion - { - get { return appVersion; } - set { SetProperty(ref appVersion, value); } - } - - private bool isReceiveBetaVersion; - public bool IsReceiveBetaVersion - { - get { return isReceiveBetaVersion; } - set { SetProperty(ref isReceiveBetaVersion, value); } - } - - private bool autoUpdateWhenLaunch; - public bool AutoUpdateWhenLaunch - { - get { return autoUpdateWhenLaunch; } - set { SetProperty(ref autoUpdateWhenLaunch, value); } - } - - #endregion - - public ViewAboutViewModel(IEventAggregator eventAggregator, IDialogService dialogService) : base(eventAggregator, dialogService) - { - - #region 属性初始化 - - AppInfo app = new AppInfo(); - AppName = app.Name; - AppVersion = app.VersionName; - - #endregion - - } - - /// - /// 导航到页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - isOnNavigatedTo = true; - - // 是否接收测试版更新 - var isReceiveBetaVersion = SettingsManager.GetInstance().IsReceiveBetaVersion(); - IsReceiveBetaVersion = isReceiveBetaVersion == AllowStatus.YES; - - // 是否在启动时自动检查更新 - var isAutoUpdateWhenLaunch = SettingsManager.GetInstance().GetAutoUpdateWhenLaunch(); - AutoUpdateWhenLaunch = isAutoUpdateWhenLaunch == AllowStatus.YES; - - isOnNavigatedTo = false; - } - - #region 命令申明 - - // 访问主页事件 - private DelegateCommand appNameCommand; - public DelegateCommand AppNameCommand => appNameCommand ?? (appNameCommand = new DelegateCommand(ExecuteAppNameCommand)); - - /// - /// 访问主页事件 - /// - private void ExecuteAppNameCommand() - { - System.Diagnostics.Process.Start("https://github.com/leiurayer/downkyi"); - } - - // 检查更新事件 - private DelegateCommand checkUpdateCommand; - public DelegateCommand CheckUpdateCommand => checkUpdateCommand ?? (checkUpdateCommand = new DelegateCommand(ExecuteCheckUpdateCommand)); - - /// - /// 检查更新事件 - /// - private void ExecuteCheckUpdateCommand() - { - //eventAggregator.GetEvent().Publish("开始查找更新,请稍后~"); - eventAggregator.GetEvent().Publish("请前往主页下载最新版~"); - } - - // 意见反馈事件 - private DelegateCommand feedbackCommand; - public DelegateCommand FeedbackCommand => feedbackCommand ?? (feedbackCommand = new DelegateCommand(ExecuteFeedbackCommand)); - - /// - /// 意见反馈事件 - /// - private void ExecuteFeedbackCommand() - { - System.Diagnostics.Process.Start("https://github.com/leiurayer/downkyi/issues"); - } - - // 是否接收测试版更新事件 - private DelegateCommand receiveBetaVersionCommand; - public DelegateCommand ReceiveBetaVersionCommand => receiveBetaVersionCommand ?? (receiveBetaVersionCommand = new DelegateCommand(ExecuteReceiveBetaVersionCommand)); - - /// - /// 是否接收测试版更新事件 - /// - private void ExecuteReceiveBetaVersionCommand() - { - AllowStatus isReceiveBetaVersion = IsReceiveBetaVersion ? AllowStatus.YES : AllowStatus.NO; - - bool isSucceed = SettingsManager.GetInstance().IsReceiveBetaVersion(isReceiveBetaVersion); - PublishTip(isSucceed); - } - - // 是否在启动时自动检查更新事件 - private DelegateCommand autoUpdateWhenLaunchCommand; - public DelegateCommand AutoUpdateWhenLaunchCommand => autoUpdateWhenLaunchCommand ?? (autoUpdateWhenLaunchCommand = new DelegateCommand(ExecuteAutoUpdateWhenLaunchCommand)); - - /// - /// 是否在启动时自动检查更新事件 - /// - private void ExecuteAutoUpdateWhenLaunchCommand() - { - AllowStatus isAutoUpdateWhenLaunch = AutoUpdateWhenLaunch ? AllowStatus.YES : AllowStatus.NO; - - bool isSucceed = SettingsManager.GetInstance().SetAutoUpdateWhenLaunch(isAutoUpdateWhenLaunch); - PublishTip(isSucceed); - } - - // Brotli.NET许可证查看事件 - private DelegateCommand brotliLicenseCommand; - public DelegateCommand BrotliLicenseCommand => brotliLicenseCommand ?? (brotliLicenseCommand = new DelegateCommand(ExecuteBrotliLicenseCommand)); - - /// - /// Brotli.NET许可证查看事件 - /// - private void ExecuteBrotliLicenseCommand() - { - System.Diagnostics.Process.Start("https://licenses.nuget.org/MIT"); - } - - // Google.Protobuf许可证查看事件 - private DelegateCommand protobufLicenseCommand; - public DelegateCommand ProtobufLicenseCommand => protobufLicenseCommand ?? (protobufLicenseCommand = new DelegateCommand(ExecuteProtobufLicenseCommand)); - - /// - /// Google.Protobuf许可证查看事件 - /// - private void ExecuteProtobufLicenseCommand() - { - System.Diagnostics.Process.Start("https://github.com/protocolbuffers/protobuf/blob/master/LICENSE"); - } - - // Newtonsoft.Json许可证查看事件 - private DelegateCommand newtonsoftLicenseCommand; - public DelegateCommand NewtonsoftLicenseCommand => newtonsoftLicenseCommand ?? (newtonsoftLicenseCommand = new DelegateCommand(ExecuteNewtonsoftLicenseCommand)); - - /// - /// Newtonsoft.Json许可证查看事件 - /// - private void ExecuteNewtonsoftLicenseCommand() - { - System.Diagnostics.Process.Start("https://licenses.nuget.org/MIT"); - } - - // Prism.DryIoc许可证查看事件 - private DelegateCommand prismLicenseCommand; - public DelegateCommand PrismLicenseCommand => prismLicenseCommand ?? (prismLicenseCommand = new DelegateCommand(ExecutePrismLicenseCommand)); - - /// - /// Prism.DryIoc许可证查看事件 - /// - private void ExecutePrismLicenseCommand() - { - System.Diagnostics.Process.Start("https://www.nuget.org/packages/Prism.DryIoc/8.1.97/license"); - } - - // QRCoder许可证查看事件 - private DelegateCommand qRCoderLicenseCommand; - public DelegateCommand QRCoderLicenseCommand => qRCoderLicenseCommand ?? (qRCoderLicenseCommand = new DelegateCommand(ExecuteQRCoderLicenseCommand)); - - /// - /// QRCoder许可证查看事件 - /// - private void ExecuteQRCoderLicenseCommand() - { - System.Diagnostics.Process.Start("https://licenses.nuget.org/MIT"); - } - - // System.Data.SQLite.Core许可证查看事件 - private DelegateCommand sQLiteLicenseCommand; - public DelegateCommand SQLiteLicenseCommand => sQLiteLicenseCommand ?? (sQLiteLicenseCommand = new DelegateCommand(ExecuteSQLiteLicenseCommand)); - - /// - /// System.Data.SQLite.Core许可证查看事件 - /// - private void ExecuteSQLiteLicenseCommand() - { - System.Diagnostics.Process.Start("https://www.sqlite.org/copyright.html"); - } - - // Aria2c许可证查看事件 - private DelegateCommand ariaLicenseCommand; - public DelegateCommand AriaLicenseCommand => ariaLicenseCommand ?? (ariaLicenseCommand = new DelegateCommand(ExecuteAriaLicenseCommand)); - - /// - /// Aria2c许可证查看事件 - /// - private void ExecuteAriaLicenseCommand() - { - System.Diagnostics.Process.Start("aria2_COPYING.txt"); - } - - // FFmpeg许可证查看事件 - private DelegateCommand fFmpegLicenseCommand; - public DelegateCommand FFmpegLicenseCommand => fFmpegLicenseCommand ?? (fFmpegLicenseCommand = new DelegateCommand(ExecuteFFmpegLicenseCommand)); - - /// - /// FFmpeg许可证查看事件 - /// - private void ExecuteFFmpegLicenseCommand() - { - System.Diagnostics.Process.Start("FFmpeg_LICENSE.txt"); - } - - #endregion - - /// - /// 发送需要显示的tip - /// - /// - private void PublishTip(bool isSucceed) - { - if (isOnNavigatedTo) { return; } - - if (isSucceed) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipSettingUpdated")); - } - else - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipSettingFailed")); - } - } - - } -} diff --git a/src/DownKyi/ViewModels/Settings/ViewBasicViewModel.cs b/src/DownKyi/ViewModels/Settings/ViewBasicViewModel.cs deleted file mode 100644 index 3f2ce2b..0000000 --- a/src/DownKyi/ViewModels/Settings/ViewBasicViewModel.cs +++ /dev/null @@ -1,265 +0,0 @@ -using DownKyi.Core.Settings; -using DownKyi.Events; -using DownKyi.Models; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using System.Collections.Generic; -using System.Linq; - -namespace DownKyi.ViewModels.Settings -{ - public class ViewBasicViewModel : BaseViewModel - { - public const string Tag = "PageSettingsBasic"; - - private bool isOnNavigatedTo; - - #region 页面属性申明 - - private bool none; - public bool None - { - get { return none; } - set { SetProperty(ref none, value); } - } - - private bool closeApp; - public bool CloseApp - { - get { return closeApp; } - set { SetProperty(ref closeApp, value); } - } - - private bool closeSystem; - public bool CloseSystem - { - get { return closeSystem; } - set { SetProperty(ref closeSystem, value); } - } - - private bool listenClipboard; - public bool ListenClipboard - { - get { return listenClipboard; } - set { SetProperty(ref listenClipboard, value); } - } - - private bool autoParseVideo; - public bool AutoParseVideo - { - get { return autoParseVideo; } - set { SetProperty(ref autoParseVideo, value); } - } - - private List parseScopes; - public List ParseScopes - { - get { return parseScopes; } - set { SetProperty(ref parseScopes, value); } - } - - private ParseScopeDisplay selectedParseScope; - public ParseScopeDisplay SelectedParseScope - { - get { return selectedParseScope; } - set { SetProperty(ref selectedParseScope, value); } - } - - private bool autoDownloadAll; - public bool AutoDownloadAll - { - get => autoDownloadAll; - set => SetProperty(ref autoDownloadAll, value); - } - - #endregion - - public ViewBasicViewModel(IEventAggregator eventAggregator) : base(eventAggregator) - { - - #region 属性初始化 - - // 解析范围 - ParseScopes = new List() - { - new ParseScopeDisplay{ Name = DictionaryResource.GetString("ParseNone"), ParseScope = ParseScope.NONE }, - new ParseScopeDisplay{ Name = DictionaryResource.GetString("ParseSelectedItem"), ParseScope = ParseScope.SELECTED_ITEM }, - new ParseScopeDisplay{ Name = DictionaryResource.GetString("ParseCurrentSection"), ParseScope = ParseScope.CURRENT_SECTION }, - new ParseScopeDisplay{ Name = DictionaryResource.GetString("ParseAll"), ParseScope = ParseScope.ALL } - }; - - #endregion - - } - - /// - /// 导航到页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - isOnNavigatedTo = true; - - // 下载完成后的操作 - AfterDownloadOperation afterDownload = SettingsManager.GetInstance().GetAfterDownloadOperation(); - SetAfterDownloadOperation(afterDownload); - - // 是否监听剪贴板 - AllowStatus isListenClipboard = SettingsManager.GetInstance().IsListenClipboard(); - ListenClipboard = isListenClipboard == AllowStatus.YES; - - // 是否自动解析视频 - AllowStatus isAutoParseVideo = SettingsManager.GetInstance().IsAutoParseVideo(); - AutoParseVideo = isAutoParseVideo == AllowStatus.YES; - - // 解析范围 - ParseScope parseScope = SettingsManager.GetInstance().GetParseScope(); - SelectedParseScope = ParseScopes.FirstOrDefault(t => { return t.ParseScope == parseScope; }); - - // 解析后是否自动下载解析视频 - AllowStatus isAutoDownloadAll = SettingsManager.GetInstance().IsAutoDownloadAll(); - AutoDownloadAll = isAutoDownloadAll == AllowStatus.YES; - - isOnNavigatedTo = false; - } - - #region 命令申明 - - // 下载完成后的操作事件 - private DelegateCommand afterDownloadOperationCommand; - public DelegateCommand AfterDownloadOperationCommand => afterDownloadOperationCommand ?? (afterDownloadOperationCommand = new DelegateCommand(ExecuteAfterDownloadOperationCommand)); - - /// - /// 下载完成后的操作事件 - /// - private void ExecuteAfterDownloadOperationCommand(string parameter) - { - AfterDownloadOperation afterDownload; - switch (parameter) - { - case "None": - afterDownload = AfterDownloadOperation.NONE; - break; - case "CloseApp": - afterDownload = AfterDownloadOperation.CLOSE_APP; - break; - case "CloseSystem": - afterDownload = AfterDownloadOperation.CLOSE_SYSTEM; - break; - default: - afterDownload = AfterDownloadOperation.NONE; - break; - } - - bool isSucceed = SettingsManager.GetInstance().SetAfterDownloadOperation(afterDownload); - PublishTip(isSucceed); - } - - // 是否监听剪贴板事件 - private DelegateCommand listenClipboardCommand; - public DelegateCommand ListenClipboardCommand => listenClipboardCommand ?? (listenClipboardCommand = new DelegateCommand(ExecuteListenClipboardCommand)); - - /// - /// 是否监听剪贴板事件 - /// - private void ExecuteListenClipboardCommand() - { - AllowStatus isListenClipboard = ListenClipboard ? AllowStatus.YES : AllowStatus.NO; - - bool isSucceed = SettingsManager.GetInstance().IsListenClipboard(isListenClipboard); - PublishTip(isSucceed); - } - - private DelegateCommand autoParseVideoCommand; - public DelegateCommand AutoParseVideoCommand => autoParseVideoCommand ?? (autoParseVideoCommand = new DelegateCommand(ExecuteAutoParseVideoCommand)); - - /// - /// 是否自动解析视频 - /// - private void ExecuteAutoParseVideoCommand() - { - AllowStatus isAutoParseVideo = AutoParseVideo ? AllowStatus.YES : AllowStatus.NO; - - bool isSucceed = SettingsManager.GetInstance().IsAutoParseVideo(isAutoParseVideo); - PublishTip(isSucceed); - } - - // 解析范围事件 - private DelegateCommand parseScopesCommand; - public DelegateCommand ParseScopesCommand => parseScopesCommand ?? (parseScopesCommand = new DelegateCommand(ExecuteParseScopesCommand)); - - /// - /// 解析范围事件 - /// - /// - private void ExecuteParseScopesCommand(object parameter) - { - if (!(parameter is ParseScopeDisplay parseScope)) { return; } - - bool isSucceed = SettingsManager.GetInstance().SetParseScope(parseScope.ParseScope); - PublishTip(isSucceed); - } - - // 解析后是否自动下载解析视频 - private DelegateCommand autoDownloadAllCommand; - public DelegateCommand AutoDownloadAllCommand => autoDownloadAllCommand ?? (autoDownloadAllCommand = new DelegateCommand(ExecuteAutoDownloadAllCommand)); - - /// - /// 解析后是否自动下载解析视频 - /// - private void ExecuteAutoDownloadAllCommand() - { - AllowStatus isAutoDownloadAll = AutoDownloadAll ? AllowStatus.YES : AllowStatus.NO; - - bool isSucceed = SettingsManager.GetInstance().IsAutoDownloadAll(isAutoDownloadAll); - PublishTip(isSucceed); - } - - #endregion - - /// - /// 设置下载完成后的操作 - /// - /// - private void SetAfterDownloadOperation(AfterDownloadOperation afterDownload) - { - switch (afterDownload) - { - case AfterDownloadOperation.NONE: - None = true; - break; - case AfterDownloadOperation.OPEN_FOLDER: - break; - case AfterDownloadOperation.CLOSE_APP: - CloseApp = true; - break; - case AfterDownloadOperation.CLOSE_SYSTEM: - CloseSystem = true; - break; - } - } - - /// - /// 发送需要显示的tip - /// - /// - private void PublishTip(bool isSucceed) - { - if (isOnNavigatedTo) { return; } - - if (isSucceed) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipSettingUpdated")); - } - else - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipSettingFailed")); - } - } - - } -} diff --git a/src/DownKyi/ViewModels/Settings/ViewDanmakuViewModel.cs b/src/DownKyi/ViewModels/Settings/ViewDanmakuViewModel.cs deleted file mode 100644 index 659ead2..0000000 --- a/src/DownKyi/ViewModels/Settings/ViewDanmakuViewModel.cs +++ /dev/null @@ -1,374 +0,0 @@ -using DownKyi.Core.Settings; -using DownKyi.Core.Utils.Validator; -using DownKyi.Events; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using System.Collections.Generic; -using System.Drawing.Text; - -namespace DownKyi.ViewModels.Settings -{ - public class ViewDanmakuViewModel : BaseViewModel - { - public const string Tag = "PageSettingsDanmaku"; - - private bool isOnNavigatedTo; - - #region 页面属性申明 - - private bool topFilter; - public bool TopFilter - { - get { return topFilter; } - set { SetProperty(ref topFilter, value); } - } - - private bool bottomFilter; - public bool BottomFilter - { - get { return bottomFilter; } - set { SetProperty(ref bottomFilter, value); } - } - - private bool scrollFilter; - public bool ScrollFilter - { - get { return scrollFilter; } - set { SetProperty(ref scrollFilter, value); } - } - - private int screenWidth; - public int ScreenWidth - { - get { return screenWidth; } - set { SetProperty(ref screenWidth, value); } - } - - private int screenHeight; - public int ScreenHeight - { - get { return screenHeight; } - set { SetProperty(ref screenHeight, value); } - } - - private List fonts; - public List Fonts - { - get { return fonts; } - set { SetProperty(ref fonts, value); } - } - - private string selectedFont; - public string SelectedFont - { - get { return selectedFont; } - set { SetProperty(ref selectedFont, value); } - } - - private int fontSize; - public int FontSize - { - get { return fontSize; } - set { SetProperty(ref fontSize, value); } - } - - private int lineCount; - public int LineCount - { - get { return lineCount; } - set { SetProperty(ref lineCount, value); } - } - - private bool sync; - public bool Sync - { - get { return sync; } - set { SetProperty(ref sync, value); } - } - - private bool async; - public bool Async - { - get { return async; } - set { SetProperty(ref async, value); } - } - - #endregion - - public ViewDanmakuViewModel(IEventAggregator eventAggregator) : base(eventAggregator) - { - - #region 属性初始化 - - // 弹幕字体 - Fonts = new List(); - var fontCollection = new InstalledFontCollection(); - foreach (var font in fontCollection.Families) - { - Fonts.Add(font.Name); - } - - #endregion - - } - - /// - /// 导航到页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - isOnNavigatedTo = true; - - // 屏蔽顶部弹幕 - AllowStatus danmakuTopFilter = SettingsManager.GetInstance().GetDanmakuTopFilter(); - TopFilter = danmakuTopFilter == AllowStatus.YES; - - // 屏蔽底部弹幕 - AllowStatus danmakuBottomFilter = SettingsManager.GetInstance().GetDanmakuBottomFilter(); - BottomFilter = danmakuBottomFilter == AllowStatus.YES; - - // 屏蔽滚动弹幕 - AllowStatus danmakuScrollFilter = SettingsManager.GetInstance().GetDanmakuScrollFilter(); - ScrollFilter = danmakuScrollFilter == AllowStatus.YES; - - // 分辨率-宽 - ScreenWidth = SettingsManager.GetInstance().GetDanmakuScreenWidth(); - - // 分辨率-高 - ScreenHeight = SettingsManager.GetInstance().GetDanmakuScreenHeight(); - - // 弹幕字体 - string danmakuFont = SettingsManager.GetInstance().GetDanmakuFontName(); - if (danmakuFont != null && Fonts.Contains(danmakuFont)) - { - // 只有系统中存在当前设置的字体,才能显示 - SelectedFont = danmakuFont; - } - - // 弹幕字体大小 - FontSize = SettingsManager.GetInstance().GetDanmakuFontSize(); - - // 弹幕限制行数 - LineCount = SettingsManager.GetInstance().GetDanmakuLineCount(); - - // 弹幕布局算法 - DanmakuLayoutAlgorithm layoutAlgorithm = SettingsManager.GetInstance().GetDanmakuLayoutAlgorithm(); - SetLayoutAlgorithm(layoutAlgorithm); - - isOnNavigatedTo = false; - } - - #region 命令申明 - - // 屏蔽顶部弹幕事件 - private DelegateCommand topFilterCommand; - public DelegateCommand TopFilterCommand => topFilterCommand ?? (topFilterCommand = new DelegateCommand(ExecuteTopFilterCommand)); - - /// - /// 屏蔽顶部弹幕事件 - /// - private void ExecuteTopFilterCommand() - { - AllowStatus isTopFilter = TopFilter ? AllowStatus.YES : AllowStatus.NO; - - bool isSucceed = SettingsManager.GetInstance().SetDanmakuTopFilter(isTopFilter); - PublishTip(isSucceed); - } - - // 屏蔽底部弹幕事件 - private DelegateCommand bottomFilterCommand; - public DelegateCommand BottomFilterCommand => bottomFilterCommand ?? (bottomFilterCommand = new DelegateCommand(ExecuteBottomFilterCommand)); - - /// - /// 屏蔽底部弹幕事件 - /// - private void ExecuteBottomFilterCommand() - { - AllowStatus isBottomFilter = BottomFilter ? AllowStatus.YES : AllowStatus.NO; - - bool isSucceed = SettingsManager.GetInstance().SetDanmakuBottomFilter(isBottomFilter); - PublishTip(isSucceed); - } - - // 屏蔽滚动弹幕事件 - private DelegateCommand scrollFilterCommand; - public DelegateCommand ScrollFilterCommand => scrollFilterCommand ?? (scrollFilterCommand = new DelegateCommand(ExecuteScrollFilterCommand)); - - /// - /// 屏蔽滚动弹幕事件 - /// - private void ExecuteScrollFilterCommand() - { - AllowStatus isScrollFilter = ScrollFilter ? AllowStatus.YES : AllowStatus.NO; - - bool isSucceed = SettingsManager.GetInstance().SetDanmakuScrollFilter(isScrollFilter); - PublishTip(isSucceed); - } - - // 设置分辨率-宽事件 - private DelegateCommand screenWidthCommand; - public DelegateCommand ScreenWidthCommand => screenWidthCommand ?? (screenWidthCommand = new DelegateCommand(ExecuteScreenWidthCommand)); - - /// - /// 设置分辨率-宽事件 - /// - /// - private void ExecuteScreenWidthCommand(string parameter) - { - int width = (int)Number.GetInt(parameter); - ScreenWidth = width; - - bool isSucceed = SettingsManager.GetInstance().SetDanmakuScreenWidth(ScreenWidth); - PublishTip(isSucceed); - } - - // 设置分辨率-高事件 - private DelegateCommand screenHeightCommand; - public DelegateCommand ScreenHeightCommand => screenHeightCommand ?? (screenHeightCommand = new DelegateCommand(ExecuteScreenHeightCommand)); - - /// - /// 设置分辨率-高事件 - /// - /// - private void ExecuteScreenHeightCommand(string parameter) - { - int height = (int)Number.GetInt(parameter); - ScreenHeight = height; - - bool isSucceed = SettingsManager.GetInstance().SetDanmakuScreenHeight(ScreenHeight); - PublishTip(isSucceed); - } - - // 弹幕字体选择事件 - private DelegateCommand fontSelectCommand; - public DelegateCommand FontSelectCommand => fontSelectCommand ?? (fontSelectCommand = new DelegateCommand(ExecuteFontSelectCommand)); - - /// - /// 弹幕字体选择事件 - /// - /// - private void ExecuteFontSelectCommand(string parameter) - { - bool isSucceed = SettingsManager.GetInstance().SetDanmakuFontName(parameter); - PublishTip(isSucceed); - } - - // 弹幕字体大小事件 - private DelegateCommand fontSizeCommand; - public DelegateCommand FontSizeCommand => fontSizeCommand ?? (fontSizeCommand = new DelegateCommand(ExecuteFontSizeCommand)); - - /// - /// 弹幕字体大小事件 - /// - /// - private void ExecuteFontSizeCommand(string parameter) - { - int fontSize = (int)Number.GetInt(parameter); - FontSize = fontSize; - - bool isSucceed = SettingsManager.GetInstance().SetDanmakuFontSize(FontSize); - PublishTip(isSucceed); - } - - // 弹幕限制行数事件 - private DelegateCommand lineCountCommand; - public DelegateCommand LineCountCommand => lineCountCommand ?? (lineCountCommand = new DelegateCommand(ExecuteLineCountCommand)); - - /// - /// 弹幕限制行数事件 - /// - /// - private void ExecuteLineCountCommand(string parameter) - { - int lineCount = (int)Number.GetInt(parameter); - LineCount = lineCount; - - bool isSucceed = SettingsManager.GetInstance().SetDanmakuLineCount(LineCount); - PublishTip(isSucceed); - } - - // 弹幕布局算法事件 - private DelegateCommand layoutAlgorithmCommand; - public DelegateCommand LayoutAlgorithmCommand => layoutAlgorithmCommand ?? (layoutAlgorithmCommand = new DelegateCommand(ExecuteLayoutAlgorithmCommand)); - - /// - /// 弹幕布局算法事件 - /// - /// - private void ExecuteLayoutAlgorithmCommand(string parameter) - { - DanmakuLayoutAlgorithm layoutAlgorithm; - switch (parameter) - { - case "Sync": - layoutAlgorithm = DanmakuLayoutAlgorithm.SYNC; - break; - case "Async": - layoutAlgorithm = DanmakuLayoutAlgorithm.ASYNC; - break; - default: - layoutAlgorithm = DanmakuLayoutAlgorithm.SYNC; - break; - } - - bool isSucceed = SettingsManager.GetInstance().SetDanmakuLayoutAlgorithm(layoutAlgorithm); - PublishTip(isSucceed); - - if (isSucceed) - { - SetLayoutAlgorithm(layoutAlgorithm); - } - } - - #endregion - - /// - /// 设置弹幕同步算法 - /// - /// - private void SetLayoutAlgorithm(DanmakuLayoutAlgorithm layoutAlgorithm) - { - switch (layoutAlgorithm) - { - case DanmakuLayoutAlgorithm.SYNC: - Sync = true; - Async = false; - break; - case DanmakuLayoutAlgorithm.ASYNC: - Sync = false; - Async = true; - break; - case DanmakuLayoutAlgorithm.NONE: - Sync = false; - Async = false; - break; - default: - break; - } - } - - /// - /// 发送需要显示的tip - /// - /// - private void PublishTip(bool isSucceed) - { - if (isOnNavigatedTo) { return; } - - if (isSucceed) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipSettingUpdated")); - } - else - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipSettingFailed")); - } - } - - } -} diff --git a/src/DownKyi/ViewModels/Settings/ViewNetworkViewModel.cs b/src/DownKyi/ViewModels/Settings/ViewNetworkViewModel.cs deleted file mode 100644 index eba6594..0000000 --- a/src/DownKyi/ViewModels/Settings/ViewNetworkViewModel.cs +++ /dev/null @@ -1,751 +0,0 @@ -using DownKyi.Core.Aria2cNet.Server; -using DownKyi.Core.Settings; -using DownKyi.Core.Utils.Validator; -using DownKyi.Events; -using DownKyi.Services; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using Prism.Services.Dialogs; -using System.Collections.Generic; - -namespace DownKyi.ViewModels.Settings -{ - public class ViewNetworkViewModel : BaseViewModel - { - public const string Tag = "PageSettingsNetwork"; - - private bool isOnNavigatedTo; - - #region 页面属性申明 - - private bool useSSL; - public bool UseSSL - { - get => useSSL; - set => SetProperty(ref useSSL, value); - } - - private string userAgent; - public string UserAgent - { - get => userAgent; - set => SetProperty(ref userAgent, value); - } - - private bool builtin; - public bool Builtin - { - get => builtin; - set => SetProperty(ref builtin, value); - } - - private bool aria2c; - public bool Aria2c - { - get => aria2c; - set => SetProperty(ref aria2c, value); - } - - private bool customAria2c; - public bool CustomAria2c - { - get => customAria2c; - set => SetProperty(ref customAria2c, value); - } - - private List maxCurrentDownloads; - public List MaxCurrentDownloads - { - get => maxCurrentDownloads; - set => SetProperty(ref maxCurrentDownloads, value); - } - - private int selectedMaxCurrentDownload; - public int SelectedMaxCurrentDownload - { - get => selectedMaxCurrentDownload; - set => SetProperty(ref selectedMaxCurrentDownload, value); - } - - private List splits; - public List Splits - { - get => splits; - set => SetProperty(ref splits, value); - } - - private int selectedSplit; - public int SelectedSplit - { - get => selectedSplit; - set => SetProperty(ref selectedSplit, value); - } - - private bool isHttpProxy; - public bool IsHttpProxy - { - get => isHttpProxy; - set => SetProperty(ref isHttpProxy, value); - } - - private string httpProxy; - public string HttpProxy - { - get => httpProxy; - set => SetProperty(ref httpProxy, value); - } - - private int httpProxyPort; - public int HttpProxyPort - { - get => httpProxyPort; - set => SetProperty(ref httpProxyPort, value); - } - - private string ariaHost; - public string AriaHost - { - get => ariaHost; - set => SetProperty(ref ariaHost, value); - } - - private int ariaListenPort; - public int AriaListenPort - { - get => ariaListenPort; - set => SetProperty(ref ariaListenPort, value); - } - - private string ariaToken; - public string AriaToken - { - get => ariaToken; - set => SetProperty(ref ariaToken, value); - } - - private List ariaLogLevels; - public List AriaLogLevels - { - get => ariaLogLevels; - set => SetProperty(ref ariaLogLevels, value); - } - - private string selectedAriaLogLevel; - public string SelectedAriaLogLevel - { - get => selectedAriaLogLevel; - set => SetProperty(ref selectedAriaLogLevel, value); - } - - private List ariaMaxConcurrentDownloads; - public List AriaMaxConcurrentDownloads - { - get => ariaMaxConcurrentDownloads; - set => SetProperty(ref ariaMaxConcurrentDownloads, value); - } - - private int selectedAriaMaxConcurrentDownload; - public int SelectedAriaMaxConcurrentDownload - { - get => selectedAriaMaxConcurrentDownload; - set => SetProperty(ref selectedAriaMaxConcurrentDownload, value); - } - - private List ariaSplits; - public List AriaSplits - { - get => ariaSplits; - set => SetProperty(ref ariaSplits, value); - } - - private int selectedAriaSplit; - public int SelectedAriaSplit - { - get => selectedAriaSplit; - set => SetProperty(ref selectedAriaSplit, value); - } - - private int ariaMaxOverallDownloadLimit; - public int AriaMaxOverallDownloadLimit - { - get => ariaMaxOverallDownloadLimit; - set => SetProperty(ref ariaMaxOverallDownloadLimit, value); - } - - private int ariaMaxDownloadLimit; - public int AriaMaxDownloadLimit - { - get => ariaMaxDownloadLimit; - set => SetProperty(ref ariaMaxDownloadLimit, value); - } - - private bool isAriaHttpProxy; - public bool IsAriaHttpProxy - { - get => isAriaHttpProxy; - set => SetProperty(ref isAriaHttpProxy, value); - } - - private string ariaHttpProxy; - public string AriaHttpProxy - { - get => ariaHttpProxy; - set => SetProperty(ref ariaHttpProxy, value); - } - - private int ariaHttpProxyPort; - public int AriaHttpProxyPort - { - get => ariaHttpProxyPort; - set => SetProperty(ref ariaHttpProxyPort, value); - } - - private List ariaFileAllocations; - public List AriaFileAllocations - { - get => ariaFileAllocations; - set => SetProperty(ref ariaFileAllocations, value); - } - - private string selectedAriaFileAllocation; - public string SelectedAriaFileAllocation - { - get => selectedAriaFileAllocation; - set => SetProperty(ref selectedAriaFileAllocation, value); - } - - #endregion - - public ViewNetworkViewModel(IEventAggregator eventAggregator, IDialogService dialogService) : base(eventAggregator, dialogService) - { - - #region 属性初始化 - - // builtin同时下载数 - MaxCurrentDownloads = new List(); - for (int i = 1; i <= 10; i++) { MaxCurrentDownloads.Add(i); } - - // builtin最大线程数 - Splits = new List(); - for (int i = 1; i <= 10; i++) { Splits.Add(i); } - - // Aria的日志等级 - AriaLogLevels = new List - { - "DEBUG", - "INFO", - "NOTICE", - "WARN", - "ERROR" - }; - - // Aria同时下载数 - AriaMaxConcurrentDownloads = new List(); - for (int i = 1; i <= 10; i++) { AriaMaxConcurrentDownloads.Add(i); } - - // Aria最大线程数 - AriaSplits = new List(); - for (int i = 1; i <= 10; i++) { AriaSplits.Add(i); } - - // Aria文件预分配 - AriaFileAllocations = new List - { - "NONE", - "PREALLOC", - "FALLOC" - }; - - #endregion - - } - - /// - /// 导航到页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - isOnNavigatedTo = true; - - // 启用https - AllowStatus useSSL = SettingsManager.GetInstance().UseSSL(); - UseSSL = useSSL == AllowStatus.YES; - - // UserAgent - UserAgent = SettingsManager.GetInstance().GetUserAgent(); - - // 选择下载器 - var downloader = SettingsManager.GetInstance().GetDownloader(); - switch (downloader) - { - case Downloader.NOT_SET: - break; - case Downloader.BUILT_IN: - Builtin = true; - break; - case Downloader.ARIA: - Aria2c = true; - break; - case Downloader.CUSTOM_ARIA: - CustomAria2c = true; - break; - } - - // builtin同时下载数 - SelectedMaxCurrentDownload = SettingsManager.GetInstance().GetMaxCurrentDownloads(); - - // builtin最大线程数 - SelectedSplit = SettingsManager.GetInstance().GetSplit(); - - // 是否开启builtin http代理 - AllowStatus isHttpProxy = SettingsManager.GetInstance().IsHttpProxy(); - IsHttpProxy = isHttpProxy == AllowStatus.YES; - - // builtin的http代理的地址 - HttpProxy = SettingsManager.GetInstance().GetHttpProxy(); - - // builtin的http代理的端口 - HttpProxyPort = SettingsManager.GetInstance().GetHttpProxyListenPort(); - - // Aria服务器host - AriaHost = SettingsManager.GetInstance().GetAriaHost(); - - // Aria服务器端口 - AriaListenPort = SettingsManager.GetInstance().GetAriaListenPort(); - - // Aria服务器Token - AriaToken = SettingsManager.GetInstance().GetAriaToken(); - - // Aria的日志等级 - AriaConfigLogLevel ariaLogLevel = SettingsManager.GetInstance().GetAriaLogLevel(); - SelectedAriaLogLevel = ariaLogLevel.ToString("G"); - - // Aria同时下载数 - SelectedAriaMaxConcurrentDownload = SettingsManager.GetInstance().GetMaxCurrentDownloads(); - - // Aria最大线程数 - SelectedAriaSplit = SettingsManager.GetInstance().GetAriaSplit(); - - // Aria下载速度限制 - AriaMaxOverallDownloadLimit = SettingsManager.GetInstance().GetAriaMaxOverallDownloadLimit(); - - // Aria下载单文件速度限制 - AriaMaxDownloadLimit = SettingsManager.GetInstance().GetAriaMaxDownloadLimit(); - - // 是否开启Aria http代理 - AllowStatus isAriaHttpProxy = SettingsManager.GetInstance().IsAriaHttpProxy(); - IsAriaHttpProxy = isAriaHttpProxy == AllowStatus.YES; - - // Aria的http代理的地址 - AriaHttpProxy = SettingsManager.GetInstance().GetAriaHttpProxy(); - - // Aria的http代理的端口 - AriaHttpProxyPort = SettingsManager.GetInstance().GetAriaHttpProxyListenPort(); - - // Aria文件预分配 - AriaConfigFileAllocation ariaFileAllocation = SettingsManager.GetInstance().GetAriaFileAllocation(); - SelectedAriaFileAllocation = ariaFileAllocation.ToString("G"); - - isOnNavigatedTo = false; - } - - #region 命令申明 - - // 是否启用https事件 - private DelegateCommand useSSLCommand; - public DelegateCommand UseSSLCommand => useSSLCommand ?? (useSSLCommand = new DelegateCommand(ExecuteUseSSLCommand)); - - /// - /// 是否启用https事件 - /// - private void ExecuteUseSSLCommand() - { - AllowStatus useSSL = UseSSL ? AllowStatus.YES : AllowStatus.NO; - - bool isSucceed = SettingsManager.GetInstance().UseSSL(useSSL); - PublishTip(isSucceed); - } - - // 设置UserAgent事件 - private DelegateCommand userAgentCommand; - public DelegateCommand UserAgentCommand => userAgentCommand ?? (userAgentCommand = new DelegateCommand(ExecuteUserAgentCommand)); - - /// - /// 设置UserAgent事件 - /// - private void ExecuteUserAgentCommand() - { - bool isSucceed = SettingsManager.GetInstance().SetUserAgent(UserAgent); - PublishTip(isSucceed); - } - - // 下载器选择事件 - private DelegateCommand selectDownloaderCommand; - public DelegateCommand SelectDownloaderCommand => selectDownloaderCommand ?? (selectDownloaderCommand = new DelegateCommand(ExecuteSelectDownloaderCommand)); - - /// - /// 下载器选择事件 - /// - /// - private void ExecuteSelectDownloaderCommand(string parameter) - { - Downloader downloader; - switch (parameter) - { - case "Builtin": - downloader = Downloader.BUILT_IN; - break; - case "Aria2c": - downloader = Downloader.ARIA; - break; - case "CustomAria2c": - downloader = Downloader.CUSTOM_ARIA; - break; - default: - downloader = SettingsManager.GetInstance().GetDownloader(); - break; - } - - bool isSucceed = SettingsManager.GetInstance().SetDownloader(downloader); - PublishTip(isSucceed); - - AlertService alertService = new AlertService(dialogService); - ButtonResult result = alertService.ShowInfo(DictionaryResource.GetString("ConfirmReboot")); - if (result == ButtonResult.OK) - { - System.Windows.Application.Current.Shutdown(); - System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location); - } - } - - // builtin同时下载数事件 - private DelegateCommand maxCurrentDownloadsCommand; - public DelegateCommand MaxCurrentDownloadsCommand => maxCurrentDownloadsCommand ?? (maxCurrentDownloadsCommand = new DelegateCommand(ExecuteMaxCurrentDownloadsCommand)); - - /// - /// builtin同时下载数事件 - /// - /// - private void ExecuteMaxCurrentDownloadsCommand(object parameter) - { - SelectedMaxCurrentDownload = (int)parameter; - - bool isSucceed = SettingsManager.GetInstance().SetMaxCurrentDownloads(SelectedMaxCurrentDownload); - PublishTip(isSucceed); - } - - // builtin最大线程数事件 - private DelegateCommand splitsCommand; - public DelegateCommand SplitsCommand => splitsCommand ?? (splitsCommand = new DelegateCommand(ExecuteSplitsCommand)); - - /// - /// builtin最大线程数事件 - /// - /// - private void ExecuteSplitsCommand(object parameter) - { - SelectedSplit = (int)parameter; - - bool isSucceed = SettingsManager.GetInstance().SetSplit(SelectedSplit); - PublishTip(isSucceed); - } - - // 是否开启builtin http代理事件 - private DelegateCommand isHttpProxyCommand; - public DelegateCommand IsHttpProxyCommand => isHttpProxyCommand ?? (isHttpProxyCommand = new DelegateCommand(ExecuteIsHttpProxyCommand)); - - /// - /// 是否开启builtin http代理事件 - /// - private void ExecuteIsHttpProxyCommand() - { - AllowStatus isHttpProxy = IsHttpProxy ? AllowStatus.YES : AllowStatus.NO; - - bool isSucceed = SettingsManager.GetInstance().IsHttpProxy(isHttpProxy); - PublishTip(isSucceed); - } - - // builtin的http代理的地址事件 - private DelegateCommand httpProxyCommand; - public DelegateCommand HttpProxyCommand => httpProxyCommand ?? (httpProxyCommand = new DelegateCommand(ExecuteHttpProxyCommand)); - - /// - /// builtin的http代理的地址事件 - /// - /// - private void ExecuteHttpProxyCommand(string parameter) - { - bool isSucceed = SettingsManager.GetInstance().SetHttpProxy(parameter); - PublishTip(isSucceed); - } - - // builtin的http代理的端口事件 - private DelegateCommand httpProxyPortCommand; - public DelegateCommand HttpProxyPortCommand => httpProxyPortCommand ?? (httpProxyPortCommand = new DelegateCommand(ExecuteHttpProxyPortCommand)); - - /// - /// builtin的http代理的端口事件 - /// - /// - private void ExecuteHttpProxyPortCommand(string parameter) - { - int httpProxyPort = (int)Number.GetInt(parameter); - HttpProxyPort = httpProxyPort; - - bool isSucceed = SettingsManager.GetInstance().SetHttpProxyListenPort(HttpProxyPort); - PublishTip(isSucceed); - } - - // Aria服务器host事件 - private DelegateCommand ariaHostCommand; - public DelegateCommand AriaHostCommand => ariaHostCommand ?? (ariaHostCommand = new DelegateCommand(ExecuteAriaHostCommand)); - - /// - /// Aria服务器host事件 - /// - /// - private void ExecuteAriaHostCommand(string parameter) - { - AriaHost = parameter; - bool isSucceed = SettingsManager.GetInstance().SetAriaHost(AriaHost); - PublishTip(isSucceed); - } - - // Aria服务器端口事件 - private DelegateCommand ariaListenPortCommand; - public DelegateCommand AriaListenPortCommand => ariaListenPortCommand ?? (ariaListenPortCommand = new DelegateCommand(ExecuteAriaListenPortCommand)); - - /// - /// Aria服务器端口事件 - /// - /// - private void ExecuteAriaListenPortCommand(string parameter) - { - int listenPort = (int)Number.GetInt(parameter); - AriaListenPort = listenPort; - - bool isSucceed = SettingsManager.GetInstance().SetAriaListenPort(AriaListenPort); - PublishTip(isSucceed); - } - - // Aria服务器token事件 - private DelegateCommand ariaTokenCommand; - public DelegateCommand AriaTokenCommand => ariaTokenCommand ?? (ariaTokenCommand = new DelegateCommand(ExecuteAriaTokenCommand)); - - /// - /// Aria服务器token事件 - /// - /// - private void ExecuteAriaTokenCommand(string parameter) - { - AriaToken = parameter; - bool isSucceed = SettingsManager.GetInstance().SetAriaToken(AriaToken); - PublishTip(isSucceed); - } - - // Aria的日志等级事件 - private DelegateCommand ariaLogLevelsCommand; - public DelegateCommand AriaLogLevelsCommand => ariaLogLevelsCommand ?? (ariaLogLevelsCommand = new DelegateCommand(ExecuteAriaLogLevelsCommand)); - - /// - /// Aria的日志等级事件 - /// - /// - private void ExecuteAriaLogLevelsCommand(string parameter) - { - AriaConfigLogLevel ariaLogLevel; - switch (parameter) - { - case "DEBUG": - ariaLogLevel = AriaConfigLogLevel.DEBUG; - break; - case "INFO": - ariaLogLevel = AriaConfigLogLevel.INFO; - break; - case "NOTICE": - ariaLogLevel = AriaConfigLogLevel.NOTICE; - break; - case "WARN": - ariaLogLevel = AriaConfigLogLevel.WARN; - break; - case "ERROR": - ariaLogLevel = AriaConfigLogLevel.ERROR; - break; - default: - ariaLogLevel = AriaConfigLogLevel.INFO; - break; - } - - bool isSucceed = SettingsManager.GetInstance().SetAriaLogLevel(ariaLogLevel); - PublishTip(isSucceed); - } - - // Aria同时下载数事件 - private DelegateCommand ariaMaxConcurrentDownloadsCommand; - public DelegateCommand AriaMaxConcurrentDownloadsCommand => ariaMaxConcurrentDownloadsCommand ?? (ariaMaxConcurrentDownloadsCommand = new DelegateCommand(ExecuteAriaMaxConcurrentDownloadsCommand)); - - /// - /// Aria同时下载数事件 - /// - /// - private void ExecuteAriaMaxConcurrentDownloadsCommand(object parameter) - { - SelectedAriaMaxConcurrentDownload = (int)parameter; - - bool isSucceed = SettingsManager.GetInstance().SetMaxCurrentDownloads(SelectedAriaMaxConcurrentDownload); - PublishTip(isSucceed); - } - - // Aria最大线程数事件 - private DelegateCommand ariaSplitsCommand; - public DelegateCommand AriaSplitsCommand => ariaSplitsCommand ?? (ariaSplitsCommand = new DelegateCommand(ExecuteAriaSplitsCommand)); - - /// - /// Aria最大线程数事件 - /// - /// - private void ExecuteAriaSplitsCommand(object parameter) - { - SelectedAriaSplit = (int)parameter; - - bool isSucceed = SettingsManager.GetInstance().SetAriaSplit(SelectedAriaSplit); - PublishTip(isSucceed); - } - - // Aria下载速度限制事件 - private DelegateCommand ariaMaxOverallDownloadLimitCommand; - public DelegateCommand AriaMaxOverallDownloadLimitCommand => ariaMaxOverallDownloadLimitCommand ?? (ariaMaxOverallDownloadLimitCommand = new DelegateCommand(ExecuteAriaMaxOverallDownloadLimitCommand)); - - /// - /// Aria下载速度限制事件 - /// - /// - private void ExecuteAriaMaxOverallDownloadLimitCommand(string parameter) - { - int downloadLimit = (int)Number.GetInt(parameter); - AriaMaxOverallDownloadLimit = downloadLimit; - - bool isSucceed = SettingsManager.GetInstance().SetAriaMaxOverallDownloadLimit(AriaMaxOverallDownloadLimit); - PublishTip(isSucceed); - } - - // Aria下载单文件速度限制事件 - private DelegateCommand ariaMaxDownloadLimitCommand; - public DelegateCommand AriaMaxDownloadLimitCommand => ariaMaxDownloadLimitCommand ?? (ariaMaxDownloadLimitCommand = new DelegateCommand(ExecuteAriaMaxDownloadLimitCommand)); - - /// - /// Aria下载单文件速度限制事件 - /// - /// - private void ExecuteAriaMaxDownloadLimitCommand(string parameter) - { - int downloadLimit = (int)Number.GetInt(parameter); - AriaMaxDownloadLimit = downloadLimit; - - bool isSucceed = SettingsManager.GetInstance().SetAriaMaxDownloadLimit(AriaMaxDownloadLimit); - PublishTip(isSucceed); - } - - // 是否开启Aria http代理事件 - private DelegateCommand isAriaHttpProxyCommand; - public DelegateCommand IsAriaHttpProxyCommand => isAriaHttpProxyCommand ?? (isAriaHttpProxyCommand = new DelegateCommand(ExecuteIsAriaHttpProxyCommand)); - - /// - /// 是否开启Aria http代理事件 - /// - private void ExecuteIsAriaHttpProxyCommand() - { - AllowStatus isAriaHttpProxy = IsAriaHttpProxy ? AllowStatus.YES : AllowStatus.NO; - - bool isSucceed = SettingsManager.GetInstance().IsAriaHttpProxy(isAriaHttpProxy); - PublishTip(isSucceed); - } - - // Aria的http代理的地址事件 - private DelegateCommand ariaHttpProxyCommand; - public DelegateCommand AriaHttpProxyCommand => ariaHttpProxyCommand ?? (ariaHttpProxyCommand = new DelegateCommand(ExecuteAriaHttpProxyCommand)); - - /// - /// Aria的http代理的地址事件 - /// - /// - private void ExecuteAriaHttpProxyCommand(string parameter) - { - bool isSucceed = SettingsManager.GetInstance().SetAriaHttpProxy(parameter); - PublishTip(isSucceed); - } - - // Aria的http代理的端口事件 - private DelegateCommand ariaHttpProxyPortCommand; - public DelegateCommand AriaHttpProxyPortCommand => ariaHttpProxyPortCommand ?? (ariaHttpProxyPortCommand = new DelegateCommand(ExecuteAriaHttpProxyPortCommand)); - - /// - /// Aria的http代理的端口事件 - /// - /// - private void ExecuteAriaHttpProxyPortCommand(string parameter) - { - int httpProxyPort = (int)Number.GetInt(parameter); - AriaHttpProxyPort = httpProxyPort; - - bool isSucceed = SettingsManager.GetInstance().SetAriaHttpProxyListenPort(AriaHttpProxyPort); - PublishTip(isSucceed); - } - - // Aria文件预分配事件 - private DelegateCommand ariaFileAllocationsCommand; - public DelegateCommand AriaFileAllocationsCommand => ariaFileAllocationsCommand ?? (ariaFileAllocationsCommand = new DelegateCommand(ExecuteAriaFileAllocationsCommand)); - - /// - /// Aria文件预分配事件 - /// - /// - private void ExecuteAriaFileAllocationsCommand(string parameter) - { - AriaConfigFileAllocation ariaFileAllocation; - switch (parameter) - { - case "NONE": - ariaFileAllocation = AriaConfigFileAllocation.NONE; - break; - case "PREALLOC": - ariaFileAllocation = AriaConfigFileAllocation.PREALLOC; - break; - case "FALLOC": - ariaFileAllocation = AriaConfigFileAllocation.FALLOC; - break; - default: - ariaFileAllocation = AriaConfigFileAllocation.PREALLOC; - break; - } - - bool isSucceed = SettingsManager.GetInstance().SetAriaFileAllocation(ariaFileAllocation); - PublishTip(isSucceed); - } - - #endregion - - /// - /// 发送需要显示的tip - /// - /// - private void PublishTip(bool isSucceed) - { - if (isOnNavigatedTo) { return; } - - if (isSucceed) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipSettingUpdated")); - } - else - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipSettingFailed")); - } - } - - } -} diff --git a/src/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs b/src/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs deleted file mode 100644 index 7bb76fb..0000000 --- a/src/DownKyi/ViewModels/Settings/ViewVideoViewModel.cs +++ /dev/null @@ -1,831 +0,0 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Core.FileName; -using DownKyi.Core.Settings; -using DownKyi.Core.Settings.Models; -using DownKyi.Events; -using DownKyi.Models; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Collections.Specialized; -using System.Linq; - -namespace DownKyi.ViewModels.Settings -{ - public class ViewVideoViewModel : BaseViewModel - { - public const string Tag = "PageSettingsVideo"; - - private bool isOnNavigatedTo; - - #region 页面属性申明 - - private List videoCodecs; - public List VideoCodecs - { - get => videoCodecs; - set => SetProperty(ref videoCodecs, value); - } - - private Quality selectedVideoCodec; - public Quality SelectedVideoCodec - { - get => selectedVideoCodec; - set => SetProperty(ref selectedVideoCodec, value); - } - - private List videoQualityList; - public List VideoQualityList - { - get => videoQualityList; - set => SetProperty(ref videoQualityList, value); - } - - private Quality selectedVideoQuality; - public Quality SelectedVideoQuality - { - get => selectedVideoQuality; - set => SetProperty(ref selectedVideoQuality, value); - } - - private List audioQualityList; - public List AudioQualityList - { - get => audioQualityList; - set => SetProperty(ref audioQualityList, value); - } - - private Quality selectedAudioQuality; - public Quality SelectedAudioQuality - { - get => selectedAudioQuality; - set => SetProperty(ref selectedAudioQuality, value); - } - - private bool isTranscodingFlvToMp4; - public bool IsTranscodingFlvToMp4 - { - get => isTranscodingFlvToMp4; - set => SetProperty(ref isTranscodingFlvToMp4, value); - } - - private bool isUseDefaultDirectory; - public bool IsUseDefaultDirectory - { - get => isUseDefaultDirectory; - set => SetProperty(ref isUseDefaultDirectory, value); - } - - private string saveVideoDirectory; - public string SaveVideoDirectory - { - get => saveVideoDirectory; - set => SetProperty(ref saveVideoDirectory, value); - } - - private bool downloadAll; - public bool DownloadAll - { - get { return downloadAll; } - set { SetProperty(ref downloadAll, value); } - } - - private bool downloadAudio; - public bool DownloadAudio - { - get { return downloadAudio; } - set { SetProperty(ref downloadAudio, value); } - } - - private bool downloadVideo; - public bool DownloadVideo - { - get { return downloadVideo; } - set { SetProperty(ref downloadVideo, value); } - } - - private bool downloadDanmaku; - public bool DownloadDanmaku - { - get { return downloadDanmaku; } - set { SetProperty(ref downloadDanmaku, value); } - } - - private bool downloadSubtitle; - public bool DownloadSubtitle - { - get { return downloadSubtitle; } - set { SetProperty(ref downloadSubtitle, value); } - } - - private bool downloadCover; - public bool DownloadCover - { - get { return downloadCover; } - set { SetProperty(ref downloadCover, value); } - } - - private ObservableCollection selectedFileName; - public ObservableCollection SelectedFileName - { - get => selectedFileName; - set => SetProperty(ref selectedFileName, value); - } - - private ObservableCollection optionalFields; - public ObservableCollection OptionalFields - { - get => optionalFields; - set => SetProperty(ref optionalFields, value); - } - - private int selectedOptionalField; - public int SelectedOptionalField - { - get => selectedOptionalField; - set => SetProperty(ref selectedOptionalField, value); - } - - private List fileNamePartTimeFormatList; - public List FileNamePartTimeFormatList - { - get => fileNamePartTimeFormatList; - set => SetProperty(ref fileNamePartTimeFormatList, value); - } - - private string selectedFileNamePartTimeFormat; - public string SelectedFileNamePartTimeFormat - { - get => selectedFileNamePartTimeFormat; - set => SetProperty(ref selectedFileNamePartTimeFormat, value); - } - - private List orderFormatList; - public List OrderFormatList - { - get => orderFormatList; - set => SetProperty(ref orderFormatList, value); - } - - private OrderFormatDisplay orderFormatDisplay; - public OrderFormatDisplay OrderFormatDisplay - { - get => orderFormatDisplay; - set => SetProperty(ref orderFormatDisplay, value); - } - - #endregion - - public ViewVideoViewModel(IEventAggregator eventAggregator) : base(eventAggregator) - { - - #region 属性初始化 - - // 优先下载的视频编码 - VideoCodecs = Constant.GetCodecIds(); - //VideoCodecs = new List - //{ - // "H.264/AVC", - // "H.265/HEVC", - //}; - - // 优先下载画质 - VideoQualityList = Constant.GetResolutions(); - - // 优先下载音质 - AudioQualityList = Constant.GetAudioQualities(); - //AudioQualityList.RemoveAt(3); - AudioQualityList[3].Id = AudioQualityList[3].Id + 1000; - AudioQualityList[4].Id = AudioQualityList[4].Id + 1000; - - // 文件命名格式 - SelectedFileName = new ObservableCollection(); - - SelectedFileName.CollectionChanged += new NotifyCollectionChangedEventHandler((sender, e) => - { - // 当前显示的命名格式part - List fileName = new List(); - foreach (DisplayFileNamePart item in SelectedFileName) - { - fileName.Add(item.Id); - } - - bool isSucceed = SettingsManager.GetInstance().SetFileNameParts(fileName); - PublishTip(isSucceed); - }); - - OptionalFields = new ObservableCollection(); - foreach (FileNamePart item in Enum.GetValues(typeof(FileNamePart))) - { - string display = DisplayFileNamePart(item); - OptionalFields.Add(new DisplayFileNamePart { Id = item, Title = display }); - } - - SelectedOptionalField = -1; - - // 文件命名中的时间格式 - FileNamePartTimeFormatList = new List - { - "yyyy-MM-dd", - "yyyy.MM.dd", - }; - - // 文件命名中的序号格式 - OrderFormatList = new List - { - new OrderFormatDisplay{ Name = DictionaryResource.GetString("OrderFormatNatural"), OrderFormat = OrderFormat.NATURAL }, - new OrderFormatDisplay{ Name = DictionaryResource.GetString("OrderFormatLeadingZeros"), OrderFormat = OrderFormat.LEADING_ZEROS }, - }; - - #endregion - - } - - /// - /// 导航到页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - isOnNavigatedTo = true; - - // 优先下载的视频编码 - int videoCodecs = SettingsManager.GetInstance().GetVideoCodecs(); - //SelectedVideoCodec = GetVideoCodecsString(videoCodecs); - SelectedVideoCodec = VideoCodecs.FirstOrDefault(t => { return t.Id == videoCodecs; }); - - // 优先下载画质 - int quality = SettingsManager.GetInstance().GetQuality(); - SelectedVideoQuality = VideoQualityList.FirstOrDefault(t => { return t.Id == quality; }); - - // 优先下载音质 - int audioQuality = SettingsManager.GetInstance().GetAudioQuality(); - SelectedAudioQuality = AudioQualityList.FirstOrDefault(t => { return t.Id == audioQuality; }); - - // 是否下载flv视频后转码为mp4 - AllowStatus isTranscodingFlvToMp4 = SettingsManager.GetInstance().IsTranscodingFlvToMp4(); - IsTranscodingFlvToMp4 = isTranscodingFlvToMp4 == AllowStatus.YES; - - // 是否使用默认下载目录 - AllowStatus isUseSaveVideoRootPath = SettingsManager.GetInstance().IsUseSaveVideoRootPath(); - IsUseDefaultDirectory = isUseSaveVideoRootPath == AllowStatus.YES; - - // 默认下载目录 - SaveVideoDirectory = SettingsManager.GetInstance().GetSaveVideoRootPath(); - - // 下载内容 - VideoContentSettings videoContent = SettingsManager.GetInstance().GetVideoContent(); - - DownloadAudio = videoContent.DownloadAudio; - DownloadVideo = videoContent.DownloadVideo; - DownloadDanmaku = videoContent.DownloadDanmaku; - DownloadSubtitle = videoContent.DownloadSubtitle; - DownloadCover = videoContent.DownloadCover; - - if (DownloadAudio && DownloadVideo && DownloadDanmaku && DownloadSubtitle && DownloadCover) - { - DownloadAll = true; - } - else - { - DownloadAll = false; - } - - // 文件命名格式 - List fileNameParts = SettingsManager.GetInstance().GetFileNameParts(); - SelectedFileName.Clear(); - foreach (FileNamePart item in fileNameParts) - { - string display = DisplayFileNamePart(item); - SelectedFileName.Add(new DisplayFileNamePart { Id = item, Title = display }); - } - - // 文件命名中的时间格式 - SelectedFileNamePartTimeFormat = SettingsManager.GetInstance().GetFileNamePartTimeFormat(); - - // 文件命名中的序号格式 - OrderFormat orderFormat = SettingsManager.GetInstance().GetOrderFormat(); - OrderFormatDisplay = OrderFormatList.FirstOrDefault(t => { return t.OrderFormat == orderFormat; }); - - isOnNavigatedTo = false; - } - - #region 命令申明 - - // 优先下载的视频编码事件 - private DelegateCommand videoCodecsCommand; - public DelegateCommand VideoCodecsCommand => videoCodecsCommand ?? (videoCodecsCommand = new DelegateCommand(ExecuteVideoCodecsCommand)); - - /// - /// 优先下载的视频编码事件 - /// - /// - private void ExecuteVideoCodecsCommand(object parameter) - { - //VideoCodecs videoCodecs = GetVideoCodecs(parameter); - - if (!(parameter is Quality videoCodecs)) { return; } - - bool isSucceed = SettingsManager.GetInstance().SetVideoCodecs(videoCodecs.Id); - PublishTip(isSucceed); - } - - // 优先下载画质事件 - private DelegateCommand videoQualityCommand; - public DelegateCommand VideoQualityCommand => videoQualityCommand ?? (videoQualityCommand = new DelegateCommand(ExecuteVideoQualityCommand)); - - /// - /// 优先下载画质事件 - /// - /// - private void ExecuteVideoQualityCommand(object parameter) - { - if (!(parameter is Quality resolution)) { return; } - - bool isSucceed = SettingsManager.GetInstance().SetQuality(resolution.Id); - PublishTip(isSucceed); - } - - // 优先下载音质事件 - private DelegateCommand audioQualityCommand; - public DelegateCommand AudioQualityCommand => audioQualityCommand ?? (audioQualityCommand = new DelegateCommand(ExecuteAudioQualityCommand)); - - /// - /// 优先下载音质事件 - /// - /// - private void ExecuteAudioQualityCommand(object parameter) - { - if (!(parameter is Quality quality)) { return; } - - bool isSucceed = SettingsManager.GetInstance().SetAudioQuality(quality.Id); - PublishTip(isSucceed); - } - - // 是否下载flv视频后转码为mp4事件 - private DelegateCommand isTranscodingFlvToMp4Command; - public DelegateCommand IsTranscodingFlvToMp4Command => isTranscodingFlvToMp4Command ?? (isTranscodingFlvToMp4Command = new DelegateCommand(ExecuteIsTranscodingFlvToMp4Command)); - - /// - /// 是否下载flv视频后转码为mp4事件 - /// - private void ExecuteIsTranscodingFlvToMp4Command() - { - AllowStatus isTranscodingFlvToMp4 = IsTranscodingFlvToMp4 ? AllowStatus.YES : AllowStatus.NO; - - bool isSucceed = SettingsManager.GetInstance().IsTranscodingFlvToMp4(isTranscodingFlvToMp4); - PublishTip(isSucceed); - } - - // 是否使用默认下载目录事件 - private DelegateCommand isUseDefaultDirectoryCommand; - public DelegateCommand IsUseDefaultDirectoryCommand => isUseDefaultDirectoryCommand ?? (isUseDefaultDirectoryCommand = new DelegateCommand(ExecuteIsUseDefaultDirectoryCommand)); - - /// - /// 是否使用默认下载目录事件 - /// - private void ExecuteIsUseDefaultDirectoryCommand() - { - AllowStatus isUseDefaultDirectory = IsUseDefaultDirectory ? AllowStatus.YES : AllowStatus.NO; - - bool isSucceed = SettingsManager.GetInstance().IsUseSaveVideoRootPath(isUseDefaultDirectory); - PublishTip(isSucceed); - } - - // 修改默认下载目录事件 - private DelegateCommand changeSaveVideoDirectoryCommand; - public DelegateCommand ChangeSaveVideoDirectoryCommand => changeSaveVideoDirectoryCommand ?? (changeSaveVideoDirectoryCommand = new DelegateCommand(ExecuteChangeSaveVideoDirectoryCommand)); - - /// - /// 修改默认下载目录事件 - /// - private void ExecuteChangeSaveVideoDirectoryCommand() - { - string directory = DialogUtils.SetDownloadDirectory(); - if (directory == "") { return; } - - bool isSucceed = SettingsManager.GetInstance().SetSaveVideoRootPath(directory); - PublishTip(isSucceed); - - if (isSucceed) - { - SaveVideoDirectory = directory; - } - } - - // 所有内容选择事件 - private DelegateCommand downloadAllCommand; - public DelegateCommand DownloadAllCommand => downloadAllCommand ?? (downloadAllCommand = new DelegateCommand(ExecuteDownloadAllCommand)); - - /// - /// 所有内容选择事件 - /// - private void ExecuteDownloadAllCommand() - { - if (DownloadAll) - { - DownloadAudio = true; - DownloadVideo = true; - DownloadDanmaku = true; - DownloadSubtitle = true; - DownloadCover = true; - } - else - { - DownloadAudio = false; - DownloadVideo = false; - DownloadDanmaku = false; - DownloadSubtitle = false; - DownloadCover = false; - } - - SetVideoContent(); - } - - // 音频选择事件 - private DelegateCommand downloadAudioCommand; - public DelegateCommand DownloadAudioCommand => downloadAudioCommand ?? (downloadAudioCommand = new DelegateCommand(ExecuteDownloadAudioCommand)); - - /// - /// 音频选择事件 - /// - private void ExecuteDownloadAudioCommand() - { - if (!DownloadAudio) - { - DownloadAll = false; - } - - if (DownloadAudio && DownloadVideo && DownloadDanmaku && DownloadSubtitle && DownloadCover) - { - DownloadAll = true; - } - - SetVideoContent(); - } - - // 视频选择事件 - private DelegateCommand downloadVideoCommand; - public DelegateCommand DownloadVideoCommand => downloadVideoCommand ?? (downloadVideoCommand = new DelegateCommand(ExecuteDownloadVideoCommand)); - - /// - /// 视频选择事件 - /// - private void ExecuteDownloadVideoCommand() - { - if (!DownloadVideo) - { - DownloadAll = false; - } - - if (DownloadAudio && DownloadVideo && DownloadDanmaku && DownloadSubtitle && DownloadCover) - { - DownloadAll = true; - } - - SetVideoContent(); - } - - // 弹幕选择事件 - private DelegateCommand downloadDanmakuCommand; - public DelegateCommand DownloadDanmakuCommand => downloadDanmakuCommand ?? (downloadDanmakuCommand = new DelegateCommand(ExecuteDownloadDanmakuCommand)); - - /// - /// 弹幕选择事件 - /// - private void ExecuteDownloadDanmakuCommand() - { - if (!DownloadDanmaku) - { - DownloadAll = false; - } - - if (DownloadAudio && DownloadVideo && DownloadDanmaku && DownloadSubtitle && DownloadCover) - { - DownloadAll = true; - } - - SetVideoContent(); - } - - // 字幕选择事件 - private DelegateCommand downloadSubtitleCommand; - public DelegateCommand DownloadSubtitleCommand => downloadSubtitleCommand ?? (downloadSubtitleCommand = new DelegateCommand(ExecuteDownloadSubtitleCommand)); - - /// - /// 字幕选择事件 - /// - private void ExecuteDownloadSubtitleCommand() - { - if (!DownloadSubtitle) - { - DownloadAll = false; - } - - if (DownloadAudio && DownloadVideo && DownloadDanmaku && DownloadSubtitle && DownloadCover) - { - DownloadAll = true; - } - - SetVideoContent(); - } - - // 封面选择事件 - private DelegateCommand downloadCoverCommand; - public DelegateCommand DownloadCoverCommand => downloadCoverCommand ?? (downloadCoverCommand = new DelegateCommand(ExecuteDownloadCoverCommand)); - - /// - /// 封面选择事件 - /// - private void ExecuteDownloadCoverCommand() - { - if (!DownloadCover) - { - DownloadAll = false; - } - - if (DownloadAudio && DownloadVideo && DownloadDanmaku && DownloadSubtitle && DownloadCover) - { - DownloadAll = true; - } - - SetVideoContent(); - } - - // 选中文件名字段右键点击事件 - private DelegateCommand selectedFileNameRightCommand; - public DelegateCommand SelectedFileNameRightCommand => selectedFileNameRightCommand ?? (selectedFileNameRightCommand = new DelegateCommand(ExecuteSelectedFileNameRightCommand)); - - /// - /// 选中文件名字段右键点击事件 - /// - /// - private void ExecuteSelectedFileNameRightCommand(object parameter) - { - if (parameter == null) { return; } - - bool isSucceed = SelectedFileName.Remove((DisplayFileNamePart)parameter); - if (!isSucceed) - { - PublishTip(isSucceed); - return; - } - - //List fileName = new List(); - //foreach (DisplayFileNamePart item in SelectedFileName) - //{ - // fileName.Add(item.Id); - //} - - //isSucceed = SettingsManager.GetInstance().SetFileNameParts(fileName); - //PublishTip(isSucceed); - - SelectedOptionalField = -1; - } - - // 可选文件名字段点击事件 - private DelegateCommand optionalFieldsCommand; - public DelegateCommand OptionalFieldsCommand => optionalFieldsCommand ?? (optionalFieldsCommand = new DelegateCommand(ExecuteOptionalFieldsCommand)); - - /// - /// 可选文件名字段点击事件 - /// - /// - private void ExecuteOptionalFieldsCommand(object parameter) - { - if (SelectedOptionalField == -1) - { - return; - } - - SelectedFileName.Add((DisplayFileNamePart)parameter); - - List fileName = new List(); - foreach (DisplayFileNamePart item in SelectedFileName) - { - fileName.Add(item.Id); - } - - bool isSucceed = SettingsManager.GetInstance().SetFileNameParts(fileName); - PublishTip(isSucceed); - - SelectedOptionalField = -1; - } - - // 重置选中文件名字段 - private DelegateCommand resetCommand; - public DelegateCommand ResetCommand => resetCommand ?? (resetCommand = new DelegateCommand(ExecuteResetCommand)); - - /// - /// 重置选中文件名字段 - /// - private void ExecuteResetCommand() - { - bool isSucceed = SettingsManager.GetInstance().SetFileNameParts(null); - PublishTip(isSucceed); - - List fileNameParts = SettingsManager.GetInstance().GetFileNameParts(); - SelectedFileName.Clear(); - foreach (FileNamePart item in fileNameParts) - { - string display = DisplayFileNamePart(item); - SelectedFileName.Add(new DisplayFileNamePart { Id = item, Title = display }); - } - - SelectedOptionalField = -1; - } - - // 文件命名中的时间格式事件 - private DelegateCommand fileNamePartTimeFormatCommand; - public DelegateCommand FileNamePartTimeFormatCommand => fileNamePartTimeFormatCommand ?? (fileNamePartTimeFormatCommand = new DelegateCommand(ExecuteFileNamePartTimeFormatCommand)); - - /// - /// 文件命名中的时间格式事件 - /// - /// - private void ExecuteFileNamePartTimeFormatCommand(object parameter) - { - if (!(parameter is string timeFormat)) { return; } - - bool isSucceed = SettingsManager.GetInstance().SetFileNamePartTimeFormat(timeFormat); - PublishTip(isSucceed); - } - - // 文件命名中的序号格式事件 - private DelegateCommand orderFormatCommand; - public DelegateCommand OrderFormatCommand => orderFormatCommand ?? (orderFormatCommand = new DelegateCommand(ExecuteOrderFormatCommandCommand)); - - /// - /// 文件命名中的序号格式事件 - /// - /// - private void ExecuteOrderFormatCommandCommand(object parameter) - { - if (!(parameter is OrderFormatDisplay orderFormatDisplay)) { return; } - - bool isSucceed = SettingsManager.GetInstance().SetOrderFormat(orderFormatDisplay.OrderFormat); - PublishTip(isSucceed); - } - - #endregion - - /// - /// 返回VideoCodecs的字符串 - /// - /// - /// - //private string GetVideoCodecsString(VideoCodecs videoCodecs) - //{ - // string codec; - // switch (videoCodecs) - // { - // case Core.Settings.VideoCodecs.NONE: - // codec = ""; - // break; - // case Core.Settings.VideoCodecs.AVC: - // codec = "H.264/AVC"; - // break; - // case Core.Settings.VideoCodecs.HEVC: - // codec = "H.265/HEVC"; - // break; - // default: - // codec = ""; - // break; - // } - // return codec; - //} - - /// - /// 返回VideoCodecs - /// - /// - /// - //private VideoCodecs GetVideoCodecs(string str) - //{ - // VideoCodecs videoCodecs; - // switch (str) - // { - // case "H.264/AVC": - // videoCodecs = Core.Settings.VideoCodecs.AVC; - // break; - // case "H.265/HEVC": - // videoCodecs = Core.Settings.VideoCodecs.HEVC; - // break; - // default: - // videoCodecs = Core.Settings.VideoCodecs.NONE; - // break; - // } - // return videoCodecs; - //} - - /// - /// 保存下载视频内容到设置 - /// - private void SetVideoContent() - { - VideoContentSettings videoContent = new VideoContentSettings - { - DownloadAudio = DownloadAudio, - DownloadVideo = DownloadVideo, - DownloadDanmaku = DownloadDanmaku, - DownloadSubtitle = DownloadSubtitle, - DownloadCover = DownloadCover - }; - - bool isSucceed = SettingsManager.GetInstance().SetVideoContent(videoContent); - PublishTip(isSucceed); - } - - /// - /// 文件名字段显示 - /// - /// - /// - private string DisplayFileNamePart(FileNamePart item) - { - string display = string.Empty; - switch (item) - { - case FileNamePart.ORDER: - display = DictionaryResource.GetString("DisplayOrder"); - break; - case FileNamePart.SECTION: - display = DictionaryResource.GetString("DisplaySection"); - break; - case FileNamePart.MAIN_TITLE: - display = DictionaryResource.GetString("DisplayMainTitle"); - break; - case FileNamePart.PAGE_TITLE: - display = DictionaryResource.GetString("DisplayPageTitle"); - break; - case FileNamePart.VIDEO_ZONE: - display = DictionaryResource.GetString("DisplayVideoZone"); - break; - case FileNamePart.AUDIO_QUALITY: - display = DictionaryResource.GetString("DisplayAudioQuality"); - break; - case FileNamePart.VIDEO_QUALITY: - display = DictionaryResource.GetString("DisplayVideoQuality"); - break; - case FileNamePart.VIDEO_CODEC: - display = DictionaryResource.GetString("DisplayVideoCodec"); - break; - case FileNamePart.VIDEO_PUBLISH_TIME: - display = DictionaryResource.GetString("DisplayVideoPublishTime"); - break; - case FileNamePart.AVID: - display = "avid"; - break; - case FileNamePart.BVID: - display = "bvid"; - break; - case FileNamePart.CID: - display = "cid"; - break; - case FileNamePart.UP_MID: - display = DictionaryResource.GetString("DisplayUpMid"); - break; - case FileNamePart.UP_NAME: - display = DictionaryResource.GetString("DisplayUpName"); - break; - } - - if (((int)item) >= 100) - { - display = HyphenSeparated.Hyphen[(int)item]; - } - - if (display == " ") - { - display = DictionaryResource.GetString("DisplaySpace"); - } - - return display; - } - - /// - /// 发送需要显示的tip - /// - /// - private void PublishTip(bool isSucceed) - { - if (isOnNavigatedTo) { return; } - - if (isSucceed) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipSettingUpdated")); - } - else - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipSettingFailed")); - } - } - - } -} diff --git a/src/DownKyi/ViewModels/Toolbox/ViewBiliHelperViewModel.cs b/src/DownKyi/ViewModels/Toolbox/ViewBiliHelperViewModel.cs deleted file mode 100644 index cff240b..0000000 --- a/src/DownKyi/ViewModels/Toolbox/ViewBiliHelperViewModel.cs +++ /dev/null @@ -1,151 +0,0 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Core.Logging; -using Prism.Commands; -using Prism.Events; -using System; -using System.Threading.Tasks; - -namespace DownKyi.ViewModels.Toolbox -{ - public class ViewBiliHelperViewModel : BaseViewModel - { - public const string Tag = "PageToolboxBiliHelper"; - - #region 页面属性申明 - - private string avid; - public string Avid - { - get { return avid; } - set { SetProperty(ref avid, value); } - } - - private string bvid; - public string Bvid - { - get { return bvid; } - set { SetProperty(ref bvid, value); } - } - - private string danmakuUserID; - public string DanmakuUserID - { - get { return danmakuUserID; } - set { SetProperty(ref danmakuUserID, value); } - } - - private string userMid; - public string UserMid - { - get { return userMid; } - set { SetProperty(ref userMid, value); } - } - - #endregion - - public ViewBiliHelperViewModel(IEventAggregator eventAggregator) : base(eventAggregator) - { - #region 属性初始化 - #endregion - } - - #region 命令申明 - - // 输入avid事件 - private DelegateCommand avidCommand; - public DelegateCommand AvidCommand => avidCommand ?? (avidCommand = new DelegateCommand(ExecuteAvidCommand)); - - /// - /// 输入avid事件 - /// - private async void ExecuteAvidCommand(string parameter) - { - if (parameter == null) { return; } - if (!ParseEntrance.IsAvId(parameter)) { return; } - - long avid = ParseEntrance.GetAvId(parameter); - if (avid == -1) { return; } - - await Task.Run(() => - { - Bvid = BvId.Av2Bv((ulong)avid); - }); - } - - // 输入bvid事件 - private DelegateCommand bvidCommand; - public DelegateCommand BvidCommand => bvidCommand ?? (bvidCommand = new DelegateCommand(ExecuteBvidCommand)); - - /// - /// 输入bvid事件 - /// - /// - private async void ExecuteBvidCommand(string parameter) - { - if (parameter == null) { return; } - if (!ParseEntrance.IsBvId(parameter)) { return; } - - await Task.Run(() => - { - ulong avid = BvId.Bv2Av(parameter); - Avid = $"av{avid}"; - }); - } - - // 访问网页事件 - private DelegateCommand gotoWebCommand; - public DelegateCommand GotoWebCommand => gotoWebCommand ?? (gotoWebCommand = new DelegateCommand(ExecuteGotoWebCommand)); - - /// - /// 访问网页事件 - /// - private void ExecuteGotoWebCommand() - { - string baseUrl = "https://www.bilibili.com/video/"; - System.Diagnostics.Process.Start(baseUrl + Bvid); - } - - // 查询弹幕发送者事件 - private DelegateCommand findDanmakuSenderCommand; - public DelegateCommand FindDanmakuSenderCommand => findDanmakuSenderCommand ?? (findDanmakuSenderCommand = new DelegateCommand(ExecuteFindDanmakuSenderCommand)); - - /// - /// 查询弹幕发送者事件 - /// - private async void ExecuteFindDanmakuSenderCommand() - { - await Task.Run(() => - { - try - { - UserMid = DanmakuSender.FindDanmakuSender(DanmakuUserID); - } - catch (Exception e) - { - UserMid = null; - - Core.Utils.Debugging.Console.PrintLine("FindDanmakuSenderCommand()发生异常: {0}", e); - LogManager.Error(Tag, e); - } - }); - } - - // 访问用户空间事件 - private DelegateCommand visitUserSpaceCommand; - public DelegateCommand VisitUserSpaceCommand => visitUserSpaceCommand ?? (visitUserSpaceCommand = new DelegateCommand(ExecuteVisitUserSpaceCommand)); - - /// - /// 访问用户空间事件 - /// - private void ExecuteVisitUserSpaceCommand() - { - if (UserMid == null) { return; } - - string baseUrl = "https://space.bilibili.com/"; - System.Diagnostics.Process.Start(baseUrl + UserMid); - } - - #endregion - - } -} diff --git a/src/DownKyi/ViewModels/Toolbox/ViewDelogoViewModel.cs b/src/DownKyi/ViewModels/Toolbox/ViewDelogoViewModel.cs deleted file mode 100644 index ff4c6b4..0000000 --- a/src/DownKyi/ViewModels/Toolbox/ViewDelogoViewModel.cs +++ /dev/null @@ -1,176 +0,0 @@ -using DownKyi.Core.FFmpeg; -using DownKyi.Events; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using System; -using System.Threading.Tasks; -using System.Windows.Controls; - -namespace DownKyi.ViewModels.Toolbox -{ - public class ViewDelogoViewModel : BaseViewModel - { - public const string Tag = "PageToolboxDelogo"; - - // 是否正在执行去水印任务 - private bool isDelogo = false; - - #region 页面属性申明 - - private string videoPath; - public string VideoPath - { - get { return videoPath; } - set { SetProperty(ref videoPath, value); } - } - - private int logoWidth; - public int LogoWidth - { - get { return logoWidth; } - set { SetProperty(ref logoWidth, value); } - } - - private int logoHeight; - public int LogoHeight - { - get { return logoHeight; } - set { SetProperty(ref logoHeight, value); } - } - - private int logoX; - public int LogoX - { - get { return logoX; } - set { SetProperty(ref logoX, value); } - } - - private int logoY; - public int LogoY - { - get { return logoY; } - set { SetProperty(ref logoY, value); } - } - - private string status; - public string Status - { - get { return status; } - set { SetProperty(ref status, value); } - } - - #endregion - - public ViewDelogoViewModel(IEventAggregator eventAggregator) : base(eventAggregator) - { - #region 属性初始化 - - VideoPath = string.Empty; - - LogoWidth = 0; - LogoHeight = 0; - LogoX = 0; - LogoY = 0; - - #endregion - } - - #region 命令申明 - - // 选择视频事件 - private DelegateCommand selectVideoCommand; - public DelegateCommand SelectVideoCommand => selectVideoCommand ?? (selectVideoCommand = new DelegateCommand(ExecuteSelectVideoCommand)); - - /// - /// 选择视频事件 - /// - private void ExecuteSelectVideoCommand() - { - if (isDelogo) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipWaitTaskFinished")); - return; - } - - VideoPath = DialogUtils.SelectVideoFile(); - } - - // 去水印事件 - private DelegateCommand delogoCommand; - public DelegateCommand DelogoCommand => delogoCommand ?? (delogoCommand = new DelegateCommand(ExecuteDelogoCommand)); - - /// - /// 去水印事件 - /// - private async void ExecuteDelogoCommand() - { - if (isDelogo) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipWaitTaskFinished")); - return; - } - - if (VideoPath == "") - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipNoSeletedVideo")); - return; - } - - if (LogoWidth == -1) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipInputRightLogoWidth")); - return; - } - if (LogoHeight == -1) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipInputRightLogoHeight")); - return; - } - if (LogoX == -1) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipInputRightLogoX")); - return; - } - if (LogoY == -1) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipInputRightLogoY")); - return; - } - - // 新文件名 - string newFileName = VideoPath.Insert(VideoPath.Length - 4, "_delogo"); - Status = string.Empty; - - await Task.Run(() => - { - // 执行去水印程序 - isDelogo = true; - FFmpegHelper.Delogo(VideoPath, newFileName, LogoX, LogoY, LogoWidth, LogoHeight, new Action((output) => - { - Status += output + "\n"; - })); - isDelogo = false; - }); - } - - // Status改变事件 - private DelegateCommand statusCommand; - public DelegateCommand StatusCommand => statusCommand ?? (statusCommand = new DelegateCommand(ExecuteStatusCommand)); - - /// - /// Status改变事件 - /// - /// - private void ExecuteStatusCommand(object parameter) - { - if (!(parameter is TextBox output)) { return; } - - // TextBox滚动到底部 - output.ScrollToEnd(); - } - - #endregion - - } -} diff --git a/src/DownKyi/ViewModels/Toolbox/ViewExtractMediaViewModel.cs b/src/DownKyi/ViewModels/Toolbox/ViewExtractMediaViewModel.cs deleted file mode 100644 index cbd4cd6..0000000 --- a/src/DownKyi/ViewModels/Toolbox/ViewExtractMediaViewModel.cs +++ /dev/null @@ -1,180 +0,0 @@ -using DownKyi.Core.FFmpeg; -using DownKyi.Events; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using System; -using System.Threading.Tasks; -using System.Windows.Controls; - -namespace DownKyi.ViewModels.Toolbox -{ - public class ViewExtractMediaViewModel : BaseViewModel - { - public const string Tag = "PageToolboxExtractMedia"; - - // 是否正在执行任务 - private bool isExtracting = false; - - #region 页面属性申明 - - private string videoPathsStr; - public string VideoPathsStr - { - get => videoPathsStr; - set - { - SetProperty(ref videoPathsStr, value); - } - } - - private string[] videoPaths; - public string[] VideoPaths - { - get => videoPaths; - set - { - videoPaths = value; - VideoPathsStr = string.Join(Environment.NewLine, value); - } - } - - private string status; - public string Status - { - get { return status; } - set { SetProperty(ref status, value); } - } - - #endregion - - public ViewExtractMediaViewModel(IEventAggregator eventAggregator) : base(eventAggregator) - { - #region 属性初始化 - - VideoPaths = new string[0]; - - #endregion - } - - #region 命令申明 - - // 选择视频事件 - private DelegateCommand selectVideoCommand; - public DelegateCommand SelectVideoCommand => selectVideoCommand ?? (selectVideoCommand = new DelegateCommand(ExecuteSelectVideoCommand)); - - /// - /// 选择视频事件 - /// - private void ExecuteSelectVideoCommand() - { - if (isExtracting) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipWaitTaskFinished")); - return; - } - - VideoPaths = DialogUtils.SelectMultiVideoFile(); - } - - // 提取音频事件 - private DelegateCommand extractAudioCommand; - public DelegateCommand ExtractAudioCommand => extractAudioCommand ?? (extractAudioCommand = new DelegateCommand(ExecuteExtractAudioCommand)); - - /// - /// 提取音频事件 - /// - private async void ExecuteExtractAudioCommand() - { - if (isExtracting) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipWaitTaskFinished")); - return; - } - - if (VideoPaths.Length <= 0) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipNoSeletedVideo")); - return; - } - - Status = string.Empty; - - await Task.Run(() => - { - isExtracting = true; - foreach (var item in VideoPaths) - { - // 音频文件名 - string audioFileName = item.Remove(item.Length - 4, 4) + ".aac"; - // 执行提取音频程序 - FFmpegHelper.ExtractAudio(item, audioFileName, new Action((output) => - { - Status += output + "\n"; - })); - } - isExtracting = false; - }); - } - - // 提取视频事件 - private DelegateCommand extractVideoCommand; - public DelegateCommand ExtractVideoCommand => extractVideoCommand ?? (extractVideoCommand = new DelegateCommand(ExecuteExtractVideoCommand)); - - /// - /// 提取视频事件 - /// - private async void ExecuteExtractVideoCommand() - { - if (isExtracting) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipWaitTaskFinished")); - return; - } - - if (VideoPaths.Length <= 0) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipNoSeletedVideo")); - return; - } - - Status = string.Empty; - - await Task.Run(() => - { - isExtracting = true; - foreach (var item in VideoPaths) - { - // 视频文件名 - string videoFileName = item.Remove(item.Length - 4, 4) + "_onlyVideo.mp4"; - // 执行提取视频程序 - FFmpegHelper.ExtractVideo(item, videoFileName, new Action((output) => - { - Status += output + "\n"; - })); - } - isExtracting = false; - }); - } - - // Status改变事件 - private DelegateCommand statusCommand; - - public DelegateCommand StatusCommand => statusCommand ?? (statusCommand = new DelegateCommand(ExecuteStatusCommand)); - - /// - /// Status改变事件 - /// - /// - private void ExecuteStatusCommand(object parameter) - { - if (!(parameter is TextBox output)) { return; } - - // TextBox滚动到底部 - output.ScrollToEnd(); - } - - #endregion - - } -} diff --git a/src/DownKyi/ViewModels/UserSpace/Channel.cs b/src/DownKyi/ViewModels/UserSpace/Channel.cs deleted file mode 100644 index af7c2f4..0000000 --- a/src/DownKyi/ViewModels/UserSpace/Channel.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Prism.Mvvm; -using System.Windows.Media; - -namespace DownKyi.ViewModels.UserSpace -{ - public class Channel : BindableBase - { - public long Cid { get; set; } - - private ImageSource cover; - public ImageSource Cover - { - get => cover; - set => SetProperty(ref cover, value); - } - - private string name; - public string Name - { - get => name; - set => SetProperty(ref name, value); - } - - private int count; - public int Count - { - get => count; - set => SetProperty(ref count, value); - } - - private string ctime; - public string Ctime - { - get => ctime; - set => SetProperty(ref ctime, value); - } - - } -} diff --git a/src/DownKyi/ViewModels/UserSpace/PublicationZone.cs b/src/DownKyi/ViewModels/UserSpace/PublicationZone.cs deleted file mode 100644 index fef0c79..0000000 --- a/src/DownKyi/ViewModels/UserSpace/PublicationZone.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Prism.Mvvm; -using System.Windows.Media; - -namespace DownKyi.ViewModels.UserSpace -{ - public class PublicationZone : BindableBase - { - public int Tid { get; set; } - - private DrawingImage icon; - public DrawingImage Icon - { - get => icon; - set => SetProperty(ref icon, value); - } - - private string name; - public string Name - { - get => name; - set => SetProperty(ref name, value); - } - - private int count; - public int Count - { - get => count; - set => SetProperty(ref count, value); - } - } -} diff --git a/src/DownKyi/ViewModels/UserSpace/SeasonsSeries.cs b/src/DownKyi/ViewModels/UserSpace/SeasonsSeries.cs deleted file mode 100644 index 0641112..0000000 --- a/src/DownKyi/ViewModels/UserSpace/SeasonsSeries.cs +++ /dev/null @@ -1,47 +0,0 @@ -using DownKyi.Images; -using Prism.Mvvm; -using System.Windows.Media; - -namespace DownKyi.ViewModels.UserSpace -{ - public class SeasonsSeries : BindableBase - { - public long Id { get; set; } - - private ImageSource cover; - public ImageSource Cover - { - get => cover; - set => SetProperty(ref cover, value); - } - - private VectorImage typeImage; - public VectorImage TypeImage - { - get => typeImage; - set => SetProperty(ref typeImage, value); - } - - private string name; - public string Name - { - get => name; - set => SetProperty(ref name, value); - } - - private int count; - public int Count - { - get => count; - set => SetProperty(ref count, value); - } - - private string ctime; - public string Ctime - { - get => ctime; - set => SetProperty(ref ctime, value); - } - - } -} diff --git a/src/DownKyi/ViewModels/UserSpace/TabLeftBanner.cs b/src/DownKyi/ViewModels/UserSpace/TabLeftBanner.cs deleted file mode 100644 index 0754727..0000000 --- a/src/DownKyi/ViewModels/UserSpace/TabLeftBanner.cs +++ /dev/null @@ -1,41 +0,0 @@ -using DownKyi.Images; -using Prism.Mvvm; - -namespace DownKyi.ViewModels.UserSpace -{ - public class TabLeftBanner : BindableBase - { - public object Object { get; set; } - - public int Id { get; set; } - - private bool isSelected; - public bool IsSelected - { - get => isSelected; - set => SetProperty(ref isSelected, value); - } - - private VectorImage icon; - public VectorImage Icon - { - get => icon; - set => SetProperty(ref icon, value); - } - - private string iconColor; - public string IconColor - { - get => iconColor; - set => SetProperty(ref iconColor, value); - } - - private string title; - public string Title - { - get => title; - set => SetProperty(ref title, value); - } - - } -} diff --git a/src/DownKyi/ViewModels/UserSpace/TabRightBanner.cs b/src/DownKyi/ViewModels/UserSpace/TabRightBanner.cs deleted file mode 100644 index 252c3ce..0000000 --- a/src/DownKyi/ViewModels/UserSpace/TabRightBanner.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Prism.Mvvm; - -namespace DownKyi.ViewModels.UserSpace -{ - public class TabRightBanner : BindableBase - { - public int Id { get; set; } - - private bool isEnabled; - public bool IsEnabled - { - get => isEnabled; - set => SetProperty(ref isEnabled, value); - } - - private string labelColor; - public string LabelColor - { - get => labelColor; - set => SetProperty(ref labelColor, value); - } - - private string countColor; - public string CountColor - { - get => countColor; - set => SetProperty(ref countColor, value); - } - - private string label; - public string Label - { - get => label; - set => SetProperty(ref label, value); - } - - private string count; - public string Count - { - get => count; - set => SetProperty(ref count, value); - } - - } -} diff --git a/src/DownKyi/ViewModels/UserSpace/ViewArchiveViewModel.cs b/src/DownKyi/ViewModels/UserSpace/ViewArchiveViewModel.cs deleted file mode 100644 index f280cca..0000000 --- a/src/DownKyi/ViewModels/UserSpace/ViewArchiveViewModel.cs +++ /dev/null @@ -1,131 +0,0 @@ -using DownKyi.Core.BiliApi.Users.Models; -using DownKyi.Core.BiliApi.Zone; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Windows; -using System.Windows.Media; - -namespace DownKyi.ViewModels.UserSpace -{ - public class ViewArchiveViewModel : BaseViewModel - { - public const string Tag = "PageUserSpaceArchive"; - - private long mid = -1; - - #region 页面属性申明 - - private ObservableCollection publicationZones; - public ObservableCollection PublicationZones - { - get => publicationZones; - set => SetProperty(ref publicationZones, value); - } - - private int selectedItem; - public int SelectedItem - { - get => selectedItem; - set => SetProperty(ref selectedItem, value); - } - - #endregion - - public ViewArchiveViewModel(IEventAggregator eventAggregator) : base(eventAggregator) - { - #region 属性初始化 - - PublicationZones = new ObservableCollection(); - - #endregion - } - - #region 命令申明 - - // 视频选择事件 - private DelegateCommand publicationZonesCommand; - public DelegateCommand PublicationZonesCommand => publicationZonesCommand ?? (publicationZonesCommand = new DelegateCommand(ExecutePublicationZonesCommand)); - - /// - /// 视频选择事件 - /// - /// - private void ExecutePublicationZonesCommand(object parameter) - { - if (!(parameter is PublicationZone zone)) { return; } - - Dictionary data = new Dictionary - { - { "mid", mid }, - { "tid", zone.Tid }, - { "list", PublicationZones.ToList() } - }; - - // 进入视频页面 - NavigateToView.NavigationView(eventAggregator, ViewPublicationViewModel.Tag, ViewUserSpaceViewModel.Tag, data); - - SelectedItem = -1; - } - - #endregion - - public override void OnNavigatedFrom(NavigationContext navigationContext) - { - base.OnNavigatedFrom(navigationContext); - - PublicationZones.Clear(); - SelectedItem = -1; - } - - /// - /// 接收mid参数 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - PublicationZones.Clear(); - SelectedItem = -1; - - // 根据传入参数不同执行不同任务 - var parameter = navigationContext.Parameters.GetValue>("object"); - if (parameter == null) - { - return; - } - - // 传入mid - mid = navigationContext.Parameters.GetValue("mid"); - - int VideoCount = 0; - foreach (var zone in parameter) - { - VideoCount += zone.Count; - string iconKey = VideoZoneIcon.Instance().GetZoneImageKey(zone.Tid); - publicationZones.Add(new PublicationZone - { - Tid = zone.Tid, - Icon = (DrawingImage)Application.Current.Resources[iconKey], - Name = zone.Name, - Count = zone.Count - }); - } - - // 全部 - publicationZones.Insert(0, new PublicationZone - { - Tid = 0, - Icon = (DrawingImage)Application.Current.Resources["videoUpDrawingImage"], - Name = DictionaryResource.GetString("AllPublicationZones"), - Count = VideoCount - }); - - } - } -} diff --git a/src/DownKyi/ViewModels/UserSpace/ViewChannelViewModel.cs b/src/DownKyi/ViewModels/UserSpace/ViewChannelViewModel.cs deleted file mode 100644 index 82e67c0..0000000 --- a/src/DownKyi/ViewModels/UserSpace/ViewChannelViewModel.cs +++ /dev/null @@ -1,144 +0,0 @@ -using DownKyi.Core.BiliApi.Users.Models; -using DownKyi.Core.Storage; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Threading.Tasks; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels.UserSpace -{ - public class ViewChannelViewModel : BaseViewModel - { - public const string Tag = "PageUserSpaceChannel"; - - private long mid = -1; - - #region 页面属性申明 - - private ObservableCollection channels; - public ObservableCollection Channels - { - get => channels; - set => SetProperty(ref channels, value); - } - - private int selectedItem; - public int SelectedItem - { - get => selectedItem; - set => SetProperty(ref selectedItem, value); - } - - #endregion - - public ViewChannelViewModel(IEventAggregator eventAggregator) : base(eventAggregator) - { - #region 属性初始化 - - Channels = new ObservableCollection(); - - #endregion - } - - #region 命令申明 - - // 视频选择事件 - private DelegateCommand channelsCommand; - public DelegateCommand ChannelsCommand => channelsCommand ?? (channelsCommand = new DelegateCommand(ExecuteChannelsCommand)); - - /// - /// 视频选择事件 - /// - /// - private void ExecuteChannelsCommand(object parameter) - { - if (!(parameter is Channel channel)) { return; } - - Dictionary data = new Dictionary - { - { "mid", mid }, - { "cid", channel.Cid }, - { "name", channel.Name }, - { "count", channel.Count } - }; - - // 进入视频页面 - NavigateToView.NavigationView(eventAggregator, ViewModels.ViewChannelViewModel.Tag, ViewUserSpaceViewModel.Tag, data); - - SelectedItem = -1; - } - - #endregion - - public override void OnNavigatedFrom(NavigationContext navigationContext) - { - base.OnNavigatedFrom(navigationContext); - - Channels.Clear(); - SelectedItem = -1; - } - - /// - /// 接收mid参数 - /// - /// - public async override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - Channels.Clear(); - SelectedItem = -1; - - // 根据传入参数不同执行不同任务 - var parameter = navigationContext.Parameters.GetValue>("object"); - if (parameter == null) - { - return; - } - - // 传入mid - mid = navigationContext.Parameters.GetValue("mid"); - - foreach (var channel in parameter) - { - if (channel.Count <= 0) { continue; } - - BitmapImage image = null; - if (channel.Cover == null || channel.Cover == "") - { - image = new BitmapImage(new Uri($"pack://application:,,,/Resources/video-placeholder.png")); - } - else - { - StorageCover storageCover = new StorageCover(); - string cover = null; - await Task.Run(() => - { - cover = storageCover.GetCover(channel.Cover); - }); - image = storageCover.GetCoverThumbnail(cover, 190, 190); - } - - // 当地时区 - DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); - DateTime dateCTime = startTime.AddSeconds(channel.Mtime); - string mtime = dateCTime.ToString("yyyy-MM-dd"); - - Channels.Add(new Channel - { - Cid = channel.Cid, - Cover = image, - Name = channel.Name, - Count = channel.Count, - Ctime = mtime - }); - } - - } - } -} diff --git a/src/DownKyi/ViewModels/UserSpace/ViewSeasonsSeriesViewModel.cs b/src/DownKyi/ViewModels/UserSpace/ViewSeasonsSeriesViewModel.cs deleted file mode 100644 index b8f783b..0000000 --- a/src/DownKyi/ViewModels/UserSpace/ViewSeasonsSeriesViewModel.cs +++ /dev/null @@ -1,199 +0,0 @@ -using DownKyi.Core.BiliApi.Users.Models; -using DownKyi.Core.Storage; -using DownKyi.Events; -using DownKyi.Images; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Threading.Tasks; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels.UserSpace -{ - public class ViewSeasonsSeriesViewModel : BaseViewModel - { - public const string Tag = "PageUserSpaceSeasonsSeries"; - - private long mid = -1; - - #region 页面属性申明 - - private ObservableCollection seasonsSeries; - public ObservableCollection SeasonsSeries - { - get => seasonsSeries; - set => SetProperty(ref seasonsSeries, value); - } - - private int selectedItem; - public int SelectedItem - { - get => selectedItem; - set => SetProperty(ref selectedItem, value); - } - - #endregion - - public ViewSeasonsSeriesViewModel(IEventAggregator eventAggregator) : base(eventAggregator) - { - #region 属性初始化 - - SeasonsSeries = new ObservableCollection(); - - #endregion - } - - #region 命令申明 - - // 视频选择事件 - private DelegateCommand seasonsSeriesCommand; - public DelegateCommand SeasonsSeriesCommand => seasonsSeriesCommand ?? (seasonsSeriesCommand = new DelegateCommand(ExecuteSeasonsSeriesCommand)); - - /// - /// 视频选择事件 - /// - /// - private void ExecuteSeasonsSeriesCommand(object parameter) - { - if (!(parameter is SeasonsSeries seasonsSeries)) { return; } - - // 应该用枚举的,偷懒直接用数字 - int type = 0; - if (seasonsSeries.TypeImage == NormalIcon.Instance().SeasonsSeries) - { - type = 1; - } - else if (seasonsSeries.TypeImage == NormalIcon.Instance().Channel1) - { - type = 2; - } - Dictionary data = new Dictionary - { - { "mid", mid }, - { "id", seasonsSeries.Id }, - { "name", seasonsSeries.Name }, - { "count", seasonsSeries.Count }, - { "type", type } - }; - - // 进入视频页面 - NavigationParam param = new NavigationParam - { - ViewName = ViewModels.ViewSeasonsSeriesViewModel.Tag, - ParentViewName = ViewUserSpaceViewModel.Tag, - Parameter = data - }; - eventAggregator.GetEvent().Publish(param); - - SelectedItem = -1; - } - - #endregion - - public override void OnNavigatedFrom(NavigationContext navigationContext) - { - base.OnNavigatedFrom(navigationContext); - - SeasonsSeries.Clear(); - SelectedItem = -1; - } - - /// - /// 接收mid参数 - /// - /// - public async override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - SeasonsSeries.Clear(); - SelectedItem = -1; - - // 根据传入参数不同执行不同任务 - var parameter = navigationContext.Parameters.GetValue("object"); - if (parameter == null) - { - return; - } - - // 传入mid - mid = navigationContext.Parameters.GetValue("mid"); - - foreach (var item in parameter.SeasonsList) - { - if (item.Meta.Total <= 0) { continue; } - - BitmapImage image = null; - if (item.Meta.Cover == null || item.Meta.Cover == "") - { - image = new BitmapImage(new Uri($"pack://application:,,,/Resources/video-placeholder.png")); - } - else - { - StorageCover storageCover = new StorageCover(); - string cover = null; - await Task.Run(() => - { - cover = storageCover.GetCover(item.Meta.Cover); - }); - image = storageCover.GetCoverThumbnail(cover, 190, 190); - } - - // 当地时区 - DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); - DateTime dateCTime = startTime.AddSeconds(item.Meta.Ptime); - string mtime = dateCTime.ToString("yyyy-MM-dd"); - - SeasonsSeries.Add(new SeasonsSeries - { - Id = item.Meta.SeasonId, - Cover = image, - TypeImage = NormalIcon.Instance().SeasonsSeries, - Name = item.Meta.Name, - Count = item.Meta.Total, - Ctime = mtime - }); - } - - foreach (var item in parameter.SeriesList) - { - if (item.Meta.Total <= 0) { continue; } - - BitmapImage image = null; - if (item.Meta.Cover == null || item.Meta.Cover == "") - { - image = new BitmapImage(new Uri($"pack://application:,,,/Resources/video-placeholder.png")); - } - else - { - StorageCover storageCover = new StorageCover(); - string cover = null; - await Task.Run(() => - { - cover = storageCover.GetCover(item.Meta.Cover); - }); - image = storageCover.GetCoverThumbnail(cover, 190, 190); - } - - // 当地时区 - DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); - DateTime dateCTime = startTime.AddSeconds(item.Meta.Mtime); - string mtime = dateCTime.ToString("yyyy-MM-dd"); - - SeasonsSeries.Add(new SeasonsSeries - { - Id = item.Meta.SeriesId, - Cover = image, - TypeImage = NormalIcon.Instance().Channel1, - Name = item.Meta.Name, - Count = item.Meta.Total, - Ctime = mtime - }); - } - - } - } -} diff --git a/src/DownKyi/ViewModels/ViewChannelViewModel.cs b/src/DownKyi/ViewModels/ViewChannelViewModel.cs deleted file mode 100644 index 05ead10..0000000 --- a/src/DownKyi/ViewModels/ViewChannelViewModel.cs +++ /dev/null @@ -1,472 +0,0 @@ -using DownKyi.Core.BiliApi.VideoStream; -using DownKyi.Core.Storage; -using DownKyi.Core.Utils; -using DownKyi.CustomControl; -using DownKyi.Events; -using DownKyi.Images; -using DownKyi.Services; -using DownKyi.Services.Download; -using DownKyi.Utils; -using DownKyi.ViewModels.PageViewModels; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using Prism.Services.Dialogs; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels -{ - public class ViewChannelViewModel : BaseViewModel - { - public const string Tag = "PageChannel"; - - private CancellationTokenSource tokenSource; - - private long mid = -1; - private long cid = -1; - - // 每页视频数量,暂时在此写死,以后在设置中增加选项 - private readonly int VideoNumberInPage = 30; - - #region 页面属性申明 - - private string pageName = Tag; - public string PageName - { - get => pageName; - set => SetProperty(ref pageName, value); - } - - private GifImage loading; - public GifImage Loading - { - get => loading; - set => SetProperty(ref loading, value); - } - - private Visibility loadingVisibility; - public Visibility LoadingVisibility - { - get => loadingVisibility; - set => SetProperty(ref loadingVisibility, value); - } - - private Visibility noDataVisibility; - public Visibility NoDataVisibility - { - get => noDataVisibility; - set => SetProperty(ref noDataVisibility, value); - } - - private VectorImage arrowBack; - public VectorImage ArrowBack - { - get => arrowBack; - set => SetProperty(ref arrowBack, value); - } - - private VectorImage downloadManage; - public VectorImage DownloadManage - { - get => downloadManage; - set => SetProperty(ref downloadManage, value); - } - - private string title; - public string Title - { - get => title; - set => SetProperty(ref title, value); - } - - private bool isEnabled = true; - public bool IsEnabled - { - get => isEnabled; - set => SetProperty(ref isEnabled, value); - } - - private CustomPagerViewModel pager; - public CustomPagerViewModel Pager - { - get => pager; - set => SetProperty(ref pager, value); - } - - private ObservableCollection medias; - public ObservableCollection Medias - { - get => medias; - set => SetProperty(ref medias, value); - } - - private bool isSelectAll; - public bool IsSelectAll - { - get => isSelectAll; - set => SetProperty(ref isSelectAll, value); - } - - #endregion - - public ViewChannelViewModel(IEventAggregator eventAggregator, IDialogService dialogService) : base(eventAggregator) - { - this.dialogService = dialogService; - - #region 属性初始化 - - // 初始化loading gif - Loading = new GifImage(Properties.Resources.loading); - Loading.StartAnimate(); - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - - ArrowBack = NavigationIcon.Instance().ArrowBack; - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - // 下载管理按钮 - DownloadManage = ButtonIcon.Instance().DownloadManage; - DownloadManage.Height = 24; - DownloadManage.Width = 24; - DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary"); - - Medias = new ObservableCollection(); - - #endregion - } - - #region 命令申明 - - // 返回事件 - private DelegateCommand backSpaceCommand; - public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace)); - - /// - /// 返回事件 - /// - private void ExecuteBackSpace() - { - ArrowBack.Fill = DictionaryResource.GetColor("ColorText"); - - // 结束任务 - tokenSource?.Cancel(); - - NavigationParam parameter = new NavigationParam - { - ViewName = ParentView, - ParentViewName = null, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 前往下载管理页面 - private DelegateCommand downloadManagerCommand; - public DelegateCommand DownloadManagerCommand => downloadManagerCommand ?? (downloadManagerCommand = new DelegateCommand(ExecuteDownloadManagerCommand)); - - /// - /// 前往下载管理页面 - /// - private void ExecuteDownloadManagerCommand() - { - NavigationParam parameter = new NavigationParam - { - ViewName = ViewDownloadManagerViewModel.Tag, - ParentViewName = Tag, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 全选按钮点击事件 - private DelegateCommand selectAllCommand; - public DelegateCommand SelectAllCommand => selectAllCommand ?? (selectAllCommand = new DelegateCommand(ExecuteSelectAllCommand)); - - /// - /// 全选按钮点击事件 - /// - /// - private void ExecuteSelectAllCommand(object parameter) - { - if (IsSelectAll) - { - foreach (var item in Medias) - { - item.IsSelected = true; - } - } - else - { - foreach (var item in Medias) - { - item.IsSelected = false; - } - } - } - - // 列表选择事件 - private DelegateCommand mediasCommand; - public DelegateCommand MediasCommand => mediasCommand ?? (mediasCommand = new DelegateCommand(ExecuteMediasCommand)); - - /// - /// 列表选择事件 - /// - /// - private void ExecuteMediasCommand(object parameter) - { - if (!(parameter is IList selectedMedia)) { return; } - - if (selectedMedia.Count == Medias.Count) - { - IsSelectAll = true; - } - else - { - IsSelectAll = false; - } - } - - // 添加选中项到下载列表事件 - private DelegateCommand addToDownloadCommand; - public DelegateCommand AddToDownloadCommand => addToDownloadCommand ?? (addToDownloadCommand = new DelegateCommand(ExecuteAddToDownloadCommand)); - - /// - /// 添加选中项到下载列表事件 - /// - private void ExecuteAddToDownloadCommand() - { - AddToDownload(true); - } - - // 添加所有视频到下载列表事件 - private DelegateCommand addAllToDownloadCommand; - public DelegateCommand AddAllToDownloadCommand => addAllToDownloadCommand ?? (addAllToDownloadCommand = new DelegateCommand(ExecuteAddAllToDownloadCommand)); - - /// - /// 添加所有视频到下载列表事件 - /// - private void ExecuteAddAllToDownloadCommand() - { - AddToDownload(false); - } - - #endregion - - /// - /// 添加到下载 - /// - /// - private async void AddToDownload(bool isOnlySelected) - { - // 频道里只有视频 - AddToDownloadService addToDownloadService = new AddToDownloadService(PlayStreamType.VIDEO); - - // 选择文件夹 - string directory = addToDownloadService.SetDirectory(dialogService); - - // 视频计数 - int i = 0; - await Task.Run(() => - { - // 为了避免执行其他操作时, - // Medias变化导致的异常 - var list = Medias.ToList(); - - // 添加到下载 - foreach (var media in list) - { - // 只下载选中项,跳过未选中项 - if (isOnlySelected && !media.IsSelected) { continue; } - - /// 有分P的就下载全部 - - // 开启服务 - VideoInfoService videoInfoService = new VideoInfoService(media.Bvid); - - addToDownloadService.SetVideoInfoService(videoInfoService); - addToDownloadService.GetVideo(); - addToDownloadService.ParseVideo(videoInfoService); - // 下载 - i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory); - } - }); - - if (directory == null) - { - return; - } - - // 通知用户添加到下载列表的结果 - if (i <= 0) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipAddDownloadingZero")); - } - else - { - eventAggregator.GetEvent().Publish($"{DictionaryResource.GetString("TipAddDownloadingFinished1")}{i}{DictionaryResource.GetString("TipAddDownloadingFinished2")}"); - } - } - - private void OnCountChanged_Pager(int count) { } - - private bool OnCurrentChanged_Pager(int old, int current) - { - if (!IsEnabled) - { - //Pager.Current = old; - return false; - } - - Medias.Clear(); - IsSelectAll = false; - LoadingVisibility = Visibility.Visible; - NoDataVisibility = Visibility.Collapsed; - - UpdateChannel(current); - - return true; - } - - private async void UpdateChannel(int current) - { - // 是否正在获取数据 - // 在所有的退出分支中都需要设为true - IsEnabled = false; - - await Task.Run(() => - { - CancellationToken cancellationToken = tokenSource.Token; - - var channels = Core.BiliApi.Users.UserSpace.GetChannelVideoList(mid, cid, current, VideoNumberInPage); - if (channels == null || channels.Count == 0) - { - // 没有数据,UI提示 - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Visible; - return; - } - - foreach (var video in channels) - { - if (video.Cid == 0) - { - continue; - } - - // 查询、保存封面 - string coverUrl = video.Pic; - BitmapImage cover; - if (coverUrl == null || coverUrl == "") - { - cover = null; // new BitmapImage(new Uri($"pack://application:,,,/Resources/video-placeholder.png")); - } - else - { - if (!coverUrl.ToLower().StartsWith("http")) - { - coverUrl = $"https:{video.Pic}"; - } - - StorageCover storageCover = new StorageCover(); - cover = storageCover.GetCoverThumbnail(video.Aid, video.Bvid, -1, coverUrl, 200, 125); - } - - // 播放数 - string play = string.Empty; - if (video.Stat != null) - { - if (video.Stat.View > 0) - { - play = Format.FormatNumber(video.Stat.View); - } - else - { - play = "--"; - } - } - else - { - play = "--"; - } - - DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 - DateTime dateCTime = startTime.AddSeconds(video.Ctime); - string ctime = dateCTime.ToString("yyyy-MM-dd"); - - App.PropertyChangeAsync(new Action(() => - { - ChannelMedia media = new ChannelMedia(eventAggregator) - { - Avid = video.Aid, - Bvid = video.Bvid, - Cover = cover ?? new BitmapImage(new Uri($"pack://application:,,,/Resources/video-placeholder.png")), - Duration = Format.FormatDuration3(video.Duration), - Title = video.Title, - PlayNumber = play, - CreateTime = ctime - }; - Medias.Add(media); - - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - })); - - // 判断是否该结束线程,若为true,跳出循环 - if (cancellationToken.IsCancellationRequested) - { - break; - } - } - - }, (tokenSource = new CancellationTokenSource()).Token); - - IsEnabled = true; - } - - /// - /// 导航到页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - DownloadManage = ButtonIcon.Instance().DownloadManage; - DownloadManage.Height = 24; - DownloadManage.Width = 24; - DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary"); - - // 根据传入参数不同执行不同任务 - var parameter = navigationContext.Parameters.GetValue>("Parameter"); - if (parameter == null) - { - return; - } - - Medias.Clear(); - IsSelectAll = false; - - mid = (long)parameter["mid"]; - cid = (long)parameter["cid"]; - Title = (string)parameter["name"]; - int count = (int)parameter["count"]; - - // 页面选择 - Pager = new CustomPagerViewModel(1, (int)Math.Ceiling((double)count / VideoNumberInPage)); - Pager.CurrentChanged += OnCurrentChanged_Pager; - Pager.CountChanged += OnCountChanged_Pager; - Pager.Current = 1; - } - - } -} diff --git a/src/DownKyi/ViewModels/ViewDownloadManagerViewModel.cs b/src/DownKyi/ViewModels/ViewDownloadManagerViewModel.cs deleted file mode 100644 index ae3a7b3..0000000 --- a/src/DownKyi/ViewModels/ViewDownloadManagerViewModel.cs +++ /dev/null @@ -1,127 +0,0 @@ -using DownKyi.Events; -using DownKyi.Images; -using DownKyi.Utils; -using DownKyi.ViewModels.DownloadManager; -using DownKyi.ViewModels.PageViewModels; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using System.Collections.Generic; - -namespace DownKyi.ViewModels -{ - public class ViewDownloadManagerViewModel : BaseViewModel - { - public const string Tag = "PageDownloadManager"; - - private readonly IRegionManager regionManager; - - #region 页面属性申明 - - private VectorImage arrowBack; - public VectorImage ArrowBack - { - get => arrowBack; - set => SetProperty(ref arrowBack, value); - } - - private List tabHeaders; - public List TabHeaders - { - get => tabHeaders; - set => SetProperty(ref tabHeaders, value); - } - - private int selectTabId; - public int SelectTabId - { - get => selectTabId; - set => SetProperty(ref selectTabId, value); - } - - #endregion - - public ViewDownloadManagerViewModel(IRegionManager regionManager, IEventAggregator eventAggregator) : base(eventAggregator) - { - this.regionManager = regionManager; - - #region 属性初始化 - - ArrowBack = NavigationIcon.Instance().ArrowBack; - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - TabHeaders = new List - { - new TabHeader { Id = 0, Image = NormalIcon.Instance().Downloading, Title = DictionaryResource.GetString("Downloading") }, - new TabHeader { Id = 1, Image = NormalIcon.Instance().DownloadFinished, Title = DictionaryResource.GetString("DownloadFinished") } - }; - - #endregion - } - - #region 命令申明 - - // 返回事件 - private DelegateCommand backSpaceCommand; - public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace)); - - /// - /// 返回事件 - /// - private void ExecuteBackSpace() - { - NavigationParam parameter = new NavigationParam - { - ViewName = ParentView, - ParentViewName = null, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 左侧tab点击事件 - private DelegateCommand leftTabHeadersCommand; - public DelegateCommand LeftTabHeadersCommand => leftTabHeadersCommand ?? (leftTabHeadersCommand = new DelegateCommand(ExecuteLeftTabHeadersCommand)); - - /// - /// 左侧tab点击事件 - /// - /// - private void ExecuteLeftTabHeadersCommand(object parameter) - { - if (!(parameter is TabHeader tabHeader)) { return; } - - NavigationParameters param = new NavigationParameters(); - - switch (tabHeader.Id) - { - case 0: - regionManager.RequestNavigate("DownloadManagerContentRegion", ViewDownloadingViewModel.Tag, param); - break; - case 1: - regionManager.RequestNavigate("DownloadManagerContentRegion", ViewDownloadFinishedViewModel.Tag, param); - break; - default: - break; - } - } - - #endregion - - /// - /// 导航到页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - //// 进入设置页面时显示的设置项 - SelectTabId = 0; - regionManager.RequestNavigate("DownloadManagerContentRegion", ViewDownloadingViewModel.Tag, new NavigationParameters()); - - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - } - - } -} diff --git a/src/DownKyi/ViewModels/ViewFriendsViewModel.cs b/src/DownKyi/ViewModels/ViewFriendsViewModel.cs deleted file mode 100644 index 097c532..0000000 --- a/src/DownKyi/ViewModels/ViewFriendsViewModel.cs +++ /dev/null @@ -1,159 +0,0 @@ -using DownKyi.Events; -using DownKyi.Images; -using DownKyi.Utils; -using DownKyi.ViewModels.Friends; -using DownKyi.ViewModels.PageViewModels; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using System.Collections.Generic; -using System.Collections.ObjectModel; - -namespace DownKyi.ViewModels -{ - public class ViewFriendsViewModel : BaseViewModel - { - public const string Tag = "PageFriends"; - - private readonly IRegionManager regionManager; - - private long mid = -1; - - #region 页面属性申明 - - private VectorImage arrowBack; - public VectorImage ArrowBack - { - get => arrowBack; - set => SetProperty(ref arrowBack, value); - } - - private ObservableCollection tabHeaders; - public ObservableCollection TabHeaders - { - get => tabHeaders; - set => SetProperty(ref tabHeaders, value); - } - - private int selectTabId; - public int SelectTabId - { - get => selectTabId; - set => SetProperty(ref selectTabId, value); - } - - #endregion - - public ViewFriendsViewModel(IRegionManager regionManager, IEventAggregator eventAggregator) : base(eventAggregator) - { - this.regionManager = regionManager; - - #region 属性初始化 - - ArrowBack = NavigationIcon.Instance().ArrowBack; - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - TabHeaders = new ObservableCollection - { - new TabHeader { Id = 0, Title = DictionaryResource.GetString("FriendFollowing") }, - new TabHeader { Id = 1, Title = DictionaryResource.GetString("FriendFollower") }, - }; - - #endregion - } - - #region 命令申明 - - // 返回事件 - private DelegateCommand backSpaceCommand; - public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace)); - - /// - /// 返回事件 - /// - private void ExecuteBackSpace() - { - //InitView(); - - ArrowBack.Fill = DictionaryResource.GetColor("ColorText"); - - NavigationParam parameter = new NavigationParam - { - ViewName = ParentView, - ParentViewName = null, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 顶部tab点击事件 - private DelegateCommand tabHeadersCommand; - public DelegateCommand TabHeadersCommand => tabHeadersCommand ?? (tabHeadersCommand = new DelegateCommand(ExecuteTabHeadersCommand)); - - /// - /// 顶部tab点击事件 - /// - /// - private void ExecuteTabHeadersCommand(object parameter) - { - if (!(parameter is TabHeader tabHeader)) { return; } - - // TODO - // 此处应该根据具体状态传入true or false - NavigationView(tabHeader.Id, true); - } - - #endregion - - /// - /// 进入子页面 - /// - /// - /// - private void NavigationView(long id, bool isFirst) - { - // isFirst参数表示是否是从PageFriends的headerTable的item点击进入的 - // true表示加载PageFriends后第一次进入 - // false表示从headerTable的item点击进入 - NavigationParameters param = new NavigationParameters() - { - { "mid", mid }, - { "isFirst", isFirst }, - }; - - switch (id) - { - case 0: - regionManager.RequestNavigate("FriendContentRegion", ViewFollowingViewModel.Tag, param); - break; - case 1: - regionManager.RequestNavigate("FriendContentRegion", ViewFollowerViewModel.Tag, param); - break; - } - } - - /// - /// 导航到页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - // 根据传入参数不同执行不同任务 - var parameter = navigationContext.Parameters.GetValue>("Parameter"); - if (parameter == null) - { - return; - } - - mid = (long)parameter["mid"]; - SelectTabId = (int)parameter["friendId"]; - - NavigationView(SelectTabId, true); - } - - } -} diff --git a/src/DownKyi/ViewModels/ViewIndexViewModel.cs b/src/DownKyi/ViewModels/ViewIndexViewModel.cs deleted file mode 100644 index b78e5c5..0000000 --- a/src/DownKyi/ViewModels/ViewIndexViewModel.cs +++ /dev/null @@ -1,366 +0,0 @@ -using DownKyi.Core.BiliApi.Users; -using DownKyi.Core.BiliApi.Users.Models; -using DownKyi.Core.Logging; -using DownKyi.Core.Settings; -using DownKyi.Core.Settings.Models; -using DownKyi.Core.Storage; -using DownKyi.Images; -using DownKyi.Services; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using Prism.Services.Dialogs; -using System; -using System.IO; -using System.Linq; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels -{ - public class ViewIndexViewModel : BaseViewModel - { - public const string Tag = "PageIndex"; - - #region 页面属性申明 - - private Visibility loginPanelVisibility; - public Visibility LoginPanelVisibility - { - get => loginPanelVisibility; - set => SetProperty(ref loginPanelVisibility, value); - } - - private string userName; - public string UserName - { - get => userName; - set => SetProperty(ref userName, value); - } - - private BitmapImage header; - public BitmapImage Header - { - get => header; - set => SetProperty(ref header, value); - } - - private VectorImage textLogo; - public VectorImage TextLogo - { - get => textLogo; - set => SetProperty(ref textLogo, value); - } - - private string inputText; - public string InputText - { - get => inputText; - set => SetProperty(ref inputText, value); - } - - private VectorImage generalSearch; - public VectorImage GeneralSearch - { - get => generalSearch; - set => SetProperty(ref generalSearch, value); - } - - private VectorImage settings; - public VectorImage Settings - { - get => settings; - set => SetProperty(ref settings, value); - } - - private VectorImage downloadManager; - public VectorImage DownloadManager - { - get => downloadManager; - set => SetProperty(ref downloadManager, value); - } - - private VectorImage toolbox; - public VectorImage Toolbox - { - get => toolbox; - set => SetProperty(ref toolbox, value); - } - - #endregion - - public ViewIndexViewModel(IEventAggregator eventAggregator, IDialogService dialogService) : base(eventAggregator, dialogService) - { - #region 属性初始化 - - Header = new BitmapImage(new Uri("pack://application:,,,/Resources/default_header.jpg")); - - TextLogo = LogoIcon.Instance().TextLogo; - TextLogo.Fill = DictionaryResource.GetColor("ColorPrimary"); - - GeneralSearch = ButtonIcon.Instance().GeneralSearch; - GeneralSearch.Fill = DictionaryResource.GetColor("ColorPrimary"); - - Settings = ButtonIcon.Instance().Settings; - Settings.Fill = DictionaryResource.GetColor("ColorPrimary"); - - DownloadManager = ButtonIcon.Instance().DownloadManage; - DownloadManager.Fill = DictionaryResource.GetColor("ColorPrimary"); - - Toolbox = ButtonIcon.Instance().Toolbox; - Toolbox.Fill = DictionaryResource.GetColor("ColorPrimary"); - - #endregion - - } - - #region 命令申明 - - // View加载后执行的事件 - public DelegateCommand loadedCommand; - public DelegateCommand LoadedCommand => loadedCommand ?? (loadedCommand = new DelegateCommand(ExecuteViewLoaded)); - - /// - /// View加载后执行 - /// - private void ExecuteViewLoaded() { } - - // 输入确认事件 - public DelegateCommand inputCommand; - public DelegateCommand InputCommand => inputCommand ?? (inputCommand = new DelegateCommand(ExecuteInput)); - - /// - /// 处理输入事件 - /// - private void ExecuteInput() - { - EnterBili(); - } - - // 登录事件 - private DelegateCommand loginCommand; - public DelegateCommand LoginCommand => loginCommand ?? (loginCommand = new DelegateCommand(ExecuteLogin)); - - /// - /// 进入登录页面 - /// - private void ExecuteLogin() - { - if (UserName == null) - { - NavigateToView.NavigationView(eventAggregator, ViewLoginViewModel.Tag, Tag, null); - } - else - { - // 进入用户空间 - var userInfo = SettingsManager.GetInstance().GetUserInfo(); - if (userInfo != null && userInfo.Mid != -1) - { - NavigateToView.NavigationView(eventAggregator, ViewMySpaceViewModel.Tag, Tag, userInfo.Mid); - } - } - } - - // 进入设置页面 - private DelegateCommand settingsCommand; - public DelegateCommand SettingsCommand => settingsCommand ?? (settingsCommand = new DelegateCommand(ExecuteSettingsCommand)); - - /// - /// 进入设置页面 - /// - private void ExecuteSettingsCommand() - { - NavigateToView.NavigationView(eventAggregator, ViewSettingsViewModel.Tag, Tag, null); - } - - // 进入下载管理页面 - private DelegateCommand downloadManagerCommand; - public DelegateCommand DownloadManagerCommand => downloadManagerCommand ?? (downloadManagerCommand = new DelegateCommand(ExecuteDownloadManagerCommand)); - - /// - /// 进入下载管理页面 - /// - private void ExecuteDownloadManagerCommand() - { - NavigateToView.NavigationView(eventAggregator, ViewDownloadManagerViewModel.Tag, Tag, null); - } - - // 进入工具箱页面 - private DelegateCommand toolboxCommand; - public DelegateCommand ToolboxCommand => toolboxCommand ?? (toolboxCommand = new DelegateCommand(ExecuteToolboxCommand)); - - /// - /// 进入工具箱页面 - /// - private void ExecuteToolboxCommand() - { - NavigateToView.NavigationView(eventAggregator, ViewToolboxViewModel.Tag, Tag, null); - } - - #endregion - - #region 业务逻辑 - - /// - /// 进入B站链接的处理逻辑, - /// 只负责处理输入,并跳转到视频详情页。 - /// 不是支持的格式,则进入搜索页面。 - /// - private void EnterBili() - { - if (InputText == null || InputText == string.Empty) - { - return; - } - - LogManager.Debug(Tag, $"InputText: {InputText}"); - InputText = Regex.Replace(InputText, @"[【]*[^【]*[^】]*[】 ]", ""); - SearchService searchService = new SearchService(); - bool isSupport = searchService.BiliInput(InputText, Tag, eventAggregator); - if (!isSupport) - { - // 关键词搜索 - searchService.SearchKey(InputText, Tag, eventAggregator); - } - - InputText = string.Empty; - } - - private async Task GetUserInfo() - { - UserInfoForNavigation userInfo = null; - await Task.Run(new Action(() => - { - // 获取用户信息 - userInfo = UserInfo.GetUserInfoForNavigation(); - if (userInfo != null) - { - SettingsManager.GetInstance().SetUserInfo(new UserInfoSettings - { - Mid = userInfo.Mid, - Name = userInfo.Name, - IsLogin = userInfo.IsLogin, - IsVip = userInfo.VipStatus == 1, - ImgKey = userInfo.Wbi.ImgUrl.Split('/').ToList().Last().Split('.')[0], - SubKey = userInfo.Wbi.SubUrl.Split('/').ToList().Last().Split('.')[0], - }); - } - else - { - SettingsManager.GetInstance().SetUserInfo(new UserInfoSettings - { - Mid = -1, - Name = "", - IsLogin = false, - IsVip = false, - }); - } - - })); - return userInfo; - } - - /// - /// 更新用户登录信息 - /// - private async void UpdateUserInfo(bool isBackgroud = false) - { - try - { - if (isBackgroud) - { - // 获取用户信息 - await GetUserInfo(); - return; - } - - LoginPanelVisibility = Visibility.Hidden; - - // 获取用户信息 - var userInfo = await GetUserInfo(); - - // 检查本地是否存在login文件,没有则说明未登录 - if (!File.Exists(StorageManager.GetLogin())) - { - LoginPanelVisibility = Visibility.Visible; - Header = new BitmapImage(new Uri("pack://application:,,,/Resources/default_header.jpg")); - UserName = null; - return; - } - - LoginPanelVisibility = Visibility.Visible; - - if (userInfo != null) - { - if (userInfo.Face != null) - { - Header = new StorageHeader().GetHeaderThumbnail(userInfo.Mid, userInfo.Name, userInfo.Face, 36, 36); - } - else - { - Header = new BitmapImage(new Uri("pack://application:,,,/Resources/default_header.jpg")); - } - UserName = userInfo.Name; - } - else - { - Header = new BitmapImage(new Uri("pack://application:,,,/Resources/default_header.jpg")); - UserName = null; - } - - } - catch (Exception e) - { - Core.Utils.Debugging.Console.PrintLine("UpdateUserInfo()发生异常: {0}", e); - LogManager.Error(Tag, e); - } - } - - #endregion - - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - DownloadManager = ButtonIcon.Instance().DownloadManage; - DownloadManager.Height = 27; - DownloadManager.Width = 32; - DownloadManager.Fill = DictionaryResource.GetColor("ColorPrimary"); - - // 根据传入参数不同执行不同任务 - string parameter = navigationContext.Parameters.GetValue("Parameter"); - if (parameter == null) - { - // 其他情况只更新设置的用户信息,不更新UI - UpdateUserInfo(true); - return; - } - - // 启动 - if (parameter == "start") - { - UpdateUserInfo(); - } - // 从登录页面返回 - else if (parameter == "login") - { - UpdateUserInfo(); - } - // 注销 - else if (parameter == "logout") - { - UpdateUserInfo(); - } - else - { - // 其他情况只更新设置的用户信息,不更新UI - UpdateUserInfo(true); - } - - } - - } -} diff --git a/src/DownKyi/ViewModels/ViewLoginViewModel.cs b/src/DownKyi/ViewModels/ViewLoginViewModel.cs deleted file mode 100644 index 83af681..0000000 --- a/src/DownKyi/ViewModels/ViewLoginViewModel.cs +++ /dev/null @@ -1,261 +0,0 @@ - -using DownKyi.Core.Logging; -using DownKyi.Events; -using DownKyi.Images; -using DownKyi.Utils; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using System; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Media.Imaging; -using DownKyi.Core.BiliApi.Login; -using LoginQR = DownKyi.Core.BiliApi.LoginNew.LoginQR; - -namespace DownKyi.ViewModels -{ - public class ViewLoginViewModel : BaseViewModel - { - public const string Tag = "PageLogin"; - - private CancellationTokenSource tokenSource; - - #region 页面属性申明 - - private VectorImage arrowBack; - public VectorImage ArrowBack - { - get { return arrowBack; } - set { SetProperty(ref arrowBack, value); } - } - - private BitmapImage loginQRCode; - public BitmapImage LoginQRCode - { - get { return loginQRCode; } - set { SetProperty(ref loginQRCode, value); } - } - - private double loginQRCodeOpacity; - public double LoginQRCodeOpacity - { - get { return loginQRCodeOpacity; } - set { SetProperty(ref loginQRCodeOpacity, value); } - } - - private Visibility loginQRCodeStatus; - public Visibility LoginQRCodeStatus - { - get { return loginQRCodeStatus; } - set { SetProperty(ref loginQRCodeStatus, value); } - } - - #endregion - - - public ViewLoginViewModel(IEventAggregator eventAggregator) : base(eventAggregator) - { - #region 属性初始化 - - ArrowBack = NavigationIcon.Instance().ArrowBack; - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - #endregion - } - - #region 命令申明 - - // 返回 - private DelegateCommand backSpaceCommand; - public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace)); - - /// - /// 返回 - /// - private void ExecuteBackSpace() - { - // 初始化状态 - InitStatus(); - - // 结束任务 - tokenSource.Cancel(); - - NavigationParam parameter = new NavigationParam - { - ViewName = ParentView, - ParentViewName = null, - Parameter = "login" - }; - eventAggregator.GetEvent().Publish(parameter); - } - - #endregion - - #region 业务逻辑 - - /// - /// 登录 - /// - private void Login() - { - try - { - var loginUrl = LoginQR.GetLoginUrl(); - if (loginUrl == null) { return; } - - if (loginUrl.Code != 0) - { - ExecuteBackSpace(); - return; - } - - if (loginUrl.Data == null || loginUrl.Data.Url == null) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("GetLoginUrlFailed")); - return; - } - - PropertyChangeAsync(new Action(() => { LoginQRCode = LoginQR.GetLoginQRCode(loginUrl.Data.Url); })); - Core.Utils.Debugging.Console.PrintLine(loginUrl.Data.Url + "\n"); - LogManager.Debug(Tag, loginUrl.Data.Url); - - GetLoginStatus(loginUrl.Data.QrcodeKey); - } - catch (Exception e) - { - Core.Utils.Debugging.Console.PrintLine("Login()发生异常: {0}", e); - LogManager.Error(Tag, e); - } - } - - /// - /// 循环查询登录状态 - /// - /// - private void GetLoginStatus(string oauthKey) - { - CancellationToken cancellationToken = tokenSource.Token; - while (true) - { - Thread.Sleep(1000); - var loginStatus = LoginQR.GetLoginStatus(oauthKey); - if (loginStatus == null) { continue; } - - Core.Utils.Debugging.Console.PrintLine(loginStatus.Data.Code + "\n" + loginStatus.Data.Message + "\n" + loginStatus.Data.Url + "\n"); - - switch (loginStatus.Data.Code) - { - // case -1: - // // 没有这个oauthKey - // - // // 发送通知 - // eventAggregator.GetEvent().Publish(DictionaryResource.GetString("LoginKeyError")); - // LogManager.Info(Tag, DictionaryResource.GetString("LoginKeyError")); - // - // // 取消任务 - // tokenSource.Cancel(); - // - // // 创建新任务 - // PropertyChangeAsync(new Action(() => { Task.Run(Login, (tokenSource = new CancellationTokenSource()).Token); })); - // break; - case 86038: - // 不匹配的oauthKey,超时或已确认的oauthKey - - // 发送通知 - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("LoginTimeOut")); - LogManager.Info(Tag, DictionaryResource.GetString("LoginTimeOut")); - - // 取消任务 - tokenSource.Cancel(); - - // 创建新任务 - PropertyChangeAsync(new Action(() => { Task.Run(Login, (tokenSource = new CancellationTokenSource()).Token); })); - break; - case 86101: - // 未扫码 - break; - case 86090: - // 已扫码,未确认 - PropertyChangeAsync(new Action(() => - { - LoginQRCodeStatus = Visibility.Visible; - LoginQRCodeOpacity = 0.3; - })); - break; - case 0: - // 确认登录 - - // 发送通知 - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("LoginSuccessful")); - LogManager.Info(Tag, DictionaryResource.GetString("LoginSuccessful")); - - // 保存登录信息 - try - { - bool isSucceed = LoginHelper.SaveLoginInfoCookies(loginStatus.Data.Url); - if (!isSucceed) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("LoginFailed")); - LogManager.Error(Tag, DictionaryResource.GetString("LoginFailed")); - } - } - catch (Exception e) - { - Core.Utils.Debugging.Console.PrintLine("PageLogin 保存登录信息发生异常: {0}", e); - LogManager.Error(e); - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("LoginFailed")); - } - - // TODO 其他操作 - - - // 取消任务 - Thread.Sleep(3000); - PropertyChangeAsync(new Action(() => { ExecuteBackSpace(); })); - break; - } - - // 判断是否该结束线程,若为true,跳出while循环 - if (cancellationToken.IsCancellationRequested) - { - Core.Utils.Debugging.Console.PrintLine("停止Login线程,跳出while循环"); - LogManager.Debug(Tag, "登录操作结束"); - break; - } - } - } - - /// - /// 初始化状态 - /// - private void InitStatus() - { - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - LoginQRCode = null; - LoginQRCodeOpacity = 1; - LoginQRCodeStatus = Visibility.Hidden; - } - - #endregion - - /// - /// 导航到Login页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - // 初始化状态 - InitStatus(); - - Task.Run(Login, (tokenSource = new CancellationTokenSource()).Token); - //await loginTask; - } - - - } -} diff --git a/src/DownKyi/ViewModels/ViewMyBangumiFollowViewModel.cs b/src/DownKyi/ViewModels/ViewMyBangumiFollowViewModel.cs deleted file mode 100644 index 80bd30f..0000000 --- a/src/DownKyi/ViewModels/ViewMyBangumiFollowViewModel.cs +++ /dev/null @@ -1,546 +0,0 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Core.BiliApi.VideoStream; -using DownKyi.Core.Storage; -using DownKyi.CustomControl; -using DownKyi.Events; -using DownKyi.Images; -using DownKyi.Services; -using DownKyi.Services.Download; -using DownKyi.Utils; -using DownKyi.ViewModels.PageViewModels; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using Prism.Services.Dialogs; -using System; -using System.Collections; -using System.Collections.ObjectModel; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels -{ - public class ViewMyBangumiFollowViewModel : BaseViewModel - { - public const string Tag = "PageMyBangumiFollow"; - - private CancellationTokenSource tokenSource; - - private long mid = -1; - - // 每页视频数量,暂时在此写死,以后在设置中增加选项 - private readonly int VideoNumberInPage = 15; - - #region 页面属性申明 - - private string pageName = Tag; - public string PageName - { - get => pageName; - set => SetProperty(ref pageName, value); - } - - private VectorImage arrowBack; - public VectorImage ArrowBack - { - get => arrowBack; - set => SetProperty(ref arrowBack, value); - } - - private VectorImage downloadManage; - public VectorImage DownloadManage - { - get => downloadManage; - set => SetProperty(ref downloadManage, value); - } - - private ObservableCollection tabHeaders; - public ObservableCollection TabHeaders - { - get => tabHeaders; - set => SetProperty(ref tabHeaders, value); - } - - private int selectTabId; - public int SelectTabId - { - get => selectTabId; - set => SetProperty(ref selectTabId, value); - } - - private bool isEnabled = true; - public bool IsEnabled - { - get => isEnabled; - set => SetProperty(ref isEnabled, value); - } - - private Visibility contentVisibility; - public Visibility ContentVisibility - { - get => contentVisibility; - set => SetProperty(ref contentVisibility, value); - } - - private CustomPagerViewModel pager; - public CustomPagerViewModel Pager - { - get => pager; - set => SetProperty(ref pager, value); - } - - private ObservableCollection medias; - public ObservableCollection Medias - { - get => medias; - set => SetProperty(ref medias, value); - } - - private bool isSelectAll; - public bool IsSelectAll - { - get => isSelectAll; - set => SetProperty(ref isSelectAll, value); - } - - private GifImage loading; - public GifImage Loading - { - get => loading; - set => SetProperty(ref loading, value); - } - - private Visibility loadingVisibility; - public Visibility LoadingVisibility - { - get => loadingVisibility; - set => SetProperty(ref loadingVisibility, value); - } - - private Visibility noDataVisibility; - public Visibility NoDataVisibility - { - get => noDataVisibility; - set => SetProperty(ref noDataVisibility, value); - } - - #endregion - - public ViewMyBangumiFollowViewModel(IEventAggregator eventAggregator, IDialogService dialogService) : base(eventAggregator) - { - this.dialogService = dialogService; - - #region 属性初始化 - - // 初始化loading gif - Loading = new GifImage(Properties.Resources.loading); - Loading.StartAnimate(); - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - - ArrowBack = NavigationIcon.Instance().ArrowBack; - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - // 下载管理按钮 - DownloadManage = ButtonIcon.Instance().DownloadManage; - DownloadManage.Height = 24; - DownloadManage.Width = 24; - DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary"); - - TabHeaders = new ObservableCollection - { - new TabHeader { Id = (long)Core.BiliApi.Users.Models.BangumiType.ANIME, Title = DictionaryResource.GetString("FollowAnime") }, - new TabHeader { Id = (long)Core.BiliApi.Users.Models.BangumiType.EPISODE, Title = DictionaryResource.GetString("FollowMovie") } - }; - - Medias = new ObservableCollection(); - - #endregion - - } - - #region 命令申明 - - // 返回事件 - private DelegateCommand backSpaceCommand; - public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace)); - - /// - /// 返回事件 - /// - private void ExecuteBackSpace() - { - InitView(); - - ArrowBack.Fill = DictionaryResource.GetColor("ColorText"); - - // 结束任务 - tokenSource?.Cancel(); - - NavigationParam parameter = new NavigationParam - { - ViewName = ParentView, - ParentViewName = null, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 前往下载管理页面 - private DelegateCommand downloadManagerCommand; - public DelegateCommand DownloadManagerCommand => downloadManagerCommand ?? (downloadManagerCommand = new DelegateCommand(ExecuteDownloadManagerCommand)); - - /// - /// 前往下载管理页面 - /// - private void ExecuteDownloadManagerCommand() - { - NavigationParam parameter = new NavigationParam - { - ViewName = ViewDownloadManagerViewModel.Tag, - ParentViewName = Tag, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 顶部tab点击事件 - private DelegateCommand tabHeadersCommand; - public DelegateCommand TabHeadersCommand => tabHeadersCommand ?? (tabHeadersCommand = new DelegateCommand(ExecuteTabHeadersCommand, CanExecuteTabHeadersCommand)); - - /// - /// 顶部tab点击事件 - /// - /// - private void ExecuteTabHeadersCommand(object parameter) - { - if (!(parameter is TabHeader tabHeader)) { return; } - - // 顶部tab点击后,隐藏Content - ContentVisibility = Visibility.Collapsed; - - // 页面选择 - Pager = new CustomPagerViewModel(1, 1); - Pager.CurrentChanged += OnCurrentChanged_Pager; - Pager.CountChanged += OnCountChanged_Pager; - Pager.Current = 1; - } - - /// - /// 顶部tab点击事件是否允许执行 - /// - /// - /// - private bool CanExecuteTabHeadersCommand(object parameter) - { - return IsEnabled; - } - - // 全选按钮点击事件 - private DelegateCommand selectAllCommand; - public DelegateCommand SelectAllCommand => selectAllCommand ?? (selectAllCommand = new DelegateCommand(ExecuteSelectAllCommand)); - - /// - /// 全选按钮点击事件 - /// - /// - private void ExecuteSelectAllCommand(object parameter) - { - if (IsSelectAll) - { - foreach (var item in Medias) - { - item.IsSelected = true; - } - } - else - { - foreach (var item in Medias) - { - item.IsSelected = false; - } - } - } - - // 列表选择事件 - private DelegateCommand mediasCommand; - public DelegateCommand MediasCommand => mediasCommand ?? (mediasCommand = new DelegateCommand(ExecuteMediasCommand)); - - /// - /// 列表选择事件 - /// - /// - private void ExecuteMediasCommand(object parameter) - { - if (!(parameter is IList selectedMedia)) { return; } - - if (selectedMedia.Count == Medias.Count) - { - IsSelectAll = true; - } - else - { - IsSelectAll = false; - } - } - - // 添加选中项到下载列表事件 - private DelegateCommand addToDownloadCommand; - public DelegateCommand AddToDownloadCommand => addToDownloadCommand ?? (addToDownloadCommand = new DelegateCommand(ExecuteAddToDownloadCommand)); - - /// - /// 添加选中项到下载列表事件 - /// - private void ExecuteAddToDownloadCommand() - { - AddToDownload(true); - } - - // 添加所有视频到下载列表事件 - private DelegateCommand addAllToDownloadCommand; - public DelegateCommand AddAllToDownloadCommand => addAllToDownloadCommand ?? (addAllToDownloadCommand = new DelegateCommand(ExecuteAddAllToDownloadCommand)); - - /// - /// 添加所有视频到下载列表事件 - /// - private void ExecuteAddAllToDownloadCommand() - { - AddToDownload(false); - } - - #endregion - - /// - /// 添加到下载 - /// - /// - private async void AddToDownload(bool isOnlySelected) - { - // 订阅里只有BANGUMI类型 - AddToDownloadService addToDownloadService = new AddToDownloadService(PlayStreamType.BANGUMI); - - // 选择文件夹 - string directory = addToDownloadService.SetDirectory(dialogService); - - // 视频计数 - int i = 0; - await Task.Run(() => - { - // 为了避免执行其他操作时, - // Medias变化导致的异常 - var list = Medias.ToList(); - - // 添加到下载 - foreach (var media in list) - { - // 只下载选中项,跳过未选中项 - if (isOnlySelected && !media.IsSelected) { continue; } - - /// 有分P的就下载全部 - - // 开启服务 - BangumiInfoService service = new BangumiInfoService($"{ParseEntrance.BangumiMediaUrl}md{media.MediaId}"); - - addToDownloadService.SetVideoInfoService(service); - addToDownloadService.GetVideo(); - addToDownloadService.ParseVideo(service); - // 下载 - i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory); - } - }); - - if (directory == null) - { - return; - } - - // 通知用户添加到下载列表的结果 - if (i <= 0) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipAddDownloadingZero")); - } - else - { - eventAggregator.GetEvent().Publish($"{DictionaryResource.GetString("TipAddDownloadingFinished1")}{i}{DictionaryResource.GetString("TipAddDownloadingFinished2")}"); - } - } - - private void OnCountChanged_Pager(int count) { } - - private bool OnCurrentChanged_Pager(int old, int current) - { - if (!IsEnabled) - { - //Pager.Current = old; - return false; - } - - UpdateBangumiMediaList(current); - - return true; - } - - private async void UpdateBangumiMediaList(int current) - { - Medias.Clear(); - IsSelectAll = false; - - LoadingVisibility = Visibility.Visible; - NoDataVisibility = Visibility.Collapsed; - - // 是否正在获取数据 - // 在所有的退出分支中都需要设为true - IsEnabled = false; - - var tab = TabHeaders[SelectTabId]; - Core.BiliApi.Users.Models.BangumiType type = (Core.BiliApi.Users.Models.BangumiType)tab.Id; - - await Task.Run(() => - { - CancellationToken cancellationToken = tokenSource.Token; - - var bangumiFollows = Core.BiliApi.Users.UserSpace.GetBangumiFollow(mid, type, current, VideoNumberInPage); - if (bangumiFollows == null || bangumiFollows.List == null || bangumiFollows.List.Count == 0) - { - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Visible; - return; - } - - // 更新总页码 - Pager.Count = (int)Math.Ceiling((double)bangumiFollows.Total / VideoNumberInPage); - // 更新内容 - ContentVisibility = Visibility.Visible; - - foreach (var bangumiFollow in bangumiFollows.List) - { - // 查询、保存封面 - string coverUrl = bangumiFollow.Cover; - BitmapImage cover; - if (coverUrl == null || coverUrl == "") - { - cover = null; - } - else - { - if (!coverUrl.ToLower().StartsWith("http")) - { - coverUrl = $"https:{bangumiFollow.Cover}"; - } - - StorageCover storageCover = new StorageCover(); - cover = storageCover.GetCoverThumbnail(bangumiFollow.MediaId, bangumiFollow.SeasonId.ToString(), -1, coverUrl, 110, 140); - } - - // 地区 - string area = string.Empty; - if (bangumiFollow.Areas != null && bangumiFollow.Areas.Count > 0) - { - area = bangumiFollow.Areas[0].Name; - } - - // 视频更新进度 - string indexShow = string.Empty; - if (bangumiFollow.NewEp != null) - { - indexShow = bangumiFollow.NewEp.IndexShow; - } - - // 观看进度 - string progress; - if (bangumiFollow.Progress == null || bangumiFollow.Progress == "") - { - progress = DictionaryResource.GetString("BangumiNotWatched"); - } - else - { - progress = bangumiFollow.Progress; - } - - App.PropertyChangeAsync(() => - { - BangumiFollowMedia media = new BangumiFollowMedia(eventAggregator) - { - MediaId = bangumiFollow.MediaId, - SeasonId = bangumiFollow.SeasonId, - Title = bangumiFollow.Title, - SeasonTypeName = bangumiFollow.SeasonTypeName, - Area = area, - Badge = bangumiFollow.Badge, - Cover = cover ?? new BitmapImage(new Uri($"pack://application:,,,/Resources/video-placeholder.png")), - Evaluate = bangumiFollow.Evaluate, - IndexShow = indexShow, - Progress = progress - }; - - Medias.Add(media); - - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - }); - - // 判断是否该结束线程,若为true,跳出循环 - if (cancellationToken.IsCancellationRequested) - { - break; - } - } - }, (tokenSource = new CancellationTokenSource()).Token); - - IsEnabled = true; - } - - /// - /// 初始化页面数据 - /// - private void InitView() - { - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - ContentVisibility = Visibility.Collapsed; - LoadingVisibility = Visibility.Visible; - NoDataVisibility = Visibility.Collapsed; - - Medias.Clear(); - IsSelectAll = false; - } - - /// - /// 导航到页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - DownloadManage = ButtonIcon.Instance().DownloadManage; - DownloadManage.Height = 24; - DownloadManage.Width = 24; - DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary"); - - // 根据传入参数不同执行不同任务 - mid = navigationContext.Parameters.GetValue("Parameter"); - if (mid == 0) - { - return; - } - - InitView(); - - // 初始选中项 - SelectTabId = 0; - - // 页面选择 - Pager = new CustomPagerViewModel(1, 1); - Pager.CurrentChanged += OnCurrentChanged_Pager; - Pager.CountChanged += OnCountChanged_Pager; - Pager.Current = 1; - } - - } -} diff --git a/src/DownKyi/ViewModels/ViewMyFavoritesViewModel.cs b/src/DownKyi/ViewModels/ViewMyFavoritesViewModel.cs deleted file mode 100644 index 714b69d..0000000 --- a/src/DownKyi/ViewModels/ViewMyFavoritesViewModel.cs +++ /dev/null @@ -1,528 +0,0 @@ -using DownKyi.Core.BiliApi.Favorites; -using DownKyi.Core.BiliApi.VideoStream; -using DownKyi.CustomControl; -using DownKyi.Events; -using DownKyi.Images; -using DownKyi.Services; -using DownKyi.Services.Download; -using DownKyi.Utils; -using DownKyi.ViewModels.PageViewModels; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using Prism.Services.Dialogs; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; - -namespace DownKyi.ViewModels -{ - public class ViewMyFavoritesViewModel : BaseViewModel - { - public const string Tag = "PageMyFavorites"; - - //private readonly IDialogService dialogService; - - private CancellationTokenSource tokenSource1; - private CancellationTokenSource tokenSource2; - - private long mid = -1; - - // 每页视频数量,暂时在此写死,以后在设置中增加选项 - private readonly int VideoNumberInPage = 20; - - #region 页面属性申明 - - private string pageName = Tag; - public string PageName - { - get => pageName; - set => SetProperty(ref pageName, value); - } - - private Visibility contentVisibility; - public Visibility ContentVisibility - { - get => contentVisibility; - set => SetProperty(ref contentVisibility, value); - } - - private GifImage loading; - public GifImage Loading - { - get => loading; - set => SetProperty(ref loading, value); - } - - private Visibility loadingVisibility; - public Visibility LoadingVisibility - { - get => loadingVisibility; - set => SetProperty(ref loadingVisibility, value); - } - - private Visibility noDataVisibility; - public Visibility NoDataVisibility - { - get => noDataVisibility; - set => SetProperty(ref noDataVisibility, value); - } - - private GifImage mediaLoading; - public GifImage MediaLoading - { - get => mediaLoading; - set => SetProperty(ref mediaLoading, value); - } - - private Visibility mediaContentVisibility; - public Visibility MediaContentVisibility - { - get => mediaContentVisibility; - set => SetProperty(ref mediaContentVisibility, value); - } - - private Visibility mediaLoadingVisibility; - public Visibility MediaLoadingVisibility - { - get => mediaLoadingVisibility; - set => SetProperty(ref mediaLoadingVisibility, value); - } - - private Visibility mediaNoDataVisibility; - public Visibility MediaNoDataVisibility - { - get => mediaNoDataVisibility; - set => SetProperty(ref mediaNoDataVisibility, value); - } - - private VectorImage arrowBack; - public VectorImage ArrowBack - { - get => arrowBack; - set => SetProperty(ref arrowBack, value); - } - - private VectorImage downloadManage; - public VectorImage DownloadManage - { - get => downloadManage; - set => SetProperty(ref downloadManage, value); - } - - private ObservableCollection tabHeaders; - public ObservableCollection TabHeaders - { - get => tabHeaders; - set => SetProperty(ref tabHeaders, value); - } - - private int selectTabId; - public int SelectTabId - { - get => selectTabId; - set => SetProperty(ref selectTabId, value); - } - - private bool isEnabled = true; - public bool IsEnabled - { - get => isEnabled; - set => SetProperty(ref isEnabled, value); - } - - private CustomPagerViewModel pager; - public CustomPagerViewModel Pager - { - get => pager; - set => SetProperty(ref pager, value); - } - - private ObservableCollection medias; - public ObservableCollection Medias - { - get => medias; - set => SetProperty(ref medias, value); - } - - private bool isSelectAll; - public bool IsSelectAll - { - get => isSelectAll; - set => SetProperty(ref isSelectAll, value); - } - - #endregion - - public ViewMyFavoritesViewModel(IEventAggregator eventAggregator, IDialogService dialogService) : base(eventAggregator) - { - this.dialogService = dialogService; - - #region 属性初始化 - - // 初始化loading gif - Loading = new GifImage(Properties.Resources.loading); - Loading.StartAnimate(); - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - - MediaLoading = new GifImage(Properties.Resources.loading); - MediaLoading.StartAnimate(); - MediaLoadingVisibility = Visibility.Collapsed; - MediaNoDataVisibility = Visibility.Collapsed; - - ArrowBack = NavigationIcon.Instance().ArrowBack; - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - // 下载管理按钮 - DownloadManage = ButtonIcon.Instance().DownloadManage; - DownloadManage.Height = 24; - DownloadManage.Width = 24; - DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary"); - - TabHeaders = new ObservableCollection(); - Medias = new ObservableCollection(); - - #endregion - } - - #region 命令申明 - - // 返回事件 - private DelegateCommand backSpaceCommand; - public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace)); - - /// - /// 返回事件 - /// - private void ExecuteBackSpace() - { - InitView(); - - ArrowBack.Fill = DictionaryResource.GetColor("ColorText"); - - // 结束任务 - tokenSource1?.Cancel(); - tokenSource2?.Cancel(); - - NavigationParam parameter = new NavigationParam - { - ViewName = ParentView, - ParentViewName = null, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 前往下载管理页面 - private DelegateCommand downloadManagerCommand; - public DelegateCommand DownloadManagerCommand => downloadManagerCommand ?? (downloadManagerCommand = new DelegateCommand(ExecuteDownloadManagerCommand)); - - /// - /// 前往下载管理页面 - /// - private void ExecuteDownloadManagerCommand() - { - NavigationParam parameter = new NavigationParam - { - ViewName = ViewDownloadManagerViewModel.Tag, - ParentViewName = Tag, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 左侧tab点击事件 - private DelegateCommand leftTabHeadersCommand; - public DelegateCommand LeftTabHeadersCommand => leftTabHeadersCommand ?? (leftTabHeadersCommand = new DelegateCommand(ExecuteLeftTabHeadersCommand, CanExecuteLeftTabHeadersCommand)); - - /// - /// 左侧tab点击事件 - /// - /// - private void ExecuteLeftTabHeadersCommand(object parameter) - { - if (!(parameter is TabHeader tabHeader)) { return; } - - // tab点击后,隐藏MediaContent - MediaContentVisibility = Visibility.Collapsed; - - // 页面选择 - Pager = new CustomPagerViewModel(1, (int)Math.Ceiling(double.Parse(tabHeader.SubTitle) / VideoNumberInPage)); - Pager.CurrentChanged += OnCurrentChanged_Pager; - Pager.CountChanged += OnCountChanged_Pager; - Pager.Current = 1; - } - - /// - /// 左侧tab点击事件是否允许执行 - /// - /// - /// - private bool CanExecuteLeftTabHeadersCommand(object parameter) - { - return IsEnabled; - } - - // 全选按钮点击事件 - private DelegateCommand selectAllCommand; - public DelegateCommand SelectAllCommand => selectAllCommand ?? (selectAllCommand = new DelegateCommand(ExecuteSelectAllCommand)); - - /// - /// 全选按钮点击事件 - /// - /// - private void ExecuteSelectAllCommand(object parameter) - { - if (IsSelectAll) - { - foreach (var item in Medias) - { - item.IsSelected = true; - } - } - else - { - foreach (var item in Medias) - { - item.IsSelected = false; - } - } - } - - // 列表选择事件 - private DelegateCommand mediasCommand; - public DelegateCommand MediasCommand => mediasCommand ?? (mediasCommand = new DelegateCommand(ExecuteMediasCommand)); - - /// - /// 列表选择事件 - /// - /// - private void ExecuteMediasCommand(object parameter) - { - if (!(parameter is IList selectedMedia)) { return; } - - if (selectedMedia.Count == Medias.Count) - { - IsSelectAll = true; - } - else - { - IsSelectAll = false; - } - } - - // 添加选中项到下载列表事件 - private DelegateCommand addToDownloadCommand; - public DelegateCommand AddToDownloadCommand => addToDownloadCommand ?? (addToDownloadCommand = new DelegateCommand(ExecuteAddToDownloadCommand)); - - /// - /// 添加选中项到下载列表事件 - /// - private void ExecuteAddToDownloadCommand() - { - AddToDownload(true); - } - - // 添加所有视频到下载列表事件 - private DelegateCommand addAllToDownloadCommand; - public DelegateCommand AddAllToDownloadCommand => addAllToDownloadCommand ?? (addAllToDownloadCommand = new DelegateCommand(ExecuteAddAllToDownloadCommand)); - - /// - /// 添加所有视频到下载列表事件 - /// - private void ExecuteAddAllToDownloadCommand() - { - AddToDownload(false); - } - - #endregion - - /// - /// 添加到下载 - /// - /// - private async void AddToDownload(bool isOnlySelected) - { - // 收藏夹里只有视频 - AddToDownloadService addToDownloadService = new AddToDownloadService(PlayStreamType.VIDEO); - - // 选择文件夹 - string directory = addToDownloadService.SetDirectory(dialogService); - - // 视频计数 - int i = 0; - await Task.Run(() => - { - // 为了避免执行其他操作时, - // Medias变化导致的异常 - var list = Medias.ToList(); - - // 添加到下载 - foreach (var media in list) - { - // 只下载选中项,跳过未选中项 - if (isOnlySelected && !media.IsSelected) { continue; } - - /// 有分P的就下载全部 - - // 开启服务 - VideoInfoService videoInfoService = new VideoInfoService(media.Bvid); - - addToDownloadService.SetVideoInfoService(videoInfoService); - addToDownloadService.GetVideo(); - addToDownloadService.ParseVideo(videoInfoService); - // 下载 - i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory); - } - }); - - if (directory == null) - { - return; - } - - // 通知用户添加到下载列表的结果 - if (i <= 0) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipAddDownloadingZero")); - } - else - { - eventAggregator.GetEvent().Publish($"{DictionaryResource.GetString("TipAddDownloadingFinished1")}{i}{DictionaryResource.GetString("TipAddDownloadingFinished2")}"); - } - } - - private void OnCountChanged_Pager(int count) { } - - private bool OnCurrentChanged_Pager(int old, int current) - { - if (!IsEnabled) - { - //Pager.Current = old; - return false; - } - - UpdateFavoritesMediaList(current); - - return true; - } - - private async void UpdateFavoritesMediaList(int current) - { - Medias.Clear(); - IsSelectAll = false; - - MediaLoadingVisibility = Visibility.Visible; - MediaNoDataVisibility = Visibility.Collapsed; - - // 是否正在获取数据 - // 在所有的退出分支中都需要设为true - IsEnabled = false; - - var tab = TabHeaders[SelectTabId]; - - await Task.Run(new Action(() => - { - CancellationToken cancellationToken = tokenSource2.Token; - - List medias = FavoritesResource.GetFavoritesMedia(tab.Id, current, VideoNumberInPage); - if (medias == null || medias.Count == 0) - { - MediaContentVisibility = Visibility.Visible; - MediaLoadingVisibility = Visibility.Collapsed; - MediaNoDataVisibility = Visibility.Visible; - return; - } - - MediaContentVisibility = Visibility.Visible; - MediaLoadingVisibility = Visibility.Collapsed; - MediaNoDataVisibility = Visibility.Collapsed; - - var service = new FavoritesService(); - service.GetFavoritesMediaList(medias, Medias, eventAggregator, cancellationToken); - }), (tokenSource2 = new CancellationTokenSource()).Token); - - IsEnabled = true; - } - - /// - /// 初始化页面数据 - /// - private void InitView() - { - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - DownloadManage = ButtonIcon.Instance().DownloadManage; - DownloadManage.Height = 24; - DownloadManage.Width = 24; - DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary"); - - ContentVisibility = Visibility.Collapsed; - LoadingVisibility = Visibility.Visible; - NoDataVisibility = Visibility.Collapsed; - MediaLoadingVisibility = Visibility.Collapsed; - MediaNoDataVisibility = Visibility.Collapsed; - - TabHeaders.Clear(); - Medias.Clear(); - SelectTabId = -1; - IsSelectAll = false; - } - - /// - /// 导航到页面时执行 - /// - /// - public override async void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - // 根据传入参数不同执行不同任务 - mid = navigationContext.Parameters.GetValue("Parameter"); - if (mid == 0) - { - return; - } - - InitView(); - - await Task.Run(new Action(() => - { - CancellationToken cancellationToken = tokenSource1.Token; - - var service = new FavoritesService(); - service.GetCreatedFavorites(mid, TabHeaders, cancellationToken); - service.GetCollectedFavorites(mid, TabHeaders, cancellationToken); - }), (tokenSource1 = new CancellationTokenSource()).Token); - - if (TabHeaders.Count == 0) - { - ContentVisibility = Visibility.Collapsed; - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Visible; - - return; - } - - ContentVisibility = Visibility.Visible; - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - - // 初始选中项 - SelectTabId = 0; - - // 页面选择 - Pager = new CustomPagerViewModel(1, (int)Math.Ceiling(double.Parse(TabHeaders[0].SubTitle) / VideoNumberInPage)); - Pager.CurrentChanged += OnCurrentChanged_Pager; - Pager.CountChanged += OnCountChanged_Pager; - Pager.Current = 1; - } - - } -} diff --git a/src/DownKyi/ViewModels/ViewMyHistoryViewModel.cs b/src/DownKyi/ViewModels/ViewMyHistoryViewModel.cs deleted file mode 100644 index a5b6892..0000000 --- a/src/DownKyi/ViewModels/ViewMyHistoryViewModel.cs +++ /dev/null @@ -1,538 +0,0 @@ -using DownKyi.Core.BiliApi.History; -using DownKyi.Core.BiliApi.VideoStream; -using DownKyi.Core.Storage; -using DownKyi.Core.Utils; -using DownKyi.CustomControl; -using DownKyi.Events; -using DownKyi.Images; -using DownKyi.Services; -using DownKyi.Services.Download; -using DownKyi.Utils; -using DownKyi.ViewModels.PageViewModels; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using Prism.Services.Dialogs; -using System; -using System.Collections; -using System.Collections.ObjectModel; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels -{ - public class ViewMyHistoryViewModel : BaseViewModel - { - public const string Tag = "PageMyHistory"; - - private CancellationTokenSource tokenSource; - - // 每页视频数量,暂时在此写死,以后在设置中增加选项 - private readonly int VideoNumberInPage = 30; - - #region 页面属性申明 - - private string pageName = Tag; - public string PageName - { - get => pageName; - set => SetProperty(ref pageName, value); - } - - private VectorImage arrowBack; - public VectorImage ArrowBack - { - get => arrowBack; - set => SetProperty(ref arrowBack, value); - } - - private VectorImage downloadManage; - public VectorImage DownloadManage - { - get => downloadManage; - set => SetProperty(ref downloadManage, value); - } - - private Visibility contentVisibility; - public Visibility ContentVisibility - { - get => contentVisibility; - set => SetProperty(ref contentVisibility, value); - } - - private ObservableCollection medias; - public ObservableCollection Medias - { - get => medias; - set => SetProperty(ref medias, value); - } - - private bool isSelectAll; - public bool IsSelectAll - { - get => isSelectAll; - set => SetProperty(ref isSelectAll, value); - } - - private GifImage loading; - public GifImage Loading - { - get => loading; - set => SetProperty(ref loading, value); - } - - private Visibility loadingVisibility; - public Visibility LoadingVisibility - { - get => loadingVisibility; - set => SetProperty(ref loadingVisibility, value); - } - - private Visibility noDataVisibility; - public Visibility NoDataVisibility - { - get => noDataVisibility; - set => SetProperty(ref noDataVisibility, value); - } - - #endregion - - public ViewMyHistoryViewModel(IEventAggregator eventAggregator, IDialogService dialogService) : base(eventAggregator) - { - this.dialogService = dialogService; - - #region 属性初始化 - - // 初始化loading gif - Loading = new GifImage(Properties.Resources.loading); - Loading.StartAnimate(); - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - - ArrowBack = NavigationIcon.Instance().ArrowBack; - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - // 下载管理按钮 - DownloadManage = ButtonIcon.Instance().DownloadManage; - DownloadManage.Height = 24; - DownloadManage.Width = 24; - DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary"); - - Medias = new ObservableCollection(); - - #endregion - - } - - #region 命令申明 - - // 返回事件 - private DelegateCommand backSpaceCommand; - public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace)); - - /// - /// 返回事件 - /// - private void ExecuteBackSpace() - { - InitView(); - - ArrowBack.Fill = DictionaryResource.GetColor("ColorText"); - - // 结束任务 - tokenSource?.Cancel(); - - NavigationParam parameter = new NavigationParam - { - ViewName = ParentView, - ParentViewName = null, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 前往下载管理页面 - private DelegateCommand downloadManagerCommand; - public DelegateCommand DownloadManagerCommand => downloadManagerCommand ?? (downloadManagerCommand = new DelegateCommand(ExecuteDownloadManagerCommand)); - - /// - /// 前往下载管理页面 - /// - private void ExecuteDownloadManagerCommand() - { - NavigationParam parameter = new NavigationParam - { - ViewName = ViewDownloadManagerViewModel.Tag, - ParentViewName = Tag, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 全选按钮点击事件 - private DelegateCommand selectAllCommand; - public DelegateCommand SelectAllCommand => selectAllCommand ?? (selectAllCommand = new DelegateCommand(ExecuteSelectAllCommand)); - - /// - /// 全选按钮点击事件 - /// - /// - private void ExecuteSelectAllCommand(object parameter) - { - if (IsSelectAll) - { - foreach (var item in Medias) - { - item.IsSelected = true; - } - } - else - { - foreach (var item in Medias) - { - item.IsSelected = false; - } - } - } - - // 列表选择事件 - private DelegateCommand mediasCommand; - public DelegateCommand MediasCommand => mediasCommand ?? (mediasCommand = new DelegateCommand(ExecuteMediasCommand)); - - /// - /// 列表选择事件 - /// - /// - private void ExecuteMediasCommand(object parameter) - { - if (!(parameter is IList selectedMedia)) { return; } - - if (selectedMedia.Count == Medias.Count) - { - IsSelectAll = true; - } - else - { - IsSelectAll = false; - } - } - - // 添加选中项到下载列表事件 - private DelegateCommand addToDownloadCommand; - public DelegateCommand AddToDownloadCommand => addToDownloadCommand ?? (addToDownloadCommand = new DelegateCommand(ExecuteAddToDownloadCommand)); - - /// - /// 添加选中项到下载列表事件 - /// - private void ExecuteAddToDownloadCommand() - { - AddToDownload(true); - } - - // 添加所有视频到下载列表事件 - private DelegateCommand addAllToDownloadCommand; - public DelegateCommand AddAllToDownloadCommand => addAllToDownloadCommand ?? (addAllToDownloadCommand = new DelegateCommand(ExecuteAddAllToDownloadCommand)); - - /// - /// 添加所有视频到下载列表事件 - /// - private void ExecuteAddAllToDownloadCommand() - { - AddToDownload(false); - } - - #endregion - - /// - /// 添加到下载 - /// - /// - private async void AddToDownload(bool isOnlySelected) - { - // BANGUMI类型 - AddToDownloadService addToDownloadService = new AddToDownloadService(PlayStreamType.VIDEO); - - // 选择文件夹 - string directory = addToDownloadService.SetDirectory(dialogService); - - // 视频计数 - int i = 0; - await Task.Run(() => - { - // 为了避免执行其他操作时, - // Medias变化导致的异常 - var list = Medias.ToList(); - - // 添加到下载 - foreach (var media in list) - { - // 只下载选中项,跳过未选中项 - if (isOnlySelected && !media.IsSelected) { continue; } - - /// 有分P的就下载全部 - - // 开启服务 - IInfoService service = null; - switch (media.Business) - { - case "archive": - service = new VideoInfoService(media.Url); - break; - case "pgc": - service = new BangumiInfoService(media.Url); - break; - } - if (service == null) { return; } - - addToDownloadService.SetVideoInfoService(service); - addToDownloadService.GetVideo(); - addToDownloadService.ParseVideo(service); - // 下载 - i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory); - } - }); - - if (directory == null) - { - return; - } - - // 通知用户添加到下载列表的结果 - if (i <= 0) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipAddDownloadingZero")); - } - else - { - eventAggregator.GetEvent().Publish($"{DictionaryResource.GetString("TipAddDownloadingFinished1")}{i}{DictionaryResource.GetString("TipAddDownloadingFinished2")}"); - } - } - - private async void UpdateHistoryMediaList() - { - LoadingVisibility = Visibility.Visible; - NoDataVisibility = Visibility.Collapsed; - Medias.Clear(); - - await Task.Run(() => - { - CancellationToken cancellationToken = tokenSource.Token; - - var historyList = History.GetHistory(0, 0, VideoNumberInPage); - if (historyList == null || historyList.List == null || historyList.List.Count == 0) - { - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Visible; - return; - } - - foreach (var history in historyList.List) - { - if (history.History == null) { continue; } - - if (history.History.Business != "archive" && history.History.Business != "pgc") - { continue; } - - // 播放url - string url = "https://www.bilibili.com"; - switch (history.History.Business) - { - case "archive": - url = "https://www.bilibili.com/video/" + history.History.Bvid; - break; - case "pgc": - url = history.Uri; - break; - } - - // 查询、保存封面 - string coverUrl = history.Cover; - BitmapImage cover; - if (coverUrl == null || coverUrl == "") - { - cover = null; - } - else - { - if (!coverUrl.ToLower().StartsWith("http")) - { - coverUrl = $"https:{history.Cover}"; - } - - StorageCover storageCover = new StorageCover(); - cover = storageCover.GetCoverThumbnail(history.History.Oid, history.History.Bvid, history.History.Cid, coverUrl, 160, 100); - } - - // 获取用户头像 - string upName; - BitmapImage upHeader; - if (history.AuthorFace != null) - { - upName = history.AuthorName; - StorageHeader storageHeader = new StorageHeader(); - upHeader = storageHeader.GetHeaderThumbnail(history.AuthorMid, upName, history.AuthorFace, 24, 24); - } - else - { - upName = ""; - upHeader = null; - } - - // 观看进度 - // -1 已看完 - // 0 刚开始 - // >0 看到 progress - string progress; - if (history.Progress == -1) { progress = DictionaryResource.GetString("HistoryFinished"); } - else if (history.Progress == 0) { progress = DictionaryResource.GetString("HistoryStarted"); } - else { progress = DictionaryResource.GetString("HistoryWatch") + " " + Format.FormatDuration3(history.Progress); } - - // 观看平台 - VectorImage platform; - switch (history.History.Dt) - { - case 1: - case 3: - case 5: - case 7: - // 手机端 - platform = NormalIcon.Instance().PlatformMobile; - break; - case 2: - // web端 - platform = NormalIcon.Instance().PlatformPC; - break; - case 4: - case 6: - // pad端 - platform = NormalIcon.Instance().PlatformIpad; - break; - case 33: - // TV端 - platform = NormalIcon.Instance().PlatformTV; - break; - default: - // 其他 - platform = null; - break; - } - - // 是否显示Partdesc - Visibility partdescVisibility; - if (history.NewDesc == "") - { - partdescVisibility = Visibility.Hidden; - } - else - { - partdescVisibility = Visibility.Visible; - } - - // 是否显示UP主信息和分区信息 - Visibility upAndTagVisibility; - if (history.History.Business == "archive") - { - upAndTagVisibility = Visibility.Visible; - } - else - { - upAndTagVisibility = Visibility.Hidden; - } - - App.PropertyChangeAsync(() => - { - HistoryMedia media = new HistoryMedia(eventAggregator) - { - Business = history.History.Business, - Bvid = history.History.Bvid, - Url = url, - UpMid = history.AuthorMid, - Cover = cover ?? new BitmapImage(new Uri($"pack://application:,,,/Resources/video-placeholder.png")), - Title = history.Title, - SubTitle = history.ShowTitle, - Duration = history.Duration, - TagName = history.TagName, - Partdesc = history.NewDesc, - Progress = progress, - Platform = platform, - UpName = upName, - UpHeader = upHeader, - - PartdescVisibility = partdescVisibility, - UpAndTagVisibility = upAndTagVisibility, - }; - - Medias.Add(media); - - ContentVisibility = Visibility.Visible; - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - }); - - // 判断是否该结束线程,若为true,跳出循环 - if (cancellationToken.IsCancellationRequested) - { - break; - } - } - }, (tokenSource = new CancellationTokenSource()).Token); - } - - /// - /// 初始化页面数据 - /// - private void InitView() - { - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - DownloadManage = ButtonIcon.Instance().DownloadManage; - DownloadManage.Height = 24; - DownloadManage.Width = 24; - DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary"); - - ContentVisibility = Visibility.Collapsed; - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - - Medias.Clear(); - IsSelectAll = false; - } - - /// - /// 导航到页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - DownloadManage = ButtonIcon.Instance().DownloadManage; - DownloadManage.Height = 24; - DownloadManage.Width = 24; - DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary"); - - // 根据传入参数不同执行不同任务 - long mid = navigationContext.Parameters.GetValue("Parameter"); - if (mid == 0) - { - IsSelectAll = false; - foreach (var media in Medias) - { - media.IsSelected = false; - } - - return; - } - - InitView(); - - UpdateHistoryMediaList(); - } - - } -} diff --git a/src/DownKyi/ViewModels/ViewMySpaceViewModel.cs b/src/DownKyi/ViewModels/ViewMySpaceViewModel.cs deleted file mode 100644 index d057806..0000000 --- a/src/DownKyi/ViewModels/ViewMySpaceViewModel.cs +++ /dev/null @@ -1,666 +0,0 @@ -using DownKyi.Core.BiliApi.Login; -using DownKyi.Core.BiliApi.Users; -using DownKyi.Core.BiliApi.Users.Models; -using DownKyi.Core.Storage; -using DownKyi.CustomControl; -using DownKyi.Events; -using DownKyi.Images; -using DownKyi.Utils; -using DownKyi.ViewModels.PageViewModels; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels -{ - public class ViewMySpaceViewModel : BaseViewModel - { - public const string Tag = "PageMySpace"; - - private CancellationTokenSource tokenSource; - - // mid - private long mid = -1; - - #region 页面属性申明 - - private VectorImage arrowBack; - public VectorImage ArrowBack - { - get => arrowBack; - set => SetProperty(ref arrowBack, value); - } - - private VectorImage logout; - public VectorImage Logout - { - get => logout; - set => SetProperty(ref logout, value); - } - - private GifImage loading; - public GifImage Loading - { - get => loading; - set => SetProperty(ref loading, value); - } - - private Visibility noDataVisibility; - public Visibility NoDataVisibility - { - get => noDataVisibility; - set => SetProperty(ref noDataVisibility, value); - } - - private Visibility loadingVisibility; - public Visibility LoadingVisibility - { - get => loadingVisibility; - set => SetProperty(ref loadingVisibility, value); - } - - private Visibility viewVisibility; - public Visibility ViewVisibility - { - get => viewVisibility; - set => SetProperty(ref viewVisibility, value); - } - - private Visibility contentVisibility; - public Visibility ContentVisibility - { - get => contentVisibility; - set => SetProperty(ref contentVisibility, value); - } - - private string topNavigationBg; - public string TopNavigationBg - { - get => topNavigationBg; - set => SetProperty(ref topNavigationBg, value); - } - - private BitmapImage background; - public BitmapImage Background - { - get => background; - set => SetProperty(ref background, value); - } - - private BitmapImage header; - public BitmapImage Header - { - get => header; - set => SetProperty(ref header, value); - } - - private string userName; - public string UserName - { - get => userName; - set => SetProperty(ref userName, value); - } - - private BitmapImage sex; - public BitmapImage Sex - { - get => sex; - set => SetProperty(ref sex, value); - } - - private BitmapImage level; - public BitmapImage Level - { - get => level; - set => SetProperty(ref level, value); - } - - private Visibility vipTypeVisibility; - public Visibility VipTypeVisibility - { - get => vipTypeVisibility; - set => SetProperty(ref vipTypeVisibility, value); - } - - private string vipType; - public string VipType - { - get => vipType; - set => SetProperty(ref vipType, value); - } - - private string sign; - public string Sign - { - get => sign; - set => SetProperty(ref sign, value); - } - - private VectorImage coinIcon; - public VectorImage CoinIcon - { - get => coinIcon; - set => SetProperty(ref coinIcon, value); - } - - private string coin; - public string Coin - { - get => coin; - set => SetProperty(ref coin, value); - } - - private VectorImage moneyIcon; - public VectorImage MoneyIcon - { - get => moneyIcon; - set => SetProperty(ref moneyIcon, value); - } - - private string money; - public string Money - { - get => money; - set => SetProperty(ref money, value); - } - - private VectorImage bindingEmail; - public VectorImage BindingEmail - { - get => bindingEmail; - set => SetProperty(ref bindingEmail, value); - } - - private Visibility bindingEmailVisibility; - public Visibility BindingEmailVisibility - { - get => bindingEmailVisibility; - set => SetProperty(ref bindingEmailVisibility, value); - } - - private VectorImage bindingPhone; - public VectorImage BindingPhone - { - get => bindingPhone; - set => SetProperty(ref bindingPhone, value); - } - - private Visibility bindingPhoneVisibility; - public Visibility BindingPhoneVisibility - { - get => bindingPhoneVisibility; - set => SetProperty(ref bindingPhoneVisibility, value); - } - - private string levelText; - public string LevelText - { - get => levelText; - set => SetProperty(ref levelText, value); - } - - private string currentExp; - public string CurrentExp - { - get => currentExp; - set => SetProperty(ref currentExp, value); - } - - private int expProgress; - public int ExpProgress - { - get => expProgress; - set => SetProperty(ref expProgress, value); - } - - private int maxExp; - public int MaxExp - { - get => maxExp; - set => SetProperty(ref maxExp, value); - } - - private ObservableCollection statusList; - public ObservableCollection StatusList - { - get => statusList; - set => SetProperty(ref statusList, value); - } - - private ObservableCollection packageList; - public ObservableCollection PackageList - { - get => packageList; - set => SetProperty(ref packageList, value); - } - - private int selectedStatus; - public int SelectedStatus - { - get => selectedStatus; - set => SetProperty(ref selectedStatus, value); - } - - private int selectedPackage; - public int SelectedPackage - { - get => selectedPackage; - set => SetProperty(ref selectedPackage, value); - } - - #endregion - - public ViewMySpaceViewModel(IEventAggregator eventAggregator) : base(eventAggregator) - { - #region 属性初始化 - - // 返回按钮 - ArrowBack = NavigationIcon.Instance().ArrowBack; - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - // 退出登录按钮 - Logout = NavigationIcon.Instance().Logout; - Logout.Fill = DictionaryResource.GetColor("ColorTextDark"); - - // 初始化loading gif - Loading = new GifImage(Properties.Resources.loading); - Loading.StartAnimate(); - - TopNavigationBg = "#00FFFFFF"; // 透明 - - // B站图标 - CoinIcon = NormalIcon.Instance().CoinIcon; - CoinIcon.Fill = DictionaryResource.GetColor("ColorPrimary"); - MoneyIcon = NormalIcon.Instance().MoneyIcon; - MoneyIcon.Fill = DictionaryResource.GetColor("ColorMoney"); - BindingEmail = NormalIcon.Instance().BindingEmail; - BindingEmail.Fill = DictionaryResource.GetColor("ColorPrimary"); - BindingPhone = NormalIcon.Instance().BindingPhone; - BindingPhone.Fill = DictionaryResource.GetColor("ColorPrimary"); - - StatusList = new ObservableCollection(); - PackageList = new ObservableCollection(); - - #endregion - } - - #region 命令申明 - - // 返回事件 - private DelegateCommand backSpaceCommand; - public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace)); - - /// - /// 返回事件 - /// - private void ExecuteBackSpace() - { - // 结束任务 - tokenSource?.Cancel(); - - NavigationParam parameter = new NavigationParam - { - ViewName = ParentView, - ParentViewName = null, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 退出登录事件 - private DelegateCommand logoutCommand; - public DelegateCommand LogoutCommand => logoutCommand ?? (logoutCommand = new DelegateCommand(ExecuteLogoutCommand)); - - /// - /// 退出登录事件 - /// - private void ExecuteLogoutCommand() - { - // 注销 - LoginHelper.Logout(); - - // 返回上一页 - NavigationParam parameter = new NavigationParam - { - ViewName = ParentView, - ParentViewName = null, - Parameter = "logout" - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 页面选择事件 - private DelegateCommand statusListCommand; - public DelegateCommand StatusListCommand => statusListCommand ?? (statusListCommand = new DelegateCommand(ExecuteStatusListCommand)); - - /// - /// 页面选择事件 - /// - private void ExecuteStatusListCommand() - { - if (SelectedStatus == -1) - { - return; - } - - Dictionary data = new Dictionary - { - { "mid", mid }, - { "friendId", 0 } - }; - - switch (SelectedStatus) - { - case 0: - data["friendId"] = 0; - NavigateToView.NavigationView(eventAggregator, ViewFriendsViewModel.Tag, Tag, data); - break; - case 1: - data["friendId"] = 0; - NavigateToView.NavigationView(eventAggregator, ViewFriendsViewModel.Tag, Tag, data); - break; - case 2: - data["friendId"] = 1; - NavigateToView.NavigationView(eventAggregator, ViewFriendsViewModel.Tag, Tag, data); - break; - default: - break; - } - - SelectedStatus = -1; - } - - // 页面选择事件 - private DelegateCommand packageListCommand; - public DelegateCommand PackageListCommand => packageListCommand ?? (packageListCommand = new DelegateCommand(ExecutePackageListCommand)); - - /// - /// 页面选择事件 - /// - /// - private void ExecutePackageListCommand() - { - if (SelectedPackage == -1) - { - return; - } - - switch (SelectedPackage) - { - case 0: - NavigateToView.NavigationView(eventAggregator, ViewMyFavoritesViewModel.Tag, Tag, mid); - break; - case 1: - NavigateToView.NavigationView(eventAggregator, ViewMyBangumiFollowViewModel.Tag, Tag, mid); - break; - case 2: - NavigateToView.NavigationView(eventAggregator, ViewMyToViewVideoViewModel.Tag, Tag, mid); - break; - case 3: - NavigateToView.NavigationView(eventAggregator, ViewMyHistoryViewModel.Tag, Tag, mid); - break; - default: - break; - } - - SelectedPackage = -1; - } - - #endregion - - /// - /// 初始化页面 - /// - private void InitView() - { - TopNavigationBg = "#00FFFFFF"; // 透明 - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - Logout.Fill = DictionaryResource.GetColor("ColorTextDark"); - Background = null; - - Header = null; - UserName = ""; - Sex = null; - Level = null; - VipTypeVisibility = Visibility.Collapsed; - VipType = ""; - Sign = ""; - - Coin = "0.0"; - Money = "0.0"; - - LevelText = ""; - CurrentExp = "--/--"; - - StatusList.Clear(); - StatusList.Add(new SpaceItem { IsEnabled = true, Title = DictionaryResource.GetString("Following"), Subtitle = "--" }); - StatusList.Add(new SpaceItem { IsEnabled = true, Title = DictionaryResource.GetString("Whisper"), Subtitle = "--" }); - StatusList.Add(new SpaceItem { IsEnabled = true, Title = DictionaryResource.GetString("Follower"), Subtitle = "--" }); - StatusList.Add(new SpaceItem { IsEnabled = false, Title = DictionaryResource.GetString("Black"), Subtitle = "--" }); - StatusList.Add(new SpaceItem { IsEnabled = false, Title = DictionaryResource.GetString("Moral"), Subtitle = "--" }); - StatusList.Add(new SpaceItem { IsEnabled = false, Title = DictionaryResource.GetString("Silence"), Subtitle = "N/A" }); - - PackageList.Clear(); - PackageList.Add(new SpaceItem { IsEnabled = true, Image = NormalIcon.Instance().FavoriteOutline, Title = DictionaryResource.GetString("Favorites") }); - PackageList.Add(new SpaceItem { IsEnabled = true, Image = NormalIcon.Instance().Subscription, Title = DictionaryResource.GetString("Subscription") }); - PackageList.Add(new SpaceItem { IsEnabled = true, Image = NormalIcon.Instance().ToView, Title = DictionaryResource.GetString("ToView") }); - PackageList.Add(new SpaceItem { IsEnabled = true, Image = NormalIcon.Instance().History, Title = DictionaryResource.GetString("History") }); - NormalIcon.Instance().FavoriteOutline.Fill = DictionaryResource.GetColor("ColorPrimary"); - NormalIcon.Instance().Subscription.Fill = DictionaryResource.GetColor("ColorPrimary"); - NormalIcon.Instance().ToView.Fill = DictionaryResource.GetColor("ColorPrimary"); - NormalIcon.Instance().History.Fill = DictionaryResource.GetColor("ColorPrimary"); - - SelectedStatus = -1; - SelectedPackage = -1; - - ContentVisibility = Visibility.Collapsed; - ViewVisibility = Visibility.Collapsed; - LoadingVisibility = Visibility.Visible; - NoDataVisibility = Visibility.Collapsed; - } - - /// - /// 更新用户信息 - /// - private async void UpdateSpaceInfo() - { - bool isCancel = false; - bool isNoData = true; - Uri toutuUri = null; - string headerUri = null; - Uri sexUri = null; - Uri levelUri = null; - - await Task.Run(() => - { - CancellationToken cancellationToken = tokenSource.Token; - - // 背景图片 - SpaceSettings spaceSettings = Core.BiliApi.Users.UserSpace.GetSpaceSettings(mid); - if (spaceSettings != null) - { - StorageCover storageCover = new StorageCover(); - string toutu = storageCover.GetCover($"https://i0.hdslb.com/{spaceSettings.Toutu.Limg}"); - toutuUri = new Uri(toutu); - } - else - { - toutuUri = new Uri("pack://application:,,,/Resources/backgound/9-绿荫秘境.png"); - } - - // 我的用户信息 - MyInfo myInfo = UserInfo.GetMyInfo(); - if (myInfo != null) - { - isNoData = false; - - // 头像 - StorageHeader storageHeader = new StorageHeader(); - headerUri = storageHeader.GetHeader(mid, myInfo.Name, myInfo.Face); - // 用户名 - UserName = myInfo.Name; - // 性别 - if (myInfo.Sex == "男") - { - sexUri = new Uri($"pack://application:,,,/Resources/sex/male.png"); - } - else if (myInfo.Sex == "女") - { - sexUri = new Uri($"pack://application:,,,/Resources/sex/female.png"); - } - // 显示vip信息 - if (myInfo.Vip.Label.Text == null || myInfo.Vip.Label.Text == "") - { - VipTypeVisibility = Visibility.Collapsed; - } - else - { - VipTypeVisibility = Visibility.Visible; - VipType = myInfo.Vip.Label.Text; - } - // 等级 - levelUri = new Uri($"pack://application:,,,/Resources/level/lv{myInfo.Level}.png"); - // 签名 - Sign = myInfo.Sign; - // 绑定邮箱&手机 - if (myInfo.EmailStatus == 0) - { BindingEmailVisibility = Visibility.Collapsed; } - if (myInfo.TelStatus == 0) - { BindingPhoneVisibility = Visibility.Collapsed; } - // 等级 - LevelText = $"{DictionaryResource.GetString("Level")}{myInfo.LevelExp.CurrentLevel}"; - if (myInfo.LevelExp.NextExp == -1) - { - CurrentExp = $"{myInfo.LevelExp.CurrentExp}/--"; - } - else - { - CurrentExp = $"{myInfo.LevelExp.CurrentExp}/{myInfo.LevelExp.NextExp}"; - } - // 经验 - MaxExp = myInfo.LevelExp.NextExp; - ExpProgress = myInfo.LevelExp.CurrentExp; - // 节操值 - StatusList[4].Subtitle = myInfo.Moral.ToString(); - // 封禁状态 - if (myInfo.Silence == 0) - { - StatusList[5].Subtitle = DictionaryResource.GetString("Normal"); - } - else if (myInfo.Silence == 1) - { - StatusList[5].Subtitle = DictionaryResource.GetString("Ban"); - } - } - else - { - // 没有数据 - isNoData = true; - } - - // 判断是否该结束线程 - if (cancellationToken.IsCancellationRequested) - { - isCancel = true; - } - }, (tokenSource = new CancellationTokenSource()).Token); - - // 是否该结束线程 - if (isCancel) - { - return; - } - - // 是否获取到数据 - if (isNoData) - { - TopNavigationBg = "#00FFFFFF"; // 透明 - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - Logout.Fill = DictionaryResource.GetColor("ColorTextDark"); - Background = null; - - ViewVisibility = Visibility.Collapsed; - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Visible; - return; - } - else - { - // 头像 - StorageHeader storageHeader = new StorageHeader(); - Header = storageHeader.GetHeaderThumbnail(headerUri, 64, 64); - // 性别 - Sex = sexUri == null ? null : new BitmapImage(sexUri); - // 等级 - Level = levelUri == null ? null : new BitmapImage(levelUri); - - ArrowBack.Fill = DictionaryResource.GetColor("ColorText"); - Logout.Fill = DictionaryResource.GetColor("ColorText"); - TopNavigationBg = DictionaryResource.GetColor("ColorMask100"); - Background = new BitmapImage(toutuUri); - - ViewVisibility = Visibility.Visible; - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - } - - await Task.Run(() => - { - // 导航栏信息 - UserInfoForNavigation navData = UserInfo.GetUserInfoForNavigation(); - if (navData != null) - { - ContentVisibility = Visibility.Visible; - - // 硬币 - Coin = navData.Money == 0 ? "0.0" : navData.Money.ToString("F1"); - // B币 - Money = navData.Wallet.BcoinBalance == 0 ? "0.0" : navData.Wallet.BcoinBalance.ToString("F1"); - } - - //用户的关系状态数 - UserRelationStat relationStat = UserStatus.GetUserRelationStat(mid); - if (relationStat != null) - { - // 关注数 - StatusList[0].Subtitle = relationStat.Following.ToString(); - // 悄悄关注数 - StatusList[1].Subtitle = relationStat.Whisper.ToString(); - // 粉丝数 - StatusList[2].Subtitle = relationStat.Follower.ToString(); - // 黑名单数 - StatusList[3].Subtitle = relationStat.Black.ToString(); - } - }); - - } - - /// - /// 接收mid参数 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - // 根据传入参数不同执行不同任务 - long parameter = navigationContext.Parameters.GetValue("Parameter"); - if (parameter == 0) - { - return; - } - mid = parameter; - - InitView(); - UpdateSpaceInfo(); - } - - } -} diff --git a/src/DownKyi/ViewModels/ViewMyToViewVideoViewModel.cs b/src/DownKyi/ViewModels/ViewMyToViewVideoViewModel.cs deleted file mode 100644 index 6b2e1d9..0000000 --- a/src/DownKyi/ViewModels/ViewMyToViewVideoViewModel.cs +++ /dev/null @@ -1,434 +0,0 @@ -using DownKyi.Core.BiliApi.History; -using DownKyi.Core.BiliApi.VideoStream; -using DownKyi.Core.Storage; -using DownKyi.CustomControl; -using DownKyi.Events; -using DownKyi.Images; -using DownKyi.Services; -using DownKyi.Services.Download; -using DownKyi.Utils; -using DownKyi.ViewModels.PageViewModels; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using Prism.Services.Dialogs; -using System; -using System.Collections; -using System.Collections.ObjectModel; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels -{ - public class ViewMyToViewVideoViewModel : BaseViewModel - { - public const string Tag = "PageMyToView"; - - private CancellationTokenSource tokenSource; - - #region 页面属性申明 - - private string pageName = Tag; - public string PageName - { - get => pageName; - set => SetProperty(ref pageName, value); - } - - private VectorImage arrowBack; - public VectorImage ArrowBack - { - get => arrowBack; - set => SetProperty(ref arrowBack, value); - } - - private VectorImage downloadManage; - public VectorImage DownloadManage - { - get => downloadManage; - set => SetProperty(ref downloadManage, value); - } - - private Visibility contentVisibility; - public Visibility ContentVisibility - { - get => contentVisibility; - set => SetProperty(ref contentVisibility, value); - } - - private ObservableCollection medias; - public ObservableCollection Medias - { - get => medias; - set => SetProperty(ref medias, value); - } - - private bool isSelectAll; - public bool IsSelectAll - { - get => isSelectAll; - set => SetProperty(ref isSelectAll, value); - } - - private GifImage loading; - public GifImage Loading - { - get => loading; - set => SetProperty(ref loading, value); - } - - private Visibility loadingVisibility; - public Visibility LoadingVisibility - { - get => loadingVisibility; - set => SetProperty(ref loadingVisibility, value); - } - - private Visibility noDataVisibility; - public Visibility NoDataVisibility - { - get => noDataVisibility; - set => SetProperty(ref noDataVisibility, value); - } - - #endregion - - public ViewMyToViewVideoViewModel(IEventAggregator eventAggregator, IDialogService dialogService) : base(eventAggregator) - { - this.dialogService = dialogService; - - #region 属性初始化 - - // 初始化loading gif - Loading = new GifImage(Properties.Resources.loading); - Loading.StartAnimate(); - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - - ArrowBack = NavigationIcon.Instance().ArrowBack; - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - // 下载管理按钮 - DownloadManage = ButtonIcon.Instance().DownloadManage; - DownloadManage.Height = 24; - DownloadManage.Width = 24; - DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary"); - - Medias = new ObservableCollection(); - - #endregion - - } - - #region 命令申明 - - // 返回事件 - private DelegateCommand backSpaceCommand; - public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace)); - - /// - /// 返回事件 - /// - private void ExecuteBackSpace() - { - InitView(); - - ArrowBack.Fill = DictionaryResource.GetColor("ColorText"); - - // 结束任务 - tokenSource?.Cancel(); - - NavigationParam parameter = new NavigationParam - { - ViewName = ParentView, - ParentViewName = null, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 前往下载管理页面 - private DelegateCommand downloadManagerCommand; - public DelegateCommand DownloadManagerCommand => downloadManagerCommand ?? (downloadManagerCommand = new DelegateCommand(ExecuteDownloadManagerCommand)); - - /// - /// 前往下载管理页面 - /// - private void ExecuteDownloadManagerCommand() - { - NavigationParam parameter = new NavigationParam - { - ViewName = ViewDownloadManagerViewModel.Tag, - ParentViewName = Tag, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 全选按钮点击事件 - private DelegateCommand selectAllCommand; - public DelegateCommand SelectAllCommand => selectAllCommand ?? (selectAllCommand = new DelegateCommand(ExecuteSelectAllCommand)); - - /// - /// 全选按钮点击事件 - /// - /// - private void ExecuteSelectAllCommand(object parameter) - { - if (IsSelectAll) - { - foreach (var item in Medias) - { - item.IsSelected = true; - } - } - else - { - foreach (var item in Medias) - { - item.IsSelected = false; - } - } - } - - // 列表选择事件 - private DelegateCommand mediasCommand; - public DelegateCommand MediasCommand => mediasCommand ?? (mediasCommand = new DelegateCommand(ExecuteMediasCommand)); - - /// - /// 列表选择事件 - /// - /// - private void ExecuteMediasCommand(object parameter) - { - if (!(parameter is IList selectedMedia)) { return; } - - if (selectedMedia.Count == Medias.Count) - { - IsSelectAll = true; - } - else - { - IsSelectAll = false; - } - } - - // 添加选中项到下载列表事件 - private DelegateCommand addToDownloadCommand; - public DelegateCommand AddToDownloadCommand => addToDownloadCommand ?? (addToDownloadCommand = new DelegateCommand(ExecuteAddToDownloadCommand)); - - /// - /// 添加选中项到下载列表事件 - /// - private void ExecuteAddToDownloadCommand() - { - AddToDownload(true); - } - - // 添加所有视频到下载列表事件 - private DelegateCommand addAllToDownloadCommand; - public DelegateCommand AddAllToDownloadCommand => addAllToDownloadCommand ?? (addAllToDownloadCommand = new DelegateCommand(ExecuteAddAllToDownloadCommand)); - - /// - /// 添加所有视频到下载列表事件 - /// - private void ExecuteAddAllToDownloadCommand() - { - AddToDownload(false); - } - - #endregion - - /// - /// 添加到下载 - /// - /// - private async void AddToDownload(bool isOnlySelected) - { - // 稍后再看里只有视频 - AddToDownloadService addToDownloadService = new AddToDownloadService(PlayStreamType.VIDEO); - - // 选择文件夹 - string directory = addToDownloadService.SetDirectory(dialogService); - - // 视频计数 - int i = 0; - await Task.Run(() => - { - // 为了避免执行其他操作时, - // Medias变化导致的异常 - var list = Medias.ToList(); - - // 添加到下载 - foreach (var media in list) - { - // 只下载选中项,跳过未选中项 - if (isOnlySelected && !media.IsSelected) { continue; } - - /// 有分P的就下载全部 - - // 开启服务 - VideoInfoService videoInfoService = new VideoInfoService(media.Bvid); - - addToDownloadService.SetVideoInfoService(videoInfoService); - addToDownloadService.GetVideo(); - addToDownloadService.ParseVideo(videoInfoService); - // 下载 - i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory); - } - }); - - if (directory == null) - { - return; - } - - // 通知用户添加到下载列表的结果 - if (i <= 0) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipAddDownloadingZero")); - } - else - { - eventAggregator.GetEvent().Publish($"{DictionaryResource.GetString("TipAddDownloadingFinished1")}{i}{DictionaryResource.GetString("TipAddDownloadingFinished2")}"); - } - } - - private async void UpdateToViewMediaList() - { - LoadingVisibility = Visibility.Visible; - NoDataVisibility = Visibility.Collapsed; - Medias.Clear(); - - await Task.Run(() => - { - CancellationToken cancellationToken = tokenSource.Token; - - var toViewList = ToView.GetToView(); - if (toViewList == null || toViewList.Count == 0) - { - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Visible; - return; - } - - foreach (var toView in toViewList) - { - - // 查询、保存封面 - string coverUrl = toView.Pic; - BitmapImage cover; - if (coverUrl == null || coverUrl == "") - { - cover = null; - } - else - { - if (!coverUrl.ToLower().StartsWith("http")) - { - coverUrl = $"https:{toView.Pic}"; - } - - StorageCover storageCover = new StorageCover(); - cover = storageCover.GetCoverThumbnail(toView.Aid, toView.Bvid, toView.Cid, coverUrl, 160, 100); - } - - // 获取用户头像 - long upMid = -1; - string upName; - BitmapImage upHeader; - if (toView.Owner != null && toView.Owner.Face != null) - { - upMid = toView.Owner.Mid; - upName = toView.Owner.Name; - StorageHeader storageHeader = new StorageHeader(); - upHeader = storageHeader.GetHeaderThumbnail(toView.Owner.Mid, upName, toView.Owner.Face, 24, 24); - } - else - { - upName = ""; - upHeader = null; - } - - App.PropertyChangeAsync(() => - { - ToViewMedia media = new ToViewMedia(eventAggregator) - { - Aid = toView.Aid, - Bvid = toView.Bvid, - UpMid = upMid, - Cover = cover ?? new BitmapImage(new Uri($"pack://application:,,,/Resources/video-placeholder.png")), - Title = toView.Title, - UpName = upName, - UpHeader = upHeader - }; - - Medias.Add(media); - - ContentVisibility = Visibility.Visible; - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - }); - - // 判断是否该结束线程,若为true,跳出循环 - if (cancellationToken.IsCancellationRequested) - { - break; - } - } - }, (tokenSource = new CancellationTokenSource()).Token); - } - - /// - /// 初始化页面数据 - /// - private void InitView() - { - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - ContentVisibility = Visibility.Collapsed; - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - - Medias.Clear(); - IsSelectAll = false; - } - - /// - /// 导航到页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - DownloadManage = ButtonIcon.Instance().DownloadManage; - DownloadManage.Height = 24; - DownloadManage.Width = 24; - DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary"); - - // 根据传入参数不同执行不同任务 - long mid = navigationContext.Parameters.GetValue("Parameter"); - if (mid == 0) - { - IsSelectAll = false; - foreach (var media in Medias) - { - media.IsSelected = false; - } - - return; - } - - InitView(); - - UpdateToViewMediaList(); - } - - } -} diff --git a/src/DownKyi/ViewModels/ViewPublicFavoritesViewModel.cs b/src/DownKyi/ViewModels/ViewPublicFavoritesViewModel.cs deleted file mode 100644 index e45c945..0000000 --- a/src/DownKyi/ViewModels/ViewPublicFavoritesViewModel.cs +++ /dev/null @@ -1,411 +0,0 @@ -using DownKyi.Core.BiliApi.Favorites; -using DownKyi.Core.BiliApi.VideoStream; -using DownKyi.Core.Logging; -using DownKyi.CustomControl; -using DownKyi.Events; -using DownKyi.Images; -using DownKyi.Services; -using DownKyi.Services.Download; -using DownKyi.Utils; -using DownKyi.ViewModels.PageViewModels; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using Prism.Services.Dialogs; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; - -namespace DownKyi.ViewModels -{ - public class ViewPublicFavoritesViewModel : BaseViewModel - { - public const string Tag = "PagePublicFavorites"; - - private CancellationTokenSource tokenSource; - - #region 页面属性申明 - - private string pageName = Tag; - public string PageName - { - get => pageName; - set => SetProperty(ref pageName, value); - } - - private VectorImage arrowBack; - public VectorImage ArrowBack - { - get => arrowBack; - set => SetProperty(ref arrowBack, value); - } - - private VectorImage downloadManage; - public VectorImage DownloadManage - { - get => downloadManage; - set => SetProperty(ref downloadManage, value); - } - - private Favorites favorites; - public Favorites Favorites - { - get => favorites; - set => SetProperty(ref favorites, value); - } - - private ObservableCollection favoritesMedias; - public ObservableCollection FavoritesMedias - { - get => favoritesMedias; - set => SetProperty(ref favoritesMedias, value); - } - - private Visibility contentVisibility; - public Visibility ContentVisibility - { - get => contentVisibility; - set => SetProperty(ref contentVisibility, value); - } - - - private GifImage loading; - public GifImage Loading - { - get => loading; - set => SetProperty(ref loading, value); - } - - private Visibility loadingVisibility; - public Visibility LoadingVisibility - { - get => loadingVisibility; - set => SetProperty(ref loadingVisibility, value); - } - - private Visibility noDataVisibility; - public Visibility NoDataVisibility - { - get => noDataVisibility; - set => SetProperty(ref noDataVisibility, value); - } - - private GifImage mediaLoading; - public GifImage MediaLoading - { - get => mediaLoading; - set => SetProperty(ref mediaLoading, value); - } - - private Visibility mediaLoadingVisibility; - public Visibility MediaLoadingVisibility - { - get => mediaLoadingVisibility; - set => SetProperty(ref mediaLoadingVisibility, value); - } - - private Visibility mediaNoDataVisibility; - public Visibility MediaNoDataVisibility - { - get => mediaNoDataVisibility; - set => SetProperty(ref mediaNoDataVisibility, value); - } - - #endregion - - public ViewPublicFavoritesViewModel(IEventAggregator eventAggregator, IDialogService dialogService) : base(eventAggregator) - { - this.dialogService = dialogService; - - #region 属性初始化 - - // 初始化loading gif - Loading = new GifImage(Properties.Resources.loading); - Loading.StartAnimate(); - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - - MediaLoading = new GifImage(Properties.Resources.loading); - MediaLoading.StartAnimate(); - MediaLoadingVisibility = Visibility.Collapsed; - MediaNoDataVisibility = Visibility.Collapsed; - - ArrowBack = NavigationIcon.Instance().ArrowBack; - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - // 下载管理按钮 - DownloadManage = ButtonIcon.Instance().DownloadManage; - DownloadManage.Height = 24; - DownloadManage.Width = 24; - DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary"); - - FavoritesMedias = new ObservableCollection(); - - #endregion - } - - #region 命令申明 - - // 返回 - private DelegateCommand backSpaceCommand; - public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace)); - - /// - /// 返回 - /// - private void ExecuteBackSpace() - { - // 结束任务 - tokenSource?.Cancel(); - - NavigationParam parameter = new NavigationParam - { - ViewName = ParentView, - ParentViewName = null, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 前往下载管理页面 - private DelegateCommand downloadManagerCommand; - public DelegateCommand DownloadManagerCommand => downloadManagerCommand ?? (downloadManagerCommand = new DelegateCommand(ExecuteDownloadManagerCommand)); - - /// - /// 前往下载管理页面 - /// - private void ExecuteDownloadManagerCommand() - { - NavigationParam parameter = new NavigationParam - { - ViewName = ViewDownloadManagerViewModel.Tag, - ParentViewName = Tag, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 复制封面事件 - private DelegateCommand copyCoverCommand; - public DelegateCommand CopyCoverCommand => copyCoverCommand ?? (copyCoverCommand = new DelegateCommand(ExecuteCopyCoverCommand)); - - /// - /// 复制封面事件 - /// - private void ExecuteCopyCoverCommand() - { - // 复制封面图片到剪贴板 - Clipboard.SetImage(Favorites.Cover); - LogManager.Info(Tag, "复制封面图片到剪贴板"); - } - - // 复制封面URL事件 - private DelegateCommand copyCoverUrlCommand; - public DelegateCommand CopyCoverUrlCommand => copyCoverUrlCommand ?? (copyCoverUrlCommand = new DelegateCommand(ExecuteCopyCoverUrlCommand)); - - /// - /// 复制封面URL事件 - /// - private void ExecuteCopyCoverUrlCommand() - { - // 复制封面url到剪贴板 - Clipboard.SetText(Favorites.CoverUrl); - LogManager.Info(Tag, "复制封面url到剪贴板"); - } - - // 前往UP主页事件 - private DelegateCommand upperCommand; - public DelegateCommand UpperCommand => upperCommand ?? (upperCommand = new DelegateCommand(ExecuteUpperCommand)); - - /// - /// 前往UP主页事件 - /// - private void ExecuteUpperCommand() - { - NavigateToView.NavigateToViewUserSpace(eventAggregator, Tag, Favorites.UpperMid); - } - - // 添加选中项到下载列表事件 - private DelegateCommand addToDownloadCommand; - public DelegateCommand AddToDownloadCommand => addToDownloadCommand ?? (addToDownloadCommand = new DelegateCommand(ExecuteAddToDownloadCommand)); - - /// - /// 添加选中项到下载列表事件 - /// - private void ExecuteAddToDownloadCommand() - { - AddToDownload(true); - } - - // 添加所有视频到下载列表事件 - private DelegateCommand addAllToDownloadCommand; - public DelegateCommand AddAllToDownloadCommand => addAllToDownloadCommand ?? (addAllToDownloadCommand = new DelegateCommand(ExecuteAddAllToDownloadCommand)); - - /// - /// 添加所有视频到下载列表事件 - /// - private void ExecuteAddAllToDownloadCommand() - { - AddToDownload(false); - } - - // 列表选择事件 - private DelegateCommand favoritesMediasCommand; - public DelegateCommand FavoritesMediasCommand => favoritesMediasCommand ?? (favoritesMediasCommand = new DelegateCommand(ExecuteFavoritesMediasCommand)); - - /// - /// 列表选择事件 - /// - /// - private void ExecuteFavoritesMediasCommand(object parameter) - { - } - - #endregion - - private async void AddToDownload(bool isOnlySelected) - { - // 收藏夹里只有视频 - AddToDownloadService addToDownloadService = new AddToDownloadService(PlayStreamType.VIDEO); - - // 选择文件夹 - string directory = addToDownloadService.SetDirectory(dialogService); - - // 视频计数 - int i = 0; - await Task.Run(() => - { - // 为了避免执行其他操作时, - // Medias变化导致的异常 - var list = FavoritesMedias.ToList(); - - // 添加到下载 - foreach (var media in list) - { - // 只下载选中项,跳过未选中项 - if (isOnlySelected && !media.IsSelected) { continue; } - - /// 有分P的就下载全部 - - // 开启服务 - VideoInfoService videoInfoService = new VideoInfoService(media.Bvid); - - addToDownloadService.SetVideoInfoService(videoInfoService); - addToDownloadService.GetVideo(); - addToDownloadService.ParseVideo(videoInfoService); - // 下载 - i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory); - } - }); - - if (directory == null) - { - return; - } - - // 通知用户添加到下载列表的结果 - if (i <= 0) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipAddDownloadingZero")); - } - else - { - eventAggregator.GetEvent().Publish($"{DictionaryResource.GetString("TipAddDownloadingFinished1")}{i}{DictionaryResource.GetString("TipAddDownloadingFinished2")}"); - } - } - - /// - /// 初始化页面元素 - /// - private void InitView() - { - LogManager.Debug(Tag, "初始化页面元素"); - - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - DownloadManage = ButtonIcon.Instance().DownloadManage; - DownloadManage.Height = 24; - DownloadManage.Width = 24; - DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary"); - - ContentVisibility = Visibility.Collapsed; - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - MediaLoadingVisibility = Visibility.Collapsed; - MediaNoDataVisibility = Visibility.Collapsed; - - FavoritesMedias.Clear(); - } - - /// - /// 更新页面 - /// - private void UpdateView(IFavoritesService favoritesService, long favoritesId, CancellationToken cancellationToken) - { - LoadingVisibility = Visibility.Visible; - - Favorites = favoritesService.GetFavorites(favoritesId); - if (Favorites == null) - { - LogManager.Debug(Tag, "Favorites is null."); - - ContentVisibility = Visibility.Collapsed; - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Visible; - return; - } - else - { - ContentVisibility = Visibility.Visible; - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - } - - MediaLoadingVisibility = Visibility.Visible; - - List medias = FavoritesResource.GetAllFavoritesMedia(favoritesId); - if (medias == null || medias.Count == 0) - { - MediaLoadingVisibility = Visibility.Collapsed; - MediaNoDataVisibility = Visibility.Visible; - return; - } - else - { - MediaLoadingVisibility = Visibility.Collapsed; - MediaNoDataVisibility = Visibility.Collapsed; - } - - favoritesService.GetFavoritesMediaList(medias, FavoritesMedias, eventAggregator, cancellationToken); - } - - /// - /// 接收收藏夹id参数 - /// - /// - public override async void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - // 根据传入参数不同执行不同任务 - long parameter = navigationContext.Parameters.GetValue("Parameter"); - if (parameter == 0) - { - return; - } - - InitView(); - await Task.Run(new Action(() => - { - CancellationToken cancellationToken = tokenSource.Token; - - UpdateView(new FavoritesService(), parameter, cancellationToken); - }), (tokenSource = new CancellationTokenSource()).Token); - - } - } -} diff --git a/src/DownKyi/ViewModels/ViewPublicationViewModel.cs b/src/DownKyi/ViewModels/ViewPublicationViewModel.cs deleted file mode 100644 index 9067cdc..0000000 --- a/src/DownKyi/ViewModels/ViewPublicationViewModel.cs +++ /dev/null @@ -1,530 +0,0 @@ -using DownKyi.Core.BiliApi.VideoStream; -using DownKyi.Core.Storage; -using DownKyi.Core.Utils; -using DownKyi.CustomControl; -using DownKyi.Events; -using DownKyi.Images; -using DownKyi.Services; -using DownKyi.Services.Download; -using DownKyi.Utils; -using DownKyi.ViewModels.PageViewModels; -using DownKyi.ViewModels.UserSpace; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using Prism.Services.Dialogs; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels -{ - public class ViewPublicationViewModel : BaseViewModel - { - public const string Tag = "PagePublication"; - - private CancellationTokenSource tokenSource; - - private long mid = -1; - - // 每页视频数量,暂时在此写死,以后在设置中增加选项 - private readonly int VideoNumberInPage = 30; - - #region 页面属性申明 - - private string pageName = Tag; - public string PageName - { - get => pageName; - set => SetProperty(ref pageName, value); - } - - private GifImage loading; - public GifImage Loading - { - get => loading; - set => SetProperty(ref loading, value); - } - - private Visibility loadingVisibility; - public Visibility LoadingVisibility - { - get => loadingVisibility; - set => SetProperty(ref loadingVisibility, value); - } - - private Visibility noDataVisibility; - public Visibility NoDataVisibility - { - get => noDataVisibility; - set => SetProperty(ref noDataVisibility, value); - } - - private VectorImage arrowBack; - public VectorImage ArrowBack - { - get => arrowBack; - set => SetProperty(ref arrowBack, value); - } - - private VectorImage downloadManage; - public VectorImage DownloadManage - { - get => downloadManage; - set => SetProperty(ref downloadManage, value); - } - - private ObservableCollection tabHeaders; - public ObservableCollection TabHeaders - { - get => tabHeaders; - set => SetProperty(ref tabHeaders, value); - } - - private int selectTabId; - public int SelectTabId - { - get => selectTabId; - set => SetProperty(ref selectTabId, value); - } - - private bool isEnabled = true; - public bool IsEnabled - { - get => isEnabled; - set => SetProperty(ref isEnabled, value); - } - - private CustomPagerViewModel pager; - public CustomPagerViewModel Pager - { - get => pager; - set => SetProperty(ref pager, value); - } - - private ObservableCollection medias; - public ObservableCollection Medias - { - get => medias; - set => SetProperty(ref medias, value); - } - - private bool isSelectAll; - public bool IsSelectAll - { - get => isSelectAll; - set => SetProperty(ref isSelectAll, value); - } - - #endregion - - public ViewPublicationViewModel(IEventAggregator eventAggregator, IDialogService dialogService) : base(eventAggregator) - { - this.dialogService = dialogService; - - #region 属性初始化 - - // 初始化loading gif - Loading = new GifImage(Properties.Resources.loading); - Loading.StartAnimate(); - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - - ArrowBack = NavigationIcon.Instance().ArrowBack; - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - // 下载管理按钮 - DownloadManage = ButtonIcon.Instance().DownloadManage; - DownloadManage.Height = 24; - DownloadManage.Width = 24; - DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary"); - - TabHeaders = new ObservableCollection(); - Medias = new ObservableCollection(); - - #endregion - } - - #region 命令申明 - - // 返回事件 - private DelegateCommand backSpaceCommand; - public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace)); - - /// - /// 返回事件 - /// - private void ExecuteBackSpace() - { - ArrowBack.Fill = DictionaryResource.GetColor("ColorText"); - - // 结束任务 - tokenSource?.Cancel(); - - NavigationParam parameter = new NavigationParam - { - ViewName = ParentView, - ParentViewName = null, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 前往下载管理页面 - private DelegateCommand downloadManagerCommand; - public DelegateCommand DownloadManagerCommand => downloadManagerCommand ?? (downloadManagerCommand = new DelegateCommand(ExecuteDownloadManagerCommand)); - - /// - /// 前往下载管理页面 - /// - private void ExecuteDownloadManagerCommand() - { - NavigationParam parameter = new NavigationParam - { - ViewName = ViewDownloadManagerViewModel.Tag, - ParentViewName = Tag, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 左侧tab点击事件 - private DelegateCommand leftTabHeadersCommand; - public DelegateCommand LeftTabHeadersCommand => leftTabHeadersCommand ?? (leftTabHeadersCommand = new DelegateCommand(ExecuteLeftTabHeadersCommand, CanExecuteLeftTabHeadersCommand)); - - /// - /// 左侧tab点击事件 - /// - /// - private void ExecuteLeftTabHeadersCommand(object parameter) - { - if (!(parameter is TabHeader tabHeader)) { return; } - - // 页面选择 - Pager = new CustomPagerViewModel(1, (int)Math.Ceiling(double.Parse(tabHeader.SubTitle) / VideoNumberInPage)); - Pager.CurrentChanged += OnCurrentChanged_Pager; - Pager.CountChanged += OnCountChanged_Pager; - Pager.Current = 1; - } - - /// - /// 左侧tab点击事件是否允许执行 - /// - /// - /// - private bool CanExecuteLeftTabHeadersCommand(object parameter) - { - return IsEnabled; - } - - // 全选按钮点击事件 - private DelegateCommand selectAllCommand; - public DelegateCommand SelectAllCommand => selectAllCommand ?? (selectAllCommand = new DelegateCommand(ExecuteSelectAllCommand)); - - /// - /// 全选按钮点击事件 - /// - /// - private void ExecuteSelectAllCommand(object parameter) - { - if (IsSelectAll) - { - foreach (var item in Medias) - { - item.IsSelected = true; - } - } - else - { - foreach (var item in Medias) - { - item.IsSelected = false; - } - } - } - - // 列表选择事件 - private DelegateCommand mediasCommand; - public DelegateCommand MediasCommand => mediasCommand ?? (mediasCommand = new DelegateCommand(ExecuteMediasCommand)); - - /// - /// 列表选择事件 - /// - /// - private void ExecuteMediasCommand(object parameter) - { - if (!(parameter is IList selectedMedia)) { return; } - - if (selectedMedia.Count == Medias.Count) - { - IsSelectAll = true; - } - else - { - IsSelectAll = false; - } - } - - // 添加选中项到下载列表事件 - private DelegateCommand addToDownloadCommand; - public DelegateCommand AddToDownloadCommand => addToDownloadCommand ?? (addToDownloadCommand = new DelegateCommand(ExecuteAddToDownloadCommand)); - - /// - /// 添加选中项到下载列表事件 - /// - private void ExecuteAddToDownloadCommand() - { - AddToDownload(true); - } - - // 添加所有视频到下载列表事件 - private DelegateCommand addAllToDownloadCommand; - public DelegateCommand AddAllToDownloadCommand => addAllToDownloadCommand ?? (addAllToDownloadCommand = new DelegateCommand(ExecuteAddAllToDownloadCommand)); - - /// - /// 添加所有视频到下载列表事件 - /// - private void ExecuteAddAllToDownloadCommand() - { - AddToDownload(false); - } - - #endregion - - /// - /// 添加到下载 - /// - /// - private async void AddToDownload(bool isOnlySelected) - { - // 收藏夹里只有视频 - AddToDownloadService addToDownloadService = new AddToDownloadService(PlayStreamType.VIDEO); - - // 选择文件夹 - string directory = addToDownloadService.SetDirectory(dialogService); - - // 视频计数 - int i = 0; - await Task.Run(() => - { - // 为了避免执行其他操作时, - // Medias变化导致的异常 - var list = Medias.ToList(); - - // 添加到下载 - foreach (var media in list) - { - // 只下载选中项,跳过未选中项 - if (isOnlySelected && !media.IsSelected) { continue; } - - /// 有分P的就下载全部 - - // 开启服务 - VideoInfoService videoInfoService = new VideoInfoService(media.Bvid); - - addToDownloadService.SetVideoInfoService(videoInfoService); - addToDownloadService.GetVideo(); - addToDownloadService.ParseVideo(videoInfoService); - // 下载 - i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory); - } - }); - - if (directory == null) - { - return; - } - - // 通知用户添加到下载列表的结果 - if (i <= 0) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipAddDownloadingZero")); - } - else - { - eventAggregator.GetEvent().Publish($"{DictionaryResource.GetString("TipAddDownloadingFinished1")}{i}{DictionaryResource.GetString("TipAddDownloadingFinished2")}"); - } - } - - private void OnCountChanged_Pager(int count) { } - - private bool OnCurrentChanged_Pager(int old, int current) - { - if (!IsEnabled) - { - //Pager.Current = old; - return false; - } - - Medias.Clear(); - IsSelectAll = false; - LoadingVisibility = Visibility.Visible; - NoDataVisibility = Visibility.Collapsed; - - UpdatePublication(current); - - return true; - } - - private async void UpdatePublication(int current) - { - // 是否正在获取数据 - // 在所有的退出分支中都需要设为true - IsEnabled = false; - - var tab = TabHeaders[SelectTabId]; - - await Task.Run(() => - { - CancellationToken cancellationToken = tokenSource.Token; - - var publications = Core.BiliApi.Users.UserSpace.GetPublication(mid, current, VideoNumberInPage, tab.Id); - if (publications == null) - { - // 没有数据,UI提示 - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Visible; - return; - } - - var videos = publications.Vlist; - if (videos == null) - { - // 没有数据,UI提示 - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Visible; - return; - } - - foreach (var video in videos) - { - // 查询、保存封面 - string coverUrl = video.Pic; - BitmapImage cover; - if (coverUrl == null || coverUrl == "") - { - cover = null; // new BitmapImage(new Uri($"pack://application:,,,/Resources/video-placeholder.png")); - } - else - { - if (!coverUrl.ToLower().StartsWith("http")) - { - coverUrl = $"https:{video.Pic}"; - } - - StorageCover storageCover = new StorageCover(); - cover = storageCover.GetCoverThumbnail(video.Aid, video.Bvid, -1, coverUrl, 200, 125); - } - - // 播放数 - string play = string.Empty; - if (video.Play > 0) - { - play = Format.FormatNumber(video.Play); - } - else - { - play = "--"; - } - - DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 - DateTime dateCTime = startTime.AddSeconds(video.Created); - string ctime = dateCTime.ToString("yyyy-MM-dd"); - - App.PropertyChangeAsync(new Action(() => - { - PublicationMedia media = new PublicationMedia(eventAggregator) - { - Avid = video.Aid, - Bvid = video.Bvid, - Cover = cover ?? new BitmapImage(new Uri($"pack://application:,,,/Resources/video-placeholder.png")), - Duration = video.Length, - Title = video.Title, - PlayNumber = play, - CreateTime = ctime - }; - medias.Add(media); - - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - })); - - // 判断是否该结束线程,若为true,跳出循环 - if (cancellationToken.IsCancellationRequested) - { - break; - } - } - - }, (tokenSource = new CancellationTokenSource()).Token); - IsEnabled = true; - } - - /// - /// 初始化页面数据 - /// - private void InitView() - { - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - DownloadManage = ButtonIcon.Instance().DownloadManage; - DownloadManage.Height = 24; - DownloadManage.Width = 24; - DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary"); - - TabHeaders.Clear(); - Medias.Clear(); - SelectTabId = -1; - IsSelectAll = false; - } - - /// - /// 导航到页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - // 根据传入参数不同执行不同任务 - var parameter = navigationContext.Parameters.GetValue>("Parameter"); - if (parameter == null) - { - return; - } - - InitView(); - - mid = (long)parameter["mid"]; - int tid = (int)parameter["tid"]; - List zones = (List)parameter["list"]; - - foreach (var item in zones) - { - TabHeaders.Add(new TabHeader - { - Id = item.Tid, - Title = item.Name, - SubTitle = item.Count.ToString() - }); - } - - // 初始选中项 - var selectTab = TabHeaders.FirstOrDefault(item => item.Id == tid); - SelectTabId = TabHeaders.IndexOf(selectTab); - - // 页面选择 - Pager = new CustomPagerViewModel(1, (int)Math.Ceiling(double.Parse(selectTab.SubTitle) / VideoNumberInPage)); - Pager.CurrentChanged += OnCurrentChanged_Pager; - Pager.CountChanged += OnCountChanged_Pager; - Pager.Current = 1; - } - - } -} diff --git a/src/DownKyi/ViewModels/ViewSeasonsSeriesViewModel.cs b/src/DownKyi/ViewModels/ViewSeasonsSeriesViewModel.cs deleted file mode 100644 index d5e6dbe..0000000 --- a/src/DownKyi/ViewModels/ViewSeasonsSeriesViewModel.cs +++ /dev/null @@ -1,670 +0,0 @@ -using DownKyi.Core.BiliApi.VideoStream; -using DownKyi.Core.Storage; -using DownKyi.Core.Utils; -using DownKyi.CustomControl; -using DownKyi.Events; -using DownKyi.Images; -using DownKyi.Services; -using DownKyi.Services.Download; -using DownKyi.Utils; -using DownKyi.ViewModels.PageViewModels; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using Prism.Services.Dialogs; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels -{ - public class ViewSeasonsSeriesViewModel : BaseViewModel - { - public const string Tag = "PageSeasonsSeries"; - - private CancellationTokenSource tokenSource; - - private long mid = -1; - private long id = -1; - private int type = 0; - - // 每页视频数量,暂时在此写死,以后在设置中增加选项 - private readonly int VideoNumberInPage = 30; - - #region 页面属性申明 - - private string pageName = Tag; - public string PageName - { - get => pageName; - set => SetProperty(ref pageName, value); - } - - private GifImage loading; - public GifImage Loading - { - get => loading; - set => SetProperty(ref loading, value); - } - - private Visibility loadingVisibility; - public Visibility LoadingVisibility - { - get => loadingVisibility; - set => SetProperty(ref loadingVisibility, value); - } - - private Visibility noDataVisibility; - public Visibility NoDataVisibility - { - get => noDataVisibility; - set => SetProperty(ref noDataVisibility, value); - } - - private VectorImage arrowBack; - public VectorImage ArrowBack - { - get => arrowBack; - set => SetProperty(ref arrowBack, value); - } - - private VectorImage downloadManage; - public VectorImage DownloadManage - { - get => downloadManage; - set => SetProperty(ref downloadManage, value); - } - - private string title; - public string Title - { - get => title; - set => SetProperty(ref title, value); - } - - private bool isEnabled = true; - public bool IsEnabled - { - get => isEnabled; - set => SetProperty(ref isEnabled, value); - } - - private CustomPagerViewModel pager; - public CustomPagerViewModel Pager - { - get => pager; - set => SetProperty(ref pager, value); - } - - private ObservableCollection medias; - public ObservableCollection Medias - { - get => medias; - set => SetProperty(ref medias, value); - } - - private bool isSelectAll; - public bool IsSelectAll - { - get => isSelectAll; - set => SetProperty(ref isSelectAll, value); - } - - #endregion - - public ViewSeasonsSeriesViewModel(IEventAggregator eventAggregator, IDialogService dialogService) : base(eventAggregator) - { - this.dialogService = dialogService; - - #region 属性初始化 - - // 初始化loading gif - Loading = new GifImage(Properties.Resources.loading); - Loading.StartAnimate(); - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - - ArrowBack = NavigationIcon.Instance().ArrowBack; - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - // 下载管理按钮 - DownloadManage = ButtonIcon.Instance().DownloadManage; - DownloadManage.Height = 24; - DownloadManage.Width = 24; - DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary"); - - Medias = new ObservableCollection(); - - #endregion - } - - #region 命令申明 - - // 返回事件 - private DelegateCommand backSpaceCommand; - public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace)); - - /// - /// 返回事件 - /// - private void ExecuteBackSpace() - { - ArrowBack.Fill = DictionaryResource.GetColor("ColorText"); - - // 结束任务 - tokenSource?.Cancel(); - - NavigationParam parameter = new NavigationParam - { - ViewName = ParentView, - ParentViewName = null, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 前往下载管理页面 - private DelegateCommand downloadManagerCommand; - public DelegateCommand DownloadManagerCommand => downloadManagerCommand ?? (downloadManagerCommand = new DelegateCommand(ExecuteDownloadManagerCommand)); - - /// - /// 前往下载管理页面 - /// - private void ExecuteDownloadManagerCommand() - { - NavigationParam parameter = new NavigationParam - { - ViewName = ViewDownloadManagerViewModel.Tag, - ParentViewName = Tag, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 全选按钮点击事件 - private DelegateCommand selectAllCommand; - public DelegateCommand SelectAllCommand => selectAllCommand ?? (selectAllCommand = new DelegateCommand(ExecuteSelectAllCommand)); - - /// - /// 全选按钮点击事件 - /// - /// - private void ExecuteSelectAllCommand(object parameter) - { - if (IsSelectAll) - { - foreach (var item in Medias) - { - item.IsSelected = true; - } - } - else - { - foreach (var item in Medias) - { - item.IsSelected = false; - } - } - } - - // 列表选择事件 - private DelegateCommand mediasCommand; - public DelegateCommand MediasCommand => mediasCommand ?? (mediasCommand = new DelegateCommand(ExecuteMediasCommand)); - - /// - /// 列表选择事件 - /// - /// - private void ExecuteMediasCommand(object parameter) - { - if (!(parameter is IList selectedMedia)) { return; } - - if (selectedMedia.Count == Medias.Count) - { - IsSelectAll = true; - } - else - { - IsSelectAll = false; - } - } - - // 添加选中项到下载列表事件 - private DelegateCommand addToDownloadCommand; - public DelegateCommand AddToDownloadCommand => addToDownloadCommand ?? (addToDownloadCommand = new DelegateCommand(ExecuteAddToDownloadCommand)); - - /// - /// 添加选中项到下载列表事件 - /// - private void ExecuteAddToDownloadCommand() - { - AddToDownload(true); - } - - // 添加所有视频到下载列表事件 - private DelegateCommand addAllToDownloadCommand; - public DelegateCommand AddAllToDownloadCommand => addAllToDownloadCommand ?? (addAllToDownloadCommand = new DelegateCommand(ExecuteAddAllToDownloadCommand)); - - /// - /// 添加所有视频到下载列表事件 - /// - private void ExecuteAddAllToDownloadCommand() - { - AddToDownload(false); - } - - #endregion - - /// - /// 添加到下载 - /// - /// - private async void AddToDownload(bool isOnlySelected) - { - // 频道里只有视频 - AddToDownloadService addToDownloadService = new AddToDownloadService(PlayStreamType.VIDEO); - - // 选择文件夹 - string directory = addToDownloadService.SetDirectory(dialogService); - - // 视频计数 - int i = 0; - await Task.Run(() => - { - // 为了避免执行其他操作时, - // Medias变化导致的异常 - var list = Medias.ToList(); - - // 添加到下载 - foreach (var media in list) - { - // 只下载选中项,跳过未选中项 - if (isOnlySelected && !media.IsSelected) { continue; } - - /// 有分P的就下载全部 - - // 开启服务 - VideoInfoService videoInfoService = new VideoInfoService(media.Bvid); - - addToDownloadService.SetVideoInfoService(videoInfoService); - addToDownloadService.GetVideo(); - addToDownloadService.ParseVideo(videoInfoService); - // 下载 - i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory); - } - }); - - if (directory == null) - { - return; - } - - // 通知用户添加到下载列表的结果 - if (i <= 0) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipAddDownloadingZero")); - } - else - { - eventAggregator.GetEvent().Publish($"{DictionaryResource.GetString("TipAddDownloadingFinished1")}{i}{DictionaryResource.GetString("TipAddDownloadingFinished2")}"); - } - } - - private void OnCountChanged_Pager(int count) { } - - private bool OnCurrentChanged_Pager(int old, int current) - { - if (!IsEnabled) - { - //Pager.Current = old; - return false; - } - - Medias.Clear(); - IsSelectAll = false; - LoadingVisibility = Visibility.Visible; - NoDataVisibility = Visibility.Collapsed; - - //UpdateChannel(current); - - if (type == 1) { UpdateSeasons(current); } - if (type == 2) { UpdateSeries(current); } - - return true; - } - - //private async void UpdateChannel(int current) - //{ - // // 是否正在获取数据 - // // 在所有的退出分支中都需要设为true - // IsEnabled = false; - - // await Task.Run(() => - // { - // CancellationToken cancellationToken = tokenSource.Token; - - // var channels = Core.BiliApi.Users.UserSpace.GetChannelVideoList(mid, cid, current, VideoNumberInPage); - // if (channels == null || channels.Count == 0) - // { - // // 没有数据,UI提示 - // LoadingVisibility = Visibility.Collapsed; - // NoDataVisibility = Visibility.Visible; - // return; - // } - - // foreach (var video in channels) - // { - // if (video.Cid == 0) - // { - // continue; - // } - - // // 查询、保存封面 - // string coverUrl = video.Pic; - // BitmapImage cover; - // if (coverUrl == null || coverUrl == "") - // { - // cover = null; // new BitmapImage(new Uri($"pack://application:,,,/Resources/video-placeholder.png")); - // } - // else - // { - // if (!coverUrl.ToLower().StartsWith("http")) - // { - // coverUrl = $"https:{video.Pic}"; - // } - - // StorageCover storageCover = new StorageCover(); - // cover = storageCover.GetCoverThumbnail(video.Aid, video.Bvid, -1, coverUrl, 200, 125); - // } - - // // 播放数 - // string play = string.Empty; - // if (video.Stat != null) - // { - // if (video.Stat.View > 0) - // { - // play = Format.FormatNumber(video.Stat.View); - // } - // else - // { - // play = "--"; - // } - // } - // else - // { - // play = "--"; - // } - - // DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 - // DateTime dateCTime = startTime.AddSeconds(video.Ctime); - // string ctime = dateCTime.ToString("yyyy-MM-dd"); - - // App.PropertyChangeAsync(new Action(() => - // { - // ChannelMedia media = new ChannelMedia(eventAggregator) - // { - // Avid = video.Aid, - // Bvid = video.Bvid, - // Cover = cover ?? new BitmapImage(new Uri($"pack://application:,,,/Resources/video-placeholder.png")), - // Duration = Format.FormatDuration3(video.Duration), - // Title = video.Title, - // PlayNumber = play, - // CreateTime = ctime - // }; - // Medias.Add(media); - - // LoadingVisibility = Visibility.Collapsed; - // NoDataVisibility = Visibility.Collapsed; - // })); - - // // 判断是否该结束线程,若为true,跳出循环 - // if (cancellationToken.IsCancellationRequested) - // { - // break; - // } - // } - - // }, (tokenSource = new CancellationTokenSource()).Token); - - // IsEnabled = true; - //} - - private async void UpdateSeasons(int current) - { - // 是否正在获取数据 - // 在所有的退出分支中都需要设为true - IsEnabled = false; - - await Task.Run(() => - { - CancellationToken cancellationToken = tokenSource.Token; - - var seasons = Core.BiliApi.Users.UserSpace.GetSeasonsDetail(mid, id, current, VideoNumberInPage); - if (seasons == null || seasons.Meta.Total == 0) - { - // 没有数据,UI提示 - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Visible; - return; - } - - foreach (var video in seasons.Archives) - { - //if (video.Cid == 0) - //{ - // continue; - //} - - // 查询、保存封面 - string coverUrl = video.Pic; - BitmapImage cover; - if (coverUrl == null || coverUrl == "") - { - cover = null; // new BitmapImage(new Uri($"pack://application:,,,/Resources/video-placeholder.png")); - } - else - { - if (!coverUrl.ToLower().StartsWith("http")) - { - coverUrl = $"https:{video.Pic}"; - } - - StorageCover storageCover = new StorageCover(); - cover = storageCover.GetCoverThumbnail(video.Aid, video.Bvid, -1, coverUrl, 200, 125); - } - - // 播放数 - string play = string.Empty; - if (video.Stat != null) - { - if (video.Stat.View > 0) - { - play = Format.FormatNumber(video.Stat.View); - } - else - { - play = "--"; - } - } - else - { - play = "--"; - } - - DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 - DateTime dateCTime = startTime.AddSeconds(video.Ctime); - string ctime = dateCTime.ToString("yyyy-MM-dd"); - - App.PropertyChangeAsync(new Action(() => - { - ChannelMedia media = new ChannelMedia(eventAggregator) - { - Avid = video.Aid, - Bvid = video.Bvid, - Cover = cover ?? new BitmapImage(new Uri($"pack://application:,,,/Resources/video-placeholder.png")), - Duration = Format.FormatDuration3(video.Duration), - Title = video.Title, - PlayNumber = play, - CreateTime = ctime - }; - Medias.Add(media); - - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - })); - - // 判断是否该结束线程,若为true,跳出循环 - if (cancellationToken.IsCancellationRequested) - { - break; - } - } - - }, (tokenSource = new CancellationTokenSource()).Token); - - IsEnabled = true; - } - - private async void UpdateSeries(int current) - { - // 是否正在获取数据 - // 在所有的退出分支中都需要设为true - IsEnabled = false; - - await Task.Run(() => - { - CancellationToken cancellationToken = tokenSource.Token; - - var meta = Core.BiliApi.Users.UserSpace.GetSeriesMeta(id); - var series = Core.BiliApi.Users.UserSpace.GetSeriesDetail(mid, id, current, VideoNumberInPage); - if (series == null || meta.Meta.Total == 0) - { - // 没有数据,UI提示 - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Visible; - return; - } - - foreach (var video in series.Archives) - { - //if (video.Cid == 0) - //{ - // continue; - //} - - // 查询、保存封面 - string coverUrl = video.Pic; - BitmapImage cover; - if (coverUrl == null || coverUrl == "") - { - cover = null; // new BitmapImage(new Uri($"pack://application:,,,/Resources/video-placeholder.png")); - } - else - { - if (!coverUrl.ToLower().StartsWith("http")) - { - coverUrl = $"https:{video.Pic}"; - } - - StorageCover storageCover = new StorageCover(); - cover = storageCover.GetCoverThumbnail(video.Aid, video.Bvid, -1, coverUrl, 200, 125); - } - - // 播放数 - string play = string.Empty; - if (video.Stat != null) - { - if (video.Stat.View > 0) - { - play = Format.FormatNumber(video.Stat.View); - } - else - { - play = "--"; - } - } - else - { - play = "--"; - } - - DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 - DateTime dateCTime = startTime.AddSeconds(video.Ctime); - string ctime = dateCTime.ToString("yyyy-MM-dd"); - - App.PropertyChangeAsync(new Action(() => - { - ChannelMedia media = new ChannelMedia(eventAggregator) - { - Avid = video.Aid, - Bvid = video.Bvid, - Cover = cover ?? new BitmapImage(new Uri($"pack://application:,,,/Resources/video-placeholder.png")), - Duration = Format.FormatDuration3(video.Duration), - Title = video.Title, - PlayNumber = play, - CreateTime = ctime - }; - Medias.Add(media); - - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - })); - - // 判断是否该结束线程,若为true,跳出循环 - if (cancellationToken.IsCancellationRequested) - { - break; - } - } - - }, (tokenSource = new CancellationTokenSource()).Token); - - IsEnabled = true; - } - - /// - /// 导航到VideoDetail页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - DownloadManage = ButtonIcon.Instance().DownloadManage; - DownloadManage.Height = 24; - DownloadManage.Width = 24; - DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary"); - - // 根据传入参数不同执行不同任务 - var parameter = navigationContext.Parameters.GetValue>("Parameter"); - if (parameter == null) - { - return; - } - - Medias.Clear(); - IsSelectAll = false; - - mid = (long)parameter["mid"]; - id = (long)parameter["id"]; - type = (int)parameter["type"]; - Title = (string)parameter["name"]; - int count = (int)parameter["count"]; - - // 页面选择 - Pager = new CustomPagerViewModel(1, (int)Math.Ceiling((double)count / VideoNumberInPage)); - Pager.CurrentChanged += OnCurrentChanged_Pager; - Pager.CountChanged += OnCountChanged_Pager; - Pager.Current = 1; - } - - } -} diff --git a/src/DownKyi/ViewModels/ViewSettingsViewModel.cs b/src/DownKyi/ViewModels/ViewSettingsViewModel.cs deleted file mode 100644 index 882aea5..0000000 --- a/src/DownKyi/ViewModels/ViewSettingsViewModel.cs +++ /dev/null @@ -1,139 +0,0 @@ -using DownKyi.Events; -using DownKyi.Images; -using DownKyi.Utils; -using DownKyi.ViewModels.PageViewModels; -using DownKyi.ViewModels.Settings; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using System.Collections.Generic; - -namespace DownKyi.ViewModels -{ - public class ViewSettingsViewModel : BaseViewModel - { - public const string Tag = "PageSettings"; - - private readonly IRegionManager regionManager; - - #region 页面属性申明 - - private VectorImage arrowBack; - public VectorImage ArrowBack - { - get => arrowBack; - set => SetProperty(ref arrowBack, value); - } - - private List tabHeaders; - public List TabHeaders - { - get => tabHeaders; - set => SetProperty(ref tabHeaders, value); - } - - private int selectTabId; - public int SelectTabId - { - get => selectTabId; - set => SetProperty(ref selectTabId, value); - } - - #endregion - - - public ViewSettingsViewModel(IRegionManager regionManager, IEventAggregator eventAggregator) : base(eventAggregator) - { - this.regionManager = regionManager; - - #region 属性初始化 - - ArrowBack = NavigationIcon.Instance().ArrowBack; - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - TabHeaders = new List - { - new TabHeader { Id = 0, Title = DictionaryResource.GetString("Basic") }, - new TabHeader { Id = 1, Title = DictionaryResource.GetString("Network") }, - new TabHeader { Id = 2, Title = DictionaryResource.GetString("Video") }, - new TabHeader { Id = 3, Title = DictionaryResource.GetString("SettingDanmaku") }, - new TabHeader { Id = 4, Title = DictionaryResource.GetString("About") } - }; - - #endregion - - } - - #region 命令申明 - - // 返回事件 - private DelegateCommand backSpaceCommand; - public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace)); - - /// - /// 返回事件 - /// - private void ExecuteBackSpace() - { - NavigationParam parameter = new NavigationParam - { - ViewName = ParentView, - ParentViewName = null, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 左侧tab点击事件 - private DelegateCommand leftTabHeadersCommand; - public DelegateCommand LeftTabHeadersCommand => leftTabHeadersCommand ?? (leftTabHeadersCommand = new DelegateCommand(ExecuteLeftTabHeadersCommand)); - - /// - /// 左侧tab点击事件 - /// - /// - private void ExecuteLeftTabHeadersCommand(object parameter) - { - if (!(parameter is TabHeader tabHeader)) { return; } - - NavigationParameters param = new NavigationParameters(); - - switch (tabHeader.Id) - { - case 0: - regionManager.RequestNavigate("SettingsContentRegion", ViewBasicViewModel.Tag, param); - break; - case 1: - regionManager.RequestNavigate("SettingsContentRegion", ViewNetworkViewModel.Tag, param); - break; - case 2: - regionManager.RequestNavigate("SettingsContentRegion", ViewVideoViewModel.Tag, param); - break; - case 3: - regionManager.RequestNavigate("SettingsContentRegion", ViewDanmakuViewModel.Tag, param); - break; - case 4: - regionManager.RequestNavigate("SettingsContentRegion", ViewAboutViewModel.Tag, param); - break; - } - } - - #endregion - - /// - /// 导航到页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - // 进入设置页面时显示的设置项 - SelectTabId = 0; - regionManager.RequestNavigate("SettingsContentRegion", ViewBasicViewModel.Tag, new NavigationParameters()); - - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - } - - } -} diff --git a/src/DownKyi/ViewModels/ViewToolboxViewModel.cs b/src/DownKyi/ViewModels/ViewToolboxViewModel.cs deleted file mode 100644 index 4e4ce6f..0000000 --- a/src/DownKyi/ViewModels/ViewToolboxViewModel.cs +++ /dev/null @@ -1,130 +0,0 @@ -using DownKyi.Events; -using DownKyi.Images; -using DownKyi.Utils; -using DownKyi.ViewModels.PageViewModels; -using DownKyi.ViewModels.Toolbox; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using System.Collections.Generic; - -namespace DownKyi.ViewModels -{ - public class ViewToolboxViewModel : BaseViewModel - { - public const string Tag = "PageToolbox"; - - private readonly IRegionManager regionManager; - - #region 页面属性申明 - - private VectorImage arrowBack; - public VectorImage ArrowBack - { - get => arrowBack; - set => SetProperty(ref arrowBack, value); - } - - private List tabHeaders; - public List TabHeaders - { - get => tabHeaders; - set => SetProperty(ref tabHeaders, value); - } - - private int selectTabId; - public int SelectTabId - { - get => selectTabId; - set => SetProperty(ref selectTabId, value); - } - - #endregion - - public ViewToolboxViewModel(IRegionManager regionManager, IEventAggregator eventAggregator) : base(eventAggregator) - { - this.regionManager = regionManager; - - #region 属性初始化 - - ArrowBack = NavigationIcon.Instance().ArrowBack; - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - TabHeaders = new List - { - new TabHeader { Id = 0, Title = DictionaryResource.GetString("BiliHelper") }, - new TabHeader { Id = 1, Title = DictionaryResource.GetString("Delogo") }, - new TabHeader { Id = 2, Title = DictionaryResource.GetString("ExtractMedia") } - }; - - #endregion - - } - - #region 命令申明 - - // 返回事件 - private DelegateCommand backSpaceCommand; - public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace)); - - /// - /// 返回事件 - /// - private void ExecuteBackSpace() - { - NavigationParam parameter = new NavigationParam - { - ViewName = ParentView, - ParentViewName = null, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 左侧tab点击事件 - private DelegateCommand leftTabHeadersCommand; - public DelegateCommand LeftTabHeadersCommand => leftTabHeadersCommand ?? (leftTabHeadersCommand = new DelegateCommand(ExecuteLeftTabHeadersCommand)); - - /// - /// 左侧tab点击事件 - /// - /// - private void ExecuteLeftTabHeadersCommand(object parameter) - { - if (!(parameter is TabHeader tabHeader)) { return; } - - NavigationParameters param = new NavigationParameters(); - - switch (tabHeader.Id) - { - case 0: - regionManager.RequestNavigate("ToolboxContentRegion", ViewBiliHelperViewModel.Tag, param); - break; - case 1: - regionManager.RequestNavigate("ToolboxContentRegion", ViewDelogoViewModel.Tag, param); - break; - case 2: - regionManager.RequestNavigate("ToolboxContentRegion", ViewExtractMediaViewModel.Tag, param); - break; - } - } - - #endregion - - /// - /// 导航到页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - // 进入设置页面时显示的设置项 - SelectTabId = 0; - regionManager.RequestNavigate("ToolboxContentRegion", ViewBiliHelperViewModel.Tag, new NavigationParameters()); - - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - } - - } -} diff --git a/src/DownKyi/ViewModels/ViewUserSpaceViewModel.cs b/src/DownKyi/ViewModels/ViewUserSpaceViewModel.cs deleted file mode 100644 index a0b7f8e..0000000 --- a/src/DownKyi/ViewModels/ViewUserSpaceViewModel.cs +++ /dev/null @@ -1,581 +0,0 @@ -using DownKyi.Core.BiliApi.Users; -using DownKyi.Core.BiliApi.Users.Models; -using DownKyi.Core.Storage; -using DownKyi.Core.Utils; -using DownKyi.CustomControl; -using DownKyi.Events; -using DownKyi.Images; -using DownKyi.Utils; -using DownKyi.ViewModels.UserSpace; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Media.Imaging; - -namespace DownKyi.ViewModels -{ - public class ViewUserSpaceViewModel : BaseViewModel - { - public const string Tag = "PageUserSpace"; - - private readonly IRegionManager regionManager; - - // mid - private long mid = -1; - - #region 页面属性申明 - - private VectorImage arrowBack; - public VectorImage ArrowBack - { - get => arrowBack; - set => SetProperty(ref arrowBack, value); - } - - private GifImage loading; - public GifImage Loading - { - get => loading; - set => SetProperty(ref loading, value); - } - - private Visibility noDataVisibility; - public Visibility NoDataVisibility - { - get => noDataVisibility; - set => SetProperty(ref noDataVisibility, value); - } - - private Visibility loadingVisibility; - public Visibility LoadingVisibility - { - get => loadingVisibility; - set => SetProperty(ref loadingVisibility, value); - } - - private Visibility viewVisibility; - public Visibility ViewVisibility - { - get => viewVisibility; - set => SetProperty(ref viewVisibility, value); - } - - private Visibility contentVisibility; - public Visibility ContentVisibility - { - get => contentVisibility; - set => SetProperty(ref contentVisibility, value); - } - - private string topNavigationBg; - public string TopNavigationBg - { - get => topNavigationBg; - set => SetProperty(ref topNavigationBg, value); - } - - private BitmapImage background; - public BitmapImage Background - { - get => background; - set => SetProperty(ref background, value); - } - - private BitmapImage header; - public BitmapImage Header - { - get => header; - set => SetProperty(ref header, value); - } - - private string userName; - public string UserName - { - get => userName; - set => SetProperty(ref userName, value); - } - - private BitmapImage sex; - public BitmapImage Sex - { - get => sex; - set => SetProperty(ref sex, value); - } - - private BitmapImage level; - public BitmapImage Level - { - get => level; - set => SetProperty(ref level, value); - } - - private Visibility vipTypeVisibility; - public Visibility VipTypeVisibility - { - get => vipTypeVisibility; - set => SetProperty(ref vipTypeVisibility, value); - } - - private string vipType; - public string VipType - { - get => vipType; - set => SetProperty(ref vipType, value); - } - - private string sign; - public string Sign - { - get => sign; - set => SetProperty(ref sign, value); - } - - private string isFollowed; - public string IsFollowed - { - get => isFollowed; - set => SetProperty(ref isFollowed, value); - } - - private ObservableCollection tabLeftBanners; - public ObservableCollection TabLeftBanners - { - get => tabLeftBanners; - set => SetProperty(ref tabLeftBanners, value); - } - - private ObservableCollection tabRightBanners; - public ObservableCollection TabRightBanners - { - get => tabRightBanners; - set => SetProperty(ref tabRightBanners, value); - } - - private int selectedRightBanner; - public int SelectedRightBanner - { - get => selectedRightBanner; - set => SetProperty(ref selectedRightBanner, value); - } - - - #endregion - - public ViewUserSpaceViewModel(IRegionManager regionManager, IEventAggregator eventAggregator) : base(eventAggregator) - { - this.regionManager = regionManager; - - #region 属性初始化 - - // 返回按钮 - ArrowBack = NavigationIcon.Instance().ArrowBack; - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - // 初始化loading gif - Loading = new GifImage(Properties.Resources.loading); - Loading.StartAnimate(); - - TopNavigationBg = "#00FFFFFF"; // 透明 - - TabLeftBanners = new ObservableCollection(); - TabRightBanners = new ObservableCollection(); - - #endregion - } - - #region 命令申明 - - // 返回事件 - private DelegateCommand backSpaceCommand; - public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace)); - - /// - /// 返回事件 - /// - private void ExecuteBackSpace() - { - NavigationParam parameter = new NavigationParam - { - ViewName = ParentView, - ParentViewName = null, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 左侧tab点击事件 - private DelegateCommand tabLeftBannersCommand; - public DelegateCommand TabLeftBannersCommand => tabLeftBannersCommand ?? (tabLeftBannersCommand = new DelegateCommand(ExecuteTabLeftBannersCommand)); - - /// - /// 左侧tab点击事件 - /// - /// - private void ExecuteTabLeftBannersCommand(object parameter) - { - if (!(parameter is TabLeftBanner banner)) { return; } - - NavigationParameters param = new NavigationParameters() - { - { "object", banner.Object }, - { "mid", mid }, - }; - - switch (banner.Id) - { - case 0: // 投稿 - regionManager.RequestNavigate("UserSpaceContentRegion", ViewArchiveViewModel.Tag, param); - break; - case 1: // 频道(弃用) - regionManager.RequestNavigate("UserSpaceContentRegion", UserSpace.ViewChannelViewModel.Tag, param); - break; - case 2: // 合集和列表 - regionManager.RequestNavigate("UserSpaceContentRegion", UserSpace.ViewSeasonsSeriesViewModel.Tag, param); - break; - } - } - - // 右侧tab点击事件 - private DelegateCommand tabRightBannersCommand; - public DelegateCommand TabRightBannersCommand => tabRightBannersCommand ?? (tabRightBannersCommand = new DelegateCommand(ExecuteTabRightBannersCommand)); - - /// - /// 右侧tab点击事件 - /// - private void ExecuteTabRightBannersCommand(object parameter) - { - if (!(parameter is TabRightBanner banner)) { return; } - - Dictionary data = new Dictionary - { - { "mid", mid }, - { "friendId", 0 } - }; - - string parentViewName; - if (ParentView == ViewFriendsViewModel.Tag) - { - parentViewName = ViewIndexViewModel.Tag; - } - else - { - parentViewName = Tag; - } - - switch (banner.Id) - { - case 0: - data["friendId"] = 0; - NavigateToView.NavigationView(eventAggregator, ViewFriendsViewModel.Tag, parentViewName, data); - break; - case 1: - data["friendId"] = 1; - NavigateToView.NavigationView(eventAggregator, ViewFriendsViewModel.Tag, parentViewName, data); - break; - } - - SelectedRightBanner = -1; - } - - #endregion - - /// - /// 初始化页面 - /// - private void InitView() - { - TopNavigationBg = "#00FFFFFF"; // 透明 - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - Background = null; - - Header = null; - UserName = ""; - Sex = null; - Level = null; - VipTypeVisibility = Visibility.Collapsed; - VipType = ""; - Sign = ""; - - TabLeftBanners.Clear(); - TabRightBanners.Clear(); - - SelectedRightBanner = -1; - - // 将内容置空,使其不指向任何页面 - regionManager.RequestNavigate("UserSpaceContentRegion", ""); - - ContentVisibility = Visibility.Collapsed; - ViewVisibility = Visibility.Collapsed; - LoadingVisibility = Visibility.Visible; - NoDataVisibility = Visibility.Collapsed; - } - - /// - /// 更新用户信息 - /// - private async void UpdateSpaceInfo() - { - bool isNoData = true; - Uri toutuUri = null; - string headerUri = null; - Uri sexUri = null; - Uri levelUri = null; - - await Task.Run(() => - { - // 背景图片 - SpaceSettings spaceSettings = Core.BiliApi.Users.UserSpace.GetSpaceSettings(mid); - if (spaceSettings != null) - { - StorageCover storageCover = new StorageCover(); - string toutu = storageCover.GetCover($"https://i0.hdslb.com/{spaceSettings.Toutu.Limg}"); - toutuUri = new Uri(toutu); - } - else - { - toutuUri = new Uri("pack://application:,,,/Resources/backgound/9-绿荫秘境.png"); - } - - // 用户信息 - UserInfoForSpace userInfo = UserInfo.GetUserInfoForSpace(mid); - if (userInfo != null) - { - isNoData = false; - - // 头像 - StorageHeader storageHeader = new StorageHeader(); - headerUri = storageHeader.GetHeader(mid, userInfo.Name, userInfo.Face); - // 用户名 - UserName = userInfo.Name; - // 性别 - if (userInfo.Sex == "男") - { - sexUri = new Uri($"pack://application:,,,/Resources/sex/male.png"); - } - else if (userInfo.Sex == "女") - { - sexUri = new Uri($"pack://application:,,,/Resources/sex/female.png"); - } - // 显示vip信息 - if (userInfo.Vip == null || userInfo.Vip.Label.Text == null || userInfo.Vip.Label.Text == "") - { - VipTypeVisibility = Visibility.Collapsed; - } - else - { - VipTypeVisibility = Visibility.Visible; - VipType = userInfo.Vip.Label.Text; - } - // 等级 - levelUri = new Uri($"pack://application:,,,/Resources/level/lv{userInfo.Level}.png"); - // 签名 - Sign = userInfo.Sign; - - // 是否关注此UP - IsFollowed = userInfo.IsFollowed ? - DictionaryResource.GetString("Followed") : DictionaryResource.GetString("NotFollowed"); - } - else - { - // 没有数据 - isNoData = true; - } - }); - - // 是否获取到数据 - if (isNoData) - { - TopNavigationBg = "#00FFFFFF"; // 透明 - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - Background = null; - - ViewVisibility = Visibility.Collapsed; - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Visible; - return; - } - else - { - // 头像 - StorageHeader storageHeader = new StorageHeader(); - Header = storageHeader.GetHeaderThumbnail(headerUri, 64, 64); - // 性别 - Sex = sexUri == null ? null : new BitmapImage(sexUri); - // 等级 - Level = levelUri == null ? null : new BitmapImage(levelUri); - - ArrowBack.Fill = DictionaryResource.GetColor("ColorText"); - TopNavigationBg = DictionaryResource.GetColor("ColorMask100"); - Background = new BitmapImage(toutuUri); - - ViewVisibility = Visibility.Visible; - LoadingVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - } - - ContentVisibility = Visibility.Visible; - - // 投稿视频 - List publicationTypes = null; - await Task.Run(() => - { - publicationTypes = Core.BiliApi.Users.UserSpace.GetPublicationType(mid); - }); - if (publicationTypes != null && publicationTypes.Count > 0) - { - TabLeftBanners.Add(new TabLeftBanner - { - Object = publicationTypes, - Id = 0, - Icon = NormalIcon.Instance().VideoUp, - IconColor = "#FF02B5DA", - Title = DictionaryResource.GetString("Publication"), - IsSelected = true - }); - } - - // 频道 - //List channelList = null; - //await Task.Run(() => - //{ - // channelList = Core.BiliApi.Users.UserSpace.GetChannelList(mid); - //}); - //if (channelList != null && channelList.Count > 0) - //{ - // TabLeftBanners.Add(new TabLeftBanner - // { - // Object = channelList, - // Id = 1, - // Icon = NormalIcon.Instance().Channel, - // IconColor = "#FF23C9ED", - // Title = DictionaryResource.GetString("Channel") - // }); - //} - - // 合集和列表 - SpaceSeasonsSeries seasonsSeries = null; - await Task.Run(() => - { - seasonsSeries = Core.BiliApi.Users.UserSpace.GetSeasonsSeries(mid, 1, 20); - }); - if (seasonsSeries != null && seasonsSeries.Page.Total > 0) - { - TabLeftBanners.Add(new TabLeftBanner - { - Object = seasonsSeries, - Id = 2, - Icon = NormalIcon.Instance().Channel, - IconColor = "#FF23C9ED", - Title = DictionaryResource.GetString("SeasonsSeries") - }); - } - - // 收藏夹 - // 订阅 - - // 关系状态数 - UserRelationStat relationStat = null; - await Task.Run(() => - { - relationStat = UserStatus.GetUserRelationStat(mid); - }); - if (relationStat != null) - { - TabRightBanners.Add(new TabRightBanner - { - Id = 0, - IsEnabled = true, - LabelColor = DictionaryResource.GetColor("ColorPrimary"), - CountColor = DictionaryResource.GetColor("ColorPrimary"), - Label = DictionaryResource.GetString("FollowingCount"), - Count = Format.FormatNumber(relationStat.Following) - }); - TabRightBanners.Add(new TabRightBanner - { - Id = 1, - IsEnabled = true, - LabelColor = DictionaryResource.GetColor("ColorPrimary"), - CountColor = DictionaryResource.GetColor("ColorPrimary"), - Label = DictionaryResource.GetString("FollowerCount"), - Count = Format.FormatNumber(relationStat.Follower) - }); - } - - // UP主状态数,需要任意用户登录,否则不会返回任何数据 - UpStat upStat = null; - await Task.Run(() => - { - upStat = UserStatus.GetUpStat(mid); - }); - if (upStat != null && upStat.Archive != null && upStat.Article != null) - { - TabRightBanners.Add(new TabRightBanner - { - Id = 2, - IsEnabled = false, - LabelColor = DictionaryResource.GetColor("ColorTextGrey"), - CountColor = DictionaryResource.GetColor("ColorTextDark"), - Label = DictionaryResource.GetString("LikesCount"), - Count = Format.FormatNumber(upStat.Likes) - }); - - long archiveView = 0; - if (upStat.Archive != null) - { - archiveView = upStat.Archive.View; - } - TabRightBanners.Add(new TabRightBanner - { - Id = 3, - IsEnabled = false, - LabelColor = DictionaryResource.GetColor("ColorTextGrey"), - CountColor = DictionaryResource.GetColor("ColorTextDark"), - Label = DictionaryResource.GetString("ArchiveViewCount"), - Count = Format.FormatNumber(archiveView) - }); - - long articleView = 0; - if (upStat.Article != null) - { - articleView = upStat.Article.View; - } - TabRightBanners.Add(new TabRightBanner - { - Id = 4, - IsEnabled = false, - LabelColor = DictionaryResource.GetColor("ColorTextGrey"), - CountColor = DictionaryResource.GetColor("ColorTextDark"), - Label = DictionaryResource.GetString("ArticleViewCount"), - Count = Format.FormatNumber(articleView) - }); - } - - } - - /// - /// 接收mid参数 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - base.OnNavigatedTo(navigationContext); - - // 根据传入参数不同执行不同任务 - long parameter = navigationContext.Parameters.GetValue("Parameter"); - if (parameter == 0) - { - return; - } - mid = parameter; - - InitView(); - UpdateSpaceInfo(); - } - - } -} diff --git a/src/DownKyi/ViewModels/ViewVideoDetailViewModel.cs b/src/DownKyi/ViewModels/ViewVideoDetailViewModel.cs deleted file mode 100644 index 084e5f5..0000000 --- a/src/DownKyi/ViewModels/ViewVideoDetailViewModel.cs +++ /dev/null @@ -1,847 +0,0 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Core.BiliApi.VideoStream; -using DownKyi.Core.Logging; -using DownKyi.Core.Settings; -using DownKyi.CustomControl; -using DownKyi.Events; -using DownKyi.Images; -using DownKyi.Services; -using DownKyi.Services.Download; -using DownKyi.Utils; -using DownKyi.ViewModels.Dialogs; -using DownKyi.ViewModels.PageViewModels; -using Newtonsoft.Json; -using Prism.Commands; -using Prism.Events; -using Prism.Regions; -using Prism.Services.Dialogs; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.IO; -using System.Linq; -using System.Runtime.Serialization.Formatters.Binary; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using System.Windows; - -namespace DownKyi.ViewModels -{ - public class ViewVideoDetailViewModel : BaseViewModel - { - public const string Tag = "PageVideoDetail"; - - // 保存输入字符串,避免被用户修改 - private string input = null; - - // 保存当前页面服务,减少new的开销和接口调用次数 - private IInfoService infoService; - - #region 页面属性申明 - - private VectorImage arrowBack; - public VectorImage ArrowBack - { - get => arrowBack; - set => SetProperty(ref arrowBack, value); - } - - private string inputText; - public string InputText - { - get => inputText; - set => SetProperty(ref inputText, value); - } - private string inputSearchText; - - public string InputSearchText - { - get => inputSearchText; - set => SetProperty(ref inputSearchText, value); - } - private GifImage loading; - public GifImage Loading - { - get => loading; - set => SetProperty(ref loading, value); - } - - private Visibility loadingVisibility; - public Visibility LoadingVisibility - { - get => loadingVisibility; - set => SetProperty(ref loadingVisibility, value); - } - - private VectorImage downloadManage; - public VectorImage DownloadManage - { - get => downloadManage; - set => SetProperty(ref downloadManage, value); - } - - private VideoInfoView videoInfoView; - public VideoInfoView VideoInfoView - { - get => videoInfoView; - set => SetProperty(ref videoInfoView, value); - } - - private ObservableCollection videoSections; - public ObservableCollection VideoSections - { - get => videoSections; - set => SetProperty(ref videoSections, value); - } - public ObservableCollection CaCheVideoSections { get; set; } - private bool isSelectAll; - public bool IsSelectAll - { - get => isSelectAll; - set => SetProperty(ref isSelectAll, value); - } - - private Visibility contentVisibility; - public Visibility ContentVisibility - { - get => contentVisibility; - set => SetProperty(ref contentVisibility, value); - } - - private Visibility noDataVisibility; - public Visibility NoDataVisibility - { - get => noDataVisibility; - set => SetProperty(ref noDataVisibility, value); - } - - #endregion - - public ViewVideoDetailViewModel(IEventAggregator eventAggregator, IDialogService dialogService) : base(eventAggregator, dialogService) - { - #region 属性初始化 - - // 初始化loading gif - Loading = new GifImage(Properties.Resources.loading); - Loading.StartAnimate(); - LoadingVisibility = Visibility.Collapsed; - - // 返回按钮 - ArrowBack = NavigationIcon.Instance().ArrowBack; - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - // 下载管理按钮 - DownloadManage = ButtonIcon.Instance().DownloadManage; - DownloadManage.Height = 24; - DownloadManage.Width = 24; - DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary"); - - VideoSections = new ObservableCollection(); - CaCheVideoSections = new ObservableCollection(); - #endregion - } - - - #region 命令申明 - - // 返回 - private DelegateCommand backSpaceCommand; - public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace)); - - /// - /// 返回 - /// - private void ExecuteBackSpace() - { - NavigationParam parameter = new NavigationParam - { - ViewName = ParentView, - ParentViewName = null, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 前往下载管理页面 - private DelegateCommand downloadManagerCommand; - public DelegateCommand DownloadManagerCommand => downloadManagerCommand ?? (downloadManagerCommand = new DelegateCommand(ExecuteDownloadManagerCommand)); - - /// - /// 前往下载管理页面 - /// - private void ExecuteDownloadManagerCommand() - { - NavigationParam parameter = new NavigationParam - { - ViewName = ViewDownloadManagerViewModel.Tag, - ParentViewName = Tag, - Parameter = null - }; - eventAggregator.GetEvent().Publish(parameter); - } - - // 输入确认事件 - private DelegateCommand inputCommand; - public DelegateCommand InputCommand => inputCommand ?? (inputCommand = new DelegateCommand(ExecuteInputCommand, CanExecuteInputCommand)); - - - private DelegateCommand inputSearchCommand; - - public DelegateCommand InputSearchCommand => inputSearchCommand ?? (inputSearchCommand = new DelegateCommand(ExcuteInputSearchCommand)); - /// - /// 搜索视频输入事件 - /// - private async void ExcuteInputSearchCommand() { - await Task.Run(() => - { - if (InputSearchText == null || InputSearchText == string.Empty) - { - foreach (VideoSection section in VideoSections) { - var cache= CaCheVideoSections.FirstOrDefault(e=>e.Id==section.Id); - if (cache!=null) - { - section.VideoPages=cache.VideoPages; - } - } - } - else - { - foreach (VideoSection section in VideoSections) - { - var cache = CaCheVideoSections.FirstOrDefault(e => e.Id == section.Id); - if (cache != null) - { - var pages = cache.VideoPages.Where(e => e.Name.Contains(InputSearchText)).ToList(); - section.VideoPages = pages; - } - - } - } - }); - } - /// - /// 处理输入事件 - /// - private async void ExecuteInputCommand() - { - InitView(); - try - { - await Task.Run(() => - { - if (InputText == null || InputText == string.Empty) { return; } - - LogManager.Debug(Tag, $"InputText: {InputText}"); - InputText = Regex.Replace(InputText, @"[【]*[^【]*[^】]*[】 ]", ""); - input = InputText; - - // 更新页面 - UnityUpdateView(UpdateView, input, null, true); - - // 是否自动解析视频 - if (SettingsManager.GetInstance().IsAutoParseVideo() == AllowStatus.YES) - { - PropertyChangeAsync(ExecuteParseAllVideoCommand); - } - }); - } - catch (Exception e) - { - Core.Utils.Debugging.Console.PrintLine("InputCommand()发生异常: {0}", e); - LogManager.Error(Tag, e); - - LoadingVisibility = Visibility.Collapsed; - ContentVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Visible; - } - } - - /// - /// 输入事件是否允许执行 - /// - /// - private bool CanExecuteInputCommand() - { - return LoadingVisibility != Visibility.Visible; - } - - // 复制封面事件 - private DelegateCommand copyCoverCommand; - public DelegateCommand CopyCoverCommand => copyCoverCommand ?? (copyCoverCommand = new DelegateCommand(ExecuteCopyCoverCommand)); - - /// - /// 复制封面事件 - /// - private void ExecuteCopyCoverCommand() - { - // 复制封面图片到剪贴板 - Clipboard.SetImage(VideoInfoView.Cover); - LogManager.Info(Tag, "复制封面图片到剪贴板"); - } - - // 复制封面URL事件 - private DelegateCommand copyCoverUrlCommand; - public DelegateCommand CopyCoverUrlCommand => copyCoverUrlCommand ?? (copyCoverUrlCommand = new DelegateCommand(ExecuteCopyCoverUrlCommand)); - - /// - /// 复制封面URL事件 - /// - private void ExecuteCopyCoverUrlCommand() - { - // 复制封面url到剪贴板 - Clipboard.SetText(VideoInfoView.CoverUrl); - LogManager.Info(Tag, "复制封面url到剪贴板"); - } - - // 前往UP主页事件 - private DelegateCommand upperCommand; - public DelegateCommand UpperCommand => upperCommand ?? (upperCommand = new DelegateCommand(ExecuteUpperCommand)); - - /// - /// 前往UP主页事件 - /// - private void ExecuteUpperCommand() - { - NavigateToView.NavigateToViewUserSpace(eventAggregator, Tag, VideoInfoView.UpperMid); - } - - // 视频章节选择事件 - private DelegateCommand videoSectionsCommand; - public DelegateCommand VideoSectionsCommand => videoSectionsCommand ?? (videoSectionsCommand = new DelegateCommand(ExecuteVideoSectionsCommand)); - - /// - /// 视频章节选择事件 - /// - /// - private void ExecuteVideoSectionsCommand(object parameter) - { - if (!(parameter is VideoSection section)) { return; } - - bool isSelectAll = true; - foreach (VideoPage page in section.VideoPages) - { - if (!page.IsSelected) - { - isSelectAll = false; - break; - } - } - - IsSelectAll = section.VideoPages.Count != 0 && isSelectAll; - } - - // 视频page选择事件 - private DelegateCommand videoPagesCommand; - public DelegateCommand VideoPagesCommand => videoPagesCommand ?? (videoPagesCommand = new DelegateCommand(ExecuteVideoPagesCommand)); - - /// - /// 视频page选择事件 - /// - /// - private void ExecuteVideoPagesCommand(object parameter) - { - if (!(parameter is ObservableCollection videoPages)) { return; } - - VideoSection section = VideoSections.FirstOrDefault(item => item.IsSelected); - if (section == null) { return; } - IsSelectAll = section.VideoPages.Count == videoPages.Count && section.VideoPages.Count != 0; - } - - // Ctrl+A 全选事件 - private DelegateCommand keySelectAllCommand; - public DelegateCommand KeySelectAllCommand => keySelectAllCommand ?? (keySelectAllCommand = new DelegateCommand(ExecuteKeySelectAllCommand)); - - /// - /// Ctrl+A 全选事件 - /// - private void ExecuteKeySelectAllCommand(object parameter) - { - if (!(parameter is VideoSection section)) { return; } - foreach (VideoPage page in section.VideoPages) - { - page.IsSelected = true; - } - } - - // 全选事件 - private DelegateCommand selectAllCommand; - public DelegateCommand SelectAllCommand => selectAllCommand ?? (selectAllCommand = new DelegateCommand(ExecuteSelectAllCommand)); - - /// - /// 全选事件 - /// - /// - private void ExecuteSelectAllCommand(object parameter) - { - if (!(parameter is VideoSection section)) { return; } - if (IsSelectAll) - { - foreach (VideoPage page in section.VideoPages) - { - page.IsSelected = true; - } - } - else - { - foreach (VideoPage page in section.VideoPages) - { - page.IsSelected = false; - } - } - } - - // 解析视频流事件 - private DelegateCommand parseCommand; - public DelegateCommand ParseCommand => parseCommand ?? (parseCommand = new DelegateCommand(ExecuteParseCommand, CanExecuteParseCommand)); - - /// - /// 解析视频流事件 - /// - /// - private async void ExecuteParseCommand(object parameter) - { - if (!(parameter is VideoPage videoPage)) - { - return; - } - - LoadingVisibility = Visibility.Visible; - - try - { - await Task.Run(() => - { - LogManager.Debug(Tag, $"Video Page: {videoPage.Cid}"); - - UnityUpdateView(ParseVideo, input, videoPage, true); - }); - } - catch (Exception e) - { - Core.Utils.Debugging.Console.PrintLine("ParseCommand()发生异常: {0}", e); - LogManager.Error(Tag, e); - - LoadingVisibility = Visibility.Collapsed; - } - - LoadingVisibility = Visibility.Collapsed; - } - - /// - /// 解析视频流事件是否允许执行 - /// - /// - /// - private bool CanExecuteParseCommand(object parameter) - { - return LoadingVisibility != Visibility.Visible; - } - - // 解析所有视频流事件 - private DelegateCommand parseAllVideoCommand; - public DelegateCommand ParseAllVideoCommand => parseAllVideoCommand ?? (parseAllVideoCommand = new DelegateCommand(ExecuteParseAllVideoCommand, CanExecuteParseAllVideoCommand)); - - /// - /// 解析所有视频流事件 - /// - private async void ExecuteParseAllVideoCommand() - { - LoadingVisibility = Visibility.Visible; - - // 解析范围 - ParseScope parseScope = SettingsManager.GetInstance().GetParseScope(); - - // 是否选择了解析范围 - if (parseScope == ParseScope.NONE) - { - // 打开解析选择器 - dialogService.ShowDialog(ViewParsingSelectorViewModel.Tag, null, result => - { - if (result.Result == ButtonResult.OK) - { - // 选择的解析范围 - parseScope = result.Parameters.GetValue("parseScope"); - } - }); - } - LogManager.Debug(Tag, $"ParseScope: {parseScope:G}"); - - try - { - await Task.Run(() => - { - LogManager.Debug(Tag, "Parse video"); - - switch (parseScope) - { - case ParseScope.NONE: - break; - case ParseScope.SELECTED_ITEM: - foreach (VideoSection section in VideoSections) - { - foreach (VideoPage page in section.VideoPages) - { - if (page.IsSelected) - { - // 执行解析任务 - UnityUpdateView(ParseVideo, input, page); - } - } - } - break; - case ParseScope.CURRENT_SECTION: - foreach (VideoSection section in VideoSections) - { - if (section.IsSelected) - { - foreach (VideoPage page in section.VideoPages) - { - // 执行解析任务 - UnityUpdateView(ParseVideo, input, page); - } - } - } - break; - case ParseScope.ALL: - foreach (VideoSection section in VideoSections) - { - foreach (VideoPage page in section.VideoPages) - { - // 执行解析任务 - UnityUpdateView(ParseVideo, input, page); - } - } - break; - default: - break; - } - }); - } - catch (Exception e) - { - Core.Utils.Debugging.Console.PrintLine("ParseCommand()发生异常: {0}", e); - LogManager.Error(Tag, e); - - LoadingVisibility = Visibility.Collapsed; - } - - LoadingVisibility = Visibility.Collapsed; - - // 解析后是否自动下载解析视频 - AllowStatus isAutoDownloadAll = SettingsManager.GetInstance().IsAutoDownloadAll(); - if (parseScope != ParseScope.NONE && isAutoDownloadAll == AllowStatus.YES) - { - AddToDownload(true); - } - } - - /// - /// 解析所有视频流事件是否允许执行 - /// - /// - private bool CanExecuteParseAllVideoCommand() - { - return LoadingVisibility != Visibility.Visible; - } - - // 添加到下载列表事件 - private DelegateCommand addToDownloadCommand; - public DelegateCommand AddToDownloadCommand => addToDownloadCommand ?? (addToDownloadCommand = new DelegateCommand(ExecuteAddToDownloadCommand, CanExecuteAddToDownloadCommand)); - - /// - /// 添加到下载列表事件 - /// - private void ExecuteAddToDownloadCommand() - { - AddToDownload(false); - //AddToDownloadService addToDownloadService = null; - //// 视频 - //if (ParseEntrance.IsAvUrl(input) || ParseEntrance.IsBvUrl(input)) - //{ - // addToDownloadService = new AddToDownloadService(PlayStreamType.VIDEO); - //} - //// 番剧(电影、电视剧) - //else if (ParseEntrance.IsBangumiSeasonUrl(input) || ParseEntrance.IsBangumiEpisodeUrl(input) || ParseEntrance.IsBangumiMediaUrl(input)) - //{ - // addToDownloadService = new AddToDownloadService(PlayStreamType.BANGUMI); - //} - //// 课程 - //else if (ParseEntrance.IsCheeseSeasonUrl(input) || ParseEntrance.IsCheeseEpisodeUrl(input)) - //{ - // addToDownloadService = new AddToDownloadService(PlayStreamType.CHEESE); - //} - //else - //{ - // return; - //} - - //// 选择文件夹 - //string directory = addToDownloadService.SetDirectory(dialogService); - - //// 视频计数 - //int i = 0; - //await Task.Run(() => - //{ - // // 传递video对象 - // addToDownloadService.GetVideo(VideoInfoView, VideoSections.ToList()); - // // 下载 - // i = addToDownloadService.AddToDownload(eventAggregator, directory); - //}); - - //if (directory == null) - //{ - // return; - //} - - //// 通知用户添加到下载列表的结果 - //if (i <= 0) - //{ - // eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipAddDownloadingZero")); - //} - //else - //{ - // eventAggregator.GetEvent().Publish($"{DictionaryResource.GetString("TipAddDownloadingFinished1")}{i}{DictionaryResource.GetString("TipAddDownloadingFinished2")}"); - //} - } - - /// - /// 添加到下载列表事件是否允许执行 - /// - /// - private bool CanExecuteAddToDownloadCommand() - { - return LoadingVisibility != Visibility.Visible; - } - - #endregion - - #region 业务逻辑 - - /// - /// 初始化页面元素 - /// - private void InitView() - { - LogManager.Debug(Tag, "初始化页面元素"); - - LoadingVisibility = Visibility.Visible; - ContentVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Collapsed; - - VideoSections.Clear(); - CaCheVideoSections.Clear(); - } - - /// - /// 更新页面的统一方法 - /// - /// - /// - /// - /// 强制new - private void UnityUpdateView(Action action, string input, VideoPage page,bool force = false) - { - if (infoService == null || force) - { - // 视频 - if (ParseEntrance.IsAvUrl(input) || ParseEntrance.IsBvUrl(input)) - { - infoService = new VideoInfoService(input); - } - - // 番剧(电影、电视剧) - if (ParseEntrance.IsBangumiSeasonUrl(input) || ParseEntrance.IsBangumiEpisodeUrl(input) || ParseEntrance.IsBangumiMediaUrl(input)) - { - infoService = new BangumiInfoService(input); - } - - // 课程 - if (ParseEntrance.IsCheeseSeasonUrl(input) || ParseEntrance.IsCheeseEpisodeUrl(input)) - { - infoService = new CheeseInfoService(input); - } - } - if (infoService == null) - { - return; - } - action(infoService, page); - } - - /// - /// 更新页面 - /// - /// - private void UpdateView(IInfoService videoInfoService, VideoPage param) - { - // 获取视频详情 - VideoInfoView = videoInfoService.GetVideoView(); - if (VideoInfoView == null) - { - LogManager.Debug(Tag, "VideoInfoView is null."); - - LoadingVisibility = Visibility.Collapsed; - ContentVisibility = Visibility.Collapsed; - NoDataVisibility = Visibility.Visible; - return; - } - else - { - LoadingVisibility = Visibility.Collapsed; - ContentVisibility = Visibility.Visible; - NoDataVisibility = Visibility.Collapsed; - } - - // 获取视频列表 - List videoSections = videoInfoService.GetVideoSections(false); - - // 清空以前的数据 - PropertyChangeAsync(new Action(() => - { - VideoSections.Clear(); - CaCheVideoSections.Clear(); - })); - - // 添加新数据 - if (videoSections == null) - { - LogManager.Debug(Tag, "videoSections is not exist."); - - List pages = videoInfoService.GetVideoPages(); - - PropertyChangeAsync(new Action(() => - { - VideoSections.Add(new VideoSection - { - Id = 0, - Title = "default", - IsSelected = true, - VideoPages = pages - }); - CaCheVideoSections.Add(new VideoSection - { - Id = 0, - Title = "default", - IsSelected = true, - VideoPages = pages - }); - })); - } - else - { - //这里如果浅拷贝会导致用于查询的CaCheVideoSections数据变化,所以这样处理 - var videoSectionsStr = JsonConvert.SerializeObject(videoSections); - var videoSectionsData = JsonConvert.DeserializeObject>(videoSectionsStr); - PropertyChangeAsync(new Action(() => - { - VideoSections.AddRange(videoSections); - CaCheVideoSections.AddRange(videoSectionsData); - })); - } - } - /// - /// 解析视频流 - /// - /// - private void ParseVideo(IInfoService videoInfoService, VideoPage videoPage) - { - videoInfoService.GetVideoStream(videoPage); - } - - /// - /// 添加到下载列表事件 - /// - /// 是否下载所有,包括未选中项 - private async void AddToDownload(bool isAll) - { - AddToDownloadService addToDownloadService = null; - // 视频 - if (ParseEntrance.IsAvUrl(input) || ParseEntrance.IsBvUrl(input)) - { - addToDownloadService = new AddToDownloadService(PlayStreamType.VIDEO); - } - // 番剧(电影、电视剧) - else if (ParseEntrance.IsBangumiSeasonUrl(input) || ParseEntrance.IsBangumiEpisodeUrl(input) || ParseEntrance.IsBangumiMediaUrl(input)) - { - addToDownloadService = new AddToDownloadService(PlayStreamType.BANGUMI); - } - // 课程 - else if (ParseEntrance.IsCheeseSeasonUrl(input) || ParseEntrance.IsCheeseEpisodeUrl(input)) - { - addToDownloadService = new AddToDownloadService(PlayStreamType.CHEESE); - } - else - { - return; - } - - // 选择文件夹 - string directory = addToDownloadService.SetDirectory(dialogService); - - // 视频计数 - int i = 0; - await Task.Run(() => - { - // 传递video对象 - addToDownloadService.GetVideo(VideoInfoView, VideoSections.ToList()); - // 下载 - i = addToDownloadService.AddToDownload(eventAggregator, dialogService, directory, isAll); - }); - - if (directory == null) - { - return; - } - - // 通知用户添加到下载列表的结果 - if (i <= 0) - { - eventAggregator.GetEvent().Publish(DictionaryResource.GetString("TipAddDownloadingZero")); - } - else - { - eventAggregator.GetEvent().Publish($"{DictionaryResource.GetString("TipAddDownloadingFinished1")}{i}{DictionaryResource.GetString("TipAddDownloadingFinished2")}"); - } - } - - #endregion - - /// - /// 导航到页面时执行 - /// - /// - public override void OnNavigatedTo(NavigationContext navigationContext) - { - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); - - DownloadManage = ButtonIcon.Instance().DownloadManage; - DownloadManage.Height = 24; - DownloadManage.Width = 24; - DownloadManage.Fill = DictionaryResource.GetColor("ColorPrimary"); - - // Parent参数为null时,表示是从下一个页面返回到本页面,不需要执行任务 - if (navigationContext.Parameters.GetValue("Parent") != null) - { - string param = navigationContext.Parameters.GetValue("Parameter"); - // 移除剪贴板id - string input = param.Replace(AppConstant.ClipboardId, ""); - - // 检测是否从剪贴板传入 - if (InputText == input && param.EndsWith(AppConstant.ClipboardId)) - { - return; - } - - // 正在执行任务时不开启新任务 - if (LoadingVisibility != Visibility.Visible) - { - InputText = input; - PropertyChangeAsync(ExecuteInputCommand); - } - } - - base.OnNavigatedTo(navigationContext); - } - - } -} diff --git a/src/DownKyi/Views/Dialogs/ViewAlertDialog.xaml b/src/DownKyi/Views/Dialogs/ViewAlertDialog.xaml deleted file mode 100644 index 17eb4b3..0000000 --- a/src/DownKyi/Views/Dialogs/ViewAlertDialog.xaml +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/DownKyi/Views/MainWindow.xaml.cs b/src/DownKyi/Views/MainWindow.xaml.cs deleted file mode 100644 index 414eabd..0000000 --- a/src/DownKyi/Views/MainWindow.xaml.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Windows; - -namespace DownKyi.Views -{ - /// - /// Interaction logic for MainWindow.xaml - /// - public partial class MainWindow : Window - { - public MainWindow() - { - InitializeComponent(); - } - - } -} \ No newline at end of file diff --git a/src/DownKyi/Views/Settings/ViewAbout.xaml b/src/DownKyi/Views/Settings/ViewAbout.xaml deleted file mode 100644 index 61952cb..0000000 --- a/src/DownKyi/Views/Settings/ViewAbout.xaml +++ /dev/null @@ -1,409 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/DownKyi/Views/ViewDownloadManager.xaml.cs b/src/DownKyi/Views/ViewDownloadManager.xaml.cs deleted file mode 100644 index 23e31e9..0000000 --- a/src/DownKyi/Views/ViewDownloadManager.xaml.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Windows.Controls; - -namespace DownKyi.Views -{ - /// - /// Interaction logic for ViewDownloadManager - /// - public partial class ViewDownloadManager : UserControl - { - public ViewDownloadManager() - { - InitializeComponent(); - } - } -} diff --git a/src/DownKyi/Views/ViewFriends.xaml b/src/DownKyi/Views/ViewFriends.xaml deleted file mode 100644 index d9ed296..0000000 --- a/src/DownKyi/Views/ViewFriends.xaml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/DownKyi/Views/ViewFriends.xaml.cs b/src/DownKyi/Views/ViewFriends.xaml.cs deleted file mode 100644 index 8332b78..0000000 --- a/src/DownKyi/Views/ViewFriends.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace DownKyi.Views -{ - /// - /// ViewFriend.xaml 的交互逻辑 - /// - public partial class ViewFriends : UserControl - { - public ViewFriends() - { - InitializeComponent(); - } - } -} diff --git a/src/DownKyi/Views/ViewIndex.xaml b/src/DownKyi/Views/ViewIndex.xaml deleted file mode 100644 index ed0e9a9..0000000 --- a/src/DownKyi/Views/ViewIndex.xaml +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/DownKyi/Views/ViewIndex.xaml.cs b/src/DownKyi/Views/ViewIndex.xaml.cs deleted file mode 100644 index 48f47ec..0000000 --- a/src/DownKyi/Views/ViewIndex.xaml.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Windows.Controls; - -namespace DownKyi.Views -{ - /// - /// Interaction logic for ViewIndex - /// - public partial class ViewIndex : UserControl - { - public ViewIndex() - { - InitializeComponent(); - } - } -} diff --git a/src/DownKyi/Views/ViewLogin.xaml b/src/DownKyi/Views/ViewLogin.xaml deleted file mode 100644 index fc83397..0000000 --- a/src/DownKyi/Views/ViewLogin.xaml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/DownKyi/Views/ViewLogin.xaml.cs b/src/DownKyi/Views/ViewLogin.xaml.cs deleted file mode 100644 index fa0f2eb..0000000 --- a/src/DownKyi/Views/ViewLogin.xaml.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Windows.Controls; - -namespace DownKyi.Views -{ - /// - /// Interaction logic for ViewLogin - /// - public partial class ViewLogin : UserControl - { - public ViewLogin() - { - InitializeComponent(); - } - } -} diff --git a/src/DownKyi/Views/ViewMyBangumiFollow.xaml b/src/DownKyi/Views/ViewMyBangumiFollow.xaml deleted file mode 100644 index e5344dd..0000000 --- a/src/DownKyi/Views/ViewMyBangumiFollow.xaml +++ /dev/null @@ -1,378 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/DownKyi/Views/ViewMySpace.xaml.cs b/src/DownKyi/Views/ViewMySpace.xaml.cs deleted file mode 100644 index f9b726a..0000000 --- a/src/DownKyi/Views/ViewMySpace.xaml.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Windows.Controls; - -namespace DownKyi.Views -{ - /// - /// Interaction logic for ViewMySpace - /// - public partial class ViewMySpace : UserControl - { - public ViewMySpace() - { - InitializeComponent(); - } - } -} diff --git a/src/DownKyi/Views/ViewMyToViewVideo.xaml b/src/DownKyi/Views/ViewMyToViewVideo.xaml deleted file mode 100644 index 6058057..0000000 --- a/src/DownKyi/Views/ViewMyToViewVideo.xaml +++ /dev/null @@ -1,306 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/DownKyi/Views/ViewSettings.xaml.cs b/src/DownKyi/Views/ViewSettings.xaml.cs deleted file mode 100644 index 99646f3..0000000 --- a/src/DownKyi/Views/ViewSettings.xaml.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Windows.Controls; - -namespace DownKyi.Views -{ - /// - /// Interaction logic for ViewSettings - /// - public partial class ViewSettings : UserControl - { - public ViewSettings() - { - InitializeComponent(); - } - } -} diff --git a/src/DownKyi/Views/ViewToolbox.xaml b/src/DownKyi/Views/ViewToolbox.xaml deleted file mode 100644 index 5e174ac..0000000 --- a/src/DownKyi/Views/ViewToolbox.xaml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/DownKyi/Views/ViewToolbox.xaml.cs b/src/DownKyi/Views/ViewToolbox.xaml.cs deleted file mode 100644 index 11fa7eb..0000000 --- a/src/DownKyi/Views/ViewToolbox.xaml.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Windows.Controls; - -namespace DownKyi.Views -{ - /// - /// Interaction logic for ViewTools - /// - public partial class ViewToolbox : UserControl - { - public ViewToolbox() - { - InitializeComponent(); - } - } -} diff --git a/src/DownKyi/Views/ViewUserSpace.xaml b/src/DownKyi/Views/ViewUserSpace.xaml deleted file mode 100644 index 334aa8b..0000000 --- a/src/DownKyi/Views/ViewUserSpace.xaml +++ /dev/null @@ -1,367 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/DownKyi/Views/ViewUserSpace.xaml.cs b/src/DownKyi/Views/ViewUserSpace.xaml.cs deleted file mode 100644 index 92dcb15..0000000 --- a/src/DownKyi/Views/ViewUserSpace.xaml.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Windows.Controls; - -namespace DownKyi.Views -{ - /// - /// Interaction logic for ViewUserSpace - /// - public partial class ViewUserSpace : UserControl - { - public ViewUserSpace() - { - InitializeComponent(); - } - } -} diff --git a/src/DownKyi/Views/ViewVideoDetail.xaml b/src/DownKyi/Views/ViewVideoDetail.xaml deleted file mode 100644 index fb0ce14..0000000 --- a/src/DownKyi/Views/ViewVideoDetail.xaml +++ /dev/null @@ -1,775 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -