Exemplo n.º 1
0
 public KeyGenPresenter(IKeyGUI screen)
 {
     this.screen = screen;
     keygen      = new KeyGen();
     screen.register(this);
     initialiseForm();
 }
Exemplo n.º 2
0
        private void ProcessCheckBoxes()
        {
            List <keySpace> selectedKeySpace = new List <keySpace>();

            if (screen.lowercase)
            {
                selectedKeySpace.Add(keySpace.lowercase);
            }
            if (screen.numbers)
            {
                selectedKeySpace.Add(keySpace.numbers);
            }
            if (screen.uppercase)
            {
                selectedKeySpace.Add(keySpace.uppercase);
            }
            if (screen.otherChars)
            {
                selectedKeySpace.Add(keySpace.otherChars);
            }
            if (screen.hex)
            {
                if (selectedKeySpace.Count != 0)
                {
                    screen.message("Hex cannot be selected with other\n Unselect others then select Hex");
                    screen.hex = false;
                }
                else
                {
                    selectedKeySpace.Add(keySpace.hex);
                }
            }
            if (selectedKeySpace.Count == 0)
            {
                screen.setNewKey("");
                screen.setYears("");
                screen.setDays("");
                screen.setHours("");
                screen.setMinutes("");
                screen.setSeconds("");
            }
            else if (selectedKeySpace.Count == 1)
            {
                keygen = new KeyGen(selectedKeySpace[0]);
            }
            else if (selectedKeySpace.Count == 2)
            {
                keygen = new KeyGen(selectedKeySpace[0], selectedKeySpace[1]);
            }
            else if (selectedKeySpace.Count == 3)
            {
                keygen = new KeyGen(selectedKeySpace[0], selectedKeySpace[1], selectedKeySpace[2]);
            }
            else if (selectedKeySpace.Count == 4)
            {
                keygen = new KeyGen(selectedKeySpace[0], selectedKeySpace[1], selectedKeySpace[2], selectedKeySpace[3]);
            }
            else
            {
                screen.message("Error: processing the selected key type");
            }
            if (selectedKeySpace.Count != 0)
            {
                updateView();
            }
        }