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

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

Related

Creating .resource file in windows forms

I am trying to create a .resource file which will contain all the strings being used in the application. I don't want to do it manually.
I know there are certain ways to do it. But my problem is, I don't want to have it done manually, where I need to add each string resource. Is there a way to do this without I having to put each string, and it automatically detects all the strings resources corresponding to different pages.
Any insights on this would be helpful.
Yes, there is a way to do this.
You can try with R#, although the tool is commercial, there is a 30-days trial period.
As a regular user, I can tell you that it worth every cent.
There are suggestion for every string, and moving to the resource file is accomplished by one click.

C# easiest way of storing strings to external file

C#
TL;DR: I want the user to be able to input text, which is then written to an external file, which then can be called later based on position in the file. What's the easiest way and form to read and write a list of strings to?
Very amateur question, but I can't seem to find an easy anwer on the internet. If I'm missing something obvious, please redirect me. I am writing a very simple program in which the user can input a string which is then written (added) to an external file, from which later a string can be called based on the position in the file. I found things like JSON, Resource file, SQL DB... Problem is that due to my lack of programming experience I have no idea what's the best option to look into.
Example of what I want to achieve:
User inputs strings 'Dog', 'Cat', and 'Horse' into the textbox. Each of these strings are added to the external file. Lateron, the user calls the 2nd number on the list, to which the program returns 'Cat'.
Thanks!
If you already know the kind of data that will be saved I recommend using XML Serialization. This lets you save and read your file very easily. The linked example is from Microsoft and shows a dataset being serialized. If you want to save a generic list instead of a fixed object you might find this link helpful.
Alternatively, you could save data to your application configuration file (search online for "C# application configuration for PROJECT_TYPE" where the project type is winforms/mvc/class library etc..)

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.

Update app.config file after installer upgrade

I'm currently working on a Microsft Word Application-Level Add-in using C#. My application contains an app.config file. In this file I save user-settings (userSettings-Section) and some data defined by a custom ConfigurationSection. The data stored inside of custom ConfigurationSection is also user-specific.
I access the user-settings as follows:
Properties.Settings.Default.MyUserSetting
The custom ConfigurationSection I'm using like:
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal)
.GetSection("MyCustomConfigurationSection")
My questions are:
Do I even use the app.config the "correct" way? (I know that there is probably not only one correct way, but is "my way" one of these?)
Which ConfigurationUserLevel does Propeties.Settings.Default use? Is there a way of setting/changing it?
And Most importantly: Is there a way to automatically keep the user-specific settings during an upgrade of my application, but at the same time add newly created settings?
I deploy my Add-in using an installer built with WiX. At the moment I use CustomActions, which manually insert code for each added/removed/changed setting. But I was wondering whether there is a built-in way of doing this.
I did some researches the whole day now and I think I can answer my questions for myself:
Q: Which ConfigurationUserLevel does Propeties.Settings.Default use? Is there a way of setting/changing it?
A: It seems that Propeties.Settings.Default use ConfigurationUserLevel.PerUserRoamingAndLocal, what sounds logical as they only contain userSettings... I don't know whether it is possible to change it, but for me it is not necessary.
Q: Is there a way to automatically keep the user-specific settings during an upgrade of my application, but at the same time add newly created settings?
A: I found out that there is an Upgrade()-Method in Settings which should take care of copying user settings between an older version of the product and the new one. For more information see http://ngpixel.com/2011/05/05/c-keep-user-settings-between-versions/. I must confess that I haven't had occasion to test it, since I have no permissions to build the installer, but I will rely on it. I will come back to this post after I tested my solution.
Furthermore I am not using a custom ConfigurationSection any more. Instead I derive from System.Configuration.ApplicationSettingsBase, which means that I am able to handle the custom data exactly like the Properties.Settings, including the Upgrade()-Method. See this post for more information about how to use it.
Hope this helps somebody.

How do you read the properties of a file in 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?

Categories