简体   繁体   English

将 zip 文件内容从 memory 写入控制台应用程序

[英]write zip file content from memory to a console app

am sorry but I don't know where to start I need a way to use files from zip file in real time as they get unziped like to write from file stream the console app is a samsung odin flash program and the arguments to it like odin --flash --recovery /recovery.img path --boot /boot.img path etc and unziping samsung firmware files take too much duo to large size of some of the files in it so am looking for a way to make the argument go like odin --flash --recovery 'stream providing the recovery.img file as it unzip' I don't know if that possible but I hope there is a way to do that很抱歉,但我不知道从哪里开始我需要一种方法来实时使用 zip 文件中的文件,因为它们被解压缩就像从文件 stream 中写入控制台应用程序是三星 odin flash 程序和 arguments 像odin --flash --recovery /recovery.img path --boot /boot.img path etc和解压三星固件文件需要太多的duo到其中一些文件的大尺寸所以我正在寻找一种方法来制作参数go像odin --flash --recovery 'stream providing the recovery.img file as it unzip'我不知道这是否可能,但我希望有办法做到这一点

I didn't try any thing because I don't know where to start我没有尝试任何事情,因为我不知道从哪里开始

That's not possible because odin expects a file name, not a stream of data.这是不可能的,因为odin需要一个文件名,而不是 stream 的数据。 If you wanted to print a decompressed file from a.zip to the console, you'd do something like this:如果你想从 a.zip 打印一个解压文件到控制台,你会做这样的事情:

using System.IO.Compression;
using System.Text;

static void PrintZipFile(string zipPath, int fileIndex)
{
    using var zip = ZipFile.OpenRead(zipPath);
    using Stream firstEntry = zip.Entries[fileIndex].Open();
    using var r = new BinaryReader(firstEntry);

    Console.WriteLine(Encoding.ASCII.GetString(r.ReadBytes((int)r.BaseStream.Length)));
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM