According to the answer here I want to write multiple files stream to one stream as following:
4 byte reserved for length number of each stream
each stream content write after it's length number(after 4 byte)
at the end stream will be something like this
Stream = File1 len + File1 stream content + File2 len + File2 stream content + ....
Example code:
result = new ExportResult_C()
{
PackedStudy = packed.ToArray() ,
Stream = new MemoryStream()
};
string[] zipFiles = Directory.GetFiles(zipRoot);
foreach (string fileN in zipFiles)
{
MemoryStream outFile = new MemoryStream(File.ReadAllBytes(fileN));
MemoryStream len = new MemoryStream(4);
//initiate outFile len to 4 byte push it to main stream
//Then push outFile stream to main stream
//Continue and do this for another file
}
//For test Save stream to file(s)
is it good idea? really don't know how that comments can be lines of code.
Thanks in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…