Exemple #1
0
        private void btnToB64_Click(object sender, EventArgs e)
        {
            try
            {
                string value = Base64Encoding.EncodeInt32(int.Parse(txtToB64.Text), 2);
                txtFromB64.Text = value;

                if (txtToB64.Text != Base64Encoding.DecodeInt32(value).ToString())
                {
                    txtFromB64.Text = "ERROR";
                }
            }
            catch (Exception ex)
            {
                txtFromB64.Text = "ERROR";
            }
        }
Exemple #2
0
        private void btnFromB64_Click(object sender, EventArgs e)
        {
            try
            {
                try
                {
                    int value = Base64Encoding.DecodeInt32(txtFromB64.Text);
                    txtToB64.Text = value + "";

                    if (txtFromB64.Text != Base64Encoding.EncodeInt32(value, 2).ToString())
                    {
                        txtToB64.Text = "ERROR";
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
            catch (Exception ex)
            {
                txtToB64.Text = "ERROR";
            }
        }