Skip to content

Commit e3b9b22

Browse files
committed
Refactored field checks to ignore properties and fields marked with JsonIgnoreAttribute
1 parent ba0343d commit e3b9b22

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

TLibrary/Models/Plugin/PluginBase.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
using System.Collections.Generic;
44
using System.Globalization;
55
using System.IO;
6+
using System.Linq;
67
using System.Reflection;
8+
using Newtonsoft.Json;
79
using Rocket.Core.Plugins;
810
using Tavstal.TLibrary.Extensions;
911
using Tavstal.TLibrary.Managers;
@@ -195,7 +197,7 @@ public virtual void CheckPluginFiles()
195197
// Log missing fields
196198
foreach (var field in Config.GetType().GetProperties())
197199
{
198-
if (field.Name == "FileName" || field.Name == "FilePath")
200+
if (field.GetCustomAttribute<JsonIgnoreAttribute>() != null)
199201
continue;
200202

201203
if (field.GetValue(Config) != null)
@@ -206,7 +208,7 @@ public virtual void CheckPluginFiles()
206208

207209
foreach (var field in Config.GetType().GetFields())
208210
{
209-
if (field.Name == "FileName" || field.Name == "FilePath")
211+
if (field.GetCustomAttribute<JsonIgnoreAttribute>() != null)
210212
continue;
211213

212214
if (field.GetValue(Config) != null)

0 commit comments

Comments
 (0)