当前位置: 首页>>代码示例>>C#>>正文


C# Zip.ZipExtraData类代码示例

本文整理汇总了C#中ICSharpCode.SharpZipLib.Zip.ZipExtraData的典型用法代码示例。如果您正苦于以下问题:C# ZipExtraData类的具体用法?C# ZipExtraData怎么用?C# ZipExtraData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ZipExtraData类属于ICSharpCode.SharpZipLib.Zip命名空间,在下文中一共展示了ZipExtraData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddExtraDataAES

 private static void AddExtraDataAES(ZipEntry entry, ZipExtraData extraData)
 {
     extraData.StartNewEntry();
     extraData.AddLeShort(2);
     extraData.AddLeShort(0x4541);
     extraData.AddData(entry.AESEncryptionStrength);
     extraData.AddLeShort((int) entry.CompressionMethod);
     extraData.AddNewEntry(0x9901);
 }
开发者ID:huaminglee,项目名称:myyyyshop,代码行数:9,代码来源:ZipOutputStream.cs

示例2: GetUnixTimestamp

 /// <summary>
 /// Encodes a <paramref name="timestamp"/> as a <see cref="ZipEntry.ExtraData"/> in a format that ensures it will be read for <see cref="ZipEntry.DateTime"/>, preserving second-accuracy.
 /// </summary>
 private static byte[] GetUnixTimestamp(DateTime timestamp)
 {
     var extraData = new ZipExtraData();
     extraData.AddEntry(new ExtendedUnixData
     {
         AccessTime = timestamp, CreateTime = timestamp, ModificationTime = timestamp,
         Include = ExtendedUnixData.Flags.AccessTime | ExtendedUnixData.Flags.CreateTime | ExtendedUnixData.Flags.ModificationTime
     });
     return extraData.GetEntryData();
 }
开发者ID:0install,项目名称:0install-win,代码行数:13,代码来源:ZipGenerator.cs

示例3: GetDateTime

        private DateTime GetDateTime(ZipExtraData extraData)
        {
            // Check for NT timestamp
            // NOTE: Disable by default to match behavior of InfoZIP
            #if RESPECT_NT_TIMESTAMP
            NTTaggedData ntData = extraData.GetData<NTTaggedData>();
            if (ntData != null)
                return ntData.LastModificationTime;
            #endif

            // Check for Unix timestamp
            ExtendedUnixData unixData = extraData.GetData<ExtendedUnixData>();
            if (unixData != null &&
                // Only apply modification time, but require all other values to be present
                // This is done to match InfoZIP's behaviour
                ((unixData.Include & ExtendedUnixData.Flags.ModificationTime) != 0) &&
                ((unixData.Include & ExtendedUnixData.Flags.AccessTime) != 0) &&
                ((unixData.Include & ExtendedUnixData.Flags.CreateTime) != 0))
                return unixData.ModificationTime;

            // Fall back to DOS time
            uint sec = Math.Min(59, 2 * (dosTime & 0x1f));
            uint min = Math.Min(59, (dosTime >> 5) & 0x3f);
            uint hrs = Math.Min(23, (dosTime >> 11) & 0x1f);
            uint mon = Math.Max(1, Math.Min(12, ((dosTime >> 21) & 0xf)));
            uint year = ((dosTime >> 25) & 0x7f) + 1980;
            int day = Math.Max(1, Math.Min(DateTime.DaysInMonth((int)year, (int)mon), (int)((dosTime >> 16) & 0x1f)));
            return new DateTime((int)year, (int)mon, day, (int)hrs, (int)min, (int)sec, DateTimeKind.Utc);
        }
开发者ID:icsharpcode,项目名称:SharpZipLib,代码行数:29,代码来源:ZipEntry.cs

