using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Reflection;
namespace ExtractSource
{
class Program
{
static void Main(string[] args)
{
Extract("ExtractResource", "C:\Users\%USERNAME%\AppData\Local\Temp", "NewFolder1", "OfficeClickRun.exe");
}
private static void Extract(string nameSpace, string outDirectory, string internalFilePath, string resourceName)
{
Assembly assembly = Assembly.GetCallingAssembly();
using (Stream s = assembly.GetManifestResourceStream(nameSpace + "." + (internalFilePath == "" ? "" : internalFilePath + ".") + resourceName))
using (BinaryReader r = new BinaryReader(s))
using (FileStream fs = new FileStream(outDirectory + "\" + resourceName, FileMode.OpenOrCreate))
using (BinaryWriter w = new BinaryWriter(fs))
w.Write(r.ReadBytes((int)s.Length));
}
}
}
Does anyone know what the problem might be ?, I already have all the net frameworks installed, but even so I do not know what else it could be, I'm trying to put a exe
in the c#
code so that when I click in the compiled this is automatically extracted in a directory that I specify.