private void backgroundWorker2_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { try { if (text != null) { if (Hex.Checked && !Base64_box.Checked) { outputText.Text = Extra.ByteArrayToHexString(Encoding.UTF8.GetBytes((text.Decrypt(closeText)))); } if (Hex.Checked && Base64_box.Checked) { outputText.Text = Extra.ByteArrayToHexString(Encoding.UTF8.GetBytes((text.Decrypt(Convert.FromBase64String(inputText.Text))))); } if (Base64_box.Checked && !Hex.Checked) { outputText.Text = text.Decrypt(Convert.FromBase64String(inputText.Text)); } else if (!Base64_box.Checked && !Hex.Checked) { outputText.Text = text.Decrypt(closeText); } } } catch { } }
private void setVector_Click(object sender, EventArgs e) { if (openFileDialog3.ShowDialog() == DialogResult.Cancel) { return; } // получаем выбранный файл string filePath = openFileDialog3.FileName; if (File.Exists(filePath) && _regKey != null) { _regKey.SetValue("vector", filePath, RegistryValueKind.String); } // читаем файл в строку vector = File.ReadAllBytes(filePath); vectorPath.Text = filePath; vectorString.Text = Encoding.ASCII.GetString(vector); vectorHex.Text = Extra.ByteArrayToHexString(vector); }
private void setKey_Click(object sender, EventArgs e) { if (openFileDialog2.ShowDialog() == DialogResult.Cancel) { return; } // получаем выбранный файл string filePath = openFileDialog2.FileName; if (File.Exists(filePath) && _regKey != null) { _regKey.SetValue("key", filePath, RegistryValueKind.String); } // читаем файл в строку key = System.IO.File.ReadAllBytes(filePath); keyPath.Text = filePath; keyString.Text = Encoding.ASCII.GetString(key); keyHex.Text = Extra.ByteArrayToHexString(key); }
private void outputText_TextChanged(object sender, EventArgs e) { hexCloseText.Text = Extra.ByteArrayToHexString(Encoding.UTF8.GetBytes(outputText.Text)); }