aDoc.ActiveWindow.Selection.Copy; IDataObject data =
System.Windows.Forms.Clipboard.GetDataObject; String fileText =
data.GetDataSystem.Windows.Forms.DataFormats.Text.ToString; System.Windows.Forms.Clipboard.SetDataObjectstring.E
mpty; textBoxBuka.Text = fileText;
} catchException err{
MessageBox.Showerr.Message; }
finally{ MessageBox.ShowFile berhasil dibaca;
} }
6. Fungsi Kunci Beaufort
void Button3Clickobject sender, EventArgs e {
string Plainteks1 = textBoxBuka.Text.ToString; ProcessStartInfo p = new ProcessStartInfo;
p.RedirectStandardOutput = true; p.FileName = c:\\python31\\python.exe;
p.RedirectStandardOutput = true; p.UseShellExecute = false;
p.Arguments = d:\\kode\\program\\pintu.py + KunciBeau 0 0 + \ + Plainteks1 + \ + y;
try {
using Process runProses =Process.Startp {
StreamReader s = runProses.StandardOutput; string keluar = s.ReadToEnd;
string k = keluar; textBoxKunciBeau.Text = k.ToString;
} }
catch {
throw; }
}
Universitas Sumatera Utara
7. Fungsi Enkripsi Beaufort Cipher
void Button5Clickobject sender, EventArgs e {
string Plainteks2 = textBoxBuka.Text.ToString; string kunciB = textBoxKunciBeau.Text.ToString;
ProcessStartInfo p = new ProcessStartInfo; p.RedirectStandardOutput = true;
p.FileName = c:\\python31\\python.exe; p.RedirectStandardOutput = true;
p.UseShellExecute = false; p.Arguments = d:\\kode\\program\\pintu.py
+ EnkripBeaufort 0 0 + \ + Plainteks2 + \ + + \ + kunciB +\;
try {
using Process runProses = Process.Startp {
StreamReader s = runProses.StandardOutput; string keluar = s.ReadToEnd;
string k = keluar; if k =
MessageBox.ShowBerhasil, Info, MessageBo xButtons.OK;
textBoxEnkBeau.Text = k.ToString; }
} catch
{ throw;
} }
8. Fungsi Dekripsi Beaufort Cipher
void ButtonDekBeauClickobject sender, EventArgs e {
string Plainteks3 = textBoxEnkAff.Text.ToString; string kunciBe = textBoxKunciBeau.Text.ToString;
ProcessStartInfo p = new ProcessStartInfo; p.RedirectStandardOutput = true;
p.FileName = c:\\python31\\python.exe; p.RedirectStandardOutput = true;
p.UseShellExecute = false; p.Arguments = d:\\kode\\program\\pintu.py
+ DekripBeaufort 0 0 + \ + Plainteks3 + \ + + \ + kunciBe + \;
try {
Universitas Sumatera Utara
using Process runProses =Process.Startp {
StreamReader s = runProses.StandardOutput; string keluar = s.ReadToEnd;
if keluar = MessageBox.ShowBerhasil, Info, MessageBo
xButtons.OK; textBoxDekBeau.Text = keluar.ToString;
} }
catch {
throw; }
}
9. Fungsi Pergesesan Affine Cipher
void ButtonAcakAffClickobject sender, EventArgs e {
int nilai = 3; ProcessStartInfo p = new ProcessStartInfo;
p.RedirectStandardOutput = true; p.FileName = c:\\python31\\python.exe;