本文整理汇总了C#中ICSharpCode.SharpZipLib.Zip.ZipHelperStream.WriteByte方法的典型用法代码示例。如果您正苦于以下问题:C# ZipHelperStream.WriteByte方法的具体用法?C# ZipHelperStream.WriteByte怎么用?C# ZipHelperStream.WriteByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.SharpZipLib.Zip.ZipHelperStream
的用法示例。
在下文中一共展示了ZipHelperStream.WriteByte方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetData
public byte[] GetData()
{
byte[] buffer;
using (MemoryStream stream = new MemoryStream())
{
using (ZipHelperStream stream2 = new ZipHelperStream(stream))
{
stream2.IsStreamOwner = false;
stream2.WriteByte((byte) this._flags);
if (((byte) (this._flags & Flags.ModificationTime)) != 0)
{
DateTime time = new DateTime(0x7b2, 1, 1, 0, 0, 0);
TimeSpan span = (TimeSpan) (this._modificationTime.ToUniversalTime() - time.ToUniversalTime());
int totalSeconds = (int) span.TotalSeconds;
stream2.WriteLEInt(totalSeconds);
}
if (((byte) (this._flags & Flags.AccessTime)) != 0)
{
DateTime time2 = new DateTime(0x7b2, 1, 1, 0, 0, 0);
TimeSpan span2 = (TimeSpan) (this._lastAccessTime.ToUniversalTime() - time2.ToUniversalTime());
int num2 = (int) span2.TotalSeconds;
stream2.WriteLEInt(num2);
}
if (((byte) (this._flags & Flags.CreateTime)) != 0)
{
DateTime time3 = new DateTime(0x7b2, 1, 1, 0, 0, 0);
TimeSpan span3 = (TimeSpan) (this._createTime.ToUniversalTime() - time3.ToUniversalTime());
int num3 = (int) span3.TotalSeconds;
stream2.WriteLEInt(num3);
}
buffer = stream.ToArray();
}
}
return buffer;
}
示例2: GetData
/// <summary>
/// Get the binary data representing this instance.
/// </summary>
/// <returns>The raw binary data representing this instance.</returns>
public byte[] GetData()
{
using (MemoryStream ms = new MemoryStream())
using (ZipHelperStream helperStream = new ZipHelperStream(ms))
{
helperStream.IsStreamOwner = false;
helperStream.WriteByte((byte)flags_); // Flags
if ( (flags_ & Flags.ModificationTime) != 0) {
TimeSpan span = modificationTime_.ToUniversalTime() - new System.DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime();
int seconds = (int)span.TotalSeconds;
helperStream.WriteLEInt(seconds);
}
if ( (flags_ & Flags.AccessTime) != 0) {
TimeSpan span = lastAccessTime_.ToUniversalTime() - new System.DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime();
int seconds = (int)span.TotalSeconds;
helperStream.WriteLEInt(seconds);
}
if ( (flags_ & Flags.CreateTime) != 0) {
TimeSpan span = createTime_.ToUniversalTime() - new System.DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime();
int seconds = (int)span.TotalSeconds;
helperStream.WriteLEInt(seconds);
}
return ms.ToArray();
}
}
示例3: GetData
/// <summary>
/// Get the binary data representing this instance.
/// </summary>
/// <returns>The raw binary data representing this instance.</returns>
public byte[] GetData() {
using (var ms=new MemoryStream())
using (var helperStream=new ZipHelperStream(ms)) {
helperStream.IsStreamOwner=false;
helperStream.WriteByte((byte)_flags); // Flags
if ((_flags&Flags.ModificationTime)!=0) {
TimeSpan span=_modificationTime.ToUniversalTime()-
new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime();
var seconds=(int)span.TotalSeconds;
helperStream.WriteLEInt(seconds);
}
if ((_flags&Flags.AccessTime)!=0) {
TimeSpan span=_lastAccessTime.ToUniversalTime()-
new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime();
var seconds=(int)span.TotalSeconds;
helperStream.WriteLEInt(seconds);
}
if ((_flags&Flags.CreateTime)!=0) {
TimeSpan span=_createTime.ToUniversalTime()-new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime();
var seconds=(int)span.TotalSeconds;
helperStream.WriteLEInt(seconds);
}
return ms.ToArray();
}
}