How do you read the properties of a file in C#? - c#

I am currently working on two programs and both are still in the planning phase but I have one question that I need to answer before I finish planning. Is there anyway to pull a file in and read the properties?
Basically what I want to do is be able to read the properties of image files and pull out the resolution, file size, date taken, and all that. And then do the same with music files (artist, album, length, so on). The closest I've found is a 6 year old project to pull the EXIF information out of images at http://www.codeproject.com/KB/graphics/exifextractor.aspx .
I'd be thrilled if there is one method to pull properties out of both kinds of file types. But I'll also be happy with two separate ways.

Including the one you found, there's also a good one hosted on Google Code named ExifLibrary.
Edit: Found another one here based on Drew Noakes Java MetaData Extractor.

Are you looking for a .NET way to access media metadata properties?

Related

is it possible to manipulate the DOM of a web build and add some contents inside the game?

I'm working for a newly formed Unity team in my company and we came across a problem where we have to put certain questions on a quiz game. The problem is, the questions are already being used on multiple projects and is shared with HTML contents, like the Latex. They also uses Mathjax, a library used to write mathematical formulas. Some of this terms are supported by TextMesh, but not all of them.
I'm attaching few questions below.
Choose the digit(s) that can fill in the blank of a four-digit number $\underline{~}531$ to make it divisible by $9.$
There are wallpapers of two different sizes, $6\text{ feet}^2$ and $8\text{ feet}^2.$ What should be the minimum area of the wall, which can be fully covered using some identical wallpapers of any of given type?
We discussed this problem internally and came up with different solutions.
add dummy text in the field and change the DOM of the final build, but this needs an id and we don't know if this option is available in unity.
render the whole questions into PNGs and then put this PNGs instead of text. Is this possible?
Use TexDraw from Unity store which we are not sure if all the things are supported.
How do I go with this problem?
is there anything else that can be done?

Merge two Media Sources together

I have run to a brick wall in this particular situation where I have to merge two MediaSources together, one for video and one for audio, and then play that in MediaPlayerElement.
I have searched google a lot but haven't found anything relating to it. The actual problem is that I get two Urls and I can create two MediaSources from them but I cant put those two sources in the player source, because when i do it either plays the video or the audio depending upon which was the last source.
So I basically created two MediaPlayerElements and assigned different sources to them and try to sync the audio and video between them but sometimes it creates awful results. I have also thought about creating two streams and then combining those two to create a single stream but I dont know anything about streams so I am not able to do that yet.
Any suggestions here? Maybe a 3rd party library which works in UWP and can help me here? Thanks
What you are trying, adding players and trying to sync is a duct tape solution :), could work, but you will probably have issues.
As you did not mention I'm assuming you need to support various formats for audio/video, which if you go with your current solution you will need to test every possible combination to be sure it works.
The proper way to merge audio and video is to merge the streams, a great (and free) tool you can use for this is FFMPEG, you can use a wrapper for the command line that works with UWP found here, it also has a NuGet package. It supports a lot of formats and is very fast as it's written in C.

Real time editor for Cloud Storage System

I am working on cloud storage system in ASP.Net MVC5. In which I made a file manager that handles cut,copy,download multiple files,edit and preview of files, but I want to edit documents like word files in real time (collaborative editing)..is there any api that can help me accordingly.
Thank you in advance.
you should use Signal R for real time applications...it may be possible with the help of application user interface but its better to write your own code according to your choice...
[http://signalr.net/][1]
dev_express and syncfusion may be your solution..try these..
This is turning into a huge comment, so I'll just explain my point of view in an answer. I'll remove it, if I see an actual answer appears.
I am suggesting you start writing your own code for collaborative editing and the reason is quite simple. You need at least slightly different processing for almost each file type, which suggests there will never be a single API to support collaborative editing for all file types, unless somebody makes it their goal to maintain it and keep up with every one created.
Start it simple, text (or hex) editing. Define how changes are made and implemented on other clients and then work your way to add as many file types (and methods that go with them) as you need.
You could use source code of 1 of these open source collaborative text editors (you'll have to find download / Github links on their websites) to get a general idea how to do it, but you will still have to put in some work and won't go far without creating your own code.
Collaborative editing requires user 1's (who just started editing) client to send either one of these:
Data pointing to changes made in file
Full file, and user 2's client (or central "server") should be able to calculate the changes made from there and implement them.
One of the problems is to overwrite only that portion of the file changes were made to (and avoid overwriting the other user 2's work).
And the biggest problem (the reason you can't have "1 for all" method/API) is each file type has its own structure meaning that different file types will have different data representing changes in file. If you try to write raw data it might work, but you'd still need to calculate and lock away specific portions of file, that contain general information, rather than data of your file.

Adding Custom File Properties/Attribute with Java or C# in Windows

Is it possible to add custom file attribute in file Properties preferably using Java, otherwise C#?
Custom fields I want to do is
Don't let the file copy. (But it can be modified)
Don't let the file attach to anything that that connects to network.
Here you can see below Where I want to add these attributes.
First question is can I actually do this? If yes then how? Any Idea will be really appreciated.
No, not really. File Custom Properties were added in Vista, but they are really just metadata related to files (of a given extension) plus some COM interfaces to show them to the user, etc. I.e., you can index properties, display them, edit them, etc. but properties won't be able to keep a file from being read (and thus copied).
If you are interested, your can review the MS docs for file properties http://msdn.microsoft.com/en-us/library/windows/desktop/ff728898(v=vs.85).aspx. This page detailning the predined properties is probably the easiest way to see how are used http://msdn.microsoft.com/en-us/library/windows/desktop/dd561977(v=vs.85).aspx

How to get installed image editors

Is there a code to get all the image editing software the user has installed?
I would like to know how to list all the applications by going through registry, is there any way to then filter out only the apps that can edit images, like Paint, Photoshop, etc...?
Thanks!
Here is an example for any generic file type:
How to get recommended programs associated with file extension in C#
If you look for jpg, png, etc. you'll get image editors.
No.
There is no expectation that every application developer somehow places metadata tags for their application inside of the registry (or wherever)... and, if for some reaosn a few handful of application developers did there is no way to guarantee the consistancy. Not to mention that application developers don't always use the common words you'd expect for their applications... Not every image editing application has the word "Photo" in it (for example, Picasa from Google).
The best you can hope for is to build some keywords to look for, add in a list of famous applications that don't conform to the keyword conventions your expecting ("Paint", "Photo", "Image", etc.), and work with that... either that or create a large database yourself to check against. Also, as other answers/comments have indicated, looking for applications that are used for specific extensions is helpful.
Nothing guaranteed though.

Categories