-
-
Notifications
You must be signed in to change notification settings - Fork 107
Expand file tree
/
Copy pathJavaConversionOptions.cs
More file actions
83 lines (54 loc) · 2.22 KB
/
JavaConversionOptions.cs
File metadata and controls
83 lines (54 loc) · 2.22 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
using System.Text.RegularExpressions;
namespace JavaToCSharp;
public class JavaConversionOptions
{
public event EventHandler<ConversionWarningEventArgs>? WarningEncountered;
public event EventHandler<ConversionStateChangedEventArgs>? StateChanged;
public IList<Replacement> PackageReplacements { get; } = new List<Replacement>();
public IList<string> Usings { get; } = new List<string>();
public IList<string> StaticUsingEnumNames { get; } = new List<string>();
public bool IncludeSubdirectories { get; set; } = true;
public bool IncludeUsings { get; set; } = true;
public bool IncludeNamespace { get; set; } = true;
public bool UseDebugAssertForAsserts { get; set; }
public bool StartInterfaceNamesWithI { get; set; }
/// <summary>
/// Unrecognized code is translated into comments
/// </summary>
public bool UseUnrecognizedCodeToComment { get; set; } = true;
public bool ConvertSystemOutToConsole { get; set; }
public bool IncludeComments { get; set; } = true;
public bool UseFileScopedNamespaces { get; set; }
public SyntaxMapping SyntaxMappings { get; set; } = new SyntaxMapping();
public ConversionState ConversionState { get; set; }
public JavaConversionOptions AddPackageReplacement(string pattern, string replacement, RegexOptions options = RegexOptions.None)
{
PackageReplacements.Add(new Replacement(pattern, replacement, options));
return this;
}
public JavaConversionOptions ClearUsings()
{
Usings.Clear();
return this;
}
public JavaConversionOptions AddUsing(string ns)
{
Usings.Add(ns);
return this;
}
public JavaConversionOptions SetUsings(IEnumerable<string> usings)
{
Usings.Clear();
foreach (string u in usings)
{
Usings.Add(u);
}
return this;
}
internal void Warning(string message, int javaLineNumber) => WarningEncountered?.Invoke(this, new ConversionWarningEventArgs(message, javaLineNumber));
internal void ConversionStateChanged(ConversionState newState)
{
ConversionState = newState;
StateChanged?.Invoke(this, new ConversionStateChangedEventArgs(newState));
}
}