IRole IRoleStore.GetRole(string rolename)
        {
            this.Log("rolename: " + rolename, MethodBase.GetCurrentMethod().Name);

            this.assertInitialized();
            Util.CheckForNull("rolename", rolename);
            if (this._innerRoleProviderEx != null)
            {
                string fullyQualifiedRolename = this._innerRoleProviderEx.GetFullyQualifiedRolename(rolename);
                if ((fullyQualifiedRolename != null) && !fullyQualifiedRolename.Equals(""))
                {
                    IRole role = new AGSRole();
                    role.SetRolename(fullyQualifiedRolename);
                    return(role);
                }
                return(null);
            }
            if (this._innerRoleProvider.RoleExists(rolename))
            {
                IRole role2 = new AGSRole();
                role2.SetRolename(rolename);
                return(role2);
            }
            return(null);
        }
        bool IRoleStore.GetAllRolesPaged(int StartIndex, int pageSize, out IRole[] roles)
        {
            this.Log("StartIndex: " + StartIndex, MethodBase.GetCurrentMethod().Name);

            this.assertInitialized();
            if (StartIndex < 0)
            {
                throw new Exception("startIndex cannot be negative.");
            }
            string[] allRoles = this._innerRoleProvider.GetAllRoles();
            if (StartIndex >= allRoles.Length)
            {
                roles = new AGSRole[0];
                return(false);
            }
            int num = (StartIndex + pageSize) - 1;

            if (num >= allRoles.Length)
            {
                num = allRoles.Length - 1;
            }
            roles = new AGSRole[(num - StartIndex) + 1];
            int num2 = 0;

            for (int i = StartIndex; i <= num; i++)
            {
                IRole role = new AGSRole();
                role.SetRolename(allRoles[i]);
                roles[num2++] = role;
            }
            return(num < (allRoles.Length - 1));
        }
        bool IRoleStore.GetAllRoles(string filter, int maxCount, out IRole[] roles)
        {
            this.Log("filter: " + filter, MethodBase.GetCurrentMethod().Name);

            this.assertInitialized();
            if (filter == null)
            {
                filter = "";
            }
            string[] allRoles = null;
            if (this._innerRoleProviderEx != null)
            {
                allRoles = this._innerRoleProviderEx.GetAllRoles(filter);
            }
            else
            {
                allRoles = this._innerRoleProvider.GetAllRoles();
            }
            List <string> list = new List <string>();

            for (int i = 0; i < allRoles.Length; i++)
            {
                string source = allRoles[i];
                string str2   = source;
                if (source.Contains <char>('\\'))
                {
                    str2 = source.Substring(source.IndexOf('\\') + 1);
                }
                if (source.ToLower().StartsWith(filter.ToLower()) || str2.ToLower().StartsWith(filter.ToLower()))
                {
                    list.Add(source);
                }
            }
            int num2 = ((maxCount >= 0) && (maxCount <= list.Count)) ? maxCount : list.Count;

            roles = new AGSRole[num2];
            for (int j = 0; j < num2; j++)
            {
                IRole role = new AGSRole();
                role.SetRolename(list[j]);
                roles[j] = role;
            }
            return(num2 < list.Count);
        }