Debug修改为Debugging

croire 3 years ago
parent c41c81db3d
commit c63597efbd

@ -69,7 +69,7 @@ namespace DownKyi.Core.Aria2cNet
} }
if (status.Result.Result.ErrorCode != null && status.Result.Result.ErrorCode != "0") if (status.Result.Result.ErrorCode != null && status.Result.Result.ErrorCode != "0")
{ {
Utils.Debug.Console.PrintLine("ErrorMessage: " + status.Result.Result.ErrorMessage); Utils.Debugging.Console.PrintLine("ErrorMessage: " + status.Result.Result.ErrorMessage);
LogManager.Error("AriaManager", status.Result.Result.ErrorMessage); LogManager.Error("AriaManager", status.Result.Result.ErrorMessage);
//// 如果返回状态码不是200则继续 //// 如果返回状态码不是200则继续
@ -81,7 +81,7 @@ namespace DownKyi.Core.Aria2cNet
// aira中删除记录 // aira中删除记录
var ariaRemove1 = AriaClient.RemoveDownloadResultAsync(gid); var ariaRemove1 = AriaClient.RemoveDownloadResultAsync(gid);
Utils.Debug.Console.PrintLine(ariaRemove1); Utils.Debugging.Console.PrintLine(ariaRemove1);
LogManager.Debug("AriaManager", ariaRemove1.Result.Result); LogManager.Debug("AriaManager", ariaRemove1.Result.Result);
// 返回回调信息,退出函数 // 返回回调信息,退出函数

@ -1093,7 +1093,7 @@ namespace DownKyi.Core.Aria2cNet.Client
} }
catch (WebException e) catch (WebException e)
{ {
Utils.Debug.Console.PrintLine("Request()发生Web异常: {0}", e); Utils.Debugging.Console.PrintLine("Request()发生Web异常: {0}", e);
LogManager.Error("AriaClient", e); LogManager.Error("AriaClient", e);
//return Request(url, parameters, retry - 1); //return Request(url, parameters, retry - 1);
@ -1114,13 +1114,13 @@ namespace DownKyi.Core.Aria2cNet.Client
} }
catch (IOException e) catch (IOException e)
{ {
Utils.Debug.Console.PrintLine("Request()发生IO异常: {0}", e); Utils.Debugging.Console.PrintLine("Request()发生IO异常: {0}", e);
LogManager.Error("AriaClient", e); LogManager.Error("AriaClient", e);
return Request(url, parameters, retry - 1); return Request(url, parameters, retry - 1);
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("Request()发生其他异常: {0}", e); Utils.Debugging.Console.PrintLine("Request()发生其他异常: {0}", e);
LogManager.Error("AriaClient", e); LogManager.Error("AriaClient", e);
return Request(url, parameters, retry - 1); return Request(url, parameters, retry - 1);
} }

@ -71,7 +71,7 @@ namespace DownKyi.Core.Aria2cNet.Server
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("StartServerAsync()发生其他异常: {0}", e); Utils.Debugging.Console.PrintLine("StartServerAsync()发生其他异常: {0}", e);
LogManager.Error("AriaServer", e); LogManager.Error("AriaServer", e);
} }
} }
@ -111,7 +111,7 @@ namespace DownKyi.Core.Aria2cNet.Server
null, (s, e) => null, (s, e) =>
{ {
if (e.Data == null || e.Data == "" || e.Data.Replace(" ", "") == "") { return; } if (e.Data == null || e.Data == "" || e.Data.Replace(" ", "") == "") { return; }
Utils.Debug.Console.PrintLine(e.Data); Utils.Debugging.Console.PrintLine(e.Data);
LogManager.Debug("AriaServer", e.Data); LogManager.Debug("AriaServer", e.Data);
if (output != null && window != null) if (output != null && window != null)
@ -196,7 +196,7 @@ namespace DownKyi.Core.Aria2cNet.Server
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("KillServer()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("KillServer()发生异常: {0}", e);
LogManager.Error("AriaServer", e); LogManager.Error("AriaServer", e);
} }
} }

