c# - 参数 3:无法从 'bool' 转换为 'System.Text.Encoding'
问题描述
我正在使用System.IO.Compression
和使用ZipFile.ExtractToDirectory
. 我看到一个人使用 3 个参数,两个字符串和一个布尔值。当我试图准确地复制他所做的事情时,我得到了一个错误。我知道ZipFile
可以是编码或布尔值,但我希望它是布尔值。有什么我需要改变的吗?
我正在使用 .NET Framework 4.7.2
这是任何可能认为会有所帮助的人的代码。这也是我正在关注的视频。它有一个他在哪里输入 ZipFile 行的时间戳。https://youtu.be/JIjZQo03YdA?t=420
private void DownloadGameCompletedCallback(object sender, AsyncCompletedEventArgs e)
{
try
{
string onlineVersion = ((Version)e.UserState).ToString();
ZipFile.ExtractToDirectory(gameZip, rootPath, true);
File.Delete(gameZip);
File.WriteAllText(versionFile, onlineVersion);
VersionText.Text = onlineVersion;
Status = LauncherStatus.READY;
}
catch (Exception ex)
{
Status = LauncherStatus.FAILED;
MessageBox.Show($"Error finishing download: {ex}");
}
}
解决方案
我使用的是 .NET Framework 而不是 .NET Core。对不起,浪费你们的时间了伙计们!我忘记了 .NET Framework 和 .NET Core 是两个完全不同的东西。
推荐阅读
- python - Python & 路径解析
- python - 如何使用 python selenium 库提供搜索输入?
- ansible - Ansible AWX UI 或 tower-cli 智能搜索以排除模式匹配
- python - python将另一个文件中的函数外的字典作为变量导入
- wpf - 'conv:' 和 'local:' 有什么区别?
- ios - 从 AppDelegate 在 WkWebView 中打开 url
- android - 将 png 转换为可绘制,然后是颜色过滤器,然后是位图 - 不工作
- c - Unix系统编程:获取要传递给getaddrinfo的网络标识符
- javascript - 这两种连接用法有什么区别?
- javascript - 从firebase函数调用json文件