示例#1
0
        public object Invoke(IObject obj, ICallable method, params object[] arguments)
        {
            Machine current = Machine.Current;

            try
            {
                this.machine.SetCurrent();

                if (obj is ObjectProxy)
                {
                    ObjectProxy proxy = (ObjectProxy)obj;

                    if (proxy.HostId != this.Id)
                    {
                        throw new NotSupportedException();
                    }

                    return(this.Invoke(proxy.ObjectId, method, arguments));
                }

                return(obj.Invoke(method, arguments));
            }
            finally
            {
                Machine.SetCurrent(current);
            }
        }
示例#2
0
        public object ResultToObject(object result)
        {
            if (result == null)
            {
                return(null);
            }

            if (!(result is IObject))
            {
                return(result);
            }

            if (this.objectids.ContainsKey(result))
            {
                return(this.objectids[result]);
            }

            ObjectProxy proxy = new ObjectProxy(result, this);

            this.objectids[result]       = proxy.ObjectId;
            this.proxies[proxy.ObjectId] = proxy;

            return(proxy);
        }
示例#3
0
文件: Host.cs 项目: ajlopez/AjSharp
        public object ResultToObject(object result)
        {
            if (result == null)
                return null;

            if (!(result is IObject))
                return result;

            if (this.objectids.ContainsKey(result))
                return this.objectids[result];

            ObjectProxy proxy = new ObjectProxy(result, this);

            this.objectids[result] = proxy.ObjectId;
            this.proxies[proxy.ObjectId] = proxy;

            return proxy;
        }