diff --git a/DownKyi.Core/Aria2cNet/AriaManager.cs b/DownKyi.Core/Aria2cNet/AriaManager.cs index b2a8d45..59fd6e3 100644 --- a/DownKyi.Core/Aria2cNet/AriaManager.cs +++ b/DownKyi.Core/Aria2cNet/AriaManager.cs @@ -69,7 +69,7 @@ namespace DownKyi.Core.Aria2cNet } 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); //// 如果返回状态码不是200,则继续 @@ -81,7 +81,7 @@ namespace DownKyi.Core.Aria2cNet // aira中删除记录 var ariaRemove1 = AriaClient.RemoveDownloadResultAsync(gid); - Utils.Debug.Console.PrintLine(ariaRemove1); + Utils.Debugging.Console.PrintLine(ariaRemove1); LogManager.Debug("AriaManager", ariaRemove1.Result.Result); // 返回回调信息,退出函数 diff --git a/DownKyi.Core/Aria2cNet/Client/AriaClient.cs b/DownKyi.Core/Aria2cNet/Client/AriaClient.cs index ee7f287..a9852cb 100644 --- a/DownKyi.Core/Aria2cNet/Client/AriaClient.cs +++ b/DownKyi.Core/Aria2cNet/Client/AriaClient.cs @@ -1093,7 +1093,7 @@ namespace DownKyi.Core.Aria2cNet.Client } catch (WebException e) { - Utils.Debug.Console.PrintLine("Request()发生Web异常: {0}", e); + Utils.Debugging.Console.PrintLine("Request()发生Web异常: {0}", e); LogManager.Error("AriaClient", e); //return Request(url, parameters, retry - 1); @@ -1114,13 +1114,13 @@ namespace DownKyi.Core.Aria2cNet.Client } catch (IOException e) { - Utils.Debug.Console.PrintLine("Request()发生IO异常: {0}", e); + Utils.Debugging.Console.PrintLine("Request()发生IO异常: {0}", e); LogManager.Error("AriaClient", e); return Request(url, parameters, retry - 1); } catch (Exception e) { - Utils.Debug.Console.PrintLine("Request()发生其他异常: {0}", e); + Utils.Debugging.Console.PrintLine("Request()发生其他异常: {0}", e); LogManager.Error("AriaClient", e); return Request(url, parameters, retry - 1); } diff --git a/DownKyi.Core/Aria2cNet/Server/AriaServer.cs b/DownKyi.Core/Aria2cNet/Server/AriaServer.cs index ded9b16..6089865 100644 --- a/DownKyi.Core/Aria2cNet/Server/AriaServer.cs +++ b/DownKyi.Core/Aria2cNet/Server/AriaServer.cs @@ -71,7 +71,7 @@ namespace DownKyi.Core.Aria2cNet.Server } catch (Exception e) { - Utils.Debug.Console.PrintLine("StartServerAsync()发生其他异常: {0}", e); + Utils.Debugging.Console.PrintLine("StartServerAsync()发生其他异常: {0}", e); LogManager.Error("AriaServer", e); } } @@ -111,7 +111,7 @@ namespace DownKyi.Core.Aria2cNet.Server null, (s, e) => { 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); if (output != null && window != null) @@ -196,7 +196,7 @@ namespace DownKyi.Core.Aria2cNet.Server } catch (Exception e) { - Utils.Debug.Console.PrintLine("KillServer()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("KillServer()发生异常: {0}", e); LogManager.Error("AriaServer", e); } } diff --git a/DownKyi.Core/BiliApi/Bangumi/BangumiInfo.cs b/DownKyi.Core/BiliApi/Bangumi/BangumiInfo.cs index 1aca793..634a70e 100644 --- a/DownKyi.Core/BiliApi/Bangumi/BangumiInfo.cs +++ b/DownKyi.Core/BiliApi/Bangumi/BangumiInfo.cs @@ -27,7 +27,7 @@ namespace DownKyi.Core.BiliApi.Bangumi } catch (Exception e) { - Utils.Debug.Console.PrintLine("BangumiMediaInfo()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("BangumiMediaInfo()发生异常: {0}", e); LogManager.Error("BangumiInfo", e); return null; } @@ -58,7 +58,7 @@ namespace DownKyi.Core.BiliApi.Bangumi } catch (Exception e) { - Utils.Debug.Console.PrintLine("BangumiSeasonInfo()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("BangumiSeasonInfo()发生异常: {0}", e); LogManager.Error("BangumiInfo", e); return null; } diff --git a/DownKyi.Core/BiliApi/Cheese/CheeseInfo.cs b/DownKyi.Core/BiliApi/Cheese/CheeseInfo.cs index 1393d5a..d09b9b2 100644 --- a/DownKyi.Core/BiliApi/Cheese/CheeseInfo.cs +++ b/DownKyi.Core/BiliApi/Cheese/CheeseInfo.cs @@ -33,7 +33,7 @@ namespace DownKyi.Core.BiliApi.Cheese } catch (Exception e) { - Utils.Debug.Console.PrintLine("CheeseViewInfo()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("CheeseViewInfo()发生异常: {0}", e); LogManager.Error("CheeseInfo", e); return null; } @@ -60,7 +60,7 @@ namespace DownKyi.Core.BiliApi.Cheese } catch (Exception e) { - Utils.Debug.Console.PrintLine("CheeseEpisodeList()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("CheeseEpisodeList()发生异常: {0}", e); LogManager.Error("CheeseInfo", e); return null; } diff --git a/DownKyi.Core/BiliApi/Danmaku/DanmakuProtobuf.cs b/DownKyi.Core/BiliApi/Danmaku/DanmakuProtobuf.cs index 4bee84e..be4d83b 100644 --- a/DownKyi.Core/BiliApi/Danmaku/DanmakuProtobuf.cs +++ b/DownKyi.Core/BiliApi/Danmaku/DanmakuProtobuf.cs @@ -35,7 +35,7 @@ namespace DownKyi.Core.BiliApi.Danmaku } catch (Exception e) { - Utils.Debug.Console.PrintLine("GetDanmakuProto()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("GetDanmakuProto()发生异常: {0}", e); //Logging.LogManager.Error(e); } @@ -72,7 +72,7 @@ namespace DownKyi.Core.BiliApi.Danmaku } catch (Exception e) { - Utils.Debug.Console.PrintLine("GetDanmakuProto()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("GetDanmakuProto()发生异常: {0}", e); //Logging.LogManager.Error(e); return null; } diff --git a/DownKyi.Core/BiliApi/Favorites/FavoritesInfo.cs b/DownKyi.Core/BiliApi/Favorites/FavoritesInfo.cs index 022816f..45f5bf1 100644 --- a/DownKyi.Core/BiliApi/Favorites/FavoritesInfo.cs +++ b/DownKyi.Core/BiliApi/Favorites/FavoritesInfo.cs @@ -30,7 +30,7 @@ namespace DownKyi.Core.BiliApi.Favorites } catch (Exception e) { - Utils.Debug.Console.PrintLine("GetFavoritesInfo()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("GetFavoritesInfo()发生异常: {0}", e); LogManager.Error("FavoritesInfo", e); return null; } diff --git a/DownKyi.Core/BiliApi/Login/LoginHelper.cs b/DownKyi.Core/BiliApi/Login/LoginHelper.cs index 342c893..78fcd00 100644 --- a/DownKyi.Core/BiliApi/Login/LoginHelper.cs +++ b/DownKyi.Core/BiliApi/Login/LoginHelper.cs @@ -38,7 +38,7 @@ namespace DownKyi.Core.BiliApi.Login } catch (Exception e) { - Utils.Debug.Console.PrintLine("SaveLoginInfoCookies()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("SaveLoginInfoCookies()发生异常: {0}", e); Logging.LogManager.Error(e); return false; } @@ -70,7 +70,7 @@ namespace DownKyi.Core.BiliApi.Login } catch (Exception e) { - Utils.Debug.Console.PrintLine("GetLoginInfoCookies()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("GetLoginInfoCookies()发生异常: {0}", e); Logging.LogManager.Error(e); if (File.Exists(tempFile)) { @@ -135,7 +135,7 @@ namespace DownKyi.Core.BiliApi.Login } catch (IOException e) { - Utils.Debug.Console.PrintLine("Logout()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("Logout()发生异常: {0}", e); Logging.LogManager.Error(e); return false; } diff --git a/DownKyi.Core/BiliApi/Login/LoginInfo.cs b/DownKyi.Core/BiliApi/Login/LoginInfo.cs index 2931f0c..3a03586 100644 --- a/DownKyi.Core/BiliApi/Login/LoginInfo.cs +++ b/DownKyi.Core/BiliApi/Login/LoginInfo.cs @@ -31,7 +31,7 @@ namespace DownKyi.Core.BiliApi.Login } catch (Exception e) { - Utils.Debug.Console.PrintLine("GetUserInfoForNavigation()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("GetUserInfoForNavigation()发生异常: {0}", e); LogManager.Error("LoginInfo", e); return null; } diff --git a/DownKyi.Core/BiliApi/Login/LoginQR.cs b/DownKyi.Core/BiliApi/Login/LoginQR.cs index 1ad3544..a04e2d7 100644 --- a/DownKyi.Core/BiliApi/Login/LoginQR.cs +++ b/DownKyi.Core/BiliApi/Login/LoginQR.cs @@ -31,7 +31,7 @@ namespace DownKyi.Core.BiliApi.Login } catch (Exception e) { - Utils.Debug.Console.PrintLine("GetLoginUrl()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("GetLoginUrl()发生异常: {0}", e); LogManager.Error("LoginQR", e); return null; } @@ -86,7 +86,7 @@ namespace DownKyi.Core.BiliApi.Login } catch (Exception e) { - Utils.Debug.Console.PrintLine("GetLoginInfo()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("GetLoginInfo()发生异常: {0}", e); LogManager.Error("LoginQR", e); return null; } @@ -106,7 +106,7 @@ namespace DownKyi.Core.BiliApi.Login } catch (Exception e) { - Utils.Debug.Console.PrintLine("GetLoginQRCode()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("GetLoginQRCode()发生异常: {0}", e); LogManager.Error("LoginQR", e); return null; } diff --git a/DownKyi.Core/BiliApi/Video/Dynamic.cs b/DownKyi.Core/BiliApi/Video/Dynamic.cs index 330b8c8..7ea757b 100644 --- a/DownKyi.Core/BiliApi/Video/Dynamic.cs +++ b/DownKyi.Core/BiliApi/Video/Dynamic.cs @@ -30,7 +30,7 @@ namespace DownKyi.Core.BiliApi.Video } catch (Exception e) { - Utils.Debug.Console.PrintLine("RegionDynamicList()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("RegionDynamicList()发生异常: {0}", e); LogManager.Error("Dynamic", e); return null; } diff --git a/DownKyi.Core/BiliApi/Video/Ranking.cs b/DownKyi.Core/BiliApi/Video/Ranking.cs index 16ac56d..0f579f4 100644 --- a/DownKyi.Core/BiliApi/Video/Ranking.cs +++ b/DownKyi.Core/BiliApi/Video/Ranking.cs @@ -30,7 +30,7 @@ namespace DownKyi.Core.BiliApi.Video } catch (Exception e) { - Utils.Debug.Console.PrintLine("RegionRankingList()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("RegionRankingList()发生异常: {0}", e); LogManager.Error("Ranking", e); return null; } diff --git a/DownKyi.Core/BiliApi/Video/VideoInfo.cs b/DownKyi.Core/BiliApi/Video/VideoInfo.cs index aa0764d..18762f3 100644 --- a/DownKyi.Core/BiliApi/Video/VideoInfo.cs +++ b/DownKyi.Core/BiliApi/Video/VideoInfo.cs @@ -33,7 +33,7 @@ namespace DownKyi.Core.BiliApi.Video } catch (Exception e) { - Utils.Debug.Console.PrintLine("VideoInfo()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("VideoInfo()发生异常: {0}", e); LogManager.Error("VideoInfo", e); return null; } @@ -64,7 +64,7 @@ namespace DownKyi.Core.BiliApi.Video } catch (Exception e) { - Utils.Debug.Console.PrintLine("VideoDescription()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("VideoDescription()发生异常: {0}", e); LogManager.Error("VideoInfo", e); return null; } @@ -95,7 +95,7 @@ namespace DownKyi.Core.BiliApi.Video } catch (Exception e) { - Utils.Debug.Console.PrintLine("VideoPagelist()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("VideoPagelist()发生异常: {0}", e); LogManager.Error("VideoInfo", e); return null; } diff --git a/DownKyi.Core/BiliApi/VideoStream/VideoStream.cs b/DownKyi.Core/BiliApi/VideoStream/VideoStream.cs index e84cacc..b41e84d 100644 --- a/DownKyi.Core/BiliApi/VideoStream/VideoStream.cs +++ b/DownKyi.Core/BiliApi/VideoStream/VideoStream.cs @@ -91,7 +91,7 @@ namespace DownKyi.Core.BiliApi.VideoStream } catch (Exception e) { - Utils.Debug.Console.PrintLine("GetPlayUrl()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("GetPlayUrl()发生异常: {0}", e); LogManager.Error("GetPlayUrl", e); return null; } diff --git a/DownKyi.Core/DownKyi.Core.csproj b/DownKyi.Core/DownKyi.Core.csproj index 335492d..8a9a33f 100644 --- a/DownKyi.Core/DownKyi.Core.csproj +++ b/DownKyi.Core/DownKyi.Core.csproj @@ -229,7 +229,7 @@ - + diff --git a/DownKyi.Core/Storage/StorageCover.cs b/DownKyi.Core/Storage/StorageCover.cs index ae58849..0ec6979 100644 --- a/DownKyi.Core/Storage/StorageCover.cs +++ b/DownKyi.Core/Storage/StorageCover.cs @@ -172,7 +172,7 @@ namespace DownKyi.Core.Storage } catch (Exception e) { - Utils.Debug.Console.PrintLine("DownloadImage()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("DownloadImage()发生异常: {0}", e); LogManager.Error("StorageCover", e); return null; } diff --git a/DownKyi.Core/Storage/StorageHeader.cs b/DownKyi.Core/Storage/StorageHeader.cs index d80e438..505272b 100644 --- a/DownKyi.Core/Storage/StorageHeader.cs +++ b/DownKyi.Core/Storage/StorageHeader.cs @@ -151,7 +151,7 @@ namespace DownKyi.Core.Storage } catch (Exception e) { - Utils.Debug.Console.PrintLine("DownloadImage()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("DownloadImage()发生异常: {0}", e); LogManager.Error("StorageHeader", e); return null; } diff --git a/DownKyi.Core/Storage/StorageUtils.cs b/DownKyi.Core/Storage/StorageUtils.cs index 0b4ab9e..c389974 100644 --- a/DownKyi.Core/Storage/StorageUtils.cs +++ b/DownKyi.Core/Storage/StorageUtils.cs @@ -25,7 +25,7 @@ namespace DownKyi.Core.Storage } catch (Exception e) { - Utils.Debug.Console.PrintLine("DownloadImage()发生异常: {0}", e); + Utils.Debugging.Console.PrintLine("DownloadImage()发生异常: {0}", e); LogManager.Error("StorageUtils", e); return false; } diff --git a/DownKyi.Core/Utils/Debugging/Console.cs b/DownKyi.Core/Utils/Debugging/Console.cs new file mode 100644 index 0000000..84adbde --- /dev/null +++ b/DownKyi.Core/Utils/Debugging/Console.cs @@ -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 + } + + } +} diff --git a/DownKyi.Core/Utils/Encryptor/Encryptor.String.cs b/DownKyi.Core/Utils/Encryptor/Encryptor.String.cs index 87493f1..f7dcf8b 100644 --- a/DownKyi.Core/Utils/Encryptor/Encryptor.String.cs +++ b/DownKyi.Core/Utils/Encryptor/Encryptor.String.cs @@ -32,7 +32,7 @@ namespace DownKyi.Core.Utils.Encryptor } catch (Exception e) { - Debug.Console.PrintLine("EncryptString()发生异常: {0}", e); + Debugging.Console.PrintLine("EncryptString()发生异常: {0}", e); LogManager.Error("Encryptor", e); return encryptString; } @@ -60,7 +60,7 @@ namespace DownKyi.Core.Utils.Encryptor } catch (Exception e) { - Debug.Console.PrintLine("DecryptString()发生异常: {0}", e); + Debugging.Console.PrintLine("DecryptString()发生异常: {0}", e); LogManager.Error("Encryptor", e); return decryptString; } diff --git a/DownKyi.Core/Utils/ObjectHelper.cs b/DownKyi.Core/Utils/ObjectHelper.cs index 13d7632..5c012fa 100644 --- a/DownKyi.Core/Utils/ObjectHelper.cs +++ b/DownKyi.Core/Utils/ObjectHelper.cs @@ -46,7 +46,7 @@ namespace DownKyi.Core.Utils // 添加cookie 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; @@ -115,24 +115,24 @@ namespace DownKyi.Core.Utils { using (Stream stream = File.Create(file)) { - Debug.Console.PrintLine("Writing object to disk... "); + Debugging.Console.PrintLine("Writing object to disk... "); BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, obj); - Debug.Console.PrintLine("Done."); + Debugging.Console.PrintLine("Done."); return true; } } catch (IOException e) { - Debug.Console.PrintLine("WriteObjectToDisk()发生IO异常: {0}", e); + Debugging.Console.PrintLine("WriteObjectToDisk()发生IO异常: {0}", e); Logging.LogManager.Error(e); return false; } catch (Exception e) { - Debug.Console.PrintLine("WriteObjectToDisk()发生异常: {0}", e); + Debugging.Console.PrintLine("WriteObjectToDisk()发生异常: {0}", e); Logging.LogManager.Error(e); return false; } @@ -149,21 +149,21 @@ namespace DownKyi.Core.Utils { 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(); - Debug.Console.PrintLine("Done."); + Debugging.Console.PrintLine("Done."); return formatter.Deserialize(stream); } } catch (IOException e) { - Debug.Console.PrintLine("ReadObjectFromDisk()发生IO异常: {0}", e); + Debugging.Console.PrintLine("ReadObjectFromDisk()发生IO异常: {0}", e); Logging.LogManager.Error(e); return null; } catch (Exception e) { - Debug.Console.PrintLine("ReadObjectFromDisk()发生异常: {0}", e); + Debugging.Console.PrintLine("ReadObjectFromDisk()发生异常: {0}", e); Logging.LogManager.Error(e); return null; }