I’ve got a simple WCF service that lets clients/consumers upload image, audio or video files to it. After the upload, the service is supposed to analyze the file and somehow retrieve the following attributes:
Image: width, height, date taken, program used
Audio: runtime, artist, album, genre, bitrate, publication year
Video: runtime, width, height, frames/sec, video bitrate, audio bitrate
Apparently Windows can get and display these attributes pretty easily, but how do I do it in C#?
Courtesty of this thread.
I’ve verified this gets all file attributes including the extended attributes.
In your project go to ‘Add Reference’ -> COM -> ‘Microsoft Shell Controls and Automation’
Add that, and again courtesy of said thread, a C# method to read the attributes of the files in a directory. (I’m still researching to see if it’s possible to perform this functionality on a specific file. If not you could always pass the filename in question and verify to only get the attributes out for that file.)