forked from AdrianWilczynski/CSharpToTypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli-timer.csx
More file actions
37 lines (26 loc) · 1.08 KB
/
Copy pathcli-timer.csx
File metadata and controls
37 lines (26 loc) · 1.08 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
#pragma warning disable RCS1018
#r "nuget: Microsoft.Extensions.DependencyInjection, 2.2.0"
#r "..\src\CSharpToTypeScript.CLITool\bin\Debug\netcoreapp2.2\CSharpToTypeScript.Core.dll"
#r "..\src\CSharpToTypeScript.CLITool\bin\Debug\netcoreapp2.2\CSharpToTypeScript.CLITool.dll"
using Microsoft.Extensions.DependencyInjection;
using CSharpToTypeScript.CLITool;
using CSharpToTypeScript.Core.DependencyInjection;
using CSharpToTypeScript.CLITool.Commands;
var convertCommand = new ServiceCollection()
.AddCSharpToTypeScript()
.AddTransient<ConvertCommand>()
.BuildServiceProvider()
.GetRequiredService<ConvertCommand>();
var count = int.Parse(Args[0]);
const string tempDirectoryPath = "temp";
Directory.CreateDirectory(tempDirectoryPath);
for (int i = 0; i < count; i++)
{
File.WriteAllText(Path.Join(tempDirectoryPath, i + ".cs"), "class Item { }");
}
var stopwatch = Stopwatch.StartNew();
convertCommand.Input = tempDirectoryPath;
convertCommand.OnExecute();
stopwatch.Stop();
WriteLine($"Elapsed: {stopwatch.ElapsedMilliseconds}");
Directory.Delete(tempDirectoryPath, true);