Finding The Pacemaker Drive

This is where we can share code to do things with our Pacemakers
Post Reply
Sox
Admin Sox
Admin Sox
Posts: 347
Joined: Fri Sep 14, 2012 9:25 pm
Location: Bath, England
Contact:

Finding The Pacemaker Drive

Post by Sox » Sat Sep 29, 2012 7:11 pm

To find the Pacemaker drive you need to iterate through all your drives looking for a removable drive, that is "ready", and has a volume label which matches your Pacemaker. I found that my Pacemaker volume was "Pacemaker" whereas DJ Pip found his was "PACEMAKER". It could be something to do with the different versions of Windows we have (Vista 32-bit for me, Windows 7 64-bit for Pip). Therefore you should uppercase the volume of any drive you are testing, and compare it to "PACEMAKER".

Here is the code in vb .Net

Code: Select all

Private DeviceVolumeLabel As String = "PACEMAKER"

Public Function FindPacemakerDrive() As Boolean
        PacemakerDrive = ""
        PacemakerPresent = False
        For Each drive As DriveInfo In DriveInfo.GetDrives()
            If drive.DriveType = DriveType.Removable AndAlso drive.IsReady Then
                If drive.VolumeLabel.ToUpper = DeviceVolumeLabel Then
                    PacemakerDrive = drive.Name
                    PacemakerPresent = True
                    Return True
                End If
            End If
        Next drive
        Return False
End Function
Never experiment with drugs.... you might waste them

Post Reply