Introduction
RDPMan is a simple utility to manage your remote shell connections. RDPMan Ver.2 supports the following:
- Windows RDP
- VNC
- Telnet
To create a connection within RDPMan, simply drag and drop a saved RDP or VNC file into the main window. The connection will be added to the main window. Remember, once you have added the configuration for RDP, VNC config for that connection object has still to be entered. While you will still be able to connect with VNC, your optimal ouput will not be reflected until you drop a VNC file onto your created object.
You can also simply type in an internet address and click the Connect button which will add your new connection to the main window and connect using RDP.
In future versions, RDPMan will have a default connection and allow changing of the default connection option. Right now, RDPMan connects by default as RDP.
A compiled Exe file is available at: http://sourceforge.net/projects/rdpman.
Code
RDPMan was built using VB.NET. The guts of the application is in the connection.vb file in which the connection class is built. The class contains properties for all the possible .rdp and .vnc file options.
The connection class can be created without any options, like:
dim c as new connection
or created via an already created Registry key as:
dim c as new connection(subkeyname as string)
I have put together notes and what not for the main connection class. The presentation layer is pretty standard stuff that is probably covered much better than I could ever hope to; however, if you see anything in the downloadable source from above, please email me and I will do my best to provide insight.
Onto the main functions...
Within the connection class, the following methods for filling connection objects exist:
connection.FillFromVNC(f as fileinfo)
FillFromVNC
works the same way as the RDP version of this method, except it is used to read the VNC file formats instead of RDP.
Public Sub FillFromVNC(ByVal f As FileInfo)
Dim a As String() = File.ReadAllLines(f.FullName)
Dim lc As Integer = 0
Do Until lc = a.Length
Dim str As String = a(lc)
If str.Contains("=") Then
Select Case str.Remove(str.IndexOf("="))
Case "Host"
Me.FullAddress = _
str.Substring(str.LastIndexOf("=") + 1)
Case "UseLocalCursor"
Me.UseLocalCursor = _
str.Substring(str.LastIndexOf("=") + 1)
Case "UseDesktopResize"
Me.UseDesktopResize = _
str.Substring(str.LastIndexOf("=") + 1)
Case "FullScreen"
Me.FullScreen = _
str.Substring(str.LastIndexOf("=") + 1)
Case "FullColour"
Me.FullColour = _
str.Substring(str.LastIndexOf("=") + 1)
connection.FillFromRDP(f as fileinfo)
FillFromRDP
takes a fileinfo
(dim f as new fileinfo(p as path)
) object and attempts to fill the connection object with the options presented in an RDP file:
Public Sub FillFromRDP(ByVal f As FileInfo)
Dim a As String() = File.ReadAllLines(f.FullName)
Dim lc As Integer = 0
Do Until lc = a.Length
Dim str As String = a(lc)
Select Case str.Remove(str.IndexOf(":"))
Case "screen mode id"
Me.ScreenMode = _
str.Substring(str.LastIndexOf(":") + 1)
Case "desktopwidth"
Me.DesktopWidth = _
str.Substring(str.LastIndexOf(":") + 1)
Case "desktopheight"
Me.DesktopHeight = _
str.Substring(str.LastIndexOf(":") + 1)
Case "session bpp"
Me.SessionBPP = _
str.Substring(str.LastIndexOf(":") + 1)
Case "winposstr"
Me.WinPosStr = _
str.Substring(str.LastIndexOf(":") + 1)
connection.SaveToReg()
SaveToReg
saves the connection information and options into the application's Registry under HKLM\Software\RDPMan.
Public Sub SaveToReg()
Dim reg As New Reg
Dim key As String
If Me.Guid Is Nothing The
Me.Guid = System.Guid.NewGuid.ToString
key = "Software\RDPMan\" & Me.Guid & "\"
reg.CreateSubKey(reg.HKLM, Name)
Else
key = "Software\RDPMan\" & Me.Guid & "\"
End If
reg.WriteValue(reg.HKLM, key, "ObjName", Me.Name)
reg.WriteValue(reg.HKLM, key, "UseLocalCursor", _
Me.UseLocalCursor)
reg.WriteValue(reg.HKLM, key, "UseDesktopResize", _
Me.UseDesktopResize)
reg.WriteValue(reg.HKLM, key, "FullScreen", Me.FullScreen)
reg.WriteValue(reg.HKLM, key, "FullColour", Me.FullColour)
connection.DeleteFromReg()
DeleteFromReg
allows us to delete a connection object from the Registry:
Public Sub DeleteFromReg()
Dim reg As New Reg
reg.AppReg.DeleteSubKeyTree(Me.Guid)
End Sub
connection.CreateRDPFile() as fileinfo
CreateRDPFile
drops out an RDP file for the program's connectRDP
function. This class has been made a public class as one would conceivably run CreateRDPFile()
in a backup or export routine.
Public Function CreateRDPFile() As FileInfo
Dim lines As String() = { _
"screen mode id:i:" & Me.ScreenMode, _
"desk pwidth:i:" & Me.Desk pWidth, _
"desk pheight:i:" & Me.Desk pHeight _
}
Dim path As String = Application.StartupPath & _
"\~" & Me.Name & ".rdp"
Try
File.WriteAllLines(path, lines)
Catch ex As Exception
MsgBox("Cannot write RDP File")
End Try
Dim f As FileInfo = New FileInfo(path)
Return f
End Function
connection.CreateVNCFile() as fileinfo
Same as CreateRDPFile
:
Public Function CreateVNCFile() As FileInfo
Dim lines As String() = { _
"[Connection]", _
"Host=" & Me.FullAddress, _
"[Options]", _
"UseLocalCursor=" & Me.UseLocalCursor, _
"UseDesktopResize=" & Me.UseDesktopResize, _
"FullScreen=" & Me.FullScreen _
}
Dim path As String = Application.StartupPath & _
"\~" & Me.Name & ".vnc"
Try
File.WriteAllLines(path, lines)
Catch ex As Exception
MsgBox("Cannot write to VNC File")
End Try
Dim f As FileInfo = New FileInfo(path)
Return f
End Function
ConnectRDP() as fileinfo
ConnectRDP
uses the CreateRDPFile
method to drop out an RDP file in the application directory and then use the file to connect to a Remote Desktop. The ConnectRDP
function returns the fileinfo
object used so that the presentation layer can delete the file on application close. There is probably a better way to do this if someone wants to provide a tip.
Public Function ConnectRDP() As FileInfo
Dim f As FileInfo = Me.CreateRDPFile
Try
Process.Start(f.FullName)
Catch ex As Exception
Throw
End Try
Return f
End Function
ConnectVNC() as fileinfo
ConnectVNC
is the same as connectRDP
.
ConnectTelnet()
ConnectTelnet
connects to the default Telnet port 23.
Public Sub ConnectTelnet()
Try
Process.Start("telnet", Me.FullAddress)
Catch ex As Exception
Throw
End Try
End Sub
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.