Exemple #1
0
        public static void WriteAllTopLevelFilesToZip(string destPath, string sourceDir)
        {
            RetryUtility.Retry(() =>
            {
                Directory.CreateDirectory(Path.GetDirectoryName(destPath));
                var zipFile = new BloomZipFile(destPath);
                foreach (var path in Directory.EnumerateFiles(sourceDir))
                {
                    zipFile.AddTopLevelFile(path);
                }

                zipFile.Save();
            });
        }
Exemple #2
0
        /// <summary>
        /// Write the named files in the specified source folder to the specified zip file.
        /// </summary>
        public static void WriteFilesToZip(string[] names, string sourceFolder, string destPath)
        {
            RetryUtility.Retry(() =>
            {
                Directory.CreateDirectory(Path.GetDirectoryName(destPath));
                var zipFile = new BloomZipFile(destPath);
                foreach (var name in names)
                {
                    var path = Path.Combine(sourceFolder, name);
                    if (!RobustFile.Exists(path))
                    {
                        continue;
                    }
                    zipFile.AddTopLevelFile(path, true);
                }

                zipFile.Save();
            });
        }