SalamanderWnmp/Tool/Log.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using SalamanderWnmp.Programs;
using SalamanderWnmp.UI;
using System;
using System.IO;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Media;
namespace SalamanderWnmp.Tool
{
/// <summary>
/// Logs information and errors to a RichTextBox
/// </summary>
public static class Log
{
private static RichTextBox rtfLog;
public enum LogSection
{
WNMP_MAIN = 0,
WNMP_NGINX,
WNMP_MARIADB,
WNMP_PHP,
WNMP_REDIS,
}
public static string LogSectionToString(LogSection logSection)
{
switch (logSection) {
case LogSection.WNMP_MAIN:
return "Wnmp Main";
case LogSection.WNMP_NGINX:
return "Wnmp Nginx";
case LogSection.WNMP_MARIADB:
return "Wnmp MySQL";
case LogSection.WNMP_PHP:
return "Wnmp PHP";
case LogSection.WNMP_REDIS:
return "Wnmp Redis";
default:
return "";
}
}
private static void wnmp_log(string message, SolidColorBrush brush, LogSection logSection)
{
DispatcherHelper.UIDispatcher.Invoke(new Action(() =>
{
var SectionName = LogSectionToString(logSection);
var DateNow = DateTime.Now.ToString();
Run run1 = new Run(DateNow + " [");
Run run2 = new Run() { Text = SectionName, Foreground = brush };
Run run3 = new Run("] - " + message);
var p = new Paragraph();
p.Inlines.AddRange(new Run[] { run1, run2, run3 });
rtfLog.Document.Blocks.Add(p);
rtfLog.ScrollToEnd();
}));
}
/// <summary>
/// Log error
后面还有 39 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
