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


C# ZipEntry.Clone方法代码示例

本文整理汇总了C#中ZipEntry.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# ZipEntry.Clone方法的具体用法?C# ZipEntry.Clone怎么用?C# ZipEntry.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ZipEntry的用法示例。


在下文中一共展示了ZipEntry.Clone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Cloning

        public void Cloning()
        {
            long testCrc = 3456;
            long testSize = 99874276;
            long testCompressedSize = 72347;
            var testExtraData = new byte[]{0x00, 0x01, 0x00, 0x02, 0x0EF, 0xFE};
            var testName = "Namu";
            var testFlags = 4567;
            long testDosTime = 23434536;
            var testMethod = CompressionMethod.Deflated;

            var testComment = "A comment";

            var source = new ZipEntry(testName);
            source.Crc = testCrc;
            source.Comment = testComment;
            source.Size = testSize;
            source.CompressedSize = testCompressedSize;
            source.ExtraData = testExtraData;
            source.Flags = testFlags;
            source.DosTime = testDosTime;
            source.CompressionMethod = testMethod;

            var clone = (ZipEntry) source.Clone();

            // Check values against originals
            Assert.AreEqual(testName, clone.Name, "Cloned name mismatch");
            Assert.AreEqual(testCrc, clone.Crc, "Cloned crc mismatch");
            Assert.AreEqual(testComment, clone.Comment, "Cloned comment mismatch");
            Assert.AreEqual(testExtraData, clone.ExtraData, "Cloned Extra data mismatch");
            Assert.AreEqual(testSize, clone.Size, "Cloned size mismatch");
            Assert.AreEqual(testCompressedSize, clone.CompressedSize, "Cloned compressed size mismatch");
            Assert.AreEqual(testFlags, clone.Flags, "Cloned flags mismatch");
            Assert.AreEqual(testDosTime, clone.DosTime, "Cloned DOSTime mismatch");
            Assert.AreEqual(testMethod, clone.CompressionMethod, "Cloned Compression method mismatch");

            // Check against source
            PiecewiseCompare(source, clone);
        }
开发者ID:modulexcite,项目名称:graveyard,代码行数:39,代码来源:ZipTests.cs

示例2: ZipUpdate

			public ZipUpdate(UpdateCommand command, ZipEntry entry)
			{
				command_ = command;
				entry_ = ( ZipEntry )entry.Clone();
			}
开发者ID:Johnnyfly,项目名称:source20131023,代码行数:5,代码来源:ZipFile.cs

示例3: IsDataUnique

        public void IsDataUnique()
        {
            var a = new ZipEntry("Basil");
            var extra = new byte[4];
            extra[0] = 27;
            a.ExtraData = extra;

            var b = (ZipEntry) a.Clone();
            b.ExtraData[0] = 89;
            Assert.IsTrue(b.ExtraData[0] != a.ExtraData[0],
                          "Extra data not unique " + b.ExtraData[0] + " " + a.ExtraData[0]);

            var c = (ZipEntry) a.Clone();
            c.ExtraData[0] = 45;
            Assert.IsTrue(a.ExtraData[0] != c.ExtraData[0],
                          "Extra data not unique " + a.ExtraData[0] + " " + c.ExtraData[0]);
        }
开发者ID:modulexcite,项目名称:graveyard,代码行数:17,代码来源:ZipTests.cs


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