示例#1
0
 internal override void WriteToStream(BinaryWriter writer)
 {
     base.WriteToStream(writer);
     #region Entries
     if (entries == null)
     {
         writer.Write((byte)0);
     }
     else
     {
         writer.Write((byte)1);
         writer.Write((Int32)entries.Length);
         for (int i = 0; i < entries.Length; i++)
         {
             CacheEntryCustomSerializer.WriteToStream(entries[i], writer);
         }
     }
     #endregion
     #region ScopeName
     if (scopeName == null)
     {
         writer.Write((byte)0);
     }
     else
     {
         writer.Write((byte)1);
         writer.Write(scopeName);
     }
     #endregion
     #region ScopeProperties
     if (scopeProperties == null)
     {
         writer.Write((byte)0);
     }
     else
     {
         writer.Write((byte)1);
         scopeProperties.WriteToStream(writer);
     }
     #endregion
     #region ScopeToolsVersion
     if (scopeToolsVersion == null)
     {
         writer.Write((byte)0);
     }
     else
     {
         writer.Write((byte)1);
         writer.Write(scopeToolsVersion);
     }
     #endregion
     writer.Write((byte)cacheContentType);
 }
示例#2
0
        internal override void WriteToStream(BinaryWriter writer)
        {
            base.WriteToStream(writer);
            writer.Write((Int32)requestingCallNumber);
            if (replyData == null)
            {
                writer.Write((byte)0);
            }
            else
            {
                writer.Write((byte)1);

                if (replyData is CacheEntry[])
                {
                    writer.Write((byte)0);
                    CacheEntry[] cacheArray = (CacheEntry[])replyData;
                    writer.Write((Int32)cacheArray.Length);
                    for (int i = 0; i < cacheArray.Length; i++)
                    {
                        if (cacheArray[i] == null)
                        {
                            writer.Write((byte)0);
                        }
                        else
                        {
                            writer.Write((byte)1);
                            CacheEntryCustomSerializer.WriteToStream(cacheArray[i], writer);
                        }
                    }
                }
                else
                {
                    writer.Write((byte)1);
                    formatter.Serialize(writer.BaseStream, replyData);
                }
            }
        }