@ -27,7 +27,7 @@ namespace DownKyi.Core.BiliApi.Bangumi
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("BangumiMediaInfo()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("BangumiMediaInfo()发生异常: {0}", e);
LogManager.Error("BangumiInfo", e); LogManager.Error("BangumiInfo", e);
return null; return null;
} }
@ -58,7 +58,7 @@ namespace DownKyi.Core.BiliApi.Bangumi
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("BangumiSeasonInfo()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("BangumiSeasonInfo()发生异常: {0}", e);
LogManager.Error("BangumiInfo", e); LogManager.Error("BangumiInfo", e);
return null; return null;
} }

@ -33,7 +33,7 @@ namespace DownKyi.Core.BiliApi.Cheese
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("CheeseViewInfo()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("CheeseViewInfo()发生异常: {0}", e);
LogManager.Error("CheeseInfo", e); LogManager.Error("CheeseInfo", e);
return null; return null;
} }
@ -60,7 +60,7 @@ namespace DownKyi.Core.BiliApi.Cheese
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("CheeseEpisodeList()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("CheeseEpisodeList()发生异常: {0}", e);
LogManager.Error("CheeseInfo", e); LogManager.Error("CheeseInfo", e);
return null; return null;
} }

@ -35,7 +35,7 @@ namespace DownKyi.Core.BiliApi.Danmaku
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("GetDanmakuProto()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("GetDanmakuProto()发生异常: {0}", e);
//Logging.LogManager.Error(e); //Logging.LogManager.Error(e);
} }
@ -72,7 +72,7 @@ namespace DownKyi.Core.BiliApi.Danmaku
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("GetDanmakuProto()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("GetDanmakuProto()发生异常: {0}", e);
//Logging.LogManager.Error(e); //Logging.LogManager.Error(e);
return null; return null;
} }

@ -30,7 +30,7 @@ namespace DownKyi.Core.BiliApi.Favorites
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("GetFavoritesInfo()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("GetFavoritesInfo()发生异常: {0}", e);
LogManager.Error("FavoritesInfo", e); LogManager.Error("FavoritesInfo", e);
return null; return null;
} }

@ -38,7 +38,7 @@ namespace DownKyi.Core.BiliApi.Login
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("SaveLoginInfoCookies()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("SaveLoginInfoCookies()发生异常: {0}", e);
Logging.LogManager.Error(e); Logging.LogManager.Error(e);
return false; return false;
} }
@ -70,7 +70,7 @@ namespace DownKyi.Core.BiliApi.Login
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("GetLoginInfoCookies()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("GetLoginInfoCookies()发生异常: {0}", e);
Logging.LogManager.Error(e); Logging.LogManager.Error(e);
if (File.Exists(tempFile)) if (File.Exists(tempFile))
{ {
@ -135,7 +135,7 @@ namespace DownKyi.Core.BiliApi.Login
} }
catch (IOException e) catch (IOException e)
{ {
Utils.Debug.Console.PrintLine("Logout()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("Logout()发生异常: {0}", e);
Logging.LogManager.Error(e); Logging.LogManager.Error(e);
return false; return false;
} }

@ -31,7 +31,7 @@ namespace DownKyi.Core.BiliApi.Login
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("GetUserInfoForNavigation()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("GetUserInfoForNavigation()发生异常: {0}", e);
LogManager.Error("LoginInfo", e); LogManager.Error("LoginInfo", e);
return null; return null;
} }

@ -31,7 +31,7 @@ namespace DownKyi.Core.BiliApi.Login
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("GetLoginUrl()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("GetLoginUrl()发生异常: {0}", e);
LogManager.Error("LoginQR", e); LogManager.Error("LoginQR", e);
return null; return null;
} }
@ -86,7 +86,7 @@ namespace DownKyi.Core.BiliApi.Login
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("GetLoginInfo()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("GetLoginInfo()发生异常: {0}", e);
LogManager.Error("LoginQR", e); LogManager.Error("LoginQR", e);
return null; return null;
} }
@ -106,7 +106,7 @@ namespace DownKyi.Core.BiliApi.Login
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("GetLoginQRCode()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("GetLoginQRCode()发生异常: {0}", e);
LogManager.Error("LoginQR", e); LogManager.Error("LoginQR", e);
return null; return null;
} }

