Ejemplo n.º 1
0
        public static ZipSegmentedStream ForUpdate(string name, uint diskNumber)
        {
            // ForUpdate is used only when updating the zip entry metadata for
            // a segmented zip file, when the starting segment is earlier
            // than the ending segment, for a particular entry.

            ZipSegmentedStream zss = new ZipSegmentedStream()
                {
                    rw = 3,  // 3 == update
                    CurrentSegment = diskNumber,
                    _baseName = name,
                    _maxSegmentSize = Int32.MaxValue  // insure no rollover
                };

            // It's safe to assume that the update will not expand the size of the segment.
            // It's an in-place update of zip metadata.

            // Console.WriteLine("ZipSegmentedStream: update ({0})", name);
            zss._SetUpdateStream();
            return zss;
        }
Ejemplo n.º 2
0
        public static ZipSegmentedStream ForWriting(string name, int maxSegmentSize)
        {
            ZipSegmentedStream zss = new ZipSegmentedStream()
                {
                    rw = 2, // 2 == write
                    CurrentSegment = 0,
                    _baseName = name,
                    _maxSegmentSize = maxSegmentSize,
                    _baseDir = Path.GetDirectoryName(name)
                };

            // workitem 9522
            if (zss._baseDir=="") zss._baseDir=".";

            zss._SetWriteStream(0);
            return zss;
        }
Ejemplo n.º 3
0
        public static ZipSegmentedStream ForReading(string name, uint initialDiskNumber, uint maxDiskNumber)
        {
            ZipSegmentedStream zss = new ZipSegmentedStream()
                {
                    rw = 1,  // 1 == readonly
                    CurrentSegment = initialDiskNumber,
                    _maxDiskNumber = maxDiskNumber,
                    _baseName = name,
                };

            zss._SetReadStream();
            return zss;
        }