using SevenZip;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace Test
{
public static class ZipHelper
{
static bool Is64 = (IntPtr.Size == 8);
internal const string Name32 = "7z.dll";
internal const string Name64 = "7z64.dll";
internal const string ZIP_FILE = "index.zip";
static ZipHelper()
{
string name = Is64 ? Name64 : Name32;
SevenZip.SevenZipExtractor.SetLibraryPath(name);
}
public static Stream GetSteamFrom7z(string fileName)
{
var stream = new MemoryStream();
using (var tmp = new SevenZipExtractor(ZIP_FILE))
{
tmp.ExtractFile(fileName, stream);
}
stream.Position = 0;
return stream;
}
}
}
C# SevenZip简单操作
最新推荐文章于 2024-08-05 15:17:04 发布