Compare commits

...

10 Commits
v1.6.0 ... main

Author SHA1 Message Date
leiurayer
2c227d5d26 修复标题中无合法字符时崩溃的问题 #1143 2025-02-05 20:36:14 +08:00
leiurayer
e0ac25efbc Update package 2025-02-05 20:27:24 +08:00
leiurayer
1088b70cc8 Add local NuGet 2025-02-05 20:09:14 +08:00
leiurayer
d891541b4e 修复登录二维码无法显示的问题 2024-10-12 15:12:21 +08:00
leiurayer
29c6aa0375
Merge pull request #937 from yaobiao131/main
feat: 减少视频解析页面接口调用次数
2023-12-14 19:17:45 +08:00
yaobiao
6bf03de4f3 feat: 减少视频解析页面接口调用次数 2023-12-12 00:02:57 +08:00
leiurayer
0a5a13cdd6 CHANGELOG 2023-12-10 13:22:17 +08:00
leiurayer
c5db2cfb40 发布v1.6.1 2023-12-10 13:20:10 +08:00
leiurayer
6e9fef3d64 更新wbi签名算法 2023-12-10 13:03:44 +08:00
leiurayer
1a158dce32 如果存在下载完成列表,弹出选择框是否再次下载 2023-12-09 23:24:48 +08:00
27 changed files with 164 additions and 72 deletions

View File

@ -1,5 +1,10 @@
# 更新日志 # 更新日志
## `2023/12/10` v1.6.1
* [优化] 如果存在下载完成列表,弹出选择框是否再次下载。
* [修复] 更新wbi签名算法解决无法解析下载视频的问题。
## `2023/12/09` v1.6.0 ## `2023/12/09` v1.6.0
* [优化] 下载列表弹出框。 * [优化] 下载列表弹出框。

View File

@ -120,7 +120,7 @@ namespace DownKyi.Core.BiliApi.Login
public static BitmapImage GetLoginQRCode(string url) public static BitmapImage GetLoginQRCode(string url)
{ {
// 设置的参数影响app能否成功扫码 // 设置的参数影响app能否成功扫码
Bitmap qrCode = Utils.QRCode.EncodeQRCode(url, 10, 10, null, 0, 0, false); Bitmap qrCode = Utils.QRCode.EncodeQRCode(url, 12, 10, null, 0, 0, false);
MemoryStream ms = new MemoryStream(); MemoryStream ms = new MemoryStream();
qrCode.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); qrCode.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);

View File

@ -83,7 +83,7 @@ namespace DownKyi.Core.BiliApi.LoginNew
public static BitmapImage GetLoginQRCode(string url) public static BitmapImage GetLoginQRCode(string url)
{ {
// 设置的参数影响app能否成功扫码 // 设置的参数影响app能否成功扫码
Bitmap qrCode = Utils.QRCode.EncodeQRCode(url, 10, 10, null, 0, 0, false); Bitmap qrCode = Utils.QRCode.EncodeQRCode(url, 12, 10, null, 0, 0, false);
MemoryStream ms = new MemoryStream(); MemoryStream ms = new MemoryStream();
qrCode.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); qrCode.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);

View File

