mirror of
https://github.com/netchx/netch.git
synced 2026-04-01 19:15:09 +08:00
Refactor: split Global.cs
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Netch.Models
|
||||
{
|
||||
public class LogStopwatch
|
||||
{
|
||||
public LogStopwatch(string message)
|
||||
{
|
||||
_stopwatch = Stopwatch.StartNew();
|
||||
Console.WriteLine($"Start {message} LogStopwatch");
|
||||
}
|
||||
|
||||
private readonly Stopwatch _stopwatch;
|
||||
|
||||
public void Log(string name,bool stop = false)
|
||||
{
|
||||
if (!_stopwatch.IsRunning)
|
||||
throw new Exception();
|
||||
|
||||
_stopwatch.Stop();
|
||||
Console.WriteLine($"{name} LogStopwatch: {_stopwatch.ElapsedMilliseconds}");
|
||||
if(!stop)
|
||||
_stopwatch.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -161,7 +161,7 @@ namespace Netch.Models
|
||||
/// <returns>模式文件字符串</returns>
|
||||
public string ToFileString()
|
||||
{
|
||||
return $"# {Remark}, {Type}, {(BypassChina ? 1 : 0)}{Global.EOF}{string.Join(Global.EOF, Rule)}";
|
||||
return $"# {Remark}, {Type}, {(BypassChina ? 1 : 0)}{Constants.EOF}{string.Join(Constants.EOF, Rule)}";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user