用于解压zip, 和rar 文件. 使用也特别简单, using SharpCompress.Common, using SharpCompress.Reader;
1. 读取就好了, 有子文件夹也没有关系的. 读取rar
using (Stream stream = File.OpenRead(@"E:\资源\AssetBundles.rar"))
{
var reader = ReaderFactory.Open(stream);
while (reader.MoveToNextEntry())
{
if (!reader.Entry.IsDirectory)
{
Console.WriteLine(reader.Entry.FilePath);
reader.WriteEntryToDirectory(@"E:\资源\out", ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
}
}
}
2, 上面的代码用来读取zip 好像也是可以的. 运行后会在out 下面生成AssetBundle 文件夹, 然后陈列所有的东西