コード例 #1
0
 public bool IsMember(string memberName, bool checkExternallyManaged = false)
 {
     if (!checkExternallyManaged)
     {
         return(this.Members.Any((InstanceGroupMemberConfig m) => Utils.IsEqual(m.Name, memberName, StringComparison.OrdinalIgnoreCase)));
     }
     return(this.Members.Any((InstanceGroupMemberConfig m) => Utils.IsEqual(m.Name, memberName, StringComparison.OrdinalIgnoreCase) && !m.IsManagedExternally));
 }
コード例 #2
0
 public static string[] GetMultistring(XElement element)
 {
     if (element.HasElements)
     {
         return((from el in element.Elements()
                 where Utils.IsEqual(el.Name.LocalName, "String", StringComparison.OrdinalIgnoreCase)
                 select el.Value).ToArray <string>());
     }
     return(Utils.EmptyArray <string>());
 }
コード例 #3
0
 private string ResolveGroupName(string groupName)
 {
     if (string.IsNullOrEmpty(groupName) || Utils.IsEqual(groupName, "B1563499-EA40-4101-A9E6-59A8EB26FF1E", StringComparison.OrdinalIgnoreCase))
     {
         string defaultGroupName = this.GetDefaultGroupName();
         if (!string.IsNullOrEmpty(defaultGroupName))
         {
             groupName = defaultGroupName;
         }
     }
     return(groupName);
 }
コード例 #4
0
        public static string ConstructEndpointAddress(string interfaceName, string componentName, string self, string target, string targetAddress, string padding, bool isZeroboxMode, int portNumber, string protocolName)
        {
            if (string.IsNullOrEmpty(target))
            {
                target = self;
            }
            if (string.IsNullOrEmpty(targetAddress))
            {
                targetAddress = target;
            }
            if (isZeroboxMode || Utils.IsEqual(self, target, StringComparison.OrdinalIgnoreCase))
            {
                targetAddress = "localhost";
            }
            string text = string.Empty;

            if (!Utils.IsEqual(protocolName, "net.pipe", StringComparison.OrdinalIgnoreCase))
            {
                text = string.Format("{0}://{1}:{2}/DxStore/{3}/{4}", new object[]
                {
                    protocolName,
                    targetAddress,
                    portNumber,
                    interfaceName,
                    componentName
                });
            }
            else
            {
                text = string.Format("{0}://{1}/DxStore/{2}/{3}", new object[]
                {
                    protocolName,
                    targetAddress,
                    interfaceName,
                    componentName
                });
            }
            if (!string.IsNullOrEmpty(padding))
            {
                text = text + "/" + padding;
            }
            if (isZeroboxMode)
            {
                text = text + "/" + target;
            }
            return(text);
        }
コード例 #5
0
 public void RemoveGroupConfig(string groupName)
 {
     lock (this.locker)
     {
         using (RegistryKey registryKey = this.OpenGroupsContainerKey(true))
         {
             if (registryKey != null)
             {
                 DxStoreRegistryConfigProvider.Tracer.TraceDebug <string, string>((long)groupName.GetHashCode(), "{0}/{1}: Removing group", groupName, this.Self);
                 registryKey.DeleteSubKeyTree(groupName, false);
                 if (Utils.IsEqual(groupName, this.GetDefaultGroupName(), StringComparison.OrdinalIgnoreCase))
                 {
                     this.RemoveDefaultGroupName();
                 }
             }
         }
     }
 }
コード例 #6
0
        public static Binding CreateBindingAndInitialize(string address, string bindingName, WcfTimeout timeout, bool isServerBinding)
        {
            string  a = address.Substring(0, address.IndexOf(':'));
            Binding result;

            if (Utils.IsEqual(a, "http", StringComparison.OrdinalIgnoreCase))
            {
                result = EndpointBuilder.CreateHttpBindingAndInitialize(bindingName, timeout, isServerBinding);
            }
            else if (Utils.IsEqual(a, "net.tcp", StringComparison.OrdinalIgnoreCase))
            {
                result = EndpointBuilder.CreateNettcpBindingAndInitialize(bindingName, timeout, isServerBinding);
            }
            else
            {
                if (!Utils.IsEqual(a, "net.pipe", StringComparison.OrdinalIgnoreCase))
                {
                    throw new DxStoreBindingNotSupportedException(address);
                }
                result = EndpointBuilder.CreateNamedPipeBindingAndInitialize(bindingName, timeout, isServerBinding);
            }
            return(result);
        }
コード例 #7
0
        public static bool IsMembersChanged(this InstanceGroupConfig groupCfg, InstanceGroupMemberConfig[] members)
        {
            int num  = (members != null) ? members.Length : 0;
            int num2 = (groupCfg != null) ? groupCfg.Members.Length : 0;

            if (num != num2)
            {
                return(true);
            }
            if (groupCfg == null || members == null)
            {
                return(false);
            }
            int num3 = members.Count((InstanceGroupMemberConfig member) => groupCfg.Members.Any((InstanceGroupMemberConfig gm) => Utils.IsEqual(gm.Name, member.Name, StringComparison.OrdinalIgnoreCase)));

            return(num3 != num);
        }
コード例 #8
0
        public static InstanceGroupMemberConfig GetMemberConfig(this InstanceGroupConfig cfg, string memberName)
        {
            InstanceGroupMemberConfig result = null;

            if (memberName == null)
            {
                memberName = cfg.Self;
            }
            if (cfg.Members != null)
            {
                result = cfg.Members.FirstOrDefault((InstanceGroupMemberConfig mc) => Utils.IsEqual(mc.Name, memberName, StringComparison.OrdinalIgnoreCase));
            }
            return(result);
        }