本文整理汇总了C#中ICSharpCode.SharpZipLib.Zip.ZipExtraData.AddLeInt方法的典型用法代码示例。如果您正苦于以下问题:C# ZipExtraData.AddLeInt方法的具体用法?C# ZipExtraData.AddLeInt怎么用?C# ZipExtraData.AddLeInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.SharpZipLib.Zip.ZipExtraData
的用法示例。
在下文中一共展示了ZipExtraData.AddLeInt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PasswordCheckingWithDateInExtraData
public void PasswordCheckingWithDateInExtraData()
{
MemoryStream ms = new MemoryStream();
DateTime checkTime = new DateTime(2010, 10, 16, 0, 3, 28);
using (ZipOutputStream zos = new ZipOutputStream(ms)) {
zos.IsStreamOwner = false;
zos.Password = "secret";
ZipEntry ze = new ZipEntry("uno");
ze.DateTime = new DateTime(1998, 6, 5, 4, 3, 2);
ZipExtraData zed = new ZipExtraData();
zed.StartNewEntry();
zed.AddData(1);
TimeSpan delta = checkTime.ToUniversalTime() - new System.DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime();
int seconds = (int)delta.TotalSeconds;
zed.AddLeInt(seconds);
zed.AddNewEntry(0x5455);
ze.ExtraData = zed.GetEntryData();
zos.PutNextEntry(ze);
zos.WriteByte(54);
}
ms.Position = 0;
using (ZipInputStream zis = new ZipInputStream(ms)) {
zis.Password = "secret";
ZipEntry uno = zis.GetNextEntry();
byte theByte = (byte)zis.ReadByte();
Assert.AreEqual(54, theByte);
Assert.AreEqual(-1, zis.ReadByte());
Assert.AreEqual(checkTime, uno.DateTime);
}
}