7zip SDK:Reading/Writing 属性。写了什么以及如何以人的形式阅读它?

7zip SDK: Reading/Writing properties. What is written and how to read it in human form?

我正在使用7zip SDK 来压缩和解压缩文件。 一切正常,除了当我解压缩文件时,(多个文件压缩在一个文件中)我不知道它们的扩展名。

文件名和扩展名写在压缩时的属性里?

如果没有,我怎么写这些属性?

如何读取这些特定属性以编程方式命名提取的文件?

压缩方法

           // Write the encoder properties
            coder.WriteCoderProperties(output);

            // Write the decompressed file size.
            output.Write(BitConverter.GetBytes(input.Length), 0, 8);

           //This is how I am writing the standard properties

解压方法

            // Read properties
            byte[] propertyBytes = new byte[5];
            input.Read(propertyBytes, 0, 5);
            coder.SetDecoderProperties(propertyBytes);

            //File length
            byte[] fileLengthBytes = new byte[8];
            input.Read(fileLengthBytes, 0, 8);
            long fileLength = BitConverter.ToInt64(fileLengthBytes, 0);

            //Reading the properties and the size of the file.

所以根据解压方法我理解的是文件属性在字节0-5上。

文件名和扩展名应该放在那里吗?在创建提取的文件期间如何读取它来命名我的文件?

我只需要在为输出文件创建 fileStream 时找到压缩文件的名称及其格式,我就可以正确命名它。

有什么想法吗?

我认为:

我将文件名和扩展名保存在这样的变量中:

        string nameOfFile = new FileInfo(filesToCompress[i]).Name;

要将文件名作为 属性 写入我的压缩文件,我必须将其转换为字节数组并使用 fileStream 将其写入文件:

            //write the file name
            byte[] filenameByts = Encoding.Default.GetBytes(nameOfFile);
            output.Write(filenameByts, 0, filenameByts.Length);