Skip to content

Commit c4d27e6

Browse files
committed
ModConfig: Added XML clarifications for new changes
1 parent bc923ee commit c4d27e6

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

Source/Inheritables/ModConfig.cs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,20 @@ namespace KeepCoding
3434
private readonly Logger _logger = new Logger($"ModConfig ({typeof(TSerialize).Assembly.GetName().Name}.{typeof(TSerialize).Name})");
3535

3636
/// <summary>
37-
/// Creates a new <see cref="ModConfig{T}"/> with the target file name and an optional event of when the file is read.
37+
/// Creates a new <see cref="ModConfig{T}"/> with the target file name and an optional event of when the file is read. A file will automatically be made if it doesn't exist. A JSON property defined in the type <typeparamref name="TSerialize"/> that isn't in the file will automatically write to the file with said property.
3838
/// </summary>
39+
/// <remarks>
40+
/// In the editor, the constructor will not merge the default values of the type with the file.
41+
/// </remarks>
3942
/// <exception cref="ConstructorArgumentException"></exception>
4043
public ModConfig() : this($"{Caller}-settings") { }
4144

4245
/// <summary>
43-
/// Creates a new <see cref="ModConfig{T}"/> with the target file name and an optional event of when the file is read.
46+
/// Creates a new <see cref="ModConfig{T}"/> with the target file name and an optional event of when the file is read. A file will automatically be made if it doesn't exist. A JSON property defined in the type <typeparamref name="TSerialize"/> that isn't in the file will automatically write to the file with said property.
4447
/// </summary>
48+
/// <remarks>
49+
/// In the editor, the constructor will not merge the default values of the type with the file.
50+
/// </remarks>
4551
/// <exception cref="ConstructorArgumentException"></exception>
4652
/// <param name="fileName">The file name to get.</param>
4753
public ModConfig(string fileName)
@@ -64,7 +70,7 @@ static ModConfig()
6470
}
6571

6672
/// <summary>
67-
/// Whether or not there has been a successful read of the settings file.
73+
/// Whether or not there has been a successful read of the settings file. This value will always be false in the editor.
6874
/// </summary>
6975
[JsonIgnore]
7076
public bool HasReadSucceeded { get; private set; }
@@ -97,6 +103,9 @@ static ModConfig()
97103
/// <summary>
98104
/// Reads, merges, and writes the settings to the settings file. To protect the user settings, this does nothing if the read isn't successful.
99105
/// </summary>
106+
/// <remarks>
107+
/// In the editor, this method does nothing.
108+
/// </remarks>
100109
/// <exception cref="NullReferenceException"></exception>
101110
/// <param name="value">The value to merge the file with.</param>
102111
/// <param name="isDiscarding">Determines whether it should remove values from the original file that isn't contained within the type, or has the incorrect type.</param>
@@ -128,13 +137,19 @@ public void Merge(TSerialize value, bool isDiscarding = false)
128137
/// <summary>
129138
/// Writes the settings to the settings file. To protect the user settings, this does nothing if the last read wasn't successful.
130139
/// </summary>
140+
/// <remarks>
141+
/// In the editor, this method does nothing.
142+
/// </remarks>
131143
/// <exception cref="NullReferenceException"></exception>
132144
/// <param name="value">The value to overwrite the settings file with.</param>
133145
public void Write(TSerialize value) => Write(SerializeSettings(value.NullCheck("The value cannot be null.")));
134146

135147
/// <summary>
136148
/// Writes the string to the settings file. To protect the user settings, this does nothing if the last read wasn't successful.
137149
/// </summary>
150+
/// <remarks>
151+
/// In the editor, this method does nothing.
152+
/// </remarks>
138153
/// <exception cref="NullIteratorException"></exception>
139154
/// <param name="value">The contents to write.</param>
140155
public void Write(string value)
@@ -160,12 +175,18 @@ public void Write(string value)
160175
/// <summary>
161176
/// Deserializes, then reserializes the file according to <see cref="SerializeSettings(TSerialize)"/>.
162177
/// </summary>
178+
/// <remarks>
179+
/// In the editor, this method serializes the default value of the constructor in <typeparamref name="TSerialize"/>.
180+
/// </remarks>
163181
/// <returns>A string representation of the value from <see cref="Read"/>.</returns>
164182
public override string ToString() => SerializeSettings(Read());
165183

166184
/// <summary>
167185
/// Reads the settings from the settings file. If the settings couldn't be read, the default settings will be returned.
168186
/// </summary>
187+
/// <remarks>
188+
/// In the editor, this method returns the default value of the constructor in <typeparamref name="TSerialize"/>.
189+
/// </remarks>
169190
public TSerialize Read() => SuppressIO(() =>
170191
{
171192
if (isEditor)

0 commit comments

Comments
 (0)