Example #1
0
		public void Write(WritingContext SW)
		{
			// Magic (written in the outer)
			// Length (written in the outer)
			// SlotCount
			// Slot SlotTable[SlotCount]
			//   Each slot is Key, Offset
			// <Slot-referenced data>

			//WritingContext.OffsetFieldU32or64[] Offsets = new WritingContext.OffsetFieldU32or64[Slots.Count];
			long StartingPosition = SW.Position - (2 * sizeof(UInt32));

			// Start a phase for writing out the superblob data
			SW.CreateNewPhase();

			// Write the slot table, queuing up the individual slot writes
			SW.Write((UInt32)Slots.Count);

			foreach (KeyValuePair<UInt32, AbstractBlob> Slot in Slots)
			{
				SW.Write(Slot.Key);

				OffsetFieldU32or64 Offset = SW.WriteDeferredOffsetFrom(StartingPosition, Bits.Num._32);
				KeyValuePair<UInt32, AbstractBlob> LocalSlot = Slot;

				SW.CurrentPhase.PendingWrites.Enqueue(delegate(WritingContext Context)
					{
						if (Config.bCodeSignVerbose)
						{
							Console.WriteLine("Writing a slot.  Offset={0}, SlotData={1}", Offset.WritePoint, LocalSlot.ToString());
						}
						SW.CommitDeferredField(Offset);
						LocalSlot.Value.Write(Context);
					});
			}

			// Force evaluation of the slots
			SW.ProcessEntirePhase();
		}