@ -30,7 +30,7 @@ namespace DownKyi.Core.BiliApi.Video
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("RegionDynamicList()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("RegionDynamicList()发生异常: {0}", e);
LogManager.Error("Dynamic", e); LogManager.Error("Dynamic", e);
return null; return null;
} }

@ -30,7 +30,7 @@ namespace DownKyi.Core.BiliApi.Video
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("RegionRankingList()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("RegionRankingList()发生异常: {0}", e);
LogManager.Error("Ranking", e); LogManager.Error("Ranking", e);
return null; return null;
} }

@ -33,7 +33,7 @@ namespace DownKyi.Core.BiliApi.Video
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("VideoInfo()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("VideoInfo()发生异常: {0}", e);
LogManager.Error("VideoInfo", e); LogManager.Error("VideoInfo", e);
return null; return null;
} }
@ -64,7 +64,7 @@ namespace DownKyi.Core.BiliApi.Video
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("VideoDescription()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("VideoDescription()发生异常: {0}", e);
LogManager.Error("VideoInfo", e); LogManager.Error("VideoInfo", e);
return null; return null;
} }
@ -95,7 +95,7 @@ namespace DownKyi.Core.BiliApi.Video
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("VideoPagelist()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("VideoPagelist()发生异常: {0}", e);
LogManager.Error("VideoInfo", e); LogManager.Error("VideoInfo", e);
return null; return null;
} }

@ -91,7 +91,7 @@ namespace DownKyi.Core.BiliApi.VideoStream
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("GetPlayUrl()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("GetPlayUrl()发生异常: {0}", e);
LogManager.Error("GetPlayUrl", e); LogManager.Error("GetPlayUrl", e);
return null; return null;
} }

@ -229,7 +229,7 @@
<Compile Include="Storage\StorageHeader.cs" /> <Compile Include="Storage\StorageHeader.cs" />
<Compile Include="Storage\StorageManager.cs" /> <Compile Include="Storage\StorageManager.cs" />
<Compile Include="Storage\StorageUtils.cs" /> <Compile Include="Storage\StorageUtils.cs" />
<Compile Include="Utils\Debug\Console.cs" /> <Compile Include="Utils\Debugging\Console.cs" />
<Compile Include="Utils\Encryptor\Encryptor.File.cs" /> <Compile Include="Utils\Encryptor\Encryptor.File.cs" />
<Compile Include="Utils\Encryptor\Encryptor.String.cs" /> <Compile Include="Utils\Encryptor\Encryptor.String.cs" />
<Compile Include="Utils\Encryptor\Hash.cs" /> <Compile Include="Utils\Encryptor\Hash.cs" />

@ -172,7 +172,7 @@ namespace DownKyi.Core.Storage
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("DownloadImage()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("DownloadImage()发生异常: {0}", e);
LogManager.Error("StorageCover", e); LogManager.Error("StorageCover", e);
return null; return null;
} }

@ -151,7 +151,7 @@ namespace DownKyi.Core.Storage
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("DownloadImage()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("DownloadImage()发生异常: {0}", e);
LogManager.Error("StorageHeader", e); LogManager.Error("StorageHeader", e);
return null; return null;
} }

@ -25,7 +25,7 @@ namespace DownKyi.Core.Storage
} }
catch (Exception e) catch (Exception e)
{ {
Utils.Debug.Console.PrintLine("DownloadImage()发生异常: {0}", e); Utils.Debugging.Console.PrintLine("DownloadImage()发生异常: {0}", e);
LogManager.Error("StorageUtils", e); LogManager.Error("StorageUtils", e);
return false; return false;
} }

