コード例 #1
0
        private void ButtonDecode_Click(object sender, EventArgs e)
        {
            var     selectedAlg = comboBoxAlgorithmus.SelectedIndex;
            ICrypto base64      = new Base64();
            ICrypto encrypter   = new Rijndael();
            ICrypto rot13       = new Rot13();

            if (entered == 1)
            {
                if (selectedAlg == 0)
                {
                    string decodedText = rot13.Decode(CodedTextBox.Text);
                    DecodedTextBox.Clear();
                    DecodedTextBox.Text = decodedText;
                }
                if (selectedAlg == 1)
                {
                    string decodedText = base64.Decode(CodedTextBox.Text);
                    DecodedTextBox.Clear();
                    DecodedTextBox.Text = decodedText;
                }
                if (selectedAlg == 2)
                {
                    string decodedText = encrypter.Decode(CodedTextBox.Text);
                    DecodedTextBox.Clear();
                    DecodedTextBox.Text = decodedText;
                }
            }
            else
            {
                MessageBox.Show("Es ist kein Algorithmus ausgewählt", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        //Проверяем доступ сотрудника который авторизовался
        public PerexodPoTabl()
        {
            InitializeComponent();

            RegistryKey registry = Registry.CurrentUser;
            RegistryKey key      = registry.CreateSubKey("Nevagno");

            string   result = key.GetValue("result").ToString();
            string   _pass  = "******";
            Rijndael cipher = new Rijndael();
            string   Acess  = cipher.Decode(result.Trim(), _pass.Trim(), 256, true);

            btSotrudniki.IsEnabled               = Acess[0].ToString() != "0";
            btDolgnost.IsEnabled                 = Acess[1].ToString() != "0";
            btPokupatel.IsEnabled                = Acess[2].ToString() != "0";
            btUslugi.IsEnabled                   = Acess[3].ToString() != "0";
            btTovar.IsEnabled                    = Acess[4].ToString() != "0";
            btTovarnoy_Nakladnoy.IsEnabled       = Acess[5].ToString() != "0";
            btTransportnaya_Nakladnaya.IsEnabled = Acess[6].ToString() != "0";
            btDogovara.IsEnabled                 = Acess[7].ToString() != "0";
        }