Exemplo n.º 1
0
        public void CreateFinalProduct()
        {
            CryptoController crypto = new CryptoController();

            try
            {
                if (SpecialCharacterSet == "specific")
                {
                    string sCharPool = SpecialCharacters.Replace(" ", String.Empty);

                    if (GenerationType == "random")
                    {
                        FinalProduct = crypto.generateRandom(AnsweredQuestion1, AnsweredQuestion2, sCharPool, SelectedLength);
                    }
                    else if (GenerationType == "familiar")
                    {
                        string mixedBag = crypto.familiarCharMix(SpecialCharacterSet, sCharPool);

                        FinalProduct = crypto.generateFamiliar(AnsweredQuestion1, AnsweredQuestion2, mixedBag, SelectedLength);
                    }
                }
                else if (SpecialCharacterSet == "default")
                {
                    string answer1   = AnsweredQuestion1;
                    string answer2   = AnsweredQuestion2;
                    string sCharPool = "!@#$%^&*()_+-=,./";
                    int    length    = SelectedLength;

                    if (GenerationType == "random")
                    {
                        FinalProduct = crypto.generateRandom(AnsweredQuestion1, AnsweredQuestion2, sCharPool, SelectedLength);
                    }
                    else if (GenerationType == "familiar")
                    {
                        string mixedBag = crypto.familiarCharMix(SpecialCharacterSet, sCharPool);

                        FinalProduct = crypto.generateFamiliar(AnsweredQuestion1, AnsweredQuestion2, mixedBag, SelectedLength);
                    }
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
        }