niel_AvatarsAssistant/Assets/Scripts/AA/Utility/ZipArchiveExtensions.cs
using System;
using System.IO;
using System.IO.Compression;


namespace AA.Utility
{
	public static class ZipArchiveExtensions
	{
		public static void ExtractToDirectory(this ZipArchive archive, string destinationDirectoryName, bool overwrite)
		{
			if (!overwrite)
			{
				archive.ExtractToDirectory(destinationDirectoryName);
				return;
			}

			foreach (ZipArchiveEntry file in archive.Entries)
			{
				string completeFileName = Path.Combine(destinationDirectoryName, file.FullName);
				string directory        = Path.GetDirectoryName(completeFileName);

				if (!Directory.Exists(directory))
				{
					Directory.CreateDirectory(directory);
				}

				if (file.Name != "")
				{
					file.ExtractToFile(completeFileName, true);
				}
			}
		}
	}
}
