public override int GetHashCode()
        {
            var hash = 3;

            hash = (hash * 2) + EnableLdapAuthentication.GetHashCode();
            hash = (hash * 2) + StartTls.GetHashCode();
            hash = (hash * 2) + Server.GetHashCode();
            hash = (hash * 2) + UserDN.GetHashCode();
            hash = (hash * 2) + PortNumber.GetHashCode();
            hash = (hash * 2) + UserFilter.GetHashCode();
            hash = (hash * 2) + LoginAttribute.GetHashCode();
            hash = (hash * 2) + FirstNameAttribute.GetHashCode();
            hash = (hash * 2) + SecondNameAttribute.GetHashCode();
            hash = (hash * 2) + MailAttribute.GetHashCode();
            hash = (hash * 2) + TitleAttribute.GetHashCode();
            hash = (hash * 2) + MobilePhoneAttribute.GetHashCode();
            hash = (hash * 2) + LocationAttribute.GetHashCode();
            hash = (hash * 2) + GroupMembership.GetHashCode();
            hash = (hash * 2) + GroupDN.GetHashCode();
            hash = (hash * 2) + GroupNameAttribute.GetHashCode();
            hash = (hash * 2) + GroupFilter.GetHashCode();
            hash = (hash * 2) + UserAttribute.GetHashCode();
            hash = (hash * 2) + GroupAttribute.GetHashCode();
            hash = (hash * 2) + Authentication.GetHashCode();
            hash = (hash * 2) + Login.GetHashCode();
            return(hash);
        }
Пример #2
0
        public override int GetHashCode()
        {
            var hash = 3;

            hash = (hash * 2) + EnableLdapAuthentication.GetHashCode();
            hash = (hash * 2) + StartTls.GetHashCode();
            hash = (hash * 2) + Ssl.GetHashCode();
            hash = (hash * 2) + SendWelcomeEmail.GetHashCode();
            hash = (hash * 2) + Server.GetHashCode();
            hash = (hash * 2) + UserDN.GetHashCode();
            hash = (hash * 2) + PortNumber.GetHashCode();
            hash = (hash * 2) + UserFilter.GetHashCode();
            hash = (hash * 2) + LoginAttribute.GetHashCode();
            hash = (hash * 2) + GroupMembership.GetHashCode();
            hash = (hash * 2) + GroupDN.GetHashCode();
            hash = (hash * 2) + GroupNameAttribute.GetHashCode();
            hash = (hash * 2) + GroupFilter.GetHashCode();
            hash = (hash * 2) + UserAttribute.GetHashCode();
            hash = (hash * 2) + GroupAttribute.GetHashCode();
            hash = (hash * 2) + Authentication.GetHashCode();
            hash = (hash * 2) + Login.GetHashCode();

            foreach (var pair in LdapMapping)
            {
                hash = (hash * 2) + pair.Value.GetHashCode();
            }

            foreach (var pair in AccessRights)
            {
                hash = (hash * 2) + pair.Value.GetHashCode();
            }

            return(hash);
        }
