Ejemplo n.º 1
0
        private static async Task PackDirectoryAsync(ZipArchive archive, string inputDir, CancellationToken cancellation)
        {
            var fullPath = Path.GetFullPath(inputDir);

            foreach (var file in Directory.EnumerateFiles(inputDir, searchPattern: "*", SearchOption.AllDirectories))
            {
                if (Path.GetFileName(file).Equals("module.json", StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }

                var fullFilePath = Path.GetFullPath(file);
                var entryName    = fullFilePath.Substring(fullPath.Length).TrimStart('/', '\\');
                await archive.AddFileAsEntryAsync(entryName, fullFilePath, cancellation);
            }
        }