本文整理汇总了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);
}
示例2: ZipUpdate
public ZipUpdate(UpdateCommand command, ZipEntry entry)
{
command_ = command;
entry_ = ( ZipEntry )entry.Clone();
}
示例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]);
}