@ -2,6 +2,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Http;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -39,7 +40,7 @@ namespace DownKyi.Core.BiliApi.Sign
/// </summary> /// </summary>
/// <param name="parameters"></param> /// <param name="parameters"></param>
/// <returns></returns> /// <returns></returns>
public static string ParametersToQuery(Dictionary<string, object> parameters) public static string ParametersToQuery(Dictionary<string, string> parameters)
{ {
var keys = parameters.Keys.ToList(); var keys = parameters.Keys.ToList();
var queryList = new List<string>(); var queryList = new List<string>();
@ -56,9 +57,51 @@ namespace DownKyi.Core.BiliApi.Sign
/// </summary> /// </summary>
/// <param name="parameters"></param> /// <param name="parameters"></param>
/// <returns></returns> /// <returns></returns>
public static Dictionary<string, object> EncodeWbi(Dictionary<string, object> parameters) public static Dictionary<string, string> EncodeWbi(Dictionary<string, object> parameters)
{ {
return EncodeWbi(parameters, GetKey().Item1, GetKey().Item2); return EncWbi(parameters, GetKey().Item1, GetKey().Item2);
}
/// <summary>
/// Wbi签名返回所有参数字典
/// </summary>
/// <param name="parameters"></param>
/// <param name="imgKey"></param>
/// <param name="subKey"></param>
/// <returns></returns>
private static Dictionary<string, string> EncWbi(Dictionary<string, object> parameters, string imgKey, string subKey)
{
Dictionary<string, string> paraStr = new Dictionary<string, string>();
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;
} }
/// <summary> /// <summary>
@ -76,7 +119,7 @@ namespace DownKyi.Core.BiliApi.Sign
var newParameters = new Dictionary<string, object> var newParameters = new Dictionary<string, object>
{ {
{ "wts", (long)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds } { "wts", DateTimeOffset.Now.ToUnixTimeSeconds().ToString() }
}; };
foreach (var para in parameters) foreach (var para in parameters)

View File

@ -103,6 +103,7 @@ namespace DownKyi.Core.BiliApi.VideoStream
{ {
var parameters = new Dictionary<string, object> var parameters = new Dictionary<string, object>
{ {
{ "from_client", "BROWSER" },
{ "fourk", 1 }, { "fourk", 1 },
{ "fnver", 0 }, { "fnver", 0 },
{ "fnval", 4048 }, { "fnval", 4048 },

View File

@ -52,20 +52,20 @@
<Reference Include="Brotli.Core, Version=2.1.1.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Brotli.Core, Version=2.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Brotli.NET.2.1.1\lib\net45\Brotli.Core.dll</HintPath> <HintPath>..\packages\Brotli.NET.2.1.1\lib\net45\Brotli.Core.dll</HintPath>
</Reference> </Reference>
<Reference Include="Google.Protobuf, Version=3.21.12.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> <Reference Include="Google.Protobuf, Version=3.29.3.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.21.12\lib\net45\Google.Protobuf.dll</HintPath> <HintPath>..\packages\Google.Protobuf.3.29.3\lib\net45\Google.Protobuf.dll</HintPath>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />
<Reference Include="QRCoder, Version=1.4.3.0, Culture=neutral, PublicKeyToken=c4ed5b9ae8358a28, processorArchitecture=MSIL"> <Reference Include="QRCoder, Version=1.6.0.0, Culture=neutral, PublicKeyToken=c4ed5b9ae8358a28, processorArchitecture=MSIL">
<HintPath>..\packages\QRCoder.1.4.3\lib\net40\QRCoder.dll</HintPath> <HintPath>..\packages\QRCoder.1.6.0\lib\net40\QRCoder.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath> <HintPath>..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.112.1, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> <Reference Include="System.Data.SQLite, Version=1.0.112.1, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
@ -73,15 +73,15 @@
</Reference> </Reference>
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Management" /> <Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <Reference Include="System.Memory, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath> <HintPath>..\packages\System.Memory.4.6.0\lib\net462\System.Memory.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Numerics" /> <Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="System.Numerics.Vectors, Version=4.1.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath> <HintPath>..\packages\System.Numerics.Vectors.4.6.0\lib\net462\System.Numerics.Vectors.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath> <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.0\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath> <HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
@ -392,9 +392,9 @@
<Error Condition="!Exists('..\packages\Brotli.NET.2.1.1\build\Brotli.NET.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Brotli.NET.2.1.1\build\Brotli.NET.targets'))" /> <Error Condition="!Exists('..\packages\Brotli.NET.2.1.1\build\Brotli.NET.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Brotli.NET.2.1.1\build\Brotli.NET.targets'))" />
<Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.112.2\build\net40\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.112.2\build\net40\System.Data.SQLite.Core.targets'))" /> <Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.112.2\build\net40\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.112.2\build\net40\System.Data.SQLite.Core.targets'))" />
<Error Condition="!Exists('..\packages\WebPSharp.0.5.1\build\WebPSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WebPSharp.0.5.1\build\WebPSharp.targets'))" /> <Error Condition="!Exists('..\packages\WebPSharp.0.5.1\build\WebPSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WebPSharp.0.5.1\build\WebPSharp.targets'))" />
<Error Condition="!Exists('..\packages\Google.Protobuf.Tools.3.21.12\build\Google.Protobuf.Tools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Google.Protobuf.Tools.3.21.12\build\Google.Protobuf.Tools.targets'))" /> <Error Condition="!Exists('..\packages\Google.Protobuf.Tools.3.29.3\build\Google.Protobuf.Tools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Google.Protobuf.Tools.3.29.3\build\Google.Protobuf.Tools.targets'))" />
</Target> </Target>
<Import Project="..\packages\System.Data.SQLite.Core.1.0.112.2\build\net40\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.112.2\build\net40\System.Data.SQLite.Core.targets')" /> <Import Project="..\packages\System.Data.SQLite.Core.1.0.112.2\build\net40\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.112.2\build\net40\System.Data.SQLite.Core.targets')" />
<Import Project="..\packages\WebPSharp.0.5.1\build\WebPSharp.targets" Condition="Exists('..\packages\WebPSharp.0.5.1\build\WebPSharp.targets')" /> <Import Project="..\packages\WebPSharp.0.5.1\build\WebPSharp.targets" Condition="Exists('..\packages\WebPSharp.0.5.1\build\WebPSharp.targets')" />
<Import Project="..\packages\Google.Protobuf.Tools.3.21.12\build\Google.Protobuf.Tools.targets" Condition="Exists('..\packages\Google.Protobuf.Tools.3.21.12\build\Google.Protobuf.Tools.targets')" /> <Import Project="..\packages\Google.Protobuf.Tools.3.29.3\build\Google.Protobuf.Tools.targets" Condition="Exists('..\packages\Google.Protobuf.Tools.3.29.3\build\Google.Protobuf.Tools.targets')" />
</Project> </Project>

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.2.0.0")] [assembly: AssemblyVersion("2.2.1.0")]
[assembly: AssemblyFileVersion("2.2.0.0")] [assembly: AssemblyFileVersion("2.2.1.0")]

View File

@ -199,7 +199,7 @@ namespace DownKyi.Core.Utils
destName = Regex.Replace(destName, @"\p{C}+", string.Empty); destName = Regex.Replace(destName, @"\p{C}+", string.Empty);
// 如果只有空白字符、dot符 // 如果只有空白字符、dot符
if (destName == " " || destName == ".") if (string.IsNullOrWhiteSpace(destName) || destName == ".")
{ {
return "[empty title]"; return "[empty title]";
} }

View File

@ -4,11 +4,11 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-6.0.1.0" newVersion="6.0.1.0" />
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> <assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" /> <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Brotli.NET" version="2.1.1" targetFramework="net472" /> <package id="Brotli.NET" version="2.1.1" targetFramework="net472" />
<package id="Google.Protobuf" version="3.21.12" targetFramework="net472" /> <package id="Google.Protobuf" version="3.29.3" targetFramework="net472" />
<package id="Google.Protobuf.Tools" version="3.21.12" targetFramework="net472" /> <package id="Google.Protobuf.Tools" version="3.29.3" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="net472" /> <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="QRCoder" version="1.4.3" targetFramework="net472" /> <package id="QRCoder" version="1.6.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" /> <package id="System.Buffers" version="4.6.0" targetFramework="net472" />
<package id="System.Data.SQLite.Core" version="1.0.112.2" targetFramework="net472" /> <package id="System.Data.SQLite.Core" version="1.0.112.2" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" /> <package id="System.Memory" version="4.6.0" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" /> <package id="System.Numerics.Vectors" version="4.6.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" /> <package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net472" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net472" /> <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net472" />
<package id="WebPSharp" version="0.5.1" targetFramework="net472" /> <package id="WebPSharp" version="0.5.1" targetFramework="net472" />
</packages> </packages>

View File

@ -562,10 +562,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Hardcodet.NotifyIcon.Wpf"> <PackageReference Include="Hardcodet.NotifyIcon.Wpf">
<Version>1.1.0</Version> <Version>2.0.1</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Newtonsoft.Json"> <PackageReference Include="Newtonsoft.Json">
<Version>13.0.2</Version> <Version>13.0.3</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Prism.DryIoc" Version="8.1.97" /> <PackageReference Include="Prism.DryIoc" Version="8.1.97" />
<PackageReference Include="System.Data.SQLite.Core"> <PackageReference Include="System.Data.SQLite.Core">

View File

@ -144,7 +144,8 @@
<system:String x:Key="TipAlreadyToAddDownloading">已经添加到下载列表~</system:String> <system:String x:Key="TipAlreadyToAddDownloading">已经添加到下载列表~</system:String>
<system:String x:Key="TipAlreadyToAddDownloaded">已经下载完成~</system:String> <system:String x:Key="TipAlreadyToAddDownloaded">已经下载完成~</system:String>
<system:String x:Key="TipAddDownloadingZero">没有选中项符合下载要求!</system:String> <system:String x:Key="TipAlreadyToAddDownloaded2">该视频已经下载完成,是否重新下载?</system:String>
<system:String x:Key="TipAddDownloadingZero">没有添加任何视频~</system:String>
<system:String x:Key="TipAddDownloadingFinished1">成功添加了</system:String> <system:String x:Key="TipAddDownloadingFinished1">成功添加了</system:String>
<system:String x:Key="TipAddDownloadingFinished2">项~</system:String> <system:String x:Key="TipAddDownloadingFinished2">项~</system:String>

View File

@ -11,7 +11,7 @@ namespace DownKyi.Models
const int a = 1; const int a = 1;
const int b = 6; const int b = 6;
const int c = 0; const int c = 1;
public AppInfo() public AppInfo()
{ {

View File

@ -51,5 +51,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.0.0")] [assembly: AssemblyVersion("1.6.1.0")]
[assembly: AssemblyFileVersion("1.6.0.0")] [assembly: AssemblyFileVersion("1.6.1.0")]

View File

@ -67,10 +67,15 @@ namespace DownKyi.Services
{ "message", message }, { "message", message },
{ "button_number", buttonNumber } { "button_number", buttonNumber }
}; };
dialogService.ShowDialog(ViewAlertDialogViewModel.Tag, param, buttonResult =>
App.PropertyChangeAsync(() =>
{ {
result = buttonResult.Result; dialogService.ShowDialog(ViewAlertDialogViewModel.Tag, param, buttonResult =>
{
result = buttonResult.Result;
});
}); });
return result; return result;
} }

View File

@ -221,7 +221,7 @@ namespace DownKyi.Services.Download
/// <param name="directory">下载路径</param> /// <param name="directory">下载路径</param>
/// <param name="isAll">是否下载所有,包括未选中项</param> /// <param name="isAll">是否下载所有,包括未选中项</param>
/// <returns>添加的数量</returns> /// <returns>添加的数量</returns>
public int AddToDownload(IEventAggregator eventAggregator, string directory, bool isAll = false) public int AddToDownload(IEventAggregator eventAggregator, IDialogService dialogService, string directory, bool isAll = false)
{ {
if (directory == null || directory == string.Empty) { return -1; } if (directory == null || directory == string.Empty) { return -1; }
if (videoSections == null) { return -1; } if (videoSections == null) { return -1; }
@ -269,7 +269,7 @@ namespace DownKyi.Services.Download
} }
if (isDownloading) { continue; } if (isDownloading) { continue; }
// TODO 如果存在下载完成列表,弹出选择框是否再次下载 // 如果存在下载完成列表,弹出选择框是否再次下载
bool isDownloaded = false; bool isDownloaded = false;
foreach (DownloadedItem item in App.DownloadedList) foreach (DownloadedItem item in App.DownloadedList)
{ {
@ -277,8 +277,25 @@ namespace DownKyi.Services.Download
if (item.DownloadBase.Cid == page.Cid && item.Resolution.Id == page.VideoQuality.Quality && item.AudioCodec.Name == page.AudioQualityFormat && item.VideoCodecName == page.VideoQuality.SelectedVideoCodec) if (item.DownloadBase.Cid == page.Cid && item.Resolution.Id == page.VideoQuality.Quality && item.AudioCodec.Name == page.AudioQualityFormat && item.VideoCodecName == page.VideoQuality.SelectedVideoCodec)
{ {
eventAggregator.GetEvent<MessageEvent>().Publish($"{page.Name}{DictionaryResource.GetString("TipAlreadyToAddDownloaded")}"); //eventAggregator.GetEvent<MessageEvent>().Publish($"{page.Name}{DictionaryResource.GetString("TipAlreadyToAddDownloaded")}");
isDownloaded = true; //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; break;
} }
} }

View File

@ -295,7 +295,7 @@ namespace DownKyi.ViewModels
addToDownloadService.GetVideo(); addToDownloadService.GetVideo();
addToDownloadService.ParseVideo(videoInfoService); addToDownloadService.ParseVideo(videoInfoService);
// 下载 // 下载
i += addToDownloadService.AddToDownload(eventAggregator, directory); i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory);
} }
}); });

