c# - C# | 在应解压缩文件的书面程序中出现错误“找不到路径的一部分”
问题描述
using System;
using System.IO.Compression;
namespace TF2DuckHitSound
{
class Program
{
static void Main(string[] args)
{
int version = 1;
string sourcePath = @".\TF2DuckHitSounds2.1\";
string destPath = @".\steamapps\common\Team Fortress 2\tf\custom\";
string sourceZIP = @".\TF2DuckHitSound2.1\duckhitsound.zip";
string destPathAlt;
bool destPathExist;
Console.WriteLine($"Installer for TF2DuckHitsound. Version {version}");
Console.WriteLine("Looking for TF2 Directory...");
if (System.IO.Directory.Exists(destPath))
{
destPathExist = true;
}
else
{
destPathExist = false;
Console.WriteLine("TF2 Directory not found!");
}
if (destPathExist == true)
{
ZipFile.CreateFromDirectory(sourcePath, sourceZIP);
ZipFile.ExtractToDirectory(sourceZIP, destPath);
}
else
{
Console.WriteLine("Please enter the full path of your custom directory...");
destPathAlt = Console.ReadLine();
ZipFile.CreateFromDirectory(sourcePath, sourceZIP);
ZipFile.ExtractToDirectory(sourceZIP, destPathAlt);
}
Console.ReadKey();
}
}
}
请帮忙。这是确切的错误代码:
找不到路径“C:\Users\luca-\OneDrive\Visual Studio\TF2DuckHitSound\TF2DuckHitSound\bin\Release\netcoreapp3.0\TF2DuckHitSound2.1\duckhitsound.zip”的一部分。
解决方案
推荐阅读
- html - How do I remove the space when hovering over a nav link?
- android - 2018/09/16 在 android 中使用 gsm:google 4.0.1 的`compile` 仍然存在问题
- java - How to combine two elements in the same arrays?
- variables - 八度:For-Loop 创建错误的变量
- android - Toolbar won't display as action bar in Android Studio
- python - 如何使用线程并行压缩迭代器?
- javascript - Use hover on div and mouseout at same time
- java - Spring Batch JpaItemWriter vs HibernateItemWriter 以及为什么在使用 HibernateItemWriter 时需要 HibernateTransactionManager
- google-apps-script - 在同一独立脚本中使用 SpreadsheetApp 和 FormApp 时出错
- c# - Data not binding in Xamarin forms Listview group