diff --git a/UndertaleModLib/UndertaleData.cs b/UndertaleModLib/UndertaleData.cs
index ff1d3e429..ad8f12c63 100644
--- a/UndertaleModLib/UndertaleData.cs
+++ b/UndertaleModLib/UndertaleData.cs
@@ -385,19 +385,19 @@ public class UndertaleData : IDisposable
public bool GMLCacheIsReady { get; set; } = true;
///
- /// An array of a properties with type.
+ /// An array of a properties with as their type.
///
- public PropertyInfo[] ListProperties { get; private set; }
+ public PropertyInfo[] AllListProperties { get; private set; }
///
/// Initializes new instance.
///
public UndertaleData()
{
- ListProperties = GetType().GetProperties()
- .Where(x => x.PropertyType.IsGenericType
- && x.PropertyType.GetGenericTypeDefinition() == typeof(IList<>))
- .ToArray();
+ AllListProperties = GetType().GetProperties()
+ .Where(x => x.PropertyType.IsGenericType
+ && x.PropertyType.GetGenericTypeDefinition() == typeof(IList<>))
+ .ToArray();
}
///
@@ -437,11 +437,11 @@ public UndertaleNamedResource ByName(string name, bool ignoreCase = false)
public int IndexOf(UndertaleResource obj, bool panicIfInvalid = true)
{
Type objType = obj.GetType();
- PropertyInfo objListProp = ListProperties.FirstOrDefault(x => x.PropertyType.GetGenericArguments()[0] == objType);
- if (objListProp is not null)
- {
- if (objListProp.GetValue(this) is IList list)
- return list.IndexOf(obj);
+ PropertyInfo objListPropInfo = AllListProperties.FirstOrDefault(x => x.PropertyType.GetGenericArguments()[0] == objType);
+ if (objListPropInfo is not null)
+ {
+ if (objListPropInfo.GetValue(this) is IList list)
+ return list.IndexOf(obj);
}
if (panicIfInvalid)
@@ -605,7 +605,7 @@ public void Dispose()
Type disposableType = typeof(IDisposable);
PropertyInfo[] dataProperties = GetType().GetProperties();
- var dataDisposableProps = dataProperties.Except(ListProperties)
+ var dataDisposableProps = dataProperties.Except(AllListProperties)
.Where(x => disposableType.IsAssignableFrom(x.PropertyType));
// Dispose disposable properties
@@ -619,7 +619,7 @@ public void Dispose()
}
// Clear all object lists (sprites, code, etc.)
- foreach (PropertyInfo dataListProperty in ListProperties)
+ foreach (PropertyInfo dataListProperty in AllListProperties)
{
// If list is null
if (dataListProperty.GetValue(this) is not IList list)
diff --git a/UndertaleModTool/MainWindow.xaml.cs b/UndertaleModTool/MainWindow.xaml.cs
index 6b2205472..a55f4150c 100644
--- a/UndertaleModTool/MainWindow.xaml.cs
+++ b/UndertaleModTool/MainWindow.xaml.cs
@@ -3081,15 +3081,15 @@ private void SearchBox_TextChanged(object sender, TextChangedEventArgs e)
public void UpdateObjectLabel(object obj)
{
- int foundIndex = obj is UndertaleResource res
- ? Data.IndexOf(res, false)
- : -1;
- string idString = foundIndex == -1
- ? "None"
- : (foundIndex == -2
- ? "N/A"
- : Convert.ToString(foundIndex)
- );
+ int foundIndex = obj is UndertaleResource res ? Data.IndexOf(res, false) : -1;
+ string idString;
+
+ if (foundIndex == -1)
+ idString = "None";
+ else if (foundIndex == -2)
+ idString = "N/A";
+ else
+ idString = Convert.ToString(foundIndex);
SetIDString(idString);
}