Posts: 335
Threads: 22
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: Aug 2011
Reputation:
0
ok like this u make it extract form the resource for example now the ZipForge.dll
first add the dll file to resources and set the settings to it as embedded resource (Eingebettete Ressource)
apply this code to Form load
and edit it to ur dll file
using System.Reflection;
using System.IO;
...
private void Form1_Load(object sender, EventArgs e)
{
// Edit here
string DllName = "ZipForge.dll";
string resourcephat = "Launcher2_1.Resources.ZipForge.dll";
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (File.Exists(DllName) == false)
{
// if the dll is missing it get extrakted
Assembly assembly = Assembly.GetExecutingAssembly();
// Namespace.Resources.Dllfilename.dll
Stream file = assembly.GetManifestResourceStream(resourcephat ); // my resource
BinaryReader bReader = new BinaryReader(file);
FileStream fStream = new FileStream(@System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\" + DllName , FileMode.Create); // where i want to copy the resource
using (BinaryWriter bWriter = new BinaryWriter(fStream))
{
bWriter.Write(bReader.ReadBytes((int)file.Length));
bReader.Close();
bWriter.Close();
}
file.Close();
fStream.Close();
}
}
Posts: 505
Threads: 48
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: Sep 2011
Reputation:
0
Ty very much, i will add this to the next version
you got a new version yet?
you got a new version yet?
No sorry, have no time , but when i have time, i will update it