Some cleanups
This commit is contained in:
37
Scripts/LogTimer.cs
Normal file
37
Scripts/LogTimer.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Networks;
|
||||
using Assets.Scripts.Objects.Electrical;
|
||||
using Assets.Scripts.Objects.Motherboards;
|
||||
using Assets.Scripts.Util;
|
||||
using JetBrains.Annotations;
|
||||
using RemoteControl.Message;
|
||||
using Swan;
|
||||
using UnityEngine;
|
||||
using GameDevice = Assets.Scripts.Objects.Pipes.Device;
|
||||
// ReSharper disable ClassNeverInstantiated.Global
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
namespace RemoteControl
|
||||
{
|
||||
|
||||
public class LogTimer : IDisposable
|
||||
{
|
||||
private readonly DateTime _startTime = DateTime.Now;
|
||||
private string _action;
|
||||
|
||||
public LogTimer(string action)
|
||||
{
|
||||
RemoteControl.Log($"Beginning {action}");
|
||||
_action = action;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
var endTime = DateTime.Now;
|
||||
var elapsed = endTime - _startTime;
|
||||
Debug.Log($"Time taken for {_action}: " + elapsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user