C# - Urgent. -- Get a file from the assembly and pass it to the FileStream class
Posted on 2006-11-16
This is very urgent. I have a file as an embedded resource. I want to read the file and pass it to the GZipStream class. There are 2 ways in which the GZipStream accepts :-
1) As a memoryStream
2) As a FileStream.
The Embedded file is a compressed file.
1) I have test it with the FileStream method when the copressed file is present on the local.
But how do I read an embedded resource as a FileStream ?
2) I have used the Assembly.Load("assemblyName").GetManifestResourceStream("FileName");
I passed this to a StreamReader but the data is getting corrupted.
I also used the BufferedStream with the same result.
hence my instinct is -- since I know that the FileStream works -- somehow to get the embedded resource from the Assembly as a FileStream, then the remaining code would work. But how to do that ??
there is GetFile() method which returns a FileStream but currently its giving a null value.
Any help ????