Hi there. Is it possible to make it so that a user can manually add and delete file resources by using a open file dialog?

Like, the user can click a button which opens up a FileDialog. Then they can choose a file to load it into the program as a resource. And if they want they can delete the resource by the click of a button and / or with a textbox to.

I don't know if it is possible or not but that would be amazing! =)

Thanks in advance.

You can certainly call the OpenFileDialog in your click event: http://msdn.microsoft.com/en-us/library/system.windows.forms.openfiledialog.aspx

Your application can delete the files they have selected if that is what you want, or load them and have your app do something with it. If you want to allow the user to save a resource, you could use the SaveAsDialog: http://msdn.microsoft.com/en-us/library/system.windows.forms.savefiledialog.aspx

You can also customize the dialog if you want to limit it's function or something.

cool dude thanks ill try it.


I'm not exactly sure what to do next to save it as a resource inside the program though ='[

In your solution explorer expand the project -- then expand properties -- then double click "Resources.resx". When the form comes up in the IDE click on "Add New Resource" in the top center and select "Existing File". It will then let you select a file.

You cannot delete an embedded resource very easy. It is possible but this gets more in to hacking than general coding. You also don't really have a "File Structure" per se but rather a list of embedded files so it would not tailor easy to a standard open/save dialog. You also may have issues assigning values to embedded resources as they are read only.

Why don't you try explaining what you're attempting to do and maybe we can suggest an alternative idea :)

I never tried this but IMO it must be possible to manipulate Resources.resx with something like this
I already used resources some 25 years ago, they were there from the beginning, on a Macintosh...

I saw something similar to that a while ago when I was Google'ing.

Well you see, there is this site people and they sell / distribute files for this game. I was, for the hell of it, planning on making this wfa program that holds the files for them already and all theyd have to distribute was the one file (this program). But instead of me or someone, having to reload the resources files in C#, I was trying to have it so that I can add like a file dialog where it will simply replace the resources files with the one they choose. Because the files they distribute, they have to update them every now and then.

So that is somethign I can use it for. But reading what you just said it must be more complex than I had thought.

Why not just pack everything together in a zip file....?

Huh? Nom nom nom. It's so that they can place the file they want using file dialog (ie) instead of me having to replace the updated files everytime. So that they can just redistribute the program everytime =]

I don't understand why a zip file won't work. Windows Explorer will be the file dialog and just about everyone is familiar with explorer....

Well, not entirely sure what you mean but everyone uses winrar rar / zip files :\

But if it is not possible then it isn't possible ='[

Well, not entirely sure what you mean but everyone uses winrar rar / zip files :\

But if it is not possible then it isn't possible ='[

Not possible? I don't think anyone is saying it isn't possible. You just have to determine what is practical and reliable (and perhaps legal) to achieve your goal. Anyway, I don't know if you have seen this tool: Resource Hacker. I have not looked at it, but I used to modify resources in assemblies some time ago and I believed I used VS to do it, but I can't remember why--LOL. I just didn't want you to leave the discussion thinking it wasn't possible when maybe it is..., but I don't want to fool you into believing it's a practical idea either.


Well the only resources files I could view with resource hacker on this one program i made, was only 1 icon file =o

Have you considered embedding a packaging utility in your application that can package and unpackage compressed file(s) that could be distributed with your application?

I was thinking about something like that but I am yet too inexperienced to know the procedures in doing so. Help would be gladly appreciated =]

Here is a demo with source that might get you started to at least evaluating a packaging app as an option: ZipStorer