mirror of
https://github.com/leiurayer/downkyi.git
synced 2025-01-14 13:50:33 +08:00
发布v1.5.0-alpha3
This commit is contained in:
parent
cf41095725
commit
0caa3a6629
@ -1,5 +1,10 @@
|
||||
# 更新日志
|
||||
|
||||
* `2022/03/12` v1.5.0-alpha3
|
||||
1. [修复] 当用户性别为保密时,程序闪退的问题。
|
||||
2. [修复] 批量下载UP主视频时,程序偶尔闪退的问题。
|
||||
3. [修复] 其他已知问题。
|
||||
|
||||
* `2022/03/07` v1.5.0-alpha2
|
||||
1. [优化] 重构程序架构,解决一些已知问题。
|
||||
2. [优化] 界面UI的显示与操作。
|
||||
|
12
README.md
12
README.md
@ -9,16 +9,14 @@
|
||||
|
||||
[全部更新日志](CHANGELOG.md)
|
||||
|
||||
* `2022/03/07` v1.5.0-alpha2
|
||||
1. [优化] 重构程序架构,解决一些已知问题。
|
||||
2. [优化] 界面UI的显示与操作。
|
||||
3. [新增] 文件命名格式:avid、bvid、cid、UP主信息、视频发布时间。
|
||||
4. [修复] 视频音质列表导致的闪退问题。
|
||||
5. [修复] 图片下载导致的闪退问题。
|
||||
* `2022/03/12` v1.5.0-alpha3
|
||||
1. [修复] 当用户性别为保密时,程序闪退的问题。
|
||||
2. [修复] 批量下载UP主视频时,程序偶尔闪退的问题。
|
||||
3. [修复] 其他已知问题。
|
||||
|
||||
## 下载
|
||||
|
||||
- [哔哩下载姬最新版](https://github.com/FlySelfLog/downkyi/releases/download/v1.5.0-alpha2/DownKyi-1.5.0-alpha2.zip)
|
||||
- [哔哩下载姬最新版](https://github.com/FlySelfLog/downkyi/releases/download/v1.5.0-alpha3/DownKyi-1.5.0-alpha3.zip)
|
||||
|
||||
- [下载页面](https://github.com/FlySelfLog/downkyi/releases)
|
||||
|
||||
|
@ -7,6 +7,6 @@
|
||||
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; }
|
||||
public UserInfoSettings UserInfo { get; set; } = new UserInfoSettings();
|
||||
}
|
||||
}
|
||||
|
@ -82,16 +82,16 @@ namespace DownKyi.Core.Settings
|
||||
/// <returns></returns>
|
||||
private bool SetSettings()
|
||||
{
|
||||
string json = JsonConvert.SerializeObject(appSettings);
|
||||
try
|
||||
{
|
||||
string json = JsonConvert.SerializeObject(appSettings);
|
||||
|
||||
#if DEBUG
|
||||
#else
|
||||
// 加密字符串
|
||||
json = Encryptor.EncryptString(json, password);
|
||||
// 加密字符串
|
||||
json = Encryptor.EncryptString(json, password);
|
||||
#endif
|
||||
|
||||
try
|
||||
{
|
||||
File.WriteAllText(settingsName, json);
|
||||
return true;
|
||||
}
|
||||
|
@ -7,9 +7,14 @@ namespace DownKyi.Core.Storage.Database
|
||||
public class CoverDb
|
||||
{
|
||||
private const string key = "b5018ecc-09d1-4da2-aa49-4625e41e623e";
|
||||
private readonly DbHelper dbHelper = new DbHelper(StorageManager.GetCoverIndex(), key);
|
||||
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();
|
||||
@ -103,21 +108,30 @@ namespace DownKyi.Core.Storage.Database
|
||||
{
|
||||
List<Cover> covers = new List<Cover>();
|
||||
|
||||
dbHelper.ExecuteQuery(sql, reader =>
|
||||
try
|
||||
{
|
||||
while (reader.Read())
|
||||
dbHelper.ExecuteQuery(sql, reader =>
|
||||
{
|
||||
Cover cover = new Cover
|
||||
while (reader.Read())
|
||||
{
|
||||
Avid = (long)reader["avid"],
|
||||
Bvid = (string)reader["bvid"],
|
||||
Cid = (long)reader["cid"],
|
||||
Url = (string)reader["url"],
|
||||
Md5 = (string)reader["md5"]
|
||||
};
|
||||
covers.Add(cover);
|
||||
}
|
||||
});
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace DownKyi.Core.Storage.Database.Download
|
||||
protected string tableName = "download";
|
||||
|
||||
#if DEBUG
|
||||
private readonly DbHelper dbHelper = new DbHelper(StorageManager.GetDownload().Replace(".db","_debug.db"));
|
||||
private readonly DbHelper dbHelper = new DbHelper(StorageManager.GetDownload().Replace(".db", "_debug.db"));
|
||||
#else
|
||||
private readonly DbHelper dbHelper = new DbHelper(StorageManager.GetDownload(), key);
|
||||
#endif
|
||||
@ -33,25 +33,25 @@ namespace DownKyi.Core.Storage.Database.Download
|
||||
/// <param name="obj"></param>
|
||||
public void Insert(string uuid, object obj)
|
||||
{
|
||||
// 定义一个流
|
||||
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();
|
||||
|
||||
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<SQLiteParameterCollection>((para) =>
|
||||
{
|
||||
@ -86,25 +86,25 @@ namespace DownKyi.Core.Storage.Database.Download
|
||||
|
||||
public void Update(string uuid, object obj)
|
||||
{
|
||||
// 定义一个流
|
||||
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();
|
||||
|
||||
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<SQLiteParameterCollection>((para) =>
|
||||
{
|
||||
@ -160,22 +160,31 @@ namespace DownKyi.Core.Storage.Database.Download
|
||||
{
|
||||
Dictionary<string, object> objects = new Dictionary<string, object>();
|
||||
|
||||
dbHelper.ExecuteQuery(sql, reader =>
|
||||
try
|
||||
{
|
||||
while (reader.Read())
|
||||
dbHelper.ExecuteQuery(sql, reader =>
|
||||
{
|
||||
// 读取字节数组
|
||||
byte[] array = (byte[])reader["data"];
|
||||
// 定义一个流
|
||||
MemoryStream stream = new MemoryStream(array);
|
||||
//定义一个格式化器
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
// 反序列化
|
||||
object obj = formatter.Deserialize(stream);
|
||||
while (reader.Read())
|
||||
{
|
||||
// 读取字节数组
|
||||
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);
|
||||
}
|
||||
|
||||
objects.Add((string)reader["id"], obj);
|
||||
}
|
||||
});
|
||||
return objects;
|
||||
}
|
||||
|
||||
|
@ -7,9 +7,14 @@ namespace DownKyi.Core.Storage.Database
|
||||
public class HeaderDb
|
||||
{
|
||||
private const string key = "7c1f1f40-7cdf-4d11-ad28-f0137a3c5308";
|
||||
private readonly DbHelper dbHelper = new DbHelper(StorageManager.GetHeaderIndex(), key);
|
||||
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();
|
||||
@ -90,20 +95,29 @@ namespace DownKyi.Core.Storage.Database
|
||||
{
|
||||
List<Header> headers = new List<Header>();
|
||||
|
||||
dbHelper.ExecuteQuery(sql, reader =>
|
||||
try
|
||||
{
|
||||
while (reader.Read())
|
||||
dbHelper.ExecuteQuery(sql, reader =>
|
||||
{
|
||||
Header header = new Header
|
||||
while (reader.Read())
|
||||
{
|
||||
Mid = (long)reader["mid"],
|
||||
Name = (string)reader["name"],
|
||||
Url = (string)reader["url"],
|
||||
Md5 = (string)reader["md5"]
|
||||
};
|
||||
headers.Add(header);
|
||||
}
|
||||
});
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
using System.IO;
|
||||
using DownKyi.Core.Logging;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace DownKyi.Core.Utils
|
||||
{
|
||||
@ -11,17 +13,26 @@ namespace DownKyi.Core.Utils
|
||||
/// <returns></returns>
|
||||
public static long GetHardDiskSpace(string hardDiskName)
|
||||
{
|
||||
long totalSize = new long();
|
||||
hardDiskName = $"{hardDiskName}:\\";
|
||||
DriveInfo[] drives = DriveInfo.GetDrives();
|
||||
long totalSize = 0;
|
||||
|
||||
foreach (DriveInfo drive in drives)
|
||||
try
|
||||
{
|
||||
if (drive.Name == hardDiskName)
|
||||
hardDiskName = $"{hardDiskName}:\\";
|
||||
DriveInfo[] drives = DriveInfo.GetDrives();
|
||||
|
||||
foreach (DriveInfo drive in drives)
|
||||
{
|
||||
totalSize = drive.TotalSize;
|
||||
if (drive.Name == hardDiskName)
|
||||
{
|
||||
totalSize = drive.TotalSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debugging.Console.PrintLine("GetHardDiskSpace()发生异常: {0}", e);
|
||||
LogManager.Error("HardDisk", e);
|
||||
}
|
||||
|
||||
return totalSize;
|
||||
}
|
||||
@ -33,17 +44,25 @@ namespace DownKyi.Core.Utils
|
||||
/// <returns></returns>
|
||||
public static long GetHardDiskFreeSpace(string hardDiskName)
|
||||
{
|
||||
long freeSpace = new long();
|
||||
hardDiskName = $"{hardDiskName}:\\";
|
||||
DriveInfo[] drives = DriveInfo.GetDrives();
|
||||
|
||||
foreach (DriveInfo drive in drives)
|
||||
long freeSpace = 0;
|
||||
try
|
||||
{
|
||||
if (drive.Name == hardDiskName)
|
||||
hardDiskName = $"{hardDiskName}:\\";
|
||||
DriveInfo[] drives = DriveInfo.GetDrives();
|
||||
|
||||
foreach (DriveInfo drive in drives)
|
||||
{
|
||||
freeSpace = drive.TotalFreeSpace;
|
||||
if (drive.Name == hardDiskName)
|
||||
{
|
||||
freeSpace = drive.TotalFreeSpace;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debugging.Console.PrintLine("GetHardDiskFreeSpace()发生异常: {0}", e);
|
||||
LogManager.Error("HardDisk", e);
|
||||
}
|
||||
|
||||
return freeSpace;
|
||||
}
|
||||
|
@ -3,12 +3,12 @@
|
||||
public class AppInfo
|
||||
{
|
||||
public string Name { get; } = "哔哩下载姬";
|
||||
public int VersionCode { get; } = 501;
|
||||
public int VersionCode { get; } = 502;
|
||||
|
||||
#if DEBUG
|
||||
public string VersionName { get; } = "1.5.0-alpha2 Debug";
|
||||
public string VersionName { get; } = "1.5.0-alpha3 Debug";
|
||||
#else
|
||||
public string VersionName { get; } = "1.5.0-alpha2";
|
||||
public string VersionName { get; } = "1.5.0-alpha3";
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -173,6 +173,32 @@ namespace DownKyi.Services
|
||||
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,
|
||||
};
|
||||
}
|
||||
|
||||
// 视频发布时间
|
||||
DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区
|
||||
DateTime dateTime = startTime.AddSeconds(episode.PubTime);
|
||||
page.PublishTime = dateTime.ToString("yyyy-MM-dd");
|
||||
|
||||
pages.Add(page);
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ namespace DownKyi.Services.Download
|
||||
// 下载设置dialog中如果点击取消或者关闭窗口,
|
||||
// 会返回空字符串,
|
||||
// 这时直接退出
|
||||
if (directory == string.Empty) { return null; }
|
||||
if (directory == null || directory == string.Empty) { return null; }
|
||||
|
||||
// 文件夹不存在则创建
|
||||
if (!Directory.Exists(directory))
|
||||
@ -207,6 +207,8 @@ namespace DownKyi.Services.Download
|
||||
// 添加到下载
|
||||
foreach (VideoSection section in videoSections)
|
||||
{
|
||||
if (section.VideoPages == null) { continue; }
|
||||
|
||||
foreach (VideoPage page in section.VideoPages)
|
||||
{
|
||||
// 只下载选中项,跳过未选中项
|
||||
@ -338,49 +340,49 @@ namespace DownKyi.Services.Download
|
||||
break;
|
||||
}
|
||||
|
||||
// 如果不存在,直接添加到下载列表
|
||||
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.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);
|
||||
}));
|
||||
|
@ -138,6 +138,28 @@ namespace DownKyi.Services
|
||||
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,
|
||||
};
|
||||
}
|
||||
|
||||
// 视频发布时间
|
||||
DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区
|
||||
DateTime dateTime = startTime.AddSeconds(videoView.Pubdate);
|
||||
page.PublishTime = dateTime.ToString("yyyy-MM-dd");
|
||||
// 这里的发布时间有问题,
|
||||
// 如果是合集,也会执行这里,
|
||||
// 但是发布时间是入口视频的,不是所有视频的
|
||||
// TODO 修复
|
||||
|
||||
pages.Add(page);
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ namespace DownKyi.ViewModels.Dialogs
|
||||
{
|
||||
SetProperty(ref directory, value);
|
||||
|
||||
if (directory != string.Empty)
|
||||
if (directory != null && directory != string.Empty)
|
||||
{
|
||||
DriveName = directory.Substring(0, 1).ToUpper();
|
||||
DriveNameFreeSpace = Format.FormatFileSize(HardDisk.GetHardDiskFreeSpace(DriveName));
|
||||
@ -381,7 +381,7 @@ namespace DownKyi.ViewModels.Dialogs
|
||||
|
||||
// 弹出选择下载目录的窗口
|
||||
path = DialogUtils.SetDownloadDirectory();
|
||||
if (path == null || path == "")
|
||||
if (path == null || path == string.Empty)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ namespace DownKyi.ViewModels
|
||||
}
|
||||
|
||||
// 通知用户添加到下载列表的结果
|
||||
if (i == 0)
|
||||
if (i <= 0)
|
||||
{
|
||||
eventAggregator.GetEvent<MessageEvent>().Publish(DictionaryResource.GetString("TipAddDownloadingZero"));
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ namespace DownKyi.ViewModels
|
||||
}
|
||||
|
||||
// 通知用户添加到下载列表的结果
|
||||
if (i == 0)
|
||||
if (i <= 0)
|
||||
{
|
||||
eventAggregator.GetEvent<MessageEvent>().Publish(DictionaryResource.GetString("TipAddDownloadingZero"));
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ namespace DownKyi.ViewModels
|
||||
}
|
||||
|
||||
// 通知用户添加到下载列表的结果
|
||||
if (i == 0)
|
||||
if (i <= 0)
|
||||
{
|
||||
eventAggregator.GetEvent<MessageEvent>().Publish(DictionaryResource.GetString("TipAddDownloadingZero"));
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ namespace DownKyi.ViewModels
|
||||
}
|
||||
|
||||
// 通知用户添加到下载列表的结果
|
||||
if (i == 0)
|
||||
if (i <= 0)
|
||||
{
|
||||
eventAggregator.GetEvent<MessageEvent>().Publish(DictionaryResource.GetString("TipAddDownloadingZero"));
|
||||
}
|
||||
|
@ -526,7 +526,7 @@ namespace DownKyi.ViewModels
|
||||
StorageHeader storageHeader = new StorageHeader();
|
||||
Header = storageHeader.GetHeaderThumbnail(headerUri, 64, 64);
|
||||
// 性别
|
||||
Sex = new BitmapImage(sexUri);
|
||||
Sex = sexUri == null ? null : new BitmapImage(sexUri);
|
||||
// 等级
|
||||
Level = new BitmapImage(levelUri);
|
||||
|
||||
|
@ -258,7 +258,7 @@ namespace DownKyi.ViewModels
|
||||
}
|
||||
|
||||
// 通知用户添加到下载列表的结果
|
||||
if (i == 0)
|
||||
if (i <= 0)
|
||||
{
|
||||
eventAggregator.GetEvent<MessageEvent>().Publish(DictionaryResource.GetString("TipAddDownloadingZero"));
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ namespace DownKyi.ViewModels
|
||||
}
|
||||
|
||||
// 通知用户添加到下载列表的结果
|
||||
if (i == 0)
|
||||
if (i <= 0)
|
||||
{
|
||||
eventAggregator.GetEvent<MessageEvent>().Publish(DictionaryResource.GetString("TipAddDownloadingZero"));
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ namespace DownKyi.ViewModels
|
||||
}
|
||||
|
||||
// 通知用户添加到下载列表的结果
|
||||
if (i == 0)
|
||||
if (i <= 0)
|
||||
{
|
||||
eventAggregator.GetEvent<MessageEvent>().Publish(DictionaryResource.GetString("TipAddDownloadingZero"));
|
||||
}
|
||||
|
@ -29,6 +29,9 @@ namespace DownKyi.ViewModels
|
||||
|
||||
private readonly IDialogService dialogService;
|
||||
|
||||
// 保存输入字符串,避免被用户修改
|
||||
private string input;
|
||||
|
||||
#region 页面属性申明
|
||||
|
||||
private VectorImage arrowBack;
|
||||
@ -184,8 +187,10 @@ namespace DownKyi.ViewModels
|
||||
|
||||
LogManager.Debug(Tag, $"InputText: {InputText}");
|
||||
|
||||
input = InputText;
|
||||
|
||||
// 更新页面
|
||||
UnityUpdateView(UpdateView, InputText, null);
|
||||
UnityUpdateView(UpdateView, input, null);
|
||||
|
||||
// 是否自动解析视频
|
||||
if (SettingsManager.GetInstance().IsAutoParseVideo() == AllowStatus.YES)
|
||||
@ -362,7 +367,7 @@ namespace DownKyi.ViewModels
|
||||
{
|
||||
LogManager.Debug(Tag, $"Video Page: {videoPage.Cid}");
|
||||
|
||||
UnityUpdateView(ParseVideo, null, videoPage);
|
||||
UnityUpdateView(ParseVideo, input, videoPage);
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -430,12 +435,10 @@ namespace DownKyi.ViewModels
|
||||
{
|
||||
foreach (VideoPage page in section.VideoPages)
|
||||
{
|
||||
//VideoPage videoPage = section.VideoPages.FirstOrDefault(t => t == page);
|
||||
|
||||
if (page.IsSelected)
|
||||
{
|
||||
// 执行解析任务
|
||||
UnityUpdateView(ParseVideo, null, page);
|
||||
UnityUpdateView(ParseVideo, input, page);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -447,10 +450,8 @@ namespace DownKyi.ViewModels
|
||||
{
|
||||
foreach (VideoPage page in section.VideoPages)
|
||||
{
|
||||
//VideoPage videoPage = section.VideoPages.FirstOrDefault(t => t == page);
|
||||
|
||||
// 执行解析任务
|
||||
UnityUpdateView(ParseVideo, null, page);
|
||||
UnityUpdateView(ParseVideo, input, page);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -460,10 +461,8 @@ namespace DownKyi.ViewModels
|
||||
{
|
||||
foreach (VideoPage page in section.VideoPages)
|
||||
{
|
||||
//VideoPage videoPage = section.VideoPages.FirstOrDefault(t => t == page);
|
||||
|
||||
// 执行解析任务
|
||||
UnityUpdateView(ParseVideo, null, page);
|
||||
UnityUpdateView(ParseVideo, input, page);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -503,20 +502,24 @@ namespace DownKyi.ViewModels
|
||||
{
|
||||
AddToDownloadService addToDownloadService = null;
|
||||
// 视频
|
||||
if (ParseEntrance.IsAvUrl(InputText) || ParseEntrance.IsBvUrl(InputText))
|
||||
if (ParseEntrance.IsAvUrl(input) || ParseEntrance.IsBvUrl(input))
|
||||
{
|
||||
addToDownloadService = new AddToDownloadService(PlayStreamType.VIDEO);
|
||||
}
|
||||
// 番剧(电影、电视剧)
|
||||
if (ParseEntrance.IsBangumiSeasonUrl(InputText) || ParseEntrance.IsBangumiEpisodeUrl(InputText) || ParseEntrance.IsBangumiMediaUrl(InputText))
|
||||
else if (ParseEntrance.IsBangumiSeasonUrl(input) || ParseEntrance.IsBangumiEpisodeUrl(input) || ParseEntrance.IsBangumiMediaUrl(input))
|
||||
{
|
||||
addToDownloadService = new AddToDownloadService(PlayStreamType.BANGUMI);
|
||||
}
|
||||
// 课程
|
||||
if (ParseEntrance.IsCheeseSeasonUrl(InputText) || ParseEntrance.IsCheeseEpisodeUrl(InputText))
|
||||
else if (ParseEntrance.IsCheeseSeasonUrl(input) || ParseEntrance.IsCheeseEpisodeUrl(input))
|
||||
{
|
||||
addToDownloadService = new AddToDownloadService(PlayStreamType.CHEESE);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 选择文件夹
|
||||
string directory = addToDownloadService.SetDirectory(dialogService);
|
||||
@ -531,8 +534,13 @@ namespace DownKyi.ViewModels
|
||||
i = addToDownloadService.AddToDownload(eventAggregator, directory);
|
||||
});
|
||||
|
||||
if (directory == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 通知用户添加到下载列表的结果
|
||||
if (i == 0)
|
||||
if (i <= 0)
|
||||
{
|
||||
eventAggregator.GetEvent<MessageEvent>().Publish(DictionaryResource.GetString("TipAddDownloadingZero"));
|
||||
}
|
||||
@ -578,19 +586,19 @@ namespace DownKyi.ViewModels
|
||||
private void UnityUpdateView(Action<IInfoService, VideoPage> action, string input, VideoPage page)
|
||||
{
|
||||
// 视频
|
||||
if (ParseEntrance.IsAvUrl(InputText) || ParseEntrance.IsBvUrl(InputText))
|
||||
if (ParseEntrance.IsAvUrl(input) || ParseEntrance.IsBvUrl(input))
|
||||
{
|
||||
action(new VideoInfoService(input), page);
|
||||
}
|
||||
|
||||
// 番剧(电影、电视剧)
|
||||
if (ParseEntrance.IsBangumiSeasonUrl(InputText) || ParseEntrance.IsBangumiEpisodeUrl(InputText) || ParseEntrance.IsBangumiMediaUrl(InputText))
|
||||
if (ParseEntrance.IsBangumiSeasonUrl(input) || ParseEntrance.IsBangumiEpisodeUrl(input) || ParseEntrance.IsBangumiMediaUrl(input))
|
||||
{
|
||||
action(new BangumiInfoService(input), page);
|
||||
}
|
||||
|
||||
// 课程
|
||||
if (ParseEntrance.IsCheeseSeasonUrl(InputText) || ParseEntrance.IsCheeseEpisodeUrl(InputText))
|
||||
if (ParseEntrance.IsCheeseSeasonUrl(input) || ParseEntrance.IsCheeseEpisodeUrl(input))
|
||||
{
|
||||
action(new CheeseInfoService(input), page);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user