-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCSTOJSOptions.cs
More file actions
175 lines (162 loc) · 4.83 KB
/
CSTOJSOptions.cs
File metadata and controls
175 lines (162 loc) · 4.83 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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
using System.Collections.Generic;
using System.Text;
namespace CSharpToJavaScript;
/// <summary>
/// Options for <see cref="CSTOJS" />.
/// </summary>
public class CSTOJSOptions
{
/// <summary>
/// Debug. When set to true prints additional info to console, cs lines to js file.
/// </summary>
/// <remarks>
/// <blockquote class="NOTE"><h5>NOTE</h5>
/// <para>
/// cstojs_options.xml: <Option Debug="false" />
/// </para>
/// </blockquote>
/// </remarks>
/// <value>
/// Default: <c>false</c>
/// </value>
public bool Debug { get; set; } = false;
/// <summary>
/// Useful for the tests.
/// </summary>
/// <remarks>
/// <blockquote class="NOTE"><h5>NOTE</h5>
/// <para>
/// cstojs_options.xml: <Option DisableCompilationErrors="false" />
/// </para>
/// </blockquote>
/// </remarks>
/// <value>
/// Default: <c>false</c>
/// </value>
public bool DisableCompilationErrors { get; set; } = false;
/// <summary>
/// Self-explanatory, Use <c>var</c> over <c>let</c>.
/// </summary>
/// <remarks>
/// <blockquote class="NOTE"><h5>NOTE</h5>
/// <para>
/// cstojs_options.xml: <Option UseVarOverLet="false" />
/// </para>
/// </blockquote>
/// </remarks>
/// <value>
/// Default: <c>false</c>
/// </value>
public bool UseVarOverLet { get; set; } = false;
/// <summary>
/// Keep Brace <c>{</c> on the same line.
/// </summary>
/// <remarks>
/// <blockquote class="NOTE"><h5>NOTE</h5><para>Note: It is better write from the start in c#, then using this option.</para></blockquote>
/// <blockquote class="NOTE"><h5>NOTE</h5>
/// <para>
/// cstojs_options.xml: <Option KeepBraceOnTheSameLine="false" />
/// </para>
/// </blockquote>
/// </remarks>
/// <value>
/// Default: <c>false</c>
/// </value>
public bool KeepBraceOnTheSameLine { get; set; } = false;
/// <summary>
/// Self-explanatory, Normalize Whitespace.
/// </summary>
/// <remarks>
/// <blockquote class="NOTE"><h5>NOTE</h5><para>Note: If using with <see cref="CSTOJSOptions.KeepBraceOnTheSameLine" />. Normalization running before <see cref="CSTOJSOptions.KeepBraceOnTheSameLine" />.</para></blockquote>
/// <blockquote class="NOTE"><h5>NOTE</h5>
/// <para>
/// cstojs_options.xml: <Option NormalizeWhitespace="false" />
/// </para>
/// </blockquote>
/// </remarks>
/// <value>
/// Default: <c>false</c>
/// </value>
public bool NormalizeWhitespace { get; set; } = false;
/// <summary>
/// Translate current <see cref="FileData" />. If false, walker will not be called.
/// </summary>
/// <remarks>
/// <blockquote class="NOTE"><h5>NOTE</h5>
/// <para>
/// cstojs_options.xml: <Option TranslateFile="true" />
/// </para>
/// </blockquote>
/// </remarks>
/// <value>
/// Default: <c>true</c>
/// </value>
public bool TranslateFile { get; set; } = true;
/// <summary>
/// Make properties enumerable, needed if you want to use JSON.stringify.
/// </summary>
/// <remarks>
/// <blockquote class="NOTE"><h5>NOTE</h5>
/// <para>
/// cstojs_options.xml: <Option MakePropertiesEnumerable="false" />
/// </para>
/// </blockquote>
/// <blockquote class="NOTE"><h5>NOTE</h5>
/// <para>
/// Note, class must have constructor!
/// </para>
/// </blockquote>
/// </remarks>
/// <value>
/// Default: <c>false</c>
/// </value>
public bool MakePropertiesEnumerable { get; set; } = false;
/// <summary>
/// Array of custom names to convert.
/// </summary>
/// <remarks>Example: <c>new(){["Console"] = "console"}</c>. Will convert "Console" to "console".
/// <blockquote class="NOTE"><h5>NOTE</h5>
/// <para>
/// cstojs_options.xml: <Option CustomCSNamesToJS="Console-console,WriteLine-log" />
/// </para>
/// </blockquote>
/// </remarks>
/// <value>
/// Default: <c>new()</c>
/// </value>
public Dictionary<string, string> CustomCSNamesToJS { get; set; } = new();
/// <summary>
/// Add a <see cref="StringBuilder" /> to the front of a javascript file.
/// </summary>
/// <remarks>
/// <blockquote class="NOTE"><h5>NOTE</h5>
/// <para>
/// cstojs_options.xml: <Option AddSBAtTheTop="//this is comment" />
/// </para>
/// </blockquote>
/// </remarks>
/// <value>
/// Default: <c>new()</c>
/// </value>
public StringBuilder AddSBAtTheTop { get; set; } = new();
/// <summary>
/// Add a <see cref="StringBuilder" /> to the end of a javascript file.
/// </summary>
/// <remarks>
/// <blockquote class="NOTE"><h5>NOTE</h5>
/// <para>
/// cstojs_options.xml: <Option AddSBAtTheBottom="//this is comment" />
/// </para>
/// </blockquote>
/// </remarks>
/// <value>
/// Default: <c>new()</c>
/// </value>
public StringBuilder AddSBAtTheBottom { get; set; } = new();
/// <summary>
/// Creates new default options. See <see cref="CSTOJSOptions" />.
/// </summary>
public CSTOJSOptions()
{
}
}