_marshaller = new Marshaller(this);
_indices = new WeakIndexTable();
_locals = new WeakOidTypeTable();
_proxies = new WeakOidTypeTable();
_oidSuffix = $";net[0];{Guid.NewGuid()}";
_oids = new Dictionary<int, string>();
}
public IntPtr CreateProxy(string oid, string interfaceName,
IntPtr pBridge, IntPtr pUnoInterface, IntPtr pTypeDesc)
{
Type interfaceType = TypeHelper.ParseType(interfaceName); object proxy = NativeUnoProxy.CreateProxy(oid, interfaceType,
pBridge, pUnoInterface, pTypeDesc, this); int index = _indices.Register(proxy);
_oids.Add(index, oid);
_proxies.RegisterInterface(proxy, oid, interfaceType); return (IntPtr)index;
}
public IntPtr RegisterLocal(object obj, Type interfaceType)
{ int index = _indices.Register(obj); if (!_oids.ContainsKey(index))
{ string oid = $"{index}{_oidSuffix}";
_oids.Add(index, oid);
}
_locals.RegisterInterface(obj, _oids[index], interfaceType); return (IntPtr)index;
}
public IntPtr LookupInterface(string pOid, string pInterfaceName)
{
Type interfaceType = TypeHelper.ParseType(pInterfaceName); return LookupInterface(pOid, interfaceType);
} public IntPtr LookupInterface(string pOid, Type type)
{ object obj = _proxies.GetInterface(pOid, type)
?? _locals.GetInterface(pOid, type); return (IntPtr)_indices.Register(obj);
}
publicvoid RevokeInterface(string pOid, string pInterfaceName)
{
Type interfaceType = TypeHelper.ParseType(pInterfaceName); if (!_proxies.RevokeInterface(pOid, interfaceType))
_locals.RevokeInterface(pOid, interfaceType);
}
object target = _indices.Lookup((int)pNetInterface); if (target == null) thrownew RuntimeException($"{pMethodName} was called on a null or unregistered interface", null);
Type targetType = target.GetType();
MethodInfo targetMethod = targetType.GetMethod(pMethodName,
BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy); if (targetMethod == null) thrownew RuntimeException($"could not find method {pMethodName} on interface {target.GetType()}", null);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.