コード例 #1
0
ファイル: ErrorQueue.cs プロジェクト: wilson0x4d/DataRelay
		/// <summary>
		/// Serialize the class data to a stream.
		/// </summary>
		/// <param name="writer">The <see cref="T:MySpace.Common.IO.IPrimitiveWriter"/> that writes to the stream.</param>
		public void Serialize(MySpace.Common.IO.IPrimitiveWriter writer)
		{
			// If persistence is enabled, try to drain the queue before we serialize.
			StartSpill();
			WaitForSpill();

			lock (_inMessageQueueLock)
			{
				writer.Write(_enabled);
				writer.Write(_maxCount);
				writer.Write(_itemsPerDequeue);
				if (_inMessageQueue != null)
				{
					writer.Write(true);
					writer.Write(_inMessageQueue.Count);
					foreach (SerializedRelayMessage message in _inMessageQueue)
					{
						writer.Write<SerializedRelayMessage>(message, false);
					}
				}
				else
				{
					writer.Write(false);
				}
			}
		}
コード例 #2
0
 public new void Serialize(MySpace.Common.IO.IPrimitiveWriter writer)
 {
     base.Serialize(writer);
     writer.Write(ServiceGroup);
     writer.Write(ServiceLocation);
     writer.WriteList <TypePopulation>(TypePopulations);
 }
コード例 #3
0
 public void Serialize(MySpace.Common.IO.IPrimitiveWriter writer)
 {
     writer.Write(TypeID);
     writer.Write(CurrentPopulation);
     writer.Write(ScavengeMax);
     writer.Write(MaxPopulation);
 }
コード例 #4
0
        public void Serialize(MySpace.Common.IO.IPrimitiveWriter writer)
        {
            using (writer.CreateRegion())
            {
                //IndexExists
                writer.Write(IndexExists);

                //IndexSize
                writer.Write(IndexSize);

                //Metadata
                if (Metadata == null || Metadata.Length == 0)
                {
                    writer.Write((ushort)0);
                }
                else
                {
                    writer.Write((ushort)Metadata.Length);
                    writer.Write(Metadata);
                }

                //ResultItemList
                if (ResultItemList == null || ResultItemList.Count == 0)
                {
                    writer.Write(0);
                }
                else
                {
                    writer.Write(ResultItemList.Count);
                    foreach (ResultItem resultItem in ResultItemList)
                    {
                        resultItem.Serialize(writer);
                    }
                }

                //ExceptionInfo
                writer.Write(ExceptionInfo);

                //VirtualCount
                writer.Write(VirtualCount);

                //IndexCap
                writer.Write(IndexCap);

                //MetadataPropertyCollection
                if (MetadataPropertyCollection == null)
                {
                    writer.Write(false);
                }
                else
                {
                    writer.Write(true);
                    Serializer.Serialize(writer.BaseStream, MetadataPropertyCollection);
                }
            }
        }