Beispiel #1
0
        private static List <PasswordList> GetInvalidPasswordListPosition()
        {
            var fullList = ProcessInput.RegTestLine();
            var result   = new List <PasswordList>();

            foreach (var item in fullList)
            {
                char   ch         = item.Charachter.ToCharArray()[0];
                string passw      = item.Password;
                char   firstChar  = passw[item.MinCount - 1];
                char   secondChar = passw[item.MaxCount - 1];
                if ((firstChar == ch && secondChar != ch) || (firstChar != ch && secondChar == ch))
                {
                    var line = new PasswordList
                    {
                        MinCount   = item.MinCount,
                        MaxCount   = item.MaxCount,
                        Charachter = item.Charachter,
                        Password   = item.Password
                    };
                    result.Add(line);
                }
            }
            return(result);
        }
Beispiel #2
0
        private static List <PasswordList> GetValidPasswordList()
        {
            var fullList = ProcessInput.RegTestLine();
            var result   = new List <PasswordList>();

            foreach (var item in fullList)
            {
                char   ch    = item.Charachter.ToCharArray()[0];
                string passw = item.Password;
                int    count = passw.Count(s => s == ch);
                if (count >= item.MinCount && count <= item.MaxCount)
                {
                    var line = new PasswordList
                    {
                        MinCount   = item.MinCount,
                        MaxCount   = item.MaxCount,
                        Charachter = item.Charachter,
                        Password   = item.Password
                    };
                    result.Add(line);
                }
            }
            return(result);
        }