// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
// EdenAutoMorpherScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// Eden.AutoMorpher.AutoMorpherDev
using System;
using System.Diagnostics;

public static class AutoMorpherDev
{
    public readonly struct ScopeTimer : IDisposable
    {
        private readonly bool _enabled;

        private readonly string _label;

        private readonly Stopwatch _sw;

        public ScopeTimer(bool enabled, string label)
        {
            this._enabled = enabled;
            this._label = label;
            if (enabled)
            {
                this._sw = Stopwatch.StartNew();
            }
            else
            {
                this._sw = null;
            }
        }

        public void Dispose()
        {
            if (this._enabled && this._sw != null)
            {
                this._sw.Stop();
                UnityEngine.Debug.Log($"[DevTimer] {this._label}: {this._sw.ElapsedMilliseconds} ms");
            }
        }
    }

    public static bool isDeveloperMode;

    public static void Log(string message)
    {
        if (isDeveloperMode)
        {
            UnityEngine.Debug.Log(message);
        }
    }

    public static ScopeTimer Profile(string label)
    {
        return new ScopeTimer(isDeveloperMode, label);
    }
}