View File

@ -348,7 +348,7 @@ namespace DownKyi.ViewModels
addToDownloadService.GetVideo(); addToDownloadService.GetVideo();
addToDownloadService.ParseVideo(service); addToDownloadService.ParseVideo(service);
// 下载 // 下载
i += addToDownloadService.AddToDownload(eventAggregator, directory); i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory);
} }
}); });

View File

@ -378,7 +378,7 @@ namespace DownKyi.ViewModels
addToDownloadService.GetVideo(); addToDownloadService.GetVideo();
addToDownloadService.ParseVideo(videoInfoService); addToDownloadService.ParseVideo(videoInfoService);
// 下载 // 下载
i += addToDownloadService.AddToDownload(eventAggregator, directory); i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory);
} }
}); });

View File

@ -291,7 +291,7 @@ namespace DownKyi.ViewModels
addToDownloadService.GetVideo(); addToDownloadService.GetVideo();
addToDownloadService.ParseVideo(service); addToDownloadService.ParseVideo(service);
// 下载 // 下载
i += addToDownloadService.AddToDownload(eventAggregator, directory); i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory);
} }
}); });

View File

@ -277,7 +277,7 @@ namespace DownKyi.ViewModels
addToDownloadService.GetVideo(); addToDownloadService.GetVideo();
addToDownloadService.ParseVideo(videoInfoService); addToDownloadService.ParseVideo(videoInfoService);
// 下载 // 下载
i += addToDownloadService.AddToDownload(eventAggregator, directory); i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory);
} }
}); });

