Friday, May 18, 2012 Register  Login

This site uses DNS Made Easy. Use it for reliable and professional DNS services.

RSS Feeds
Categories
  
Blog Archives
  
Blog

Little visual tweak

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.

Server node has server name and drive

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);

posted @ Wednesday, April 02, 2008 10:22 PM by Hector Sosa, Jr

Posted in: PainlessSVN, Code

Actions:Tweet This Share on Facebook Share on LinkedIn Emakl Permalink del.icio.us

Previous Page | Next Page

COMMENTS

Name (required)

Email (required)

Website

CAPTCHA image
Enter the code shown above:

Terms Of Use | Privacy Statement | SystemWidgets
Copyright 2002-2012 by SystemWidgets
Google Analytics Alternative