本文整理汇总了C#中System.IO.BinaryWriter.WriteDateTime方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryWriter.WriteDateTime方法的具体用法?C# BinaryWriter.WriteDateTime怎么用?C# BinaryWriter.WriteDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.BinaryWriter
的用法示例。
在下文中一共展示了BinaryWriter.WriteDateTime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Serialize
///<exclude/>
public void Serialize(BinaryWriter bw)
{
bw.Write(seq);
bw.WriteDateTime(stamp);
bw.WriteUtf8String(frame_id);
}
示例2: EncodeEvent
public static void EncodeEvent(BinaryWriter writer, BuildEventArgs e)
{
EventTypes type = GetEventType(e);
writer.WriteInt32((int)type);
writer.WriteNullableString(e.Message);
writer.WriteNullableString(e.HelpKeyword);
writer.WriteNullableString(e.SenderName);
writer.WriteDateTime(e.Timestamp);
switch (type) {
case EventTypes.Error:
BuildErrorEventArgs error = (BuildErrorEventArgs)e;
writer.WriteNullableString(error.Subcategory);
writer.WriteNullableString(error.Code);
writer.WriteNullableString(error.File);
writer.WriteInt32(error.LineNumber);
writer.WriteInt32(error.ColumnNumber);
writer.WriteInt32(error.EndLineNumber);
writer.WriteInt32(error.EndColumnNumber);
break;
case EventTypes.Warning:
BuildWarningEventArgs warning = (BuildWarningEventArgs)e;
writer.WriteNullableString(warning.Subcategory);
writer.WriteNullableString(warning.Code);
writer.WriteNullableString(warning.File);
writer.WriteInt32(warning.LineNumber);
writer.WriteInt32(warning.ColumnNumber);
writer.WriteInt32(warning.EndLineNumber);
writer.WriteInt32(warning.EndColumnNumber);
break;
case EventTypes.Message:
BuildMessageEventArgs message = (BuildMessageEventArgs)e;
writer.WriteInt32((int)message.Importance);
break;
case EventTypes.BuildFinished:
BuildFinishedEventArgs buildFinished = (BuildFinishedEventArgs)e;
writer.Write(buildFinished.Succeeded);
break;
case EventTypes.BuildStarted:
break;
case EventTypes.ProjectFinished:
ProjectFinishedEventArgs projectFinished = (ProjectFinishedEventArgs)e;
writer.WriteNullableString(projectFinished.ProjectFile);
writer.Write(projectFinished.Succeeded);
break;
case EventTypes.ProjectStarted:
ProjectStartedEventArgs projectStarted = (ProjectStartedEventArgs)e;
writer.WriteNullableString(projectStarted.ProjectFile);
writer.WriteNullableString(projectStarted.TargetNames);
break;
case EventTypes.TargetFinished:
TargetFinishedEventArgs targetFinished = (TargetFinishedEventArgs)e;
writer.WriteNullableString(targetFinished.TargetName);
writer.WriteNullableString(targetFinished.ProjectFile);
writer.WriteNullableString(targetFinished.TargetFile);
writer.Write(targetFinished.Succeeded);
break;
case EventTypes.TargetStarted:
TargetStartedEventArgs targetStarted = (TargetStartedEventArgs)e;
writer.WriteNullableString(targetStarted.TargetName);
writer.WriteNullableString(targetStarted.ProjectFile);
writer.WriteNullableString(targetStarted.TargetFile);
#if MSBUILD35
writer.WriteNullableString(null);
#else
writer.WriteNullableString(targetStarted.ParentTarget);
#endif
break;
case EventTypes.TaskFinished:
TaskFinishedEventArgs taskFinished = (TaskFinishedEventArgs)e;
writer.WriteNullableString(taskFinished.ProjectFile);
writer.WriteNullableString(taskFinished.TaskFile);
writer.WriteNullableString(taskFinished.TaskName);
writer.Write(taskFinished.Succeeded);
break;
case EventTypes.TaskStarted:
TaskStartedEventArgs taskStarted = (TaskStartedEventArgs)e;
writer.WriteNullableString(taskStarted.ProjectFile);
writer.WriteNullableString(taskStarted.TaskFile);
writer.WriteNullableString(taskStarted.TaskName);
break;
default: // unknown etc.
break;
}
}
示例3: Serialize
///<exclude/>
public void Serialize(BinaryWriter bw)
{
bw.WriteDateTime(data);
}
示例4: Serialize
///<exclude/>
public void Serialize(BinaryWriter bw)
{
bw.WriteDateTime(clock);
}