📖create

void create(string pathFoler, string outputArchive);

pathFolder - Путь до запаковываемой папки

outputArchive - Выходной файл

Пример:

MultiAPI.Zip.create("C:\\AIFolder", "C:\\okay.zip")

Исключения:

Исключения: 0x00003 и 0x00004

Обработка: Исключения

Описание:

Создаёт архив из папки

Код:

public static void create(string pathFoler, string outputArchive)
{
    if (string.IsNullOrEmpty(pathFoler) || string.IsNullOrEmpty(outputArchive)) throw new Exception("0x00003"); // Если pathFolder или outputArchive пуст, то выдаём исключение "0x00003"
    if (Directory.Exists(pathFoler)) ZipFile.CreateFromDirectory(pathFoler, outputArchive); // Если pathFolder есть, то создаём архив из папки
    else throw new Exception("0x00004"); // Если pathFolder нету, то выдаём исключение "0x00004"
}

Last updated

Was this helpful?