Esempio n. 1
0
    public static void Zip(string sourceDirectory, string destinationPath)
    {
        if (sourceDirectory == null)
        {
            Debug.LogError("Null source directory string, cannot zip!");
        }

        if (!Directory.Exists(sourceDirectory))
        {
            Debug.LogError("Directory does not exist, cannot zip!");
        }

        if (destinationPath == null)
        {
            Debug.LogError("Null destination path string, cannot zip!");
        }

        if (File.Exists(destinationPath))
        {
            File.Delete(destinationPath);
        }

        GameIO.EnsureDirectory(GameIO.DirectoryFromFile(destinationPath));
        ZipFile.CreateFromDirectory(sourceDirectory, destinationPath, CompressionLevel.Optimal, false);
        Debug.Log("Zipped '{0}' to '{1}'.".Form(sourceDirectory, destinationPath));
    }