System.Collections.Generic.ICollection.Add(ZipArchiveEntry)

Here are the examples of the csharp api System.Collections.Generic.ICollection.Add(ZipArchiveEntry) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

19 Source : FunctionManager.cs
with Apache License 2.0
from Azure-App-Service

public void CreateArchive(ZipArchive zip, bool includeAppSettings = false, bool includeCsproj = false, string projectName = null)
        {
            var tracer = _traceFactory.GetTracer();
            var directoryInfo = FileSystemHelpers.DirectoryInfoFromDirectoryName(_environment.FunctionsPath);

            // First add the entire wwwroot folder at the root of the zip.
            IList<ZipArchiveEntry> files;
            zip.AddDirectory(directoryInfo, tracer, string.Empty, out files);

            if (includeAppSettings)
            {
                // include local.settings.json if needed.
                files.Add(AddAppSettingsFile(zip));
            }

            if (includeCsproj)
            {
                // include .csproj for Visual Studio if needed.
                projectName = projectName ?? ServerConfiguration.GetApplicationName();
                AddCsprojFile(zip, files, projectName);
            }
        }

19 Source : ZipArchiveExtensions.cs
with Apache License 2.0
from Azure-App-Service

private static void InternalAddDirectory(ZipArchive zipArchive, DirectoryInfoBase directory, ITracer tracer, string directoryNameInArchive, IList<ZipArchiveEntry> files = null)
        {
            bool any = false;
            foreach (var info in directory.GetFileSystemInfos())
            {
                any = true;
                var subDirectoryInfo = info as DirectoryInfoBase;
                if (subDirectoryInfo != null)
                {
                    string childName = ForwardSlashCombine(directoryNameInArchive, subDirectoryInfo.Name);
                    InternalAddDirectory(zipArchive, subDirectoryInfo, tracer, childName, files);
                }
                else
                {
                    var entry = zipArchive.AddFile((FileInfoBase)info, tracer, directoryNameInArchive);
                    files?.Add(entry);
                }
            }

            if (!any)
            {
                // If the directory did not have any files or folders, add a entry for it
                zipArchive.CreateEntry(EnsureTrailingSlash(directoryNameInArchive));
            }
        }