mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
48 lines
1.0 KiB
C#
48 lines
1.0 KiB
C#
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
|
|
namespace Obfuz
|
|
{
|
|
public class Pipeline
|
|
{
|
|
private readonly List<IObfuscationPass> _passes = new List<IObfuscationPass>();
|
|
|
|
public bool Empty => _passes.Count == 0;
|
|
|
|
public Pipeline AddPass(IObfuscationPass pass)
|
|
{
|
|
_passes.Add(pass);
|
|
return this;
|
|
}
|
|
|
|
public void Start()
|
|
{
|
|
foreach (var pass in _passes)
|
|
{
|
|
pass.Start();
|
|
}
|
|
}
|
|
|
|
public void Stop()
|
|
{
|
|
|
|
foreach (var pass in _passes)
|
|
{
|
|
pass.Stop();
|
|
}
|
|
}
|
|
|
|
public void Run()
|
|
{
|
|
var sw = new Stopwatch();
|
|
foreach (var pass in _passes)
|
|
{
|
|
sw.Restart();
|
|
pass.Process();
|
|
sw.Stop();
|
|
UnityEngine.Debug.Log($"Pass: {pass.GetType().Name} process cost time: {sw.ElapsedMilliseconds}ms");
|
|
}
|
|
}
|
|
}
|
|
}
|