-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBeginSampleCommand.cs
More file actions
40 lines (33 loc) · 1.13 KB
/
BeginSampleCommand.cs
File metadata and controls
40 lines (33 loc) · 1.13 KB
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
using System.Collections.Generic;
using System.Linq;
using Rocket.API;
using Rocket.Core.Logging;
using UnityEngine.Profiling;
namespace UntProfiler
{
public class BeginSampleCommand : IRocketCommand
{
public AllowedCaller AllowedCaller => AllowedCaller.Console;
public string Name => "beginsample";
public string Help => "Begins a new profiling sample piece.";
public string Syntax => "/beginsample <name>";
public List<string> Aliases => new List<string> { "bsample" };
public List<string> Permissions => new List<string> { };
public void Execute(IRocketPlayer caller, string[] command)
{
if (command.Length < 1)
{
Logger.Log("Usage: " + Syntax);
return;
}
if (!Profiler.enabled)
{
Logger.Log("No profiling session is running.");
return;
}
string sampleName = string.Join(" ", command.Skip(1));
Logger.Log($"Begin profiling sample: {sampleName}");
Profiler.BeginSample(sampleName);
}
}
}