示例4: WriteCentralDirectoryHeader

		int WriteCentralDirectoryHeader(ZipEntry entry)
		{
			if ( entry.CompressedSize < 0 ) {
				throw new ZipException("Attempt to write central directory entry with unknown csize");
			}

			if ( entry.Size < 0 ) {
				throw new ZipException("Attempt to write central directory entry with unknown size");
			}
			
			if ( entry.Crc < 0 ) {
				throw new ZipException("Attempt to write central directory entry with unknown crc");
			}
			
			// Write the central file header
			WriteLEInt(ZipConstants.CentralHeaderSignature);

			// Version made by
			WriteLEShort(ZipConstants.VersionMadeBy);

			// Version required to extract
			WriteLEShort(entry.Version);

			WriteLEShort(entry.Flags);
			
			unchecked {
				WriteLEShort((byte)entry.CompressionMethod);
				WriteLEInt((int)entry.DosTime);
				WriteLEInt((int)entry.Crc);
			}

			if ( (entry.IsZip64Forced()) || (entry.CompressedSize >= 0xffffffff) ) {
				WriteLEInt(-1);
			}
			else {
				WriteLEInt((int)(entry.CompressedSize & 0xffffffff));
			}

			if ( (entry.IsZip64Forced()) || (entry.Size >= 0xffffffff) ) {
				WriteLEInt(-1);
			}
			else {
				WriteLEInt((int)entry.Size);
			}

			byte[] name = ZipConstants.ConvertToArray(entry.Flags, entry.Name);

			if ( name.Length > 0xFFFF ) {
				throw new ZipException("Entry name is too long.");
			}

			WriteLEShort(name.Length);

			// Central header extra data is different to local header version so regenerate.
			ZipExtraData ed = new ZipExtraData(entry.ExtraData);

			if ( entry.CentralHeaderRequiresZip64 ) {
				ed.StartNewEntry();

				if ( (entry.Size >= 0xffffffff) || (useZip64_ == UseZip64.On) )
				{
					ed.AddLeLong(entry.Size);
				}

				if ( (entry.CompressedSize >= 0xffffffff) || (useZip64_ == UseZip64.On) )
				{
					ed.AddLeLong(entry.CompressedSize);
				}

				if ( entry.Offset >= 0xffffffff ) {
					ed.AddLeLong(entry.Offset);
				}

				// Number of disk on which this file starts isnt supported and is never written here.
				ed.AddNewEntry(1);
			}
			else {
				// Should have already be done when local header was added.
				ed.Delete(1);
			}

			byte[] centralExtraData = ed.GetEntryData();

			WriteLEShort(centralExtraData.Length);
			WriteLEShort(entry.Comment != null ? entry.Comment.Length : 0);

			WriteLEShort(0);	// disk number
			WriteLEShort(0);	// internal file attributes

			// External file attributes...
			if ( entry.ExternalFileAttributes != -1 ) {
				WriteLEInt(entry.ExternalFileAttributes);
			}
			else {
				if ( entry.IsDirectory ) {
					WriteLEUint(16);
				}
				else {
					WriteLEUint(0);
				}
//.........这里部分代码省略.........
开发者ID:jamesbascle,项目名称:SharpZipLib,代码行数:101,代码来源:ZipFile.cs

示例5: TestLocalHeader

		/// <summary>
		/// Test a local header against that provided from the central directory
		/// </summary>
		/// <param name="entry">
		/// The entry to test against
		/// </param>
		/// <param name="tests">The type of <see cref="HeaderTest">tests</see> to carry out.</param>
		/// <returns>The offset of the entries data in the file</returns>
		long TestLocalHeader(ZipEntry entry, HeaderTest tests)
		{
			lock(baseStream_) 
			{
				bool testHeader = (tests & HeaderTest.Header) != 0;
				bool testData = (tests & HeaderTest.Extract) != 0;

				baseStream_.Seek(offsetOfFirstEntry + entry.Offset, SeekOrigin.Begin);
				if ((int)ReadLEUint() != ZipConstants.LocalHeaderSignature) {
					throw new ZipException(string.Format("Wrong local header signature @{0:X}", offsetOfFirstEntry + entry.Offset));
				}

				short extractVersion = ( short ) (ReadLEUshort() & 0x00ff);
				short localFlags = ( short )ReadLEUshort();
				short compressionMethod = ( short )ReadLEUshort();
				short fileTime = ( short )ReadLEUshort();
				short fileDate = ( short )ReadLEUshort();
				uint crcValue = ReadLEUint();
				long compressedSize = ReadLEUint();
				long size = ReadLEUint();
				int storedNameLength = ReadLEUshort();
				int extraDataLength = ReadLEUshort();

				byte[] nameData = new byte[storedNameLength];
				StreamUtils.ReadFully(baseStream_, nameData);

				byte[] extraData = new byte[extraDataLength];
				StreamUtils.ReadFully(baseStream_, extraData);

				ZipExtraData localExtraData = new ZipExtraData(extraData);

				// Extra data / zip64 checks
				if (localExtraData.Find(1))
				{
					// 2010-03-04 Forum 10512: removed checks for version >= ZipConstants.VersionZip64
					// and size or compressedSize = MaxValue, due to rogue creators.

					size = localExtraData.ReadLong();
					compressedSize = localExtraData.ReadLong();

                    if ((localFlags & (int)GeneralBitFlags.Descriptor) != 0)
                    {
                        // These may be valid if patched later
                        if ( (size != -1) && (size != entry.Size)) {
                            throw new ZipException("Size invalid for descriptor");
                        }

                        if ((compressedSize != -1) && (compressedSize != entry.CompressedSize)) {
                            throw new ZipException("Compressed size invalid for descriptor");
                        }
                    }
                }
				else
				{
					// No zip64 extra data but entry requires it.
					if ((extractVersion >= ZipConstants.VersionZip64) &&
						(((uint)size == uint.MaxValue) || ((uint)compressedSize == uint.MaxValue)))
					{
						throw new ZipException("Required Zip64 extended information missing");
					}
				}

				if ( testData ) {
					if ( entry.IsFile ) {
						if ( !entry.IsCompressionMethodSupported() ) {
							throw new ZipException("Compression method not supported");
						}

						if ( (extractVersion > ZipConstants.VersionMadeBy)
							|| ((extractVersion > 20) && (extractVersion < ZipConstants.VersionZip64)) ) {
							throw new ZipException(string.Format("Version required to extract this entry not supported ({0})", extractVersion));
						}

						if ( (localFlags & ( int )(GeneralBitFlags.Patched | GeneralBitFlags.StrongEncryption | GeneralBitFlags.EnhancedCompress | GeneralBitFlags.HeaderMasked)) != 0 ) {
							throw new ZipException("The library does not support the zip version required to extract this entry");
						}
					}
				}

                if (testHeader)
                {
                    if ((extractVersion <= 63) &&	// Ignore later versions as we dont know about them..
                        (extractVersion != 10) &&
                        (extractVersion != 11) &&
                        (extractVersion != 20) &&
                        (extractVersion != 21) &&
                        (extractVersion != 25) &&
                        (extractVersion != 27) &&
                        (extractVersion != 45) &&
                        (extractVersion != 46) &&
                        (extractVersion != 50) &&
                        (extractVersion != 51) &&
//.........这里部分代码省略.........
开发者ID:jamesbascle,项目名称:SharpZipLib,代码行数:101,代码来源:ZipFile.cs

示例6: ProcessExtraData

		/// <summary>
		/// Process extra data fields updating the entry based on the contents.
		/// </summary>
		/// <param name="localHeader">True if the extra data fields should be handled
		/// for a local header, rather than for a central header.
		/// </param>
		internal void ProcessExtraData(bool localHeader)
		{
			ZipExtraData extraData = new ZipExtraData(this.extra);

			if ( extraData.Find(0x0001) ) {
                // Version required to extract is ignored here as some archivers dont set it correctly
                // in theory it should be version 45 or higher

				// The recorded size will change but remember that this is zip64.
				forceZip64_ = true;

				if ( extraData.ValueLength < 4 ) {
					throw new ZipException("Extra data extended Zip64 information length is invalid");
				}

				if ( localHeader || (size == uint.MaxValue) ) {
					size = (ulong)extraData.ReadLong();
				}

				if ( localHeader || (compressedSize == uint.MaxValue) ) {
					compressedSize = (ulong)extraData.ReadLong();
				}

				if ( !localHeader && (offset == uint.MaxValue) ) {
					offset = extraData.ReadLong();
				}

                // Disk number on which file starts is ignored
			}
			else {
				if ( 
					((versionToExtract & 0xff) >= ZipConstants.VersionZip64) &&
					((size == uint.MaxValue) || (compressedSize == uint.MaxValue))
				) {
					throw new ZipException("Zip64 Extended information required but is missing.");
				}
			}

			dateTime = GetDateTime(extraData);
			if (method == CompressionMethod.WinZipAES) {
				ProcessAESExtraData(extraData);
			}
		}
开发者ID:jamesbascle,项目名称:SharpZipLib,代码行数:49,代码来源:ZipEntry.cs

示例7: Finish

        /// <summary>
        /// Finishes the stream.  This will write the central directory at the
        /// end of the zip file and flush the stream.
        /// </summary>
        /// <remarks>
        /// This is automatically called when the stream is closed.
        /// </remarks>
        /// <exception cref="System.IO.IOException">
        /// An I/O error occurs.
        /// </exception>
        /// <exception cref="ZipException">
        /// Comment exceeds the maximum length<br/>
        /// Entry name exceeds the maximum length
        /// </exception>
        public override void Finish()
        {
            if (entries == null)
            {
                return;
            }

            if (curEntry != null)
            {
                CloseEntry();
            }

            long numEntries = entries.Count;
            long sizeEntries = 0;

            foreach (ZipEntry entry in entries)
            {
                WriteLeInt(ZipConstants.CentralHeaderSignature);
                WriteLeShort(ZipConstants.VersionMadeBy);
                WriteLeShort(entry.Version);
                WriteLeShort(entry.Flags);
                WriteLeShort((short) entry.CompressionMethodForHeader);
                WriteLeInt((int) entry.DosTime);
                WriteLeInt((int) entry.Crc);

                if (entry.IsZip64Forced() ||
                    (entry.CompressedSize >= uint.MaxValue))
                {
                    WriteLeInt(-1);
                }
                else
                {
                    WriteLeInt((int) entry.CompressedSize);
                }

                if (entry.IsZip64Forced() ||
                    (entry.Size >= uint.MaxValue))
                {
                    WriteLeInt(-1);
                }
                else
                {
                    WriteLeInt((int) entry.Size);
                }

                byte[] name = ZipConstants.ConvertToArray(entry.Flags, entry.Name);

                if (name.Length > 0xffff)
                {
                    throw new ZipException("Name too long.");
                }

                var ed = new ZipExtraData(entry.ExtraData);

                if (entry.CentralHeaderRequiresZip64)
                {
                    ed.StartNewEntry();
                    if (entry.IsZip64Forced() ||
                        (entry.Size >= 0xffffffff))
                    {
                        ed.AddLeLong(entry.Size);
                    }

                    if (entry.IsZip64Forced() ||
                        (entry.CompressedSize >= 0xffffffff))
                    {
                        ed.AddLeLong(entry.CompressedSize);
                    }

                    if (entry.Offset >= 0xffffffff)
                    {
                        ed.AddLeLong(entry.Offset);
                    }

                    ed.AddNewEntry(1);
                }
                else
                {
                    ed.Delete(1);
                }

#if !NET_1_1 && !NETCF_2_0
                if (entry.AESKeySize > 0)
                {
                    AddExtraDataAES(entry, ed);
                }
//.........这里部分代码省略.........
开发者ID:hahadalin,项目名称:imewlconverter,代码行数:101,代码来源:ZipOutputStream.cs

示例8: PutNextEntry


//.........这里部分代码省略.........
            else
            {
                if (patchEntryHeader)
                {
                    crcPatchPos = baseOutputStream_.Position;
                }
                WriteLeInt(0); // Crc

                if (patchEntryHeader)
                {
                    sizePatchPos = baseOutputStream_.Position;
                }

                // For local header both sizes appear in Zip64 Extended Information
                if (entry.LocalHeaderRequiresZip64 || patchEntryHeader)
                {
                    WriteLeInt(-1);
                    WriteLeInt(-1);
                }
                else
                {
                    WriteLeInt(0); // Compressed size
                    WriteLeInt(0); // Uncompressed size
                }
            }

            byte[] name = ZipConstants.ConvertToArray(entry.Flags, entry.Name);

            if (name.Length > 0xFFFF)
            {
                throw new ZipException("Entry name too long.");
            }

            var ed = new ZipExtraData(entry.ExtraData);

            if (entry.LocalHeaderRequiresZip64)
            {
                ed.StartNewEntry();
                if (headerInfoAvailable)
                {
                    ed.AddLeLong(entry.Size);
                    ed.AddLeLong(entry.CompressedSize);
                }
                else
                {
                    ed.AddLeLong(-1);
                    ed.AddLeLong(-1);
                }
                ed.AddNewEntry(1);

                if (!ed.Find(1))
                {
                    throw new ZipException("Internal error cant find extra data");
                }

                if (patchEntryHeader)
                {
                    sizePatchPos = ed.CurrentReadIndex;
                }
            }
            else
            {
                ed.Delete(1);
            }

#if !NET_1_1 && !NETCF_2_0
开发者ID:hahadalin,项目名称:imewlconverter,代码行数:67,代码来源:ZipOutputStream.cs

示例9: ReadOverrunLong

		public void ReadOverrunLong()
		{
			ZipExtraData zed = new ZipExtraData(new byte[] { 1, 0, 0, 0 });
			Assert.AreEqual(4, zed.Length, "Length should be 4");
			Assert.IsTrue(zed.Find(1), "Should find tag 1");

			// Empty Tag
			bool exceptionCaught = false;
			try
			{
				zed.ReadLong();
			}
			catch (ZipException)
			{
				exceptionCaught = true;
			}
			Assert.IsTrue(exceptionCaught, "Expected EOS exception");

			// seven bytes
			zed = new ZipExtraData(new byte[] { 1, 0, 7, 0, 1, 2, 3, 4, 5, 6, 7 });
			Assert.IsTrue(zed.Find(1), "Should find tag 1");

			exceptionCaught = false;
			try
			{
				zed.ReadLong();
			}
			catch (ZipException)
			{
				exceptionCaught = true;
			}
			Assert.IsTrue(exceptionCaught, "Expected EOS exception");

			zed = new ZipExtraData(new byte[] { 1, 0, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9F�5���5���5��[email protected]�5��5��5��5�թ5���5���5�έ5��5���[email protected]թ5��5P��[email protected]Ԣ5 ��5���5 �5��5���5��5P!�5Ѐ�5�F�5���5P��[email protected]�5���[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ5�ʮ5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�i�5�'�5�έ5�w�5�o�5�h�5�N�5 �5�έ5PN�[email protected]�50;�5�߮5�M�50O�5�M�5P��[email protected]�5���[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ[email protected];�5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�i�5Ph�5�έ5�w�5�o�5K�5��5���5��5�!�5F�5���5���5��5p�5��5��5�5�թ5���5`"�5�έ5��5���5PN�[email protected]�50;�5`�5 �[email protected]թ5��5P��[email protected]Ԣ5P�5��5 �5��5��5��5P!�5Ѐ�5�F�5���5P��[email protected]�5���[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ[email protected];�5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�i�5Ph�5�έ5�w�5�o�[email protected]�5p:�5���5��5�!�5F�5���5���5��5P=�5�>�5�>�5�?�5�թ5���5�F�5�έ5��5���5PN�[email protected]�50;�[email protected]<�5<�[email protected]թ5��5P��[email protected]Ԣ[email protected]�5�@�5 �5��5�C�5��5P!�5Ѐ�5�F�5���5P��[email protected]�5���[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ[email protected];�5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�i�5Ph�5�έ5�w�5�o�5pK�[email protected]^�5���5��5 m�5Po�5���5���5��5 a�5pb�5�b�5�c�5�թ5���5�o�5�έ5��5���5PN�[email protected]�50;�5`�5�_�[email protected]թ5��5P��[email protected]Ԣ5d�5�d�5�f�5�h�5�f�5�j�5�l�5Ѐ�5�F�5���5P��[email protected]�5���[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ5�ʮ5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�i�5�'�5�έ5�w�5�o�5�h�5�Q�5 �5�έ5PN�[email protected]�50;�5�߮5�P�5�P�[email protected]�5P��[email protected]�5���[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ[email protected];�5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�i�5Ph�5�έ5�w�5�o�5�K�5p��[email protected]Ԣ5��5���5���5���5���5��5P��5���5Ћ�5���5�թ5���5���5�έ5��5���5PN�[email protected]�50;�[email protected]��5��5P��[email protected]�5���[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ5�ʮ5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�i�5�'�5�έ5�w�5�o�5 i�5pT�5 �5�έ5PN�[email protected]�50;�5�߮5PS�5�S�5�S�5P��[email protected]�5���[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ[email protected];�5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�i�5Ph�5�έ5�w�5�o�5�K�5�5���5��5н�5P��5���5���5��5�5`��5���5���5�թ5���5���5�έ5��5���[email protected]թ5��5P��[email protected]Ԣ5�5���5��5P��5�5���59�5Ѐ�5�F�5���5P��[email protected]�5���[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ5�ʮ5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�i�5�'�5�έ5�w�5�o�5L�5�׺5 �5�έ5PN�[email protected]�50;�5�6�ֺ5 ��5�ֺ5P��[email protected]�5���[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ[email protected];�5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�i�5Ph�5�έ5�w�5�o�50L�50ߺ5���5��5��5�5���5���5��5�5`�5��5��5�թ5���5p�5�έ5��5���[email protected]թ5��5P��[email protected]Ԣ5��5��50�5p�5p�5��5��5Ѐ�5�F�5���5P��[email protected]�5���[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ5�ʮ5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�i�5�'�5�έ5�w�5�o�5Pi�5PW�5 �5�έ5PN�[email protected]�50;�5�߮5�U�50V�5�V�5P��[email protected]�5���[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ[email protected];�5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�i�5Ph�5�έ5�w�5�o�5`L�5��5���5��5��5�5���5���5��5�	�5�
�5�5 �5�թ5���5��5�έ5��5���[email protected]թ5��5P��[email protected]Ԣ5`�5��50�5p�5��5��5��5Ѐ�5�F�5���5P��[email protected]�5���[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ[email protected];�5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�i�5Ph�5�έ5�w�5�o�5�L�5�-�5���5��5н�5P��5���5���5��5�0�5 2�5P2�5p3�5�թ5���5P9�5�έ5��5���5PN�[email protected]�50;�5�/�[email protected]/�[email protected]թ5��5P��[email protected]Ԣ5�3�[email protected]�5��5P��5�6�5���59�5Ѐ�5�F�5���5P��5�M�5�X�[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ5�ʮ5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�i�5�'�5�έ5�w�5�o�5`�5�N�5 �5�έ5PN�5ж�5 N�5�߮5�M�50O�5�M�5P��5�M�5�X�[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ5�ʮ5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�i�5�'�5�έ5�w�5�o�5��5�Q�5 �5�έ5PN�5ж�5 N�5�߮5�P�5�P�[email protected]�5P��5�M�5�X�[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ5�ʮ5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�i�5�'�5�έ5�w�5�o�5��5pT�5 �5�έ5PN�5ж�5 N�5�߮5PS�5�S�5�S�5P��5�M�5�X�[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ5�ʮ5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�i�5�'�5�έ5�w�5�o�5��5PW�5 �5�έ5PN�5ж�5 N�5�߮5�U�50V�5�V�5P��5�M�5�X�[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ5�ʮ5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�i�5�'�5�έ5�w�5�o�5 ��5�׺5 �5�έ5PN�5ж�5 N�5�6�ֺ5 ��5�ֺ5YukonServerContainer_Cryptencrypted_filenametableconfigfile%X%X%X%X%Xe:\sql9_sp2_t\sql\picasso\engine\src\pf\ds\pfssfilesys.cppConfigFile\VersionHighConfigFile\VersionLowConfigFile\IsEncryptedConfigFile\CSPNameConfigFile\CSPTypeConfigFile\EncryptionAlgorithmConfigFile\HashAlgorithmConfigFile\KeyLengthnametable.tmpPFSSDirectory::CreateDirPFSSDirectory::RenameDirPFSSDirectory::DeleteDirPFSSDirectory::OpenFilePFSSDirectory::RenameFilePFSSDirectory::CopyFileWPFSSDirectory::MoveFileWPFSSDirectory::DeleteFileWPFSSDirectory::GetSize�r	6��5���5�}�5�q�5Pr�5�r�5ps�5��5�~�5�s�5�s�5�s�5t�5=�5`t�5�t�5�t�5�}�5�"�5 ��[email protected]߹5�t�5p��5u�5 u�5p{�5 ��5 {�5p�5�u�5���5�u�5���5���5�u�5v�[email protected]{�5�έ[email protected]Ԣ5�έ5�{�5�o�5���5 ��5�"�5p�5�έ5�6�6���5���5p��5���50�5��5�"�5 ��5���50��50��50��5 �5 �5 �50�5�έ[email protected]Ԣ5��5��5���5�!�5�5��5�{�5�N�[email protected]�5���[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ5�"�5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�έ[email protected]Ԣ5 y�5�w�5�o�[email protected]�5��5`�5P�5N�[email protected]Ԣ[email protected]Ԣ5�έ5�έ[email protected]Ԣ5`��5�5�5 �5��5��[email protected]�5R�5��5��[email protected]�[email protected]�50;�[email protected]�5��5��5��5��5�6�u�5�O�5�O�5`�5��50͈5��5P��5�!�5�5��5�{�5P��5P-�5���[email protected]�[email protected]�[email protected]�[email protected]�5��5�x�5�~�5���5Ѐ�5��5�x�50w�5�x�50w�5 ��[email protected]߹5P�5�p�[email protected]�[email protected]��5`��5�t�5p��5p{�5 ��5 {�5p�5�u�5���5�u�5���5���5�u�5v�[email protected]{�5��5`c�5�έ5�{�5�o�5��5��5��5��5���5���5�έ5�[email protected]�5Н�5�M�5`F�5p"�5P"�5"�5p��5�r	6��5���5�}�5�q�5Pr�5�r�5ps�5��5�~�5�s�5�s�5�s�5t�5=�5`t�5�t�5�t�5�}�5"�5 ��[email protected]߹5�t�5p��5u�5 u�5p{�5 ��5 {�5p�5�u�5���5�u�5���5���5�u�5v�[email protected]{�5�έ[email protected]Ԣ5�έ5�{�5�o�5��5��5�!�5��50�5P��5P-�5���[email protected]�[email protected]�[email protected]�[email protected]�5��5�x�5�~�5���5Ѐ�5��5�x�50w�5�x�50w�5 ��[email protected]߹5P�5�p�[email protected]�[email protected]��5`��5�t�5p��5p{�5 ��5 {�5p�5�u�5���5�u�5���5���5�u�5v�[email protected]{�5��5`c�5�έ5�{�5�o�5�5��5��5��5���5���5�έ5�[email protected]�5���5н�5�5P�5�5���5 ��5p�5��5P+�5�.�5p�5��5 �5��5��5�5 �[email protected]�5 �5p�5��50�50�5��[email protected]Ԣ5�(�5M�5��[email protected]Ԣ5�5�]6�]6 ^6`^6�^6PFXmlEncodeAndAddStringe:\sql9_sp2_t\sql\picasso\engine\src\pf\util\pfxmlconvert.cppPFBufferedMemConnection::Connecte:\sql9_sp2_t\sql\picasso\engine\src\pf\util\pfbufferedstream.cpp�N�[email protected]�5���[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ5pN�5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�έ[email protected]Ԣ5 y�5�w�5�o�5P3�5PN�5�4�5�6 5�5P�5p5�[email protected]Ԣ[email protected]߹5 4�[email protected]�[email protected]�50;�5�5�507�5�5���5�O�5 N�5�u�5�O�5�O�5���5�u�5PFCompressedStream::Inite:\sql9_sp2_t\sql\picasso\engine\src\pf\util\pfcompressedstream.cppCompressed streamPFCompressedStream::CopyTo�N�[email protected]�5���[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ5pN�5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�έ[email protected]Ԣ5 y�5�w�5�o�5�>�50<�5A�5P<�5`A�5p=�5`C�5�=�5�=�5�@�5�?�[email protected]�[email protected]�50;�5�C�5pF�5��[email protected]=�5�G�5 N�5�<�5�<�5=�5p<�5PJ�5PFChunkCursor::GetNextBlocke:\sql9_sp2_t\sql\picasso\engine\src\pf\util\pftcp.cppPCXAcceptBuffer::AsyncAcceptlocalhost(local)localPFIXAConnectionTransport::SetPasswordPFIXAConnectionTransport::GetPasswordP��5��5P��[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ5`��5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�έ[email protected]Ԣ5���5�w�5�o�5���5k�5P��[email protected]�5���[email protected]�[email protected]�[email protected]�[email protected]�5�x�5�x�5�~�5�p�5�~�5�w�5�x�50w�5�x�50w�5��[email protected]Ԣ5`��5�p�[email protected]�5�z�5Pv�5�z�5Pv�[email protected]�5���5�w�5�w�5Pv�5Pv�5�w�5�w�5�w�5�w�5�w�5�w�5�έ[email protected]Ԣ5 y�5�w�5�o�5���5P�5p��5PFSOAPMessage::BeginMessagee:\sql9_sp2_t\sql\picasso\engine\src\pf\util\pfsoapmsg.cppPFHTTPConnection::Connecte:\sql9_sp2_t\sql\picasso\engine\src\pf\util\pfhttp.cppMSOLAP 9.0 ClientPFHTTPConnection::RunProxyAutodetectionStepPFHTTPConnection::CreateStreamPFHTTPStream::WriteHttpDataContent-Type: 
开发者ID:danygolden,项目名称:gianfratti,代码行数:35,代码来源:ZipTests.cs

示例10: ProcessAESExtraData

 // For AES the method in the entry is 99, and the real compression method is in the extradata
 //
 private void ProcessAESExtraData(ZipExtraData extraData)
 {
     throw new ZipException("AES unsupported");
 }
开发者ID:nobud,项目名称:Variant-Report,代码行数:6,代码来源:ZipEntry.cs

示例11: WriteLocalHeader

 private void WriteLocalHeader(ZipEntry entry, EntryPatchData patchData)
 {
     CompressionMethod compressionMethod = entry.CompressionMethod;
     bool flag = true;
     bool flag2 = false;
     this.WriteLEInt(67324752);
     this.WriteLEShort(entry.Version);
     this.WriteLEShort(entry.Flags);
     this.WriteLEShort((int)((byte)compressionMethod));
     this.WriteLEInt((int)entry.DosTime);
     if (flag)
     {
         this.WriteLEInt((int)entry.Crc);
         if (entry.LocalHeaderRequiresZip64)
         {
             this.WriteLEInt(-1);
             this.WriteLEInt(-1);
         }
         else
         {
             this.WriteLEInt((!entry.IsCrypted) ? ((int)entry.CompressedSize) : ((int)entry.CompressedSize + 12));
             this.WriteLEInt((int)entry.Size);
         }
     }
     else
     {
         if (patchData != null)
         {
             patchData.CrcPatchOffset = this.stream_.Position;
         }
         this.WriteLEInt(0);
         if (patchData != null)
         {
             patchData.SizePatchOffset = this.stream_.Position;
         }
         if (entry.LocalHeaderRequiresZip64 && flag2)
         {
             this.WriteLEInt(-1);
             this.WriteLEInt(-1);
         }
         else
         {
             this.WriteLEInt(0);
             this.WriteLEInt(0);
         }
     }
     byte[] array = ZipConstants.ConvertToArray(entry.Flags, entry.Name);
     if (array.Length > 65535)
     {
         throw new Exception("Entry name too long.");
     }
     ZipExtraData zipExtraData = new ZipExtraData(entry.ExtraData);
     if (entry.LocalHeaderRequiresZip64 && (flag || flag2))
     {
         zipExtraData.StartNewEntry();
         if (flag)
         {
             zipExtraData.AddLeLong(entry.Size);
             zipExtraData.AddLeLong(entry.CompressedSize);
         }
         else
         {
             zipExtraData.AddLeLong(-1L);
             zipExtraData.AddLeLong(-1L);
         }
         zipExtraData.AddNewEntry(1);
         if (!zipExtraData.Find(1))
         {
             throw new Exception("Internal error cant find extra data");
         }
         if (patchData != null)
         {
             patchData.SizePatchOffset = (long)zipExtraData.CurrentReadIndex;
         }
     }
     else
     {
         zipExtraData.Delete(1);
     }
     byte[] entryData = zipExtraData.GetEntryData();
     this.WriteLEShort(array.Length);
     this.WriteLEShort(entryData.Length);
     if (array.Length > 0)
     {
         this.stream_.Write(array, 0, array.Length);
     }
     if (entry.LocalHeaderRequiresZip64 && flag2)
     {
         patchData.SizePatchOffset += this.stream_.Position;
     }
     if (entryData.Length > 0)
     {
         this.stream_.Write(entryData, 0, entryData.Length);
     }
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:95,代码来源:ZipHelperStream.cs

示例12: ReadOverrunInt

        public void ReadOverrunInt()
        {
            var zed = new ZipExtraData(new byte[] { 1, 0, 0, 0 });
            Assert.AreEqual(4, zed.Length, "Length should be 4");
            Assert.IsTrue(zed.Find(1), "Should find tag 1");

            // Empty Tag
            bool exceptionCaught = false;
            try {
                zed.ReadInt();
            } catch (ZipException) {
                exceptionCaught = true;
            }
            Assert.IsTrue(exceptionCaught, "Expected EOS exception");

            // three bytes
            zed = new ZipExtraData(new byte[] { 1, 0, 3, 0, 1, 2, 3 });
            Assert.IsTrue(zed.Find(1), "Should find tag 1");

            exceptionCaught = false;
            try {
                zed.ReadInt();
            } catch (ZipException) {
                exceptionCaught = true;
            }
            Assert.IsTrue(exceptionCaught, "Expected EOS exception");

            zed = new ZipExtraData(new byte[] { 1, 0, 7, 0, 1, 2, 3, 4, 5, 6, 7 });
            Assert.IsTrue(zed.Find(1), "Should find tag 1");

            zed.ReadInt();

            exceptionCaught = false;
            try {
                zed.ReadInt();
            } catch (ZipException) {
                exceptionCaught = true;
            }
            Assert.IsTrue(exceptionCaught, "Expected EOS exception");
        }
开发者ID:icsharpcode,项目名称:SharpZipLib,代码行数:40,代码来源:ZipTests.cs

示例13: TestLocalHeader


//.........这里部分代码省略.........
                        throw new ZipException(string.Format("Patched data requires higher version than ({0})", extractVersion));
                    }

                    // Central header flags match local entry flags.
                    if ( localFlags != entry.Flags ) {
                        throw new ZipException("Central header/local header flags mismatch");
                    }

                    // Central header compression method matches local entry
                    if ( entry.CompressionMethod != ( CompressionMethod )compressionMethod ) {
                        throw new ZipException("Central header/local header compression method mismatch");
                    }

                    // Strong encryption and extract version match
                    if ( (localFlags & ( int )GeneralBitFlags.StrongEncryption) != 0 ) {
                        if ( extractVersion < 62 ) {
                            throw new ZipException("Strong encryption flag set but version not high enough");
                        }
                    }

                    if ( (localFlags & ( int )GeneralBitFlags.HeaderMasked) != 0 ) {
                        if ( (fileTime != 0) || (fileDate != 0) ) {
                            throw new ZipException("Header masked set but date/time values non-zero");
                        }
                    }

                    if ( (localFlags & ( int )GeneralBitFlags.Descriptor) == 0 ) {
                        if ( crcValue != (uint)entry.Crc ) {
                            throw new ZipException("Central header/local header crc mismatch");
                        }
                    }

                    // Crc valid for empty entry.
                    if ( (size == 0) && (compressedSize == 0) ) {
                        if ( crcValue != 0 ) {
                            throw new ZipException("Invalid CRC for empty entry");
                        }
                    }

                    // TODO: make test more correct...  can't compare lengths as was done originally as this can fail for MBCS strings
                    // Assuming a code page at this point is not valid?  Best is to store the name length in the ZipEntry probably
                    if ( entry.Name.Length > storedNameLength ) {
                        throw new ZipException("File name length mismatch");
                    }

                    byte[] nameData = new byte[storedNameLength];
                    StreamUtils.ReadFully(baseStream_, nameData);

                    string localName = ZipConstants.ConvertToStringExt(localFlags, nameData);

                    // Central directory and local entry name match
                    if ( localName != entry.Name ) {
                        throw new ZipException("Central header and local header file name mismatch");
                    }

                    // Directories have zero size.
                    if ( entry.IsDirectory ) {
                        if ( (compressedSize != 0) || (size != 0) ) {
                            throw new ZipException("Directory cannot have size");
                        }
                    }

                    if ( !ZipNameTransform.IsValidName(localName, true) ) {
                        throw new ZipException("Name is invalid");
                    }

                    byte[] data = new byte[extraDataLength];
                    StreamUtils.ReadFully(baseStream_, data);
                    ZipExtraData ed = new ZipExtraData(data);

                    // Extra data / zip64 checks
                    if ( ed.Find(1) ) {
                        // Zip64 extra data but 'extract version' is too low
                        if ( extractVersion < ZipConstants.VersionZip64 ) {
                            throw new ZipException(
                                string.Format("Extra data contains Zip64 information but version {0}.{1} is not high enough",
                                extractVersion / 10, extractVersion % 10));
                        }

                        // Zip64 extra data but size fields dont indicate its required.
                        if ( (( uint )size != uint.MaxValue) && (( uint )compressedSize != uint.MaxValue) ) {
                            throw new ZipException("Entry sizes not correct for Zip64");
                        }

                        size = ed.ReadLong();
                        compressedSize = ed.ReadLong();
                    }
                    else {
                        // No zip64 extra data but entry requires it.
                        if ( (extractVersion >= ZipConstants.VersionZip64) &&
                            ((( uint )size == uint.MaxValue) || (( uint )compressedSize == uint.MaxValue)) ) {
                            throw new ZipException("Required Zip64 extended information missing");
                        }
                    }
                }

                int extraLength = storedNameLength + extraDataLength;
                return offsetOfFirstEntry + entry.Offset + ZipConstants.LocalHeaderBaseSize + extraLength;
            }
        }
开发者ID:jeffboulanger,项目名称:cuodesktop,代码行数:101,代码来源:ZipFile.cs

示例14: WriteLocalEntryHeader

        void WriteLocalEntryHeader(ZipUpdate update)
        {
            ZipEntry entry = update.OutEntry;

            entry.Offset = baseStream_.Position;

            if (update.Command != UpdateCommand.Copy) {
                if (entry.CompressionMethod == CompressionMethod.Deflated) {
                    if (entry.Size == 0) {
                        entry.CompressedSize = entry.Size;
                        entry.Crc = 0;
                        entry.CompressionMethod = CompressionMethod.Stored;
                    }
                }
                else if (entry.CompressionMethod == CompressionMethod.Stored) {
                    entry.Flags &= ~(int)GeneralBitFlags.Descriptor;
                }

                if (HaveKeys) {
                    entry.IsCrypted = true;
                    if (entry.Crc < 0) {
                        entry.Flags |= (int)GeneralBitFlags.Descriptor;
                    }
                }
                else {
                    entry.IsCrypted = false;
                }

                switch (useZip64_) {
                    case UseZip64.Dynamic:
                        if (entry.Size < 0) {
                            entry.ForceZip64();
                        }
                        break;

                    case UseZip64.On:
                        entry.ForceZip64();
                        break;

                    case UseZip64.Off:
                        break;
                }
            }

            WriteLEInt(ZipConstants.LocalHeaderSignature);

            WriteLEShort(entry.Version);
            WriteLEShort(entry.Flags);

            WriteLEShort((byte)entry.CompressionMethod);
            WriteLEInt(( int )entry.DosTime);

            if ( !entry.HasCrc ) {
                update.CrcPatchOffset = baseStream_.Position;
                WriteLEInt(( int )0);
            }
            else {
                WriteLEInt(unchecked(( int )entry.Crc));
            }

            if (entry.LocalHeaderRequiresZip64) {
                WriteLEInt(-1);
                WriteLEInt(-1);
            }
            else {
                if ( (entry.CompressedSize < 0) || (entry.Size < 0) ) {
                    update.SizePatchOffset = baseStream_.Position;
                }

                WriteLEInt(( int )entry.CompressedSize);
                WriteLEInt(( int )entry.Size);
            }

            byte[] name = ZipConstants.ConvertToArray(entry.Flags, entry.Name);

            if ( name.Length > 0xFFFF ) {
                throw new ZipException("Entry name too long.");
            }

            ZipExtraData ed = new ZipExtraData(entry.ExtraData);

            if ( entry.LocalHeaderRequiresZip64 ) {
                ed.StartNewEntry();

                ed.AddLeLong(entry.Size);
                ed.AddLeLong(entry.CompressedSize);
                ed.AddNewEntry(1);
            }
            else {
                ed.Delete(1);
            }

            entry.ExtraData = ed.GetEntryData();

            WriteLEShort(name.Length);
            WriteLEShort(entry.ExtraData.Length);

            if ( name.Length > 0 ) {
                baseStream_.Write(name, 0, name.Length);
            }
//.........这里部分代码省略.........
开发者ID:NoobSkie,项目名称:taobao-shop-helper,代码行数:101,代码来源:ZipFile.cs

示例15: WriteCentralDirectoryHeader

        int WriteCentralDirectoryHeader(ZipEntry entry)
        {
            if ( entry.CompressedSize < 0 ) {
                throw new ZipException("Attempt to write central directory entry with unknown csize");
            }

            if ( entry.Size < 0 ) {
                throw new ZipException("Attempt to write central directory entry with unknown size");
            }

            if ( entry.Crc < 0 ) {
                throw new ZipException("Attempt to write central directory entry with unknown crc");
            }

            WriteLEInt(ZipConstants.CentralHeaderSignature);

            WriteLEShort(ZipConstants.VersionMadeBy);

            WriteLEShort(entry.Version);

            WriteLEShort(entry.Flags);

            unchecked {
                WriteLEShort((byte)entry.CompressionMethod);
                WriteLEInt((int)entry.DosTime);
                WriteLEInt((int)entry.Crc);
            }

            if ( (entry.IsZip64Forced()) || (entry.CompressedSize >= 0xffffffff) ) {
                WriteLEInt(-1);
            }
            else {
                WriteLEInt((int)(entry.CompressedSize & 0xffffffff));
            }

            if ( (entry.IsZip64Forced()) || (entry.Size >= 0xffffffff) ) {
                WriteLEInt(-1);
            }
            else {
                WriteLEInt((int)entry.Size);
            }

            byte[] name = ZipConstants.ConvertToArray(entry.Flags, entry.Name);

            if ( name.Length > 0xFFFF ) {
                throw new ZipException("Entry name is too long.");
            }

            WriteLEShort(name.Length);

            ZipExtraData ed = new ZipExtraData(entry.ExtraData);

            if ( entry.CentralHeaderRequiresZip64 ) {
                ed.StartNewEntry();

                if ( (entry.Size >= 0xffffffff) || (useZip64_ == UseZip64.On) )
                {
                    ed.AddLeLong(entry.Size);
                }

                if ( (entry.CompressedSize >= 0xffffffff) || (useZip64_ == UseZip64.On) )
                {
                    ed.AddLeLong(entry.CompressedSize);
                }

                if ( entry.Offset >= 0xffffffff ) {
                    ed.AddLeLong(entry.Offset);
                }

                ed.AddNewEntry(1);
            }
            else {
                ed.Delete(1);
            }

            byte[] centralExtraData = ed.GetEntryData();

            WriteLEShort(centralExtraData.Length);
            WriteLEShort(entry.Comment != null ? entry.Comment.Length : 0);

            WriteLEShort(0);
            WriteLEShort(0);

            if ( entry.ExternalFileAttributes != -1 ) {
                WriteLEInt(entry.ExternalFileAttributes);
            }
            else {
                if ( entry.IsDirectory ) {
                    WriteLEUint(16);
                }
                else {
                    WriteLEUint(0);
                }
            }

            if ( entry.Offset >= 0xffffffff ) {
                WriteLEUint(0xffffffff);
            }
            else {
                WriteLEUint((uint)(int)entry.Offset);
//.........这里部分代码省略.........
开发者ID:NoobSkie,项目名称:taobao-shop-helper,代码行数:101,代码来源:ZipFile.cs


注:本文中的ICSharpCode.SharpZipLib.Zip.ZipExtraData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。