index.html
Main Page
|
modules.html
Modules
|
namespaces.html
Namespace List
|
hierarchy.html
Class Hierarchy
|
annotated.html
Data Structures
|
dirs.html
Directories
|
files.html
File List
|
namespacemembers.html
Namespace Members
|
functions.html
Data Fields
|
pages.html
Related Pages
dir_000000.html
mono
InterfaceProxy.cs
00001
namespace
DBus
00002 {
00003
using
System;
00004
using
System.Collections;
00005
using
System.Reflection;
00006
classDBus_1_1InterfaceProxy.html
00007
internal
class
classDBus_1_1InterfaceProxy.html
InterfaceProxy
00008   {
00009
private
static
Hashtable interfaceProxies =
new
Hashtable();
00010
private
Hashtable methods = null;
00011
private
Hashtable signals = null;
00012
00013
private
string interfaceName;
00014
00015
private
classDBus_1_1InterfaceProxy.html
InterfaceProxy
(Type type)
00016     {
00017       object[] attributes = type.GetCustomAttributes(typeof(
classDBus_1_1InterfaceAttribute.html
InterfaceAttribute
),
true
);
00018
classDBus_1_1InterfaceAttribute.html
InterfaceAttribute
interfaceAttribute = (
classDBus_1_1InterfaceAttribute.html
InterfaceAttribute
) attributes[0];
00019
this
.interfaceName = interfaceAttribute.
classDBus_1_1InterfaceAttribute.html#00
InterfaceName
;
00020       AddMethods(type);
00021       AddSignals(type);
00022     }
00023
00024
// Add all the events with Signal attributes
00025
private
void
AddSignals(Type type)
00026     {
00027
this
.signals =
new
Hashtable();
00028       foreach (EventInfo signal in type.GetEvents(BindingFlags.Public |
00029                                                   BindingFlags.Instance |
00030                                                   BindingFlags.DeclaredOnly)) {
00031         object[] attributes = signal.GetCustomAttributes(typeof(
classDBus_1_1SignalAttribute.html
SignalAttribute
),
false
);
00032
if
(attributes.GetLength(0) > 0) {
00033           MethodInfo invoke = signal.EventHandlerType.GetMethod(
"Invoke"
);
00034           signals.Add(signal.Name +
" "
+
classDBus_1_1InterfaceProxy.html#e1
GetSignature
(invoke), signal);
00035         }
00036       }
00037     }
00038
00039
// Add all the methods with Method attributes
00040
private
void
AddMethods(Type type)
00041     {
00042
this
.methods =
new
Hashtable();
00043       foreach (MethodInfo method in type.GetMethods(BindingFlags.Public |
00044                                                     BindingFlags.Instance |
00045                                                     BindingFlags.DeclaredOnly)) {
00046         object[] attributes = method.GetCustomAttributes(typeof(
classDBus_1_1MethodAttribute.html
MethodAttribute
),
false
);
00047
if
(attributes.GetLength(0) > 0) {
00048           methods.Add(method.Name +
" "
+
classDBus_1_1InterfaceProxy.html#e1
GetSignature
(method), method);
00049         }
00050       }
00051     }
00052
00053
classDBus_1_1InterfaceProxy.html#e0
00054
public
static
classDBus_1_1InterfaceProxy.html
InterfaceProxy
classDBus_1_1InterfaceProxy.html#e0
GetInterface
(Type type)
00055     {
00056
if
(!interfaceProxies.Contains(type)) {
00057         interfaceProxies[type] =
new
classDBus_1_1InterfaceProxy.html
InterfaceProxy
(type);
00058       }
00059
00060
return
(
classDBus_1_1InterfaceProxy.html
InterfaceProxy
) interfaceProxies[type];
00061     }
00062
classDBus_1_1InterfaceProxy.html#a0
00063
public
bool
classDBus_1_1InterfaceProxy.html#a0
HasMethod
(string key)
00064     {
00065
return
this
.Methods.Contains(key);
00066     }
00067
classDBus_1_1InterfaceProxy.html#a1
00068
public
bool
classDBus_1_1InterfaceProxy.html#a1
HasSignal
(string key)
00069     {
00070
return
this
.Signals.Contains(key);
00071     }
00072
classDBus_1_1InterfaceProxy.html#a2
00073
public
EventInfo
classDBus_1_1InterfaceProxy.html#a2
GetSignal
(string key)
00074     {
00075
return
(EventInfo)
this
.Signals[key];
00076     }
00077
classDBus_1_1InterfaceProxy.html#a3
00078
public
MethodInfo
classDBus_1_1InterfaceProxy.html#a3
GetMethod
(string key)
00079     {
00080
return
(MethodInfo)
this
.Methods[key];
00081     }
00082
classDBus_1_1InterfaceProxy.html#e1
00083
public
static
string
classDBus_1_1InterfaceProxy.html#e1
GetSignature
(MethodInfo method)
00084     {
00085       ParameterInfo[] pars = method.GetParameters();
00086       string key =
""
;
00087
00088       foreach (ParameterInfo par in pars) {
00089
if
(!par.IsOut) {
00090           Type dbusType =
classDBus_1_1Arguments.html
Arguments
.MatchType(par.ParameterType);
00091           key +=
classDBus_1_1Arguments.html
Arguments
.GetCode(dbusType);
00092         }
00093       }
00094
00095
return
key;
00096     }
00097
00098
public
Hashtable
classDBus_1_1InterfaceProxy.html#00
Methods
classDBus_1_1InterfaceProxy.html#00
00099
{
00100       get {
00101
return
this
.methods;
00102       }
00103     }
00104
00105
public
Hashtable
classDBus_1_1InterfaceProxy.html#01
Signals
classDBus_1_1InterfaceProxy.html#01
00106
{
00107       get {
00108
return
this
.signals;
00109       }
00110     }
00111
00112
public
string
classDBus_1_1InterfaceProxy.html#02
InterfaceName
classDBus_1_1InterfaceProxy.html#02
00113
{
00114       get {
00115
return
this
.interfaceName;
00116       }
00117     }
00118   }
00119 }
00120
00121
Generated on Tue Sep 13 01:28:08 2005 for D-BUS by
http://www.doxygen.org/index.html
doxygen
1.4.4
