您好,我目前正在尝试解决有关我正在开发的软件的问题。
我想要实现的目标:从没有 WriteAllBytes 的 byte[] 将 dll 加载到内存流中(这意味着我想避免接触磁盘)。
我尝试了很多方法,但都失败了。我认为我成功地将 byte[] 加载到内存中,但是我编译的可执行文件仍在寻找从磁盘而不是内存加载它。我如何使它从内存中加载它以便能够使用?
让我们进入代码。
WebClient client = new WebClient();
string b64strbin = client.DownloadString("URL OF A FILE WHERE IT CONTAINS BYTE[]"); // this will download the string and store it to a variable.
byte[] decode = Convert.FromBase64String(b64strbin); // just decode it from base64 back to byte[]
byte[] packed = QuickLZ.decompress(decode); // decompressed dll byte[] (dont mind about this)
Assembly.Load(packed); // here i am loading the byte[] to the memory but still i get an exception
//methods that require the dll in order to run
Console.Read();