mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 06:20:25 +00:00
Fix batch editor filter check
passing an object with a type from another assembly will have obj.GetType() return a System.RuntimeType, which is absolutely not what we want. supply the pkm derived GetType why is this so wonky Closes #1266
This commit is contained in:
parent
2822a55d53
commit
a4c0927d9c
1 changed files with 4 additions and 4 deletions
|
@ -382,7 +382,7 @@ namespace PKHeX.WinForms
|
|||
}
|
||||
private sealed class PKMInfo
|
||||
{
|
||||
private readonly PKM pkm;
|
||||
internal PKM pkm { get; }
|
||||
internal PKMInfo(PKM pk) { pkm = pk; }
|
||||
|
||||
private LegalityAnalysis la;
|
||||
|
@ -477,7 +477,7 @@ namespace PKHeX.WinForms
|
|||
return true;
|
||||
}
|
||||
if (!pkm.HasPropertyAll(cmd.PropertyName)
|
||||
|| ReflectFrameworkUtil.IsValueEqual(pkm, cmd.PropertyName, cmd.PropertyValue) != cmd.Evaluator)
|
||||
|| pkm.IsValueEqual(info.pkm, cmd.PropertyName, cmd.PropertyValue) != cmd.Evaluator)
|
||||
{
|
||||
result = ModifyResult.Filtered;
|
||||
return true;
|
||||
|
@ -567,9 +567,9 @@ namespace PKHeX.WinForms
|
|||
|
||||
public static class ReflectFrameworkUtil
|
||||
{
|
||||
public static bool IsValueEqual(object obj, string propertyName, object value)
|
||||
public static bool IsValueEqual(this Type t, object obj, string propertyName, object value)
|
||||
{
|
||||
PropertyInfo pi = obj.GetType().GetProperty(propertyName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
PropertyInfo pi = t.GetProperty(propertyName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||
var v = pi.GetValue(obj, null);
|
||||
var c = ConvertValue(value, pi.PropertyType);
|
||||
return v.Equals(c);
|
||||
|
|
Loading…
Reference in a new issue