1

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.

xZerox
  • 331
  • 4
  • 7
  • 21
  • What do you mean by "download it to resources"? – Kangkan Aug 13 '10 at 03:31
  • @Kangkan Exactly why I used quotes. Basically, I want to write something to resources. That my client has to download. – xZerox Aug 13 '10 at 03:33
  • This is not what resources are intended for. Please describe your initial problem, then we'll be able to give you some advice on how to solve it. – Fyodor Soikin Aug 13 '10 at 03:35
  • @Fyodor Soikin My problem is I want my client to run my other programs from memory. Basically making a secure login client for my programs. – xZerox Aug 13 '10 at 03:40

2 Answers2

2

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

Community
  • 1
  • 1
instcode
  • 1,495
  • 14
  • 16
1

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.

Ani
  • 111,048
  • 26
  • 262
  • 307