コード例 #1
0
        public object GetObject(Type type, string bus_name, ObjectPath path)
        {
            if (!CheckBusNameExists(bus_name))
            {
                return(null);
            }

            //if the requested type is an interface, we can implement it efficiently
            //otherwise we fall back to using a transparent proxy
            if (type.IsInterface || type.IsAbstract)
            {
                return(BusObject.GetObject(this, bus_name, path, type));
            }
            else
            {
                if (ProtocolInformation.Verbose)
                {
                    Console.Error.WriteLine("Warning: Note that MarshalByRefObject use is not recommended; for best performance, define interfaces");
                }

                BusObject busObject = new BusObject(this, bus_name, path);
                DProxy    prox      = new DProxy(busObject, type);
                return(prox.GetTransparentProxy());
            }
        }
コード例 #2
0
        public static object GetObject(Connection conn, string bus_name, ObjectPath object_path, Type declType)
        {
            Type proxyType = TypeImplementer.Root.GetImplementation(declType);

            object    instObj = Activator.CreateInstance(proxyType);
            BusObject inst    = GetBusObject(instObj);

            inst.conn        = conn;
            inst.bus_name    = bus_name;
            inst.object_path = object_path;

            return(instObj);
        }
コード例 #3
0
ファイル: BusObject.cs プロジェクト: rcaelers/dbus-sharp
        public static BusObject GetBusObject(object instObj)
        {
            if (instObj is BusObject)
                return (BusObject)instObj;

            BusObject inst;
            if (boCache.TryGetValue (instObj, out inst))
                return inst;

            inst = new BusObject ();
            boCache[instObj] = inst;

            return inst;
        }
コード例 #4
0
ファイル: Connection.cs プロジェクト: evgenekov/dbus-sharp
        public object GetObject(Type type, string bus_name, ObjectPath path)
        {
            if (!CheckBusNameExists(bus_name))
            {
                return(null);
            }

            //if the requested type is an interface, we can implement it efficiently
            //otherwise we fall back to using a transparent proxy
            if (type.IsInterface || type.IsAbstract)
            {
                return(BusObject.GetObject(this, bus_name, path, type));
            }
            else
            {
                throw new ApplicationException("Warning: Note that MarshalByRefObject use is not available");
            }
        }
コード例 #5
0
        public static BusObject GetBusObject(object instObj)
        {
            if (instObj is BusObject)
            {
                return((BusObject)instObj);
            }

            BusObject inst;

            if (boCache.TryGetValue(instObj, out inst))
            {
                return(inst);
            }

            inst             = new BusObject();
            boCache[instObj] = inst;

            return(inst);
        }
コード例 #6
0
ファイル: MessageWriter.cs プロジェクト: genesi/dbus-sharp
        public void WriteObject(Type type, object val)
        {
            ObjectPath path;

            BusObject bobj = val as BusObject;

            if (bobj == null && val is MarshalByRefObject)
            {
                bobj = ((MarshalByRefObject)val).GetLifetimeService() as BusObject;
            }

            if (bobj == null)
            {
                throw new Exception("No object reference to write");
            }

            path = bobj.Path;

            Write(path);
        }
コード例 #7
0
ファイル: DProxy.cs プロジェクト: brookpatten/dbus-sharp
		public DProxy (BusObject busObject, Type type) : base(type)
		{
			this.busObject = busObject;
		}
コード例 #8
0
ファイル: DProxy.cs プロジェクト: genesi/dbus-sharp
 public DProxy(BusObject busObject, Type type) : base(type)
 {
     this.busObject = busObject;
 }