Beispiel #1
0
        private static bool TryCreateSecurity(SecurityBindingElement sbe, UnifiedSecurityMode mode, out NetMsmqSecurity security)
        {
            if (sbe != null)
            {
                mode &= UnifiedSecurityMode.Both | UnifiedSecurityMode.Message;
            }
            else
            {
                mode &= ~(UnifiedSecurityMode.Both | UnifiedSecurityMode.Message);
            }
            NetMsmqSecurityMode mode2 = NetMsmqSecurityModeHelper.ToSecurityMode(mode);

            return(NetMsmqSecurity.TryCreate(sbe, mode2, out security));
        }
Beispiel #2
0
        static bool TryCreateSecurity(SecurityBindingElement sbe, UnifiedSecurityMode mode, out NetMsmqSecurity security)
        {
            if (sbe != null)
            {
                mode &= UnifiedSecurityMode.Message | UnifiedSecurityMode.Both;
            }
            else
            {
                mode &= ~(UnifiedSecurityMode.Message | UnifiedSecurityMode.Both);
            }

            NetMsmqSecurityMode netMsmqSecurityMode = NetMsmqSecurityModeHelper.ToSecurityMode(mode);

            Fx.Assert(NetMsmqSecurityModeHelper.IsDefined(netMsmqSecurityMode), string.Format("Invalid NetMsmqSecurityMode value: {0}.", netMsmqSecurityMode.ToString()));

            if (NetMsmqSecurity.TryCreate(sbe, netMsmqSecurityMode, out security))
            {
                return(true);
            }
            return(false);
        }