mirror of
https://github.com/leiurayer/downkyi.git
synced 2024-04-21 12:41:55 +00:00
修复视频BV1rr4y1i74o无法加载的问题
This commit is contained in:
@@ -72,6 +72,8 @@ namespace DownKyi.Core.Storage.Database
|
||||
/// </summary>
|
||||
public void Open()
|
||||
{
|
||||
if (conn == null) { return; }
|
||||
|
||||
if (!IsOpen())
|
||||
{
|
||||
conn.Open();
|
||||
@@ -83,6 +85,8 @@ namespace DownKyi.Core.Storage.Database
|
||||
/// </summary>
|
||||
public void Close()
|
||||
{
|
||||
if (conn == null) { return; }
|
||||
|
||||
if (IsOpen())
|
||||
{
|
||||
conn.Close();
|
||||
@@ -97,6 +101,8 @@ namespace DownKyi.Core.Storage.Database
|
||||
/// <param name="sql"></param>
|
||||
public void ExecuteNonQuery(string sql, Action<SQLiteParameterCollection> action = null)
|
||||
{
|
||||
if (conn == null) { return; }
|
||||
|
||||
try
|
||||
{
|
||||
lock (conn)
|
||||
@@ -129,6 +135,8 @@ namespace DownKyi.Core.Storage.Database
|
||||
/// <param name="action"></param>
|
||||
public void ExecuteQuery(string sql, Action<SQLiteDataReader> action)
|
||||
{
|
||||
if (conn == null) { return; }
|
||||
|
||||
try
|
||||
{
|
||||
lock (conn)
|
||||
|
||||
@@ -44,10 +44,30 @@ namespace DownKyi.Core.Storage
|
||||
{
|
||||
if (cover == null) { return null; }
|
||||
|
||||
Bitmap bitmap = new Bitmap(cover);
|
||||
Image thumbnail = bitmap.GetThumbnailImage(width, height, null, IntPtr.Zero);
|
||||
try
|
||||
{
|
||||
Bitmap bitmap = new Bitmap(cover);
|
||||
Image thumbnail = bitmap.GetThumbnailImage(width, height, null, IntPtr.Zero);
|
||||
|
||||
return StorageUtils.BitmapToBitmapImage(new Bitmap(thumbnail));
|
||||
return StorageUtils.BitmapToBitmapImage(new Bitmap(thumbnail));
|
||||
}
|
||||
catch (ArgumentException e)
|
||||
{
|
||||
Utils.Debugging.Console.PrintLine(cover);
|
||||
Utils.Debugging.Console.PrintLine("GetCoverThumbnail()发生异常: {0}", e);
|
||||
|
||||
LogManager.Error("StorageCover.GetCoverThumbnail()", cover);
|
||||
LogManager.Error("StorageCover.GetCoverThumbnail()", e);
|
||||
|
||||
return null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.Debugging.Console.PrintLine("GetCoverThumbnail()发生异常: {0}", e);
|
||||
LogManager.Error("StorageCover.GetCoverThumbnail()", e);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -44,10 +44,30 @@ namespace DownKyi.Core.Storage
|
||||
{
|
||||
if (header == null) { return null; }
|
||||
|
||||
var bitmap = new Bitmap(header);
|
||||
var thumbnail = bitmap.GetThumbnailImage(width, height, null, IntPtr.Zero);
|
||||
try
|
||||
{
|
||||
Bitmap bitmap = new Bitmap(header);
|
||||
Image thumbnail = bitmap.GetThumbnailImage(width, height, null, IntPtr.Zero);
|
||||
|
||||
return StorageUtils.BitmapToBitmapImage(new Bitmap(thumbnail));
|
||||
return StorageUtils.BitmapToBitmapImage(new Bitmap(thumbnail));
|
||||
}
|
||||
catch (ArgumentException e)
|
||||
{
|
||||
Utils.Debugging.Console.PrintLine(header);
|
||||
Utils.Debugging.Console.PrintLine("GetHeaderThumbnail()发生异常: {0}", e);
|
||||
|
||||
LogManager.Error("StorageHeader.GetHeaderThumbnail()", header);
|
||||
LogManager.Error("StorageHeader.GetHeaderThumbnail()", e);
|
||||
|
||||
return null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.Debugging.Console.PrintLine("GetHeaderThumbnail()发生异常: {0}", e);
|
||||
LogManager.Error("StorageHeader.GetHeaderThumbnail()", e);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -58,7 +78,7 @@ namespace DownKyi.Core.Storage
|
||||
public string GetHeader(long mid, string name, string url)
|
||||
{
|
||||
HeaderDb headerDb = new HeaderDb();
|
||||
var header = headerDb.QueryByMid(mid);
|
||||
Header header = headerDb.QueryByMid(mid);
|
||||
|
||||
if (header != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user