xZerox
xZerox

Reputation: 331

C# Write Resource from Download

Alright, so I have been wondering how to do this for a while. Basically, what I want to do is instead of downloading a file directly to the hard drive can I make my application "download it to resources"

I need to Download the file or bytes, and write it to resources.

Using a method like this to download

        byte[] example;
        using (WebClient client = new WebClient())
        {
            example = client.DownloadData("http://example.com/file.exe");
        }

If this is not possible

Would I be able to download my program into bytes then run it. All of these programs are .NET assemblies.

Upvotes: 1

Views: 226

Answers (2)

instcode
instcode

Reputation: 1497

Although I'm kinda understanding what you want to do, your question was not clearly stated and confused everybody. So you wanna run a program which is downloaded from the Internet right? And you don't want to store that program on the hard disk but to load it to the memory on-the-fly, do you? In that case, check out:

How can I launch a program from memory in C#?

and

http://blog.devexperience.net/en/9/Load_an_EXE_file_and_run_it_from_memory.aspx

Upvotes: 2

Ani
Ani

Reputation: 113472

Resource files are meant to act as static data repositories. If you want this sort of functionality, I suggest you use an embedded database such as SQLite or SQL Server Compact Edition.

Upvotes: 1

Related Questions