Esempio n. 1
0
        static pwdCheck[] Initialize_Pwdcheck_Object_Array(Random rand)
        {
            Console.WriteLine("Creating a heterogeneous collection of pwdCheck, compundC, and excessC objects to");
            Console.WriteLine("input into FlipPwdCheck objects...");
            Console.WriteLine();
            pwdCheck[] initializer_array = new pwdCheck[TEST_OBJ_ARRAY_SIZE];

            const int MAX_STATE_CHANGES = 10;
            uint      random_password_length;
            int       random_valid_ascii_index;
            uint      max_state_changes;

            for (uint i = 0; i < TEST_OBJ_ARRAY_SIZE; i++)
            {
                random_password_length   = (uint)rand.Next(0, RANDOM_PASSWORD_LENGTH);
                random_valid_ascii_index = rand.Next(0, POSSIBLE_ASCII.Length);
                max_state_changes        = (uint)rand.Next(0, MAX_STATE_CHANGES);
                if (i < TEST_OBJ_ARRAY_SIZE / 3)
                {
                    initializer_array[i] = new pwdCheck(random_password_length, POSSIBLE_ASCII[random_valid_ascii_index]);
                    Console.WriteLine("Object " + i + " is a pwdCheck object.");
                }
                else if ((TEST_OBJ_ARRAY_SIZE / 3) <= i && TEST_OBJ_ARRAY_SIZE - (TEST_OBJ_ARRAY_SIZE / 3) > i)
                {
                    initializer_array[i] = new excessC(random_password_length, POSSIBLE_ASCII[random_valid_ascii_index]);
                    Console.WriteLine("Object " + i + " is an excessC object.");
                }
                else
                {
                    initializer_array[i] = new compundC(max_state_changes, random_password_length,
                                                        POSSIBLE_ASCII[random_valid_ascii_index]);
                    Console.WriteLine("Object " + i + " is a compundC object.");
                }
                Console.WriteLine("Object " + i + " took in a password of length: " + random_password_length);
                Console.WriteLine("After construction, object " + i + " has a password length requirement of: " +
                                  initializer_array[i].Minimum_Password_Length);
                Console.WriteLine("Object " + i + " has a forbidden character: " + POSSIBLE_ASCII[random_valid_ascii_index]);
                Console.WriteLine();
            }
            Console.WriteLine(ASTERISK);
            Console.WriteLine("Press enter to continue program...");
            Console.WriteLine(ASTERISK);
            Console.ReadLine();
            return(initializer_array);
        }
Esempio n. 2
0
 public FlipPwdCheck(string input_encapsulated_string, pwdCheck input_pwd_obj) : base(input_encapsulated_string)
 {
     pwd_obj = new pwdCheck();
     pwd_obj = input_pwd_obj;
 }