Good Day,
I am reading some files (Crystal Report files) that are stored as embedded resources, and have the following code to do so:
string[] listOfFiles = Assembly.GetExecutingAssembly().GetManifestResourceNames();
string applicationPath = @"C:\TEMP\Reports";
foreach (string item in listOfFiles)
{
string fileName = item.Replace("RegistryReader.Reports.", String.Empty);
Stream inputStream = GetEmbeddedResourceStream(item);
string report = Path.Combine(applicationPath, fileName);
using (StreamWriter sw = new StreamWriter(report))
{
sw.Write(inputStream);
sw.Flush();
}
}
The following code appears to work and when I'm in debug mode, I can see that the length of the inputStream is the correct number of bytes, unfortunately, it only writes 31 bytes for each file.
Am I missing something? Or should I be using a binary writer.