本文整理汇总了C#中System.IO.BinaryWriter.WriteInt32方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryWriter.WriteInt32方法的具体用法?C# BinaryWriter.WriteInt32怎么用?C# BinaryWriter.WriteInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.BinaryWriter
的用法示例。
在下文中一共展示了BinaryWriter.WriteInt32方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteTo
public void WriteTo(BinaryWriter writer)
{
writer.Write(this.ProjectFileName);
writer.Write(this.Target);
writer.WriteInt32((int)eventMask);
writer.WriteInt32(properties.Count);
foreach (var pair in properties) {
writer.Write(pair.Key);
writer.Write(pair.Value);
}
writer.WriteInt32(interestingTaskNames.Count);
foreach (string taskName in interestingTaskNames)
writer.Write(taskName);
}
示例2: EncodeBlockTxNode
public static void EncodeBlockTxNode(BinaryWriter writer, BlockTxNode blockTx)
{
writer.WriteInt32(blockTx.Index);
writer.WriteInt32(blockTx.Depth);
writer.WriteUInt256(blockTx.Hash);
writer.WriteBool(blockTx.Pruned);
if (!blockTx.Pruned)
writer.WriteBytes(blockTx.TxBytes.ToArray());
}
示例3: EncodeTxLookupKey
public static void EncodeTxLookupKey(BinaryWriter writer, TxLookupKey txLookupKey)
{
writer.WriteUInt256(txLookupKey.BlockHash);
writer.WriteInt32(txLookupKey.TxIndex);
}
示例4: EncodeSpentTx
public static void EncodeSpentTx(BinaryWriter writer, SpentTx spentTx)
{
writer.WriteUInt256(spentTx.TxHash);
writer.WriteInt32(spentTx.ConfirmedBlockIndex);
writer.WriteInt32(spentTx.TxIndex);
writer.WriteInt32(spentTx.OutputCount);
}
示例5: EncodeUnspentTx
public static void EncodeUnspentTx(BinaryWriter writer, UnspentTx unspentTx)
{
writer.WriteUInt256(unspentTx.TxHash);
writer.WriteInt32(unspentTx.BlockIndex);
writer.WriteInt32(unspentTx.TxIndex);
writer.WriteUInt32(unspentTx.TxVersion);
writer.WriteBool(unspentTx.IsCoinbase);
writer.WriteVarBytes(unspentTx.OutputStates.ToByteArray());
writer.WriteInt32(unspentTx.OutputStates.Length);
}
示例6: EncodePrevTxOutput
public static void EncodePrevTxOutput(BinaryWriter writer, PrevTxOutput txOutput)
{
writer.WriteUInt64(txOutput.Value);
writer.WriteVarBytes(txOutput.ScriptPublicKey.ToArray());
writer.WriteInt32(txOutput.BlockHeight);
writer.WriteInt32(txOutput.TxIndex);
writer.WriteUInt32(txOutput.TxVersion);
writer.WriteBool(txOutput.IsCoinbase);
}
示例7: EncodeChainedHeader
public static void EncodeChainedHeader(BinaryWriter writer, ChainedHeader chainedHeader)
{
writer.WriteUInt256(chainedHeader.Hash);
EncodeBlockHeader(writer, chainedHeader.BlockHeader);
writer.WriteInt32(chainedHeader.Height);
writer.WriteVarBytes(chainedHeader.TotalWork.ToByteArray());
writer.WriteInt64(chainedHeader.DateSeen.UtcTicks);
}
示例8: WritePart3
public void WritePart3(BinaryWriter writer)
{
this.Part3BaseAddress = (uint)writer.BaseStream.Position;
Debug.Assert(this.Part3BaseAddress == 0xf30 + this.Index * 0x10);
writer.WriteInt32((int)this.TargetState);
writer.WriteInt32(this.UnkFlag);
writer.WriteInt32(this.Commands.Count);
writer.WriteInt32(0); // script address placeholder
}
示例9: WritePart2
public void WritePart2(BinaryWriter writer)
{
writer.WriteZeroBytes(4);
writer.WriteInt32(this.Unk_BLR1);
writer.WriteInt32(this.ResUnk2);
writer.WriteInt32(-1);
writer.WriteInt32(0x1a);
writer.WriteInt32(1);
writer.WriteInt32(this.Unk_Confusing);
writer.WriteZeroBytes(4);
writer.WriteZeroBytes(16);
}
示例10: WritePart1
public void WritePart1(BinaryWriter writer)
{
writer.WriteCharArrayString(this.Name, 8);
writer.WriteZeroBytes(36);
writer.Write(this.ResUnk1_1);
writer.Write(this.ResUnk1_2);
writer.WriteInt32(-1);
writer.WriteZeroBytes(12);
writer.Write(this.Unk_SGT5);
writer.WriteZeroBytes(12);
writer.WriteInt32(-2);
writer.WriteInt32((int)this.UltraSelection);
writer.WriteInt32(1);
writer.WriteInt32(0x0ac0 - this.Index * 0x40);
writer.WriteZeroBytes(8);
writer.WriteInt32(1);
writer.WriteInt32(0x0f60 - this.Index * 0x60);
}
示例11: 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;
}
}
示例12: WriteScript
public void WriteScript(BinaryWriter writer)
{
this.BaseAddress = (uint)writer.BaseStream.Position;
writer.WriteCharArrayString(this.OnScreenPart1, 32);
writer.WriteCharArrayString(this.OnScreenPart2, 32);
writer.WriteCharArrayString(this.OnScreenPart3, 32);
writer.WriteCharArrayString(this.OnScreenPart4, 32);
writer.WriteCharArrayString(this.HelpMenuPart1, 32);
writer.WriteCharArrayString(this.HelpMenuPart2, 32);
writer.WriteCharArrayString(this.HelpMenuPart3, 32);
writer.WriteCharArrayString(this.HelpMenuPart4, 32);
writer.Write((short)this.CriteriaType);
writer.Write((ushort)this.CriteriaIds.Count);
// Criteria offset placeholder
writer.WriteInt32(0);
}
示例13: WriteCriteria
public void WriteCriteria(BinaryWriter writer)
{
var criteriaStart = writer.BaseStream.Position;
var criteriaOffset = criteriaStart - this.BaseAddress;
writer.Seek((int)(this.BaseAddress + 0x104), SeekOrigin.Begin);
writer.Write((uint)criteriaOffset);
writer.Seek((int)criteriaStart, SeekOrigin.Begin);
for (int i = 0; i < this.CriteriaIds.Count; i++)
{
writer.WriteInt32(this.CriteriaIds[i]);
}
}
示例14: EncodeBlockTx
public static void EncodeBlockTx(BinaryWriter writer, BlockTx blockTx)
{
var txBytes = blockTx.Transaction != null ? EncodeTransaction(blockTx.Transaction) : new byte[0];
writer.WriteInt32(blockTx.Index);
writer.WriteInt32(blockTx.Depth);
writer.WriteUInt256(blockTx.Hash);
writer.WriteBool(blockTx.Pruned);
if (!blockTx.Pruned)
EncodeTransaction(writer, blockTx.Transaction);
}