@ -0,0 +1,139 @@
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
}
}
}

@ -32,7 +32,7 @@ namespace DownKyi.Core.Utils.Encryptor
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Console.PrintLine("EncryptString()发生异常: {0}", e); Debugging.Console.PrintLine("EncryptString()发生异常: {0}", e);
LogManager.Error("Encryptor", e); LogManager.Error("Encryptor", e);
return encryptString; return encryptString;
} }
@ -60,7 +60,7 @@ namespace DownKyi.Core.Utils.Encryptor
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Console.PrintLine("DecryptString()发生异常: {0}", e); Debugging.Console.PrintLine("DecryptString()发生异常: {0}", e);
LogManager.Error("Encryptor", e); LogManager.Error("Encryptor", e);
return decryptString; return decryptString;
} }

@ -46,7 +46,7 @@ namespace DownKyi.Core.Utils
// 添加cookie // 添加cookie
cookieContainer.Add(new Cookie(name, value, "/", ".bilibili.com") { Expires = dateTime }); cookieContainer.Add(new Cookie(name, value, "/", ".bilibili.com") { Expires = dateTime });
Debug.Console.PrintLine(name + ": " + value + "\t" + cookieContainer.Count); Debugging.Console.PrintLine(name + ": " + value + "\t" + cookieContainer.Count);
} }
return cookieContainer; return cookieContainer;
@ -115,24 +115,24 @@ namespace DownKyi.Core.Utils
{ {
using (Stream stream = File.Create(file)) using (Stream stream = File.Create(file))
{ {
Debug.Console.PrintLine("Writing object to disk... "); Debugging.Console.PrintLine("Writing object to disk... ");
BinaryFormatter formatter = new BinaryFormatter(); BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(stream, obj); formatter.Serialize(stream, obj);
Debug.Console.PrintLine("Done."); Debugging.Console.PrintLine("Done.");
return true; return true;
} }
} }
catch (IOException e) catch (IOException e)
{ {
Debug.Console.PrintLine("WriteObjectToDisk()发生IO异常: {0}", e); Debugging.Console.PrintLine("WriteObjectToDisk()发生IO异常: {0}", e);
Logging.LogManager.Error(e); Logging.LogManager.Error(e);
return false; return false;
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Console.PrintLine("WriteObjectToDisk()发生异常: {0}", e); Debugging.Console.PrintLine("WriteObjectToDisk()发生异常: {0}", e);
Logging.LogManager.Error(e); Logging.LogManager.Error(e);
return false; return false;
} }
@ -149,21 +149,21 @@ namespace DownKyi.Core.Utils
{ {
using (Stream stream = File.Open(file, FileMode.Open)) using (Stream stream = File.Open(file, FileMode.Open))
{ {
Debug.Console.PrintLine("Reading object from disk... "); Debugging.Console.PrintLine("Reading object from disk... ");
BinaryFormatter formatter = new BinaryFormatter(); BinaryFormatter formatter = new BinaryFormatter();
Debug.Console.PrintLine("Done."); Debugging.Console.PrintLine("Done.");
return formatter.Deserialize(stream); return formatter.Deserialize(stream);
} }
} }
catch (IOException e) catch (IOException e)
{ {
Debug.Console.PrintLine("ReadObjectFromDisk()发生IO异常: {0}", e); Debugging.Console.PrintLine("ReadObjectFromDisk()发生IO异常: {0}", e);
Logging.LogManager.Error(e); Logging.LogManager.Error(e);
return null; return null;
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Console.PrintLine("ReadObjectFromDisk()发生异常: {0}", e); Debugging.Console.PrintLine("ReadObjectFromDisk()发生异常: {0}", e);
Logging.LogManager.Error(e); Logging.LogManager.Error(e);
return null; return null;
} }

Loading…
Cancel
Save