【问题标题】:Check the method in project检查项目中的方法
【发布时间】:2018-02-21 06:53:24
【问题描述】:

我正在尝试从https://nunrar.codeplex.com/ 调试代码。在分支 DOCUMENTATION -> Basic Usage 中有以下代码:

RarArchive archive = RarArchive.Open(source);
foreach (RarArchiveEntry entry in archive.Entries)
{
    string path = Path.Combine(destination, Path.GetFileName(entry.FilePath));
    entry.ExtractToFile(path);
}

嗯..我已经下载了源代码,找到RarArchiveEntry类并开始寻找方法ExtractToFile(),但是在类和项目中都没有任何方法! 请帮我找到这个方法或我可以调用的方法来查看这个程序如何逐步解压rar文件?

【问题讨论】:

  • 您是否尝试过使用 SharpCompress,正如该网站上的大写字母所建议的那样?
  • “SharpCompress 是 NUnrar 的未来”
  • 不,我认为那个网站上的代码对我来说已经足够了......我现在开始浏览它!但是还是很奇怪,找不到这个方法……
  • RarArchiveEntry 是否继承自另一个类?
  • 是的,来自RarEntry

标签: c# rar


【解决方案1】:

看起来文档已过时并且方法名称已更改,在RarArchiveEntry.Exensions.cs 中找到了一个名为WriteToFile 的扩展方法。

/// <summary>
/// Extract to specific file
/// </summary>
public static void WriteToFile(this RarArchiveEntry entry, string destinationFileName, ExtractOptions options = ExtractOptions.Overwrite)
{
    entry.WriteToFile(destinationFileName, new NullRarExtractionListener(), options);
}

【讨论】:

  • 非常感谢!所以现在我从main 调用它并逐步查看代码:)
猜你喜欢
  • 1970-01-01
  • 2021-10-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-11-10
  • 2016-12-08
  • 2023-03-22
相关资源
最近更新 更多