void ChangeAddress(MemoryWatcher watcher) { if (watcher is StringWatcher) { _innerType = typeof(string); } else { _innerType = watcher.GetType().GetProperties() .First(p => p.Name == "Current" && p.PropertyType != typeof(object)).GetValue(watcher) .GetType(); } SetComparisons(); SetPossibleValues(); SetOptions(); }
public static bool IsSupportedMemoryWatcher(MemoryWatcher watcher) { var t = watcher.GetType(); if (t.IsGenericType) { var genericT = t.GetGenericTypeDefinition(); var genericArg = t.GetGenericArguments()[0]; if (genericT == typeof(MemoryWatcher <>) || genericT == typeof(FakeMemoryWatcher <>)) { return(genericArg.IsPrimitive); } } if (watcher is StringWatcher) { return(true); } return(false); }