-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathIniFileParsingOptions.cs
98 lines (96 loc) · 4.98 KB
/
IniFileParsingOptions.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
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
namespace BytecodeApi.IniParser;
/// <summary>
/// Represents a set of parsing options for INI files to support the common feature variations.
/// </summary>
public sealed class IniFileParsingOptions
{
/// <summary>
/// <see langword="true" /> to ignore parsing errors and add error lines to <see cref="IniFile.ErrorLines" />; <see langword="false" /> to throw an <see cref="IniParsingException" />.
/// <para>The default value is <see langword="false" />.</para>
/// </summary>
public bool IgnoreErrors { get; set; }
/// <summary>
/// Gets or sets a value indicating whether section names should be trimmed.
/// <para>The default value is <see langword="true" />.</para>
/// </summary>
public bool TrimSectionNames { get; set; }
/// <summary>
/// Gets or sets a value indicating whether property names should be trimmed.
/// <para>The default value is <see langword="true" />.</para>
/// </summary>
public bool TrimPropertyNames { get; set; }
/// <summary>
/// Gets or sets a value indicating whether property values should be trimmed.
/// <para>The default value is <see langword="true" />.</para>
/// </summary>
public bool TrimPropertyValues { get; set; }
/// <summary>
/// <see langword="true" /> to allow properties with no section and add them to <see cref="IniFile.GlobalProperties" />; <see langword="false" /> to throw an <see cref="IniParsingException" />.
/// <para>The default value is <see langword="true" />.</para>
/// </summary>
public bool AllowGlobalProperties { get; set; }
/// <summary>
/// <see langword="true" /> to allow section names containing closing brackets ("]"); <see langword="false" /> to throw an <see cref="IniParsingException" />.
/// <para>The default value is <see langword="true" />.</para>
/// </summary>
public bool AllowSectionNameClosingBracket { get; set; }
/// <summary>
/// <see langword="true" /> to allow empty or whitespace lines; <see langword="false" /> to throw an <see cref="IniParsingException" />.
/// <para>The default value is <see langword="true" />.</para>
/// </summary>
public bool AllowEmptyLines { get; set; }
/// <summary>
/// Gets or sets a value specifying what delimiter is used between property names and values.
/// <para>The default value is <see cref="IniPropertyDelimiter.EqualSign" />.</para>
/// </summary>
public IniPropertyDelimiter PropertyDelimiter { get; set; }
/// <summary>
/// <see langword="true" /> to ignore lines that start with a semicolon; <see langword="false" /> to treat it as a normal character, which will be included in the property name.
/// <para>The default value is <see langword="true" />.</para>
/// </summary>
public bool AllowSemicolonComments { get; set; }
/// <summary>
/// <see langword="true" /> to ignore lines that start with a number sign ("#"); <see langword="false" /> to treat it as a normal character, which will be included in the property name.
/// <para>The default value is <see langword="false" />.</para>
/// </summary>
public bool AllowNumberSignComments { get; set; }
/// <summary>
/// Gets or sets how duplicate section names are treated.
/// <para>The default value is <see cref="IniDuplicateSectionNameBehavior.Merge" />.</para>
/// </summary>
public IniDuplicateSectionNameBehavior DuplicateSectionNameBehavior { get; set; }
/// <summary>
/// Gets or sets a value indicating whether duplicate checking in section names should ignore character casing. The property <see cref="DuplicateSectionNameBehavior" /> defines how duplicates are treated.
/// <para>The default value is <see langword="true" />.</para>
/// </summary>
public bool DuplicateSectionNameIgnoreCase { get; set; }
/// <summary>
/// Gets or sets how duplicate property names are treated.
/// <para>The default value is <see cref="IniDuplicatePropertyNameBehavior.Duplicate" />.</para>
/// </summary>
public IniDuplicatePropertyNameBehavior DuplicatePropertyNameBehavior { get; set; }
/// <summary>
/// Gets or sets a value indicating whether duplicate checking in property names should ignore character casing. The property <see cref="DuplicatePropertyNameBehavior" /> defines how duplicates are treated.
/// <para>The default value is <see langword="true" />.</para>
/// </summary>
public bool DuplicatePropertyNameIgnoreCase { get; set; }
//TODO:FEATURE: bool AllowSingleQuotedValues, bool AllowDoubleQuotedValues bool AllowCommentsAfterContent
/// <summary>
/// Initializes a new instance of the <see cref="IniFileParsingOptions" /> class with default parsing options.
/// </summary>
public IniFileParsingOptions()
{
TrimSectionNames = true;
TrimPropertyNames = true;
TrimPropertyValues = true;
AllowGlobalProperties = true;
AllowSectionNameClosingBracket = true;
AllowEmptyLines = true;
PropertyDelimiter = IniPropertyDelimiter.EqualSign;
AllowSemicolonComments = true;
DuplicateSectionNameBehavior = IniDuplicateSectionNameBehavior.Merge;
DuplicateSectionNameIgnoreCase = true;
DuplicatePropertyNameBehavior = IniDuplicatePropertyNameBehavior.Duplicate;
DuplicatePropertyNameIgnoreCase = true;
}
}