private static CheckForInfrastructurePermission ( |
||
asm | ||
Résultat | void |
internal static IConstructionReturnMessage DoCrossContextActivation(IConstructionCallMessage reqMsg) { bool isContextful = reqMsg.ActivationType.IsContextful; Context context = null; if (isContextful) { context = new Context(); ArrayList arrayList = (ArrayList)reqMsg.ContextProperties; for (int i = 0; i < arrayList.Count; i++) { IContextProperty contextProperty = arrayList[i] as IContextProperty; if (contextProperty == null) { throw new RemotingException(Environment.GetResourceString("Remoting_Activation_BadAttribute")); } RuntimeAssembly asm = (RuntimeAssembly)contextProperty.GetType().Assembly; ActivationServices.CheckForInfrastructurePermission(asm); if (context.GetProperty(contextProperty.Name) == null) { context.SetProperty(contextProperty); } } context.Freeze(); for (int j = 0; j < arrayList.Count; j++) { if (!((IContextProperty)arrayList[j]).IsNewContextOK(context)) { throw new RemotingException(Environment.GetResourceString("Remoting_Activation_PropertyUnhappy")); } } } InternalCrossContextDelegate internalCrossContextDelegate = new InternalCrossContextDelegate(ActivationServices.DoCrossContextActivationCallback); object[] args = new object[] { reqMsg }; IConstructionReturnMessage result; if (isContextful) { result = (Thread.CurrentThread.InternalCrossContextCallback(context, internalCrossContextDelegate, args) as IConstructionReturnMessage); } else { result = (internalCrossContextDelegate(args) as IConstructionReturnMessage); } return(result); }
internal static void GetPropertiesFromAttributes(IConstructionCallMessage ctorMsg, object[] attributes) { if (attributes == null) { return; } for (int index = 0; index < attributes.Length; ++index) { IContextAttribute contextAttribute = attributes[index] as IContextAttribute; if (contextAttribute == null) { throw new RemotingException(Environment.GetResourceString("Remoting_Activation_BadAttribute")); } ActivationServices.CheckForInfrastructurePermission((RuntimeAssembly)contextAttribute.GetType().Assembly); contextAttribute.GetPropertiesForNewContext(ctorMsg); } }
internal static IConstructionReturnMessage DoCrossContextActivation(IConstructionCallMessage reqMsg) { bool isContextful = reqMsg.ActivationType.IsContextful; Context context = (Context)null; if (isContextful) { context = new Context(); ArrayList arrayList = (ArrayList)reqMsg.ContextProperties; for (int index = 0; index < arrayList.Count; ++index) { IContextProperty prop = arrayList[index] as IContextProperty; if (prop == null) { throw new RemotingException(Environment.GetResourceString("Remoting_Activation_BadAttribute")); } ActivationServices.CheckForInfrastructurePermission((RuntimeAssembly)prop.GetType().Assembly); if (context.GetProperty(prop.Name) == null) { context.SetProperty(prop); } } context.Freeze(); for (int index = 0; index < arrayList.Count; ++index) { if (!((IContextProperty)arrayList[index]).IsNewContextOK(context)) { throw new RemotingException(Environment.GetResourceString("Remoting_Activation_PropertyUnhappy")); } } } InternalCrossContextDelegate ftnToCall = new InternalCrossContextDelegate(ActivationServices.DoCrossContextActivationCallback); object[] args = new object[1] { (object)reqMsg }; return(!isContextful?ftnToCall(args) as IConstructionReturnMessage : Thread.CurrentThread.InternalCrossContextCallback(context, ftnToCall, args) as IConstructionReturnMessage); }
private static bool QueryAttributesIfContextOK(Context ctx, IConstructionCallMessage ctorMsg, object[] attributes) { bool flag = true; if (attributes != null) { for (int index = 0; index < attributes.Length; ++index) { IContextAttribute contextAttribute = attributes[index] as IContextAttribute; if (contextAttribute == null) { throw new RemotingException(Environment.GetResourceString("Remoting_Activation_BadAttribute")); } ActivationServices.CheckForInfrastructurePermission((RuntimeAssembly)contextAttribute.GetType().Assembly); flag = contextAttribute.IsContextOK(ctx, ctorMsg); if (!flag) { break; } } } return(flag); }