本文整理汇总了C#中ICSharpCode.SharpZipLib.Zip.ZipHelperStream.ReadByte方法的典型用法代码示例。如果您正苦于以下问题:C# ZipHelperStream.ReadByte方法的具体用法?C# ZipHelperStream.ReadByte怎么用?C# ZipHelperStream.ReadByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.SharpZipLib.Zip.ZipHelperStream
的用法示例。
在下文中一共展示了ZipHelperStream.ReadByte方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetData
public void SetData(byte[] data, int index, int count)
{
using (MemoryStream stream = new MemoryStream(data, index, count, false))
{
using (ZipHelperStream stream2 = new ZipHelperStream(stream))
{
this._flags = (Flags) ((byte) stream2.ReadByte());
if ((((byte) (this._flags & Flags.ModificationTime)) != 0) && (count >= 5))
{
int seconds = stream2.ReadLEInt();
DateTime time = new DateTime(0x7b2, 1, 1, 0, 0, 0);
this._modificationTime = (time.ToUniversalTime() + new TimeSpan(0, 0, 0, seconds, 0)).ToLocalTime();
}
if (((byte) (this._flags & Flags.AccessTime)) != 0)
{
int num2 = stream2.ReadLEInt();
DateTime time3 = new DateTime(0x7b2, 1, 1, 0, 0, 0);
this._lastAccessTime = (time3.ToUniversalTime() + new TimeSpan(0, 0, 0, num2, 0)).ToLocalTime();
}
if (((byte) (this._flags & Flags.CreateTime)) != 0)
{
int num3 = stream2.ReadLEInt();
DateTime time5 = new DateTime(0x7b2, 1, 1, 0, 0, 0);
this._createTime = (time5.ToUniversalTime() + new TimeSpan(0, 0, 0, num3, 0)).ToLocalTime();
}
}
}
}
示例2: SetData
/// <summary>
/// Set the data from the raw values provided.
/// </summary>
/// <param name="data">The raw data to extract values from.</param>
/// <param name="index">The index to start extracting values from.</param>
/// <param name="count">The number of bytes available.</param>
public void SetData(byte[] data, int index, int count)
{
using (MemoryStream ms = new MemoryStream(data, index, count, false))
using (ZipHelperStream helperStream = new ZipHelperStream(ms))
{
// bit 0 if set, modification time is present
// bit 1 if set, access time is present
// bit 2 if set, creation time is present
flags_ = (Flags)helperStream.ReadByte();
if (((flags_ & Flags.ModificationTime) != 0) && (count >= 5))
{
int iTime = helperStream.ReadLEInt();
modificationTime_ = (new System.DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() +
new TimeSpan(0, 0, 0, iTime, 0)).ToLocalTime();
}
if ((flags_ & Flags.AccessTime) != 0)
{
int iTime = helperStream.ReadLEInt();
lastAccessTime_ = (new System.DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() +
new TimeSpan(0, 0, 0, iTime, 0)).ToLocalTime();
}
if ((flags_ & Flags.CreateTime) != 0)
{
int iTime = helperStream.ReadLEInt();
createTime_ = (new System.DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() +
new TimeSpan(0, 0, 0, iTime, 0)).ToLocalTime();
}
}
}