Вот мой код:Изменить местоположение .zip C#
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string appdata = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData);
string subFolderPath = System.IO.Path.Combine(appdata, ".minecraft");
string bin = System.IO.Path.Combine(subFolderPath, "bin");
string mods = System.IO.Path.Combine(subFolderPath, "mods");
string coremods =System.IO.Path.Combine(subFolderPath, "coremods");
string config = System.IO.Path.Combine(subFolderPath, "config");
if (Directory.Exists(mods)) Directory.Delete(mods,true);
if (Directory.Exists(config)) Directory.Delete(config, true);
if (Directory.Exists(coremods)) Directory.Delete(coremods, true);
FastZip fZip1 = new FastZip();
fZip1.ExtractZip(@"C:\Users\Rafa\Desktop\MagicFarm.zip", subFolderPath, "config");
FastZip fZip = new FastZip();
fZip.ExtractZip(@"C:\Users\Rafa\Desktop\MagicFarm.zip", subFolderPath, "mods");
FastZip fZip2 = new FastZip();
fZip2.ExtractZip(@"C:\Users\Rafa\Desktop\MagicFarm.zip", subFolderPath, "coremods");
Я хочу поставить "C: \ Users \ Рафа \ Desktop \ MagicFarm.zip" в директории проекта.
Может кто-нибудь мне помочь?
Когда вы говорите «каталог проекта», что вы имеете в виду? вы хотите, чтобы программа проверила ту же папку, в которой была запущена программа, чтобы искать zip? Или вы хотите, чтобы zip распространялся с exe, поэтому ваш exe извлекал zip? –
Помните, что как только ваша программа скомпилирована, она не знает, где сохраняются исходные файлы исходного кода. Единственное место, где он сможет сохранить ZIP-файл, находится в той же папке, в которой находится EXE. –