Create() public static méthode

Create a new ZipFile whose data will be stored on a stream.
is null doesnt support writing.
public static Create ( Stream outStream ) : ZipFile
outStream Stream The stream providing data storage.
Résultat ZipFile
Exemple #1
0
        ZipFile(string filename, IReadWritePackage parent)
        {
            pkgStream = new MemoryStream();

            Name   = filename;
            Parent = parent;
            pkg    = SZipFile.Create(pkgStream);
        }
Exemple #2
0
        public ZipFile(IReadOnlyFileSystem context, string filename, bool createOrClearContents = false)
        {
            Name = filename;

            if (createOrClearContents)
            {
                pkg = SZipFile.Create(filename);
            }
            else
            {
                pkg = new SZipFile(filename);
            }
        }
Exemple #3
0
        public ZipFile(FileSystem context, string filename, Stream stream, bool createOrClearContents = false)
        {
            Name = filename;

            if (createOrClearContents)
            {
                pkg = SZipFile.Create(stream);
            }
            else
            {
                pkg = new SZipFile(stream);
            }
        }
Exemple #4
0
        // Create a new zip with the specified contents
        public ZipFile(string filename, int priority, Dictionary <string, byte[]> contents)
        {
            this.priority = priority;
            this.filename = filename;

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

            pkg = SZipFile.Create(filename);
            Write(contents);
        }
Exemple #5
0
        public void Write(Dictionary <string, byte[]> contents)
        {
            // TODO: Clear existing content?
            pkg.Close();
            pkg = SZipFile.Create(filename);
            pkg.BeginUpdate();

            foreach (var kvp in contents)
            {
                pkg.Add(new StaticMemoryDataSource(kvp.Value), kvp.Key);
            }

            pkg.CommitUpdate();
            pkg.Close();
            pkg = new SZipFile(new MemoryStream(File.ReadAllBytes(filename)));
        }