Run file.exe from Resource

Oct 12 2009 12:08 AM
hi i have problem
how to executing(run,start) file.exe directly from Resource
sorry my english very bad (:

my codes

 System.Reflection.Assembly asm;
            asm = System.Reflection.Assembly.GetExecutingAssembly();
            string resourceName = asm.GetName().Name + ".Child.exe";
            System.IO.Stream stream = asm.GetManifestResourceStream(resourceName);

            byte[] buffer = new byte[stream.Length];
            int bufferSize = Convert.ToInt32(stream.Length);
            stream.Read(buffer, 0, bufferSize);

            string tempFileFolder = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            string tempFilePath = System.IO.Path.Combine(tempFileFolder, "Child.exe");

            System.IO.FileStream fs = new System.IO.FileStream(tempFilePath, System.IO.FileMode.Create);
            fs.Write(buffer, 0, bufferSize);
            fs.Close();

            System.Diagnostics.Process.Start(tempFilePath);



Answers (2)