/// <summary> /// Creates a proxy instance that wraps a dictionary of properties /// </summary> /// <returns>The property decomposed instance.</returns> /// <param name="peer">The unused peer instance.</param> /// <param name="type">The remote type being wrapped.</param> /// <param name="interface">The interface presented as the wrapped.</param> /// <param name="values">The decomposed property values.</param> public static object WrapPropertyDecomposedInstance(this RPCPeer peer, Type type, Type @interface, object[] values) { var d = new Dictionary <string, object>(); var names = (string[])values[0]; for (var i = 0; i < names.Length; i++) { d[names[i]] = values[i + 1]; } var p = ProxyCreator.CreateAutomaticProxy <PropertyDecomposedObject>(peer, type, @interface, 0); var h = p.GetType().GetField("__remoteHandle", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(p) as PropertyDecomposedObject; h.m_values = d; return(p); }
/// <summary> /// Creates a remote proxy for the given handle /// </summary> /// <returns>The create.</returns> /// <param name="peer">The peer to invoke the method on.</param> /// <param name="type">The remote type being wrapped.</param> /// <param name="interface">The interface to return</param> /// <param name="handle">The remote handle.</param> public static IRemoteInstance WrapRemote(this RPCPeer peer, Type type, Type @interface, long handle) { return((IRemoteInstance)ProxyCreator.CreateAutomaticProxy <RemoteObject>(peer, type, @interface, handle)); }