Пример #3
0
        //second method it looks to (used as main help formatter) i!help
        public override BaseHelpFormatter WithSubcommands(IEnumerable <Command> subcommands)
        {
            List <cmdGroup> module     = new List <cmdGroup>();
            var             enumerable = subcommands.ToList();

            if (enumerable.Any())
            {
                foreach (var cmd in enumerable)
                {
                    if (cmd.Name != "help")
                    {
                        // getting the cmd's group through their attributes
                        string groupName  = string.Empty;
                        string groupEmoji = string.Empty;
                        foreach (var attr in cmd.CustomAttributes)
                        {
                            if (attr is GroupNameAttribute)
                            {
                                GroupNameAttribute a = (GroupNameAttribute)attr;
                                groupName  = a.Name;
                                groupEmoji = a.emoji;
                            }
                        }
                        bool exists = false;
                        foreach (var group in module)
                        {
                            if (group.GroupName == groupName)
                            {
                                exists = true;
                            }
                        }

                        // put outside to ensure it is one once per cmd
                        if (exists)                                                      //gets that a field already exists
                        {
                            module.Find(x => x.GroupName == groupName).cmdList.Add(cmd); //finds the groupname by name, and then adds the cmd
                        }
                        else // else it makes a new group and adds in the main module (filled with groups)
                        {
                            cmdGroup group = new cmdGroup(groupName, groupEmoji);
                            group.cmdList.Add(cmd);
                            module.Add(group);
                        }
                    }
                }
            }
            //where we output all the groups
            foreach (var group in module)
            {
                _output.AddField(group.emoji + " " + Formatter.Bold(group.GroupName), string.Join(" ", group.cmdList.Select(c => Formatter.InlineCode(c.Name))));
            }
            return(this);
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (ProviderName != null)
         {
             hashCode = hashCode * 59 + ProviderName.GetHashCode();
         }
         if (HostName != null)
         {
             hashCode = hashCode * 59 + HostName.GetHashCode();
         }
         if (HostPort != null)
         {
             hashCode = hashCode * 59 + HostPort.GetHashCode();
         }
         if (HostSsl != null)
         {
             hashCode = hashCode * 59 + HostSsl.GetHashCode();
         }
         if (HostTls != null)
         {
             hashCode = hashCode * 59 + HostTls.GetHashCode();
         }
         if (HostNoCertCheck != null)
         {
             hashCode = hashCode * 59 + HostNoCertCheck.GetHashCode();
         }
         if (BindDn != null)
         {
             hashCode = hashCode * 59 + BindDn.GetHashCode();
         }
         if (BindPassword != null)
         {
             hashCode = hashCode * 59 + BindPassword.GetHashCode();
         }
         if (SearchTimeout != null)
         {
             hashCode = hashCode * 59 + SearchTimeout.GetHashCode();
         }
         if (AdminPoolMaxActive != null)
         {
             hashCode = hashCode * 59 + AdminPoolMaxActive.GetHashCode();
         }
         if (AdminPoolLookupOnValidate != null)
         {
             hashCode = hashCode * 59 + AdminPoolLookupOnValidate.GetHashCode();
         }
         if (UserPoolMaxActive != null)
         {
             hashCode = hashCode * 59 + UserPoolMaxActive.GetHashCode();
         }
         if (UserPoolLookupOnValidate != null)
         {
             hashCode = hashCode * 59 + UserPoolLookupOnValidate.GetHashCode();
         }
         if (UserBaseDN != null)
         {
             hashCode = hashCode * 59 + UserBaseDN.GetHashCode();
         }
         if (UserObjectclass != null)
         {
             hashCode = hashCode * 59 + UserObjectclass.GetHashCode();
         }
         if (UserIdAttribute != null)
         {
             hashCode = hashCode * 59 + UserIdAttribute.GetHashCode();
         }
         if (UserExtraFilter != null)
         {
             hashCode = hashCode * 59 + UserExtraFilter.GetHashCode();
         }
         if (UserMakeDnPath != null)
         {
             hashCode = hashCode * 59 + UserMakeDnPath.GetHashCode();
         }
         if (GroupBaseDN != null)
         {
             hashCode = hashCode * 59 + GroupBaseDN.GetHashCode();
         }
         if (GroupObjectclass != null)
         {
             hashCode = hashCode * 59 + GroupObjectclass.GetHashCode();
         }
         if (GroupNameAttribute != null)
         {
             hashCode = hashCode * 59 + GroupNameAttribute.GetHashCode();
         }
         if (GroupExtraFilter != null)
         {
             hashCode = hashCode * 59 + GroupExtraFilter.GetHashCode();
         }
         if (GroupMakeDnPath != null)
         {
             hashCode = hashCode * 59 + GroupMakeDnPath.GetHashCode();
         }
         if (GroupMemberAttribute != null)
         {
             hashCode = hashCode * 59 + GroupMemberAttribute.GetHashCode();
         }
         if (UseUidForExtId != null)
         {
             hashCode = hashCode * 59 + UseUidForExtId.GetHashCode();
         }
         if (Customattributes != null)
         {
             hashCode = hashCode * 59 + Customattributes.GetHashCode();
         }
         return(hashCode);
     }
 }
        /// <summary>
        /// Returns true if OrgApacheJackrabbitOakSecurityAuthenticationLdapImplLdapIdentiProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of OrgApacheJackrabbitOakSecurityAuthenticationLdapImplLdapIdentiProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrgApacheJackrabbitOakSecurityAuthenticationLdapImplLdapIdentiProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ProviderName == other.ProviderName ||
                     ProviderName != null &&
                     ProviderName.Equals(other.ProviderName)
                     ) &&
                 (
                     HostName == other.HostName ||
                     HostName != null &&
                     HostName.Equals(other.HostName)
                 ) &&
                 (
                     HostPort == other.HostPort ||
                     HostPort != null &&
                     HostPort.Equals(other.HostPort)
                 ) &&
                 (
                     HostSsl == other.HostSsl ||
                     HostSsl != null &&
                     HostSsl.Equals(other.HostSsl)
                 ) &&
                 (
                     HostTls == other.HostTls ||
                     HostTls != null &&
                     HostTls.Equals(other.HostTls)
                 ) &&
                 (
                     HostNoCertCheck == other.HostNoCertCheck ||
                     HostNoCertCheck != null &&
                     HostNoCertCheck.Equals(other.HostNoCertCheck)
                 ) &&
                 (
                     BindDn == other.BindDn ||
                     BindDn != null &&
                     BindDn.Equals(other.BindDn)
                 ) &&
                 (
                     BindPassword == other.BindPassword ||
                     BindPassword != null &&
                     BindPassword.Equals(other.BindPassword)
                 ) &&
                 (
                     SearchTimeout == other.SearchTimeout ||
                     SearchTimeout != null &&
                     SearchTimeout.Equals(other.SearchTimeout)
                 ) &&
                 (
                     AdminPoolMaxActive == other.AdminPoolMaxActive ||
                     AdminPoolMaxActive != null &&
                     AdminPoolMaxActive.Equals(other.AdminPoolMaxActive)
                 ) &&
                 (
                     AdminPoolLookupOnValidate == other.AdminPoolLookupOnValidate ||
                     AdminPoolLookupOnValidate != null &&
                     AdminPoolLookupOnValidate.Equals(other.AdminPoolLookupOnValidate)
                 ) &&
                 (
                     UserPoolMaxActive == other.UserPoolMaxActive ||
                     UserPoolMaxActive != null &&
                     UserPoolMaxActive.Equals(other.UserPoolMaxActive)
                 ) &&
                 (
                     UserPoolLookupOnValidate == other.UserPoolLookupOnValidate ||
                     UserPoolLookupOnValidate != null &&
                     UserPoolLookupOnValidate.Equals(other.UserPoolLookupOnValidate)
                 ) &&
                 (
                     UserBaseDN == other.UserBaseDN ||
                     UserBaseDN != null &&
                     UserBaseDN.Equals(other.UserBaseDN)
                 ) &&
                 (
                     UserObjectclass == other.UserObjectclass ||
                     UserObjectclass != null &&
                     UserObjectclass.Equals(other.UserObjectclass)
                 ) &&
                 (
                     UserIdAttribute == other.UserIdAttribute ||
                     UserIdAttribute != null &&
                     UserIdAttribute.Equals(other.UserIdAttribute)
                 ) &&
                 (
                     UserExtraFilter == other.UserExtraFilter ||
                     UserExtraFilter != null &&
                     UserExtraFilter.Equals(other.UserExtraFilter)
                 ) &&
                 (
                     UserMakeDnPath == other.UserMakeDnPath ||
                     UserMakeDnPath != null &&
                     UserMakeDnPath.Equals(other.UserMakeDnPath)
                 ) &&
                 (
                     GroupBaseDN == other.GroupBaseDN ||
                     GroupBaseDN != null &&
                     GroupBaseDN.Equals(other.GroupBaseDN)
                 ) &&
                 (
                     GroupObjectclass == other.GroupObjectclass ||
                     GroupObjectclass != null &&
                     GroupObjectclass.Equals(other.GroupObjectclass)
                 ) &&
                 (
                     GroupNameAttribute == other.GroupNameAttribute ||
                     GroupNameAttribute != null &&
                     GroupNameAttribute.Equals(other.GroupNameAttribute)
                 ) &&
                 (
                     GroupExtraFilter == other.GroupExtraFilter ||
                     GroupExtraFilter != null &&
                     GroupExtraFilter.Equals(other.GroupExtraFilter)
                 ) &&
                 (
                     GroupMakeDnPath == other.GroupMakeDnPath ||
                     GroupMakeDnPath != null &&
                     GroupMakeDnPath.Equals(other.GroupMakeDnPath)
                 ) &&
                 (
                     GroupMemberAttribute == other.GroupMemberAttribute ||
                     GroupMemberAttribute != null &&
                     GroupMemberAttribute.Equals(other.GroupMemberAttribute)
                 ) &&
                 (
                     UseUidForExtId == other.UseUidForExtId ||
                     UseUidForExtId != null &&
                     UseUidForExtId.Equals(other.UseUidForExtId)
                 ) &&
                 (
                     Customattributes == other.Customattributes ||
                     Customattributes != null &&
                     Customattributes.Equals(other.Customattributes)
                 ));
        }