LC UpdateHelper
#5

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();
}
}



Messages In This Thread
[No subject] - by ReeCube - 04-21-2012, 09:05 PM
[No subject] - by Koko - 04-21-2012, 10:17 PM
[No subject] - by HateMe - 04-21-2012, 10:56 PM
[No subject] - by ReeCube - 04-22-2012, 09:19 AM
[No subject] - by HateMe - 04-22-2012, 06:36 PM
[No subject] - by ReeCube - 04-22-2012, 07:06 PM
[No subject] - by halohalo - 10-03-2012, 09:17 PM
[No subject] - by ReeCube - 10-05-2012, 03:38 PM
[No subject] - by halohalo - 02-18-2013, 10:36 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)