本文整理汇总了C#中System.Runtime.Remoting.Proxies.RealProxy类的典型用法代码示例。如果您正苦于以下问题:C# RealProxy类的具体用法?C# RealProxy怎么用?C# RealProxy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RealProxy类属于System.Runtime.Remoting.Proxies命名空间,在下文中一共展示了RealProxy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ServicedComponentMarshaler
protected ServicedComponentMarshaler(SerializationInfo info, StreamingContext context) : base(info, context)
{
byte[] buffer = null;
Type type = null;
bool flag = false;
ComponentServices.InitializeRemotingChannels();
SerializationInfoEnumerator enumerator = info.GetEnumerator();
while (enumerator.MoveNext())
{
if (enumerator.Name.Equals("servertype"))
{
type = (Type) enumerator.Value;
}
else
{
if (enumerator.Name.Equals("dcomInfo"))
{
buffer = (byte[]) enumerator.Value;
continue;
}
if (enumerator.Name.Equals("fIsMarshalled"))
{
int num = 0;
object obj2 = enumerator.Value;
if (obj2.GetType() == typeof(string))
{
num = ((IConvertible) obj2).ToInt32(null);
}
else
{
num = (int) obj2;
}
if (num == 0)
{
flag = true;
}
}
}
}
if (!flag)
{
this._marshalled = true;
}
this._um = new SCUnMarshaler(type, buffer);
this._rt = type;
if (base.IsFromThisProcess() && !ServicedComponentInfo.IsTypeEventSource(type))
{
this._rp = RemotingServices.GetRealProxy(base.GetRealObject(context));
}
else
{
if (ServicedComponentInfo.IsTypeEventSource(type))
{
this.TypeInfo = new SCMTypeName(type);
}
object realObject = base.GetRealObject(context);
this._rp = RemotingServices.GetRealProxy(realObject);
}
this._um.Dispose();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:60,代码来源:ServicedComponentMarshaler.cs
示例2: RedirectionProxy
internal RedirectionProxy(MarshalByRefObject proxy, Type serverType)
{
_proxy = proxy;
_realProxy = RemotingServices.GetRealProxy(_proxy);
_serverType = serverType;
_objectMode = WellKnownObjectMode.Singleton;
} // RedirectionProxy
示例3: GetRealProxy
internal RealProxy GetRealProxy()
{
if ((this._rp == null) && !this._fUnMarshaled)
{
this._rp = this.UnmarshalRemoteReference();
}
return this._rp;
}
示例4: SwitchWrappers
public static void SwitchWrappers(RealProxy oldcp, RealProxy newcp)
{
object transparentProxy = oldcp.GetTransparentProxy();
object tp = newcp.GetTransparentProxy();
RemotingServices.GetServerContextForProxy(transparentProxy);
RemotingServices.GetServerContextForProxy(tp);
Marshal.InternalSwitchCCW(transparentProxy, tp);
}
示例5: RemotingInvocation
public RemotingInvocation(RealProxy proxy, IMethodCallMessage message)
{
this.message = message;
this.proxy = proxy;
arguments = message.Args;
if (arguments == null)
arguments = new object[0];
}
示例6: NeverCallThis
private IntPtr _stub; // Unmanaged code that decides whether to short circuit calls or not
// This method should never be called. Its sole purpose is to shut up the compiler
// because it warns about private fields that are never used. Most of these fields
// are used in unmanaged code.
#if _DEBUG
private int NeverCallThis()
{
BCLDebug.Assert(false,"NeverCallThis");
_rp = null;
_pMT = new IntPtr(RemotingServices.TrashMemory);
_pInterfaceMT = new IntPtr(RemotingServices.TrashMemory);
_stub = new IntPtr(RemotingServices.TrashMemory);
RealProxy rp = _rp;
return _pInterfaceMT.ToInt32();
}
示例7: InvokeRealProxy
private static void InvokeRealProxy(RealProxy realProxy, WcfInvocation wcfInvocation)
{
var message = new MethodCallMessage(wcfInvocation.Method, wcfInvocation.Arguments);
var returnMessage = (IMethodReturnMessage)realProxy.Invoke(message);
if (returnMessage.Exception != null)
{
throw returnMessage.Exception;
}
wcfInvocation.ReturnValue = returnMessage.ReturnValue;
}
示例8: ObjectCall
public ObjectCall(
RealProxy proxy,
IMessage callMessage,
Action<IConstructionCallMessage> validationOnInit = null,
Action<IMethodCallMessage> validationOnAction = null)
{
this.proxy = proxy;
this.callMessage = callMessage;
this.validationOnInit = validationOnInit;
this.validationOnAction = validationOnAction;
}
示例9: SwitchWrappers
[System.Security.SecurityCritical] // auto-generated_required
public static void SwitchWrappers(RealProxy oldcp, RealProxy newcp)
{
Object oldtp = oldcp.GetTransparentProxy();
Object newtp = newcp.GetTransparentProxy();
IntPtr oldcontextId = RemotingServices.GetServerContextForProxy(oldtp);
IntPtr newcontextId = RemotingServices.GetServerContextForProxy(newtp);
// switch the CCW from oldtp to new tp
Marshal.InternalSwitchCCW(oldtp, newtp);
}
示例10: InvokeRealProxy
private static void InvokeRealProxy(RealProxy realProxy, WcfInvocation wcfInvocation)
{
var message = new MethodCallMessage(wcfInvocation.Method, wcfInvocation.Arguments);
var returnMessage = (IMethodReturnMessage)realProxy.Invoke(message);
if (returnMessage.Exception != null)
{
var exception = ExceptionHelper.PreserveStackTrace(returnMessage.Exception);
throw exception;
}
wcfInvocation.ReturnValue = returnMessage.ReturnValue;
}
示例11: CreateTransparentProxy
internal static extern Object CreateTransparentProxy(
RealProxy rp,
RuntimeType typeToProxy,
IntPtr stub,
Object stubData);
示例12: ProxyCheckCast
[System.Security.SecurityCritical] // auto-generated
internal static bool ProxyCheckCast(RealProxy rp, RuntimeType castType)
{
return CheckCast(rp, castType);
} // ProxyCheckCast
示例13: CheckCast
[System.Security.SecurityCritical] // auto-generated
private static bool CheckCast(RealProxy rp, RuntimeType castType)
{
// NOTE: This is the point where JIT_CheckCastClass ultimately
// lands up in the managed world if the object being cast is
// a transparent proxy.
// If we are here, it means that walking the current EEClass
// up the chain inside the EE was unable to verify the cast.
Message.DebugOut("Entered CheckCast for type " + castType);
bool fCastOK = false;
BCLDebug.Assert(rp != null, "Shouldn't be called with null real proxy.");
// Always return true if cast is to System.Object
if (castType == typeof(Object))
return true;
// We do not allow casting to non-interface types that do not extend
// from System.MarshalByRefObject
if (!castType.IsInterface && !castType.IsMarshalByRef)
return false;
// Note: this is a bit of a hack to allow deserialization of WellKnown
// object refs (in the well known cases, we always return TRUE for
// interface casts but doing so messes us up in the case when
// the object manager is trying to resolve object references since
// it ends up thinking that the proxy we returned needs to be resolved
// further).
if (castType != typeof(IObjectReference))
{
IRemotingTypeInfo typeInfo = rp as IRemotingTypeInfo;
if(null != typeInfo)
{
fCastOK = typeInfo.CanCastTo(castType, rp.GetTransparentProxy());
}
else
{
// The proxy does not implement IRemotingTypeInfo, so we should
// try to do casting based on the ObjRef type info.
Identity id = rp.IdentityObject;
if (id != null)
{
ObjRef objRef = id.ObjectRef;
if (objRef != null)
{
typeInfo = objRef.TypeInfo;
if (typeInfo != null)
{
fCastOK = typeInfo.CanCastTo(castType, rp.GetTransparentProxy());
}
}
}
}
}
Message.DebugOut("CheckCast returning " + fCastOK);
return fCastOK;
}
示例14: GetStubData
public static extern Object GetStubData(RealProxy rp);
示例15: SetStubData
public static extern void SetStubData(RealProxy rp, Object stubData);