Skip to content

Commit 47af6e2

Browse files
committed
Fix behaviour of INIDefineable.WriteIfDefault
1 parent c8d1c96 commit 47af6e2

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/TSMapEditor/Models/INIDefineable.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,6 @@ public void ReadPropertiesFromIniSection(IniSection iniSection)
5151
{
5252
continue;
5353
}
54-
55-
if (!iniAttribute.WriteIfDefault)
56-
{
57-
object val = property.GetValue(this, null);
58-
if ((val != null && val.Equals(iniAttribute.DefaultValue)) || (val == null && iniAttribute.DefaultValue == null))
59-
{
60-
iniSection.RemoveKey(property.Name);
61-
continue;
62-
}
63-
}
6454
}
6555

6656
if (propertyType.IsEnum)
@@ -142,6 +132,16 @@ public void WritePropertiesToIniSection(IniSection iniSection)
142132
{
143133
if (!iniAttribute.INIDefined)
144134
continue;
135+
136+
if (!iniAttribute.WriteIfDefault)
137+
{
138+
object val = property.GetValue(this, null);
139+
if ((val != null && val.Equals(iniAttribute.DefaultValue)) || (val == null && iniAttribute.DefaultValue == null))
140+
{
141+
iniSection.RemoveKey(property.Name);
142+
continue;
143+
}
144+
}
145145
}
146146

147147
if (propertyType.IsEnum)

0 commit comments

Comments
 (0)