C#C
C#3y ago
wawa

✅ this extractor writes the project name + the file name how do I make it just say the file name

This extractor which I got from stackoverflow because I dont know how to code in c# that much which extracts from embedded resource writes the project name eg if the file was named music.wav and the project name was extract then when it outputs it would rename the extracted file to "extract.music.wav" instead of just "music.wav"


How would I make this code keep the original name
using System;
using System.Reflection;
using System.IO;
using System;

namespace program
{
    class prog
    {
        public static void Main(string[] args)
        {
            var assembly = Assembly.GetExecutingAssembly();

            var names = Assembly.GetExecutingAssembly().GetManifestResourceNames();

            foreach (string filename in names)
            {
                var stream = assembly.GetManifestResourceStream(filename);
                var rawFile = new byte[stream.Length];

                stream.Read(rawFile, 0, (int)stream.Length);

                using (var fs = new FileStream(filename, FileMode.Create))
                {
                    fs.Write(rawFile, 0, (int)stream.Length);
                }
            }
        }
    }
}
Was this page helpful?