ich habe in visualbasic 2010 ein tool gecodet, welches man daten in einer listbox reinziehen kann (nur die fateiname z.B.: brain.exe)
, in einer anderen textbox steht der Datei pfad (C:\users\basti\desktop\)
in textbox2 steht das zielspeicherpfad (C:\users\basti\desktop)
zeile steht für jedes item in meiner listbox, ich machs mit for each schleife..
mein problem ist jetzt nur das er mir das brav verschlüsselt, aber beim entschlüsseln er mir dateien ohne endung erstellt, die kann ich aber sobald ich manuel die endung definiert habe wieder öffnen..
Verschlüsseln, klappt ja soweit..
PHP Code:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
If System.IO.Directory.Exists(TextBox2.Text) = False Then
System.IO.Directory.CreateDirectory(TextBox2.Text)
If txtpassword.Text = "" Then
MsgBox("Bitte Passwort eingeben", vbInformation, "Passwort Fehlerhaft")
Else
Try
For Each Zeile As String In ListBox1.Items
If System.IO.Directory.Exists(TextBox1.Text + "\" + Zeile) = False Then
_crypto = New CryptoLib.Crypto
_crypto.EncryptFile(TextBox1.Text + "\" + Zeile,
'## hier wird verschlüsselt
TextBox2.Text + "\" + Zeile + ".axc3", Me.txtpassword.Text)
Application.DoEvents()
Else
_crypto = New CryptoLib.Crypto
_crypto.EncryptFile(TextBox1.Text + "\" + Zeile,
'## hier wird verschlüsselt
TextBox2.Text + "\" + Zeile + ".axc3", Me.txtpassword.Text)
Application.DoEvents()
End If
Next
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
If Not _crypto Is Nothing Then _crypto.Dispose()
End Try
End If
Else
If txtpassword.Text = "" Then
MsgBox("Bitte Passwort eingeben", vbInformation, "Passwort Fehlerhaft")
Else
Try
For Each Zeile As String In ListBox1.Items
If System.IO.Directory.Exists(TextBox1.Text + "\" +
'## hier wird verschlüsselt
Zeile) = False Then
_crypto = New CryptoLib.Crypto
_crypto.EncryptFile(TextBox1.Text + "\" + Zeile, TextBox2.Text + "\" + Zeile + ".axc3", Me.txtpassword.Text)
Application.DoEvents()
Else
_crypto = New CryptoLib.Crypto
_crypto.EncryptFile(TextBox1.Text + "\" + Zeile,
'## hier wird verschlüsselt
TextBox2.Text + "\" + Zeile + ".axc3", Me.txtpassword.Text)
Application.DoEvents()
End If
Next
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
If Not _crypto Is Nothing Then _crypto.Dispose()
End Try
End If
End If
End Sub
enschtlüsseln:
PHP Code:
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
If System.IO.Directory.Exists(TextBox2.Text) = False Then
System.IO.Directory.CreateDirectory(TextBox2.Text)
Application.DoEvents()
If txtpassword.Text = "" Then
MsgBox("Bitte Passwort eingeben", vbInformation, "Passwort Fehlerhaft")
End If
For Each Zeile As String In ListBox1.Items
Dim quelle As String = TextBox1.Text + "\" + Zeile.ToString
Dim speicherort As String = TextBox2.Text + "\" + Zeile.ToString
If System.IO.Directory.Exists(speicherort) = False Then
_crypto = New CryptoLib.Crypto
_crypto.DecryptFile(quelle, speicherort.Substring(0, quelle.Length - 4), Me.txtpassword.Text)
'## hier wird wieder entschlüsselt
Else
_crypto = New CryptoLib.Crypto
_crypto.DecryptFile(quelle, speicherort.Substring(0, quelle.Length - 4), Me.txtpassword.Text)
End If
Next
If Not _crypto Is Nothing Then _crypto.Dispose()
Else
If Not _crypto Is Nothing Then _crypto.Dispose()
' MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End Sub