Esempio n. 1
0
		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);
		}
Esempio n. 2
0
 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());
 }
Esempio n. 3
0
 public static void EncodeTxLookupKey(BinaryWriter writer, TxLookupKey txLookupKey)
 {
     writer.WriteUInt256(txLookupKey.BlockHash);
     writer.WriteInt32(txLookupKey.TxIndex);
 }
Esempio n. 4
0
 public static void EncodeSpentTx(BinaryWriter writer, SpentTx spentTx)
 {
     writer.WriteUInt256(spentTx.TxHash);
     writer.WriteInt32(spentTx.ConfirmedBlockIndex);
     writer.WriteInt32(spentTx.TxIndex);
     writer.WriteInt32(spentTx.OutputCount);
 }
Esempio n. 5
0
 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);
 }
Esempio n. 6
0
 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);
 }
Esempio n. 7
0
 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);
 }
Esempio n. 8
0
        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
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        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);
        }
Esempio n. 11
0
		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;
			}
			
		}
Esempio n. 12
0
        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);
        }
Esempio n. 13
0
        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]);
            }
        }
Esempio n. 14
0
        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);
        }