Im trying to integrate our current security algorithms in Unity, this would require me to detect all the cd drives on the users computer. I Found two ways to do it in C#:
Using ManagementObjectSearcher to query WMI, or using System.IO.DriveInfo.GetDrives(), but I get “NotImplementedException: The requested feature is not implemented.” when using either.
1 Answer
1Hey, just an update, I found a solution to my problem.(Again i mention that I was only looking for a solution for Windows stand alone player).
I called the following command: wmic /OUTPUT:%TEMP%\cdRomInfo.txt PATH Win32_CDROMDrive GET /VALUE /FORMAT:csv, this outputs a csv formatted txt file in the current users temp folder wich contains a bunch of info about the CD-Rom drives. (it can also give lots of technical info about other hardware components like processor, RAM etc)
@chiuan Ill try. I created a new batch file(.bat) containing the command "wmic /OUTPUT:%TEMP%\cdRomInfo.txt PATH Win32_CDROMDrive GET /VALUE /FORMAT:csv" witch basically creates a csv formatted file in the current users temp directory called cdRomInfo.txt, that contains info on all CD ROM drives Windows is aware of.I parsed the file to find the drives I was interested in using some code i found by simply googleing parsing CSV C#. And yes this can also be applied for other devices, because I am guessing that's what interests you.
– TecsiAron
This method only works on windows- searching for device drivers would be more cross-platform (and after all, Unity is all about the cross-plateform). I only ever get those non-implemented exceptions when I try to modify my scripts at runtime- I'm not really sure what causes them.
– syclamoth@syclamoth NotImplementedExceptions are used when you declare a method but you do not implement it(it doesn't actually do anything). To make sure people know it doesn't do anything you throw a not implemented exception. @msknapp Thanks for the suggestion but that would help me only to find every drive, without being able to decide if it is a CD-ROM. Please note that the solution I am looking for only needs to work for Windows stand alone player. Thanks
– TecsiAron