forked from microsoft/GraphEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnew_test.cs
More file actions
38 lines (34 loc) · 2.45 KB
/
new_test.cs
File metadata and controls
38 lines (34 loc) · 2.45 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
using System;
using System.IO;
using System.Reflection;
namespace Trinity.Tools
{
class TemplateGen
{
public static void Write(string entry, string root)
{
var test_name = Path.GetFileName(root);
var target = Path.Combine(root, Path.GetFileName(entry)).Replace("test_name", test_name);
var txt = File.ReadAllText(entry).Replace("test_name", test_name);
File.WriteAllText(target, txt);
}
public static void Main(string[] args)
{
try
{
var dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var template = Path.Combine(dir, "template", "standalone");
var target = args[0];
Directory.CreateDirectory(target);
foreach(var dirent in Directory.GetFileSystemEntries(template))
{
if (File.Exists(dirent))
{
Write(dirent, target);
}
}
}
catch (Exception ex) { Console.WriteLine($"Failed to create template: {ex.Message} \n {ex.StackTrace}"); }
}
}
}