View File

@ -298,7 +298,7 @@ namespace DownKyi.ViewModels
addToDownloadService.GetVideo(); addToDownloadService.GetVideo();
addToDownloadService.ParseVideo(videoInfoService); addToDownloadService.ParseVideo(videoInfoService);
// 下载 // 下载
i += addToDownloadService.AddToDownload(eventAggregator, directory); i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory);
} }
}); });

View File

@ -332,7 +332,7 @@ namespace DownKyi.ViewModels
addToDownloadService.GetVideo(); addToDownloadService.GetVideo();
addToDownloadService.ParseVideo(videoInfoService); addToDownloadService.ParseVideo(videoInfoService);
// 下载 // 下载
i += addToDownloadService.AddToDownload(eventAggregator, directory); i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory);
} }
}); });

View File

@ -296,7 +296,7 @@ namespace DownKyi.ViewModels
addToDownloadService.GetVideo(); addToDownloadService.GetVideo();
addToDownloadService.ParseVideo(videoInfoService); addToDownloadService.ParseVideo(videoInfoService);
// 下载 // 下载
i += addToDownloadService.AddToDownload(eventAggregator, directory); i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory);
} }
}); });

View File

@ -362,7 +362,7 @@ namespace DownKyi.ViewModels
sexUri = new Uri($"pack://application:,,,/Resources/sex/female.png"); sexUri = new Uri($"pack://application:,,,/Resources/sex/female.png");
} }
// 显示vip信息 // 显示vip信息
if (userInfo.Vip.Label.Text == null || userInfo.Vip.Label.Text == "") if (userInfo.Vip == null || userInfo.Vip.Label.Text == null || userInfo.Vip.Label.Text == "")
{ {
VipTypeVisibility = Visibility.Collapsed; VipTypeVisibility = Visibility.Collapsed;
} }

View File

@ -34,6 +34,9 @@ namespace DownKyi.ViewModels
// 保存输入字符串,避免被用户修改 // 保存输入字符串,避免被用户修改
private string input = null; private string input = null;
// 保存当前页面服务减少new的开销和接口调用次数
private IInfoService infoService;
#region #region
private VectorImage arrowBack; private VectorImage arrowBack;
@ -233,7 +236,7 @@ namespace DownKyi.ViewModels
input = InputText; input = InputText;
// 更新页面 // 更新页面
UnityUpdateView(UpdateView, input, null); UnityUpdateView(UpdateView, input, null, true);
// 是否自动解析视频 // 是否自动解析视频
if (SettingsManager.GetInstance().IsAutoParseVideo() == AllowStatus.YES) if (SettingsManager.GetInstance().IsAutoParseVideo() == AllowStatus.YES)
@ -410,7 +413,7 @@ namespace DownKyi.ViewModels
{ {
LogManager.Debug(Tag, $"Video Page: {videoPage.Cid}"); LogManager.Debug(Tag, $"Video Page: {videoPage.Cid}");
UnityUpdateView(ParseVideo, input, videoPage); UnityUpdateView(ParseVideo, input, videoPage, true);
}); });
} }
catch (Exception e) catch (Exception e)
@ -635,25 +638,34 @@ namespace DownKyi.ViewModels
/// <param name="action"></param> /// <param name="action"></param>
/// <param name="input"></param> /// <param name="input"></param>
/// <param name="page"></param> /// <param name="page"></param>
private void UnityUpdateView(Action<IInfoService, VideoPage> action, string input, VideoPage page) /// <param name="force">强制new</param>
private void UnityUpdateView(Action<IInfoService, VideoPage> action, string input, VideoPage page,bool force = false)
{ {
// 视频 if (infoService == null || force)
if (ParseEntrance.IsAvUrl(input) || ParseEntrance.IsBvUrl(input))
{ {
action(new VideoInfoService(input), page); // 视频
} if (ParseEntrance.IsAvUrl(input) || ParseEntrance.IsBvUrl(input))
{
infoService = new VideoInfoService(input);
}
// 番剧(电影、电视剧) // 番剧(电影、电视剧)
if (ParseEntrance.IsBangumiSeasonUrl(input) || ParseEntrance.IsBangumiEpisodeUrl(input) || ParseEntrance.IsBangumiMediaUrl(input)) if (ParseEntrance.IsBangumiSeasonUrl(input) || ParseEntrance.IsBangumiEpisodeUrl(input) || ParseEntrance.IsBangumiMediaUrl(input))
{ {
action(new BangumiInfoService(input), page); infoService = new BangumiInfoService(input);
} }
// 课程 // 课程
if (ParseEntrance.IsCheeseSeasonUrl(input) || ParseEntrance.IsCheeseEpisodeUrl(input)) if (ParseEntrance.IsCheeseSeasonUrl(input) || ParseEntrance.IsCheeseEpisodeUrl(input))
{ {
action(new CheeseInfoService(input), page); infoService = new CheeseInfoService(input);
}
} }
if (infoService == null)
{
return;
}
action(infoService, page);
} }
/// <summary> /// <summary>
@ -773,7 +785,7 @@ namespace DownKyi.ViewModels
// 传递video对象 // 传递video对象
addToDownloadService.GetVideo(VideoInfoView, VideoSections.ToList()); addToDownloadService.GetVideo(VideoInfoView, VideoSections.ToList());
// 下载 // 下载
i = addToDownloadService.AddToDownload(eventAggregator, directory, isAll); i = addToDownloadService.AddToDownload(eventAggregator, dialogService, directory, isAll);
}); });
if (directory == null) if (directory == null)

8
src/NuGet.config Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!-- 下一行的 clear 如果取消了注释,那么就会清除掉全局的 NuGet 源,而注释掉可以继承全局 NuGet 源,只是额外添加。 -->
<!-- <clear /> -->
<add key="MyNuget" value="../third_party" />
</packageSources>
</configuration>