-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCustomCodedom.cs
69 lines (57 loc) · 1.84 KB
/
CustomCodedom.cs
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System.IO;
using System.Text;
using System.Collections.Generic;
namespace UIFramework
{
/// <summary>
/// cs 파일을 만드는 클래스입니다.
/// </summary>
public class CustomCodedom
{
public const string const_strListFieldName = "list";
private static string const_strPrefix = @"
/* ============================================
* Author : Strix
* Summary :
*
* 툴로 자동으로 생성되는 코드입니다.
* 이 파일을 직접 수정하시면 나중에 툴로 생성할 때 날아갑니다.
============================================= */
using UnityEngine;
using System.Collections.Generic;
public partial class {0} : CanvasManager<{0}, {0}.{1}>
{
public enum {1}
{
}
}";
enum ETextType
{
ManagerName,
EnumName,
ManagerLogic,
MAX,
}
private Dictionary<ETextType, StringBuilder> mapBuilder = new Dictionary<ETextType, StringBuilder>();
public CustomCodedom()
{
mapBuilder.Clear();
for (int i = 0; i < (int)ETextType.MAX; i++)
mapBuilder.Add((ETextType)i, new StringBuilder());
}
/// <summary>
///
/// </summary>
public void DoExportCS(string strFilePath_Absolute)
{
// string.Format이 안됨;
//string strFileContent = string.Format(const_strPrefix,
// nameof(CustomLogType),
// _strBuilder_Class.ToString());
string strFileContent = const_strPrefix.
Replace("{0}", mapBuilder[ETextType.ManagerName].ToString()).
Replace("{1}", mapBuilder[ETextType.EnumName].ToString());
File.WriteAllText($"{strFilePath_Absolute}.cs", strFileContent, Encoding.UTF8);
}
}
}