
|
|
I have several Subversion servers on my network, so I'm registering new servers in PainlessSVN fairly often. I got tired of trying to figure out what server I was hooked to, so I added a little visual tweak on the server node.

So now, I can tell exactly what server I'm working with at a glance. I will probably end up adding the ability to keep several servers registered, a la Enterprise Manager and SQL Server Management Studio.
I had to mess with Win32 APIs in order to get this working correctly. Here are the API calls that I used:
public const uint DRIVE_UNKNOWN = 0; // unknow drive type
public const uint DRIVE_NO_ROOT_DIR = 1; // invalid root path was given to the function
public const uint DRIVE_REMOVABLE = 2; // removeable drive like a floppy
public const uint DRIVE_FIXED = 3; // a fixed drive like a hard disk
public const uint DRIVE_REMOTE = 4; // a network drive
public const uint DRIVE_CDROM = 5; // a cd-rom drive
public const uint DRIVE_RAMDISK = 6; // a ram disk
[DllImport("Kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern uint GetDriveType(string lpRootPathName);
[DllImport("mpr.dll")]
[return: MarshalAs(UnmanagedType.U4)]
public static extern int WNetGetUniversalName(
string lpLocalPath,
[MarshalAs(UnmanagedType.U4)] int dwInfoLevel,
IntPtr lpBuffer,
[MarshalAs(UnmanagedType.U4)] ref int lpBufferSize);
Previous Page | Next Page