Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting DSLR's drive information in .NET C#

Tags:

c#

.net

I am trying to get my connected DSLR's drive information so that I can access the photos inside the SD card. I can't directly read from the SD card because of project requirements.

I tried using .NET's DriveInfo but it couldn't register my connected DSLR. Am I doing anything wrong?

Code:

DriveInfo[] drives = DriveInfo.GetDrives();
foreach(DriveInfo d in drives)
{
   if(d.Name == "D5100")
      Console.WriteLine("Camera found");
}

Edit: The results of the following code is that "C://" is found only. No other drives are detected.

Edit2: The connected DSLR seems to not be under any drives. DSLR Drive information

like image 941
Bocky Avatar asked Jan 21 '26 11:01

Bocky


1 Answers

DriveInfo.GetDrives() method gets only logical drives on your computer.

Retrieves the drive names of all logical drives on a computer.

In my computer, it returns only C:/, D:/ and E:/. Because of that reason, d.Name gives these type of information, not like D5100. There is a platform called Wia (Windows Image Acquisition) which can access images in cameras, webcams etc. Loot at this link.

like image 177
Soner Gönül Avatar answered Jan 25 '26 00:01

Soner Gönül



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!