summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XTimeProfiler.cs
blob: de1faf83fe85b286e0d79c91d1ab08026f316600 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;

namespace XMainClient
{
	internal class XTimeProfiler
	{
		private int _timeLimit;

		private int _start;

		private XTimeoutHandler _handler;

		private static XTimeProfiler _Instance;

		public static XTimeProfiler getLogProfiler(int timeLimit, string message)
		{
			bool flag = XTimeProfiler._Instance == null;
			if (flag)
			{
				XTimeoutLogHandler handler = new XTimeoutLogHandler();
				XTimeProfiler._Instance = new XTimeProfiler(timeLimit);
				XTimeProfiler._Instance.SetHandler(handler);
			}
			else
			{
				XTimeProfiler._Instance._timeLimit = timeLimit;
			}
			(XTimeProfiler._Instance._handler as XTimeoutLogHandler).Message = message;
			return XTimeProfiler._Instance;
		}

		public XTimeProfiler(int timeLimit)
		{
			this._timeLimit = timeLimit;
			this._start = 0;
			this._handler = null;
		}

		public void SetHandler(XTimeoutHandler handler)
		{
			this._handler = handler;
		}

		public void Begin()
		{
			this._start = Environment.TickCount;
		}

		public void End()
		{
		}
	}
}