Common/ConsoleHelper.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
using System.Text;
namespace Common
{
public class ConsoleHelper
{
public static void ShowError(string errorMsg)
{
Show(errorMsg, "Error");
}
public static void ShowInfo(string infoMsg)
{
Show(infoMsg, "Info");
}
public static void ShowWarning(string warningMsg)
{
Show(warningMsg, "Warning");
}
public static void ShowSuccess(string successMsg)
{
Show(successMsg, "Success");
}
private static void Show(string msg,string type)
{
Console.ResetColor();
switch(type)
{
case "Error":
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("Error:");
break;
case "Info":
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write("Info:");
break;
case "Warning":
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write("Warning:");
break;
case "Success":
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("Success:");
break;
}
Console.ResetColor();
Console.WriteLine(msg);
}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
