private bool Invoke(string name, bool getprop, out object result, object[] args) { result = null; if (getprop && _methods.ContainsKey(name)) { result = new DynamicComFunctionWrapper(_registry, _methods[name], _target); return(true); } else if (getprop && name == "__qi__") { result = new Func <string, object>(QueryInterface); return(true); } else if (getprop && name == "__interfaces__") { result = GetInterfaces().Clone(); return(true); } else if (_properties.ContainsKey(name)) { PropertyInfo pi = _properties[name]; if (getprop && pi.CanRead) { result = Wrap(_registry, pi.GetValue(_target, new object[0]), pi.PropertyType); } else if (!getprop && pi.CanWrite) { pi.SetValue(_target, args[0], new object[0]); } else { return(false); } return(true); } else if (getprop && (name == "__instance__")) { result = _target; return(true); } else { return(false); } }
private bool Invoke(string name, bool getprop, out object result, object[] args) { result = null; if (getprop && _methods.ContainsKey(name)) { result = new DynamicComFunctionWrapper(_registry, _methods[name], _target); return true; } else if (getprop && name == "__qi__") { result = new Func<string, object>(QueryInterface); return true; } else if (getprop && name == "__interfaces__") { result = GetInterfaces().Clone(); return true; } else if (_properties.ContainsKey(name)) { PropertyInfo pi = _properties[name]; if (getprop && pi.CanRead) { result = Wrap(_registry, pi.GetValue(_target, new object[0]), pi.PropertyType); } else if (!getprop && pi.CanWrite) { pi.SetValue(_target, args[0], new object[0]); } else { return false; } return true; } else if (getprop && (name == "__instance__")) { result = _target; return true; } else { return false; } }