I am sorry for my poor english. I need copy Embedded file in .exe to C:\ directory, this code working whose try to copy in D:. I think I need admin permissions. I tried to run my .exe as admin but It doesn't work. How to do this? Thanks for your replies!
private static void ExtractEmbeddedResource(string outputDir, string resourceLocation, List<string> files)
{
foreach (string file in files)
{
using (System.IO.Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceLocation + @"." + file))
{
using (System.IO.FileStream fileStream = new System.IO.FileStream(System.IO.Path.Combine(outputDir, file), System.IO.FileMode.Create))
{
for (int i = 0; i < stream.Length; i++)
{
fileStream.WriteByte((byte)stream.ReadByte());
}
fileStream.Close();
}
}
}
}