38
Lampiran 1 Kode Program
Kode Program 1
Kode Program Login
Private Sub DoLogin()
Dim Sec As New User(Me.TxtUsername.Text, Me.TxtPassword.Text) If Sec.Identity.IsAuthenticated = Nothing Then
_isLogIn = False
MsgBox("Username dan password tidak cocok", MsgBoxStyle.Exclamation, "Failed to login") Me.TxtPassword.Text = ""
Me.TxtPassword.Focus() Else
_isLogIn = True Me.Close() End If End Sub
Private Sub BtnLogIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLogIn.Click Try
DoLogin()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error") End Try
End Sub
Private Sub BtnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCancel.Click Me.Close()
39
Kode Program 2
Kode Program Form Utama
Public Class Mainform
Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
OpenToolStripMenuItem.Click, AboutToolStripMenuItem.Click Dim abt As New about
abt.ShowDialog() End Sub
Private Sub EndcodeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
EndcodeToolStripMenuItem.Click, EncodeButton.Click Dim _enc As New Encode
_enc.ShowDialog() End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
ExitToolStripMenuItem.Click Me.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handle s Button2.Click
Dim Hd As New Decode Hd.ShowDialog() End Sub
Private Sub DecodeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
DecodeToolStripMenuItem.Click Dim _hd As New Decode _hd.ShowDialog() End Sub
40
Kode Program 3
Kode Program Hide
Kode Program 4 Kode Program Extract
For Pc = 0 To gambar.Height - 1For Pb = 0 To gambar.Width - 1 vR = gambar.GetPixel(Pb, Pc).R vG = gambar.GetPixel(Pb, Pc).G vB = gambar.GetPixel(Pb, Pc).B xhuruf1 = Mid(T.Text, i, 1) xhuruf2 = Mid(T.Text, i + 1, 1) xhuruf3 = Mid(T.Text, i + 2, 1)
vR = Convect(toLSB(DesimalToBiner(vR), xhuruf1)) vG = Convect (toLSB(DesimalToBiner(vG), xhuruf2)) vB = Convect (toLSB(DesimalToBiner(vB), xhuruf3)) gambar.SetPixel(Pb, Pc, Color.FromArgb(vR, HG vB)) xpic = xpic + 1
If xpic > xpc Then Exit For i = i + 3
Next
For x = 0 To gambar.Height - 1
For y = 0 To gambar.Height - 1 vR = gambar.GetPixel(x, y).R vG = gambar.GetPixel(x, y).G vB = gambar.GetPixel(x, y).B
bit.Text = bit.Text &
Microsoft.VisualBasic.Mid((DesimalToBiner(vR)), 8, 1) & _
Microsoft.VisualBasic.Mid((DesimalToBiner(v G)), 8, 1) & _
Microsoft.VisualBasic.Mid((DesimalToBiner(vB)), 8, 1) xpic = xpic + 1
If xpic > xpc Then Exit For bit.Refresh()