本文整理匯總了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);
}