Clone() public méthode

Creates a copy of this zip entry.
public Clone ( ) : object
Résultat object
Exemple #1
0
			public ZipUpdate(UpdateCommand command, ZipEntry entry)
			{
				command_ = command;
				entry_ = ( ZipEntry )entry.Clone();
			}
Exemple #2
0
        public void Cloning()
        {
            long testCrc = 3456;
            long testSize = 99874276;
            long testCompressedSize = 72347;
            byte[] testExtraData = new byte[] { 0x00, 0x01, 0x00, 0x02, 0x0EF, 0xFE };
            string testName = "Namu";
            int testFlags = 4567;
            long testDosTime = 23434536;
            CompressionMethod testMethod = CompressionMethod.Deflated;

            string testComment = "A comment";

            ZipEntry 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;

            ZipEntry 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);
        }
Exemple #3
0
        public void IsDataUnique()
        {
            ZipEntry a = new ZipEntry("Basil");
            byte[] extra = new byte[4];
            extra[0] = 27;
            a.ExtraData = extra;

            ZipEntry 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]);

            ZipEntry 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]);
        }
Exemple #4
0
 public ZipUpdate(ZipFile.UpdateCommand command, ZipEntry entry)
 {
     this.sizePatchOffset_ = -1L;
     this.crcPatchOffset_ = -1L;
     this._offsetBasedSize = -1L;
     this.command_ = command;
     this.entry_ = (ZipEntry) entry.Clone();
 }