Improved ExtensionData checks, moved closer to source
This commit is contained in:
@@ -60,6 +60,11 @@ public static class ObjectExtensions
|
||||
|
||||
foreach (var prop in list)
|
||||
{
|
||||
if (string.Equals(prop.Name, "extensiondata", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
result.Add(prop.GetValue(obj));
|
||||
}
|
||||
|
||||
@@ -68,7 +73,15 @@ public static class ObjectExtensions
|
||||
|
||||
public static Dictionary<string, object?> GetAllPropsAsDict(this object? obj)
|
||||
{
|
||||
var props = obj.GetType().GetProperties();
|
||||
if (obj is null)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
var props = obj
|
||||
.GetType()
|
||||
.GetProperties()
|
||||
.Where(prop => !string.Equals(prop.Name, "extensiondata", StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
return props.ToDictionary(prop => prop.Name, prop => prop.GetValue(obj));
|
||||
}
|
||||
|
||||
@@ -275,11 +275,6 @@ public class HealthController(
|
||||
|
||||
foreach (var bodyPartKvP in healthTreatmentRequest.Difference.BodyParts.GetAllPropsAsDict())
|
||||
{
|
||||
if (string.Equals(bodyPartKvP.Key, "extensiondata", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get body part from request + from pmc profile
|
||||
var partRequest = (BodyPartEffects) bodyPartKvP.Value;
|
||||
var profilePart = pmcData.Health.BodyParts[bodyPartKvP.Key];
|
||||
|
||||
@@ -62,7 +62,9 @@ public class LauncherController(
|
||||
{
|
||||
var result = new Dictionary<string, string>();
|
||||
var dbProfiles = _databaseService.GetProfiles();
|
||||
foreach (var templatesProperty in typeof(ProfileTemplates).GetProperties().Where(p => p.CanWrite && p.Name != "ExtensionData"))
|
||||
foreach (var templatesProperty in typeof(ProfileTemplates).GetProperties()
|
||||
.Where(p => p.CanWrite
|
||||
&& !string.Equals(p.Name, "extensiondata", StringComparison.InvariantCultureIgnoreCase)))
|
||||
{
|
||||
var propertyValue = templatesProperty.GetValue(dbProfiles);
|
||||
if (propertyValue == null)
|
||||
|
||||
@@ -48,7 +48,9 @@ public class LauncherV2Controller(
|
||||
var result = new Dictionary<string, string>();
|
||||
var dbProfiles = _databaseService.GetProfiles();
|
||||
|
||||
foreach (var templatesProperty in typeof(ProfileTemplates).GetProperties().Where(p => p.CanWrite && p.Name != "ExtensionData"))
|
||||
foreach (var templatesProperty in typeof(ProfileTemplates).GetProperties()
|
||||
.Where(p => p.CanWrite
|
||||
&& !string.Equals(p.Name, "extensiondata", StringComparison.InvariantCultureIgnoreCase)))
|
||||
{
|
||||
var propertyValue = templatesProperty.GetValue(dbProfiles);
|
||||
if (propertyValue == null)
|
||||
|
||||
@@ -1205,11 +1205,6 @@ public class QuestHelper(
|
||||
continue;
|
||||
}
|
||||
|
||||
if (string.Equals(rewardType.Key, "extensiondata", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
propsAsDict[rewardType.Key] = ((List<Reward>) propsAsDict[rewardType.Key])
|
||||
.Where(reward =>
|
||||
_rewardHelper.RewardIsForGameEdition(reward, gameVersion)
|
||||
|
||||
Reference in New Issue
Block a user