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 no开发者_运维百科t possible
Would I be able to download my program into bytes then run it. All of these programs are .NET assemblies.
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
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.
精彩评论