Exemple #1
0
        static void GetPass(IPasswordGenerator _passwordGenerator)
        {
            Console.Write("Password length (default 8)?: ");
            int count;

            try
            {
                count = Convert.ToInt32(Console.ReadLine());
                _passwordGenerator.SetLength(count);
            }
            catch
            {
                _passwordGenerator.SetLength(8);
            }

            Console.WriteLine("");

            Console.Write("Use numbers (default yes)?: ");
            string useNumber = Console.ReadLine();

            if (useNumber == "no")
            {
                _passwordGenerator.SetNumber(false);
            }
            else
            {
                _passwordGenerator.SetNumber(true);
            }
            Console.WriteLine("");

            Console.Write("Use lower char (default yes)?: ");
            string useLower = Console.ReadLine();

            if (useLower == "no")
            {
                _passwordGenerator.SetLower(false);
            }
            else
            {
                _passwordGenerator.SetLower(true);
            }
            Console.WriteLine("");

            Console.Write("Use upper char (default yes)?: ");
            string useUpper = Console.ReadLine();

            if (useUpper == "no")
            {
                _passwordGenerator.SetUpper(false);
            }
            else
            {
                _passwordGenerator.SetUpper(true);
            }
            Console.WriteLine("");

            Console.Write("Use special symbols  (default yes)?: ");
            string useSpecialSymbols = Console.ReadLine();

            if (useSpecialSymbols == "no")
            {
                _passwordGenerator.SetSpecialSymbols(false);
            }
            else
            {
                _passwordGenerator.SetSpecialSymbols(true);
            }
            Console.WriteLine("");



            Console.WriteLine("");
            Console.WriteLine("------------------------------------");
            Console.WriteLine(_passwordGenerator.GetPassword());

            for (int i = 0; i < 1000; i++)
            {
                Console.WriteLine(_passwordGenerator.GetPassword());
            }


            Console.WriteLine("------------------------------------");
        }