internal override void CreateFromStream(BinaryReader reader) { base.CreateFromStream(reader); requestingCallNumber = reader.ReadInt32(); if (reader.ReadByte() == 0) { replyData = null; } else { if (reader.ReadByte() == 0) { int numberOfEntries = reader.ReadInt32(); CacheEntry[] cacheArray = new CacheEntry[numberOfEntries]; for (int i = 0; i < numberOfEntries; i++) { if (reader.ReadByte() == 0) { cacheArray[i] = null; } else { cacheArray[i] = CacheEntryCustomSerializer.CreateFromStream(reader); } } replyData = cacheArray; } else { replyData = formatter.Deserialize(reader.BaseStream); } } }
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); }
internal override void CreateFromStream(BinaryReader reader) { base.CreateFromStream(reader); #region Entries if (reader.ReadByte() == 0) { entries = null; } else { int numberOfEntries = reader.ReadInt32(); entries = new CacheEntry[numberOfEntries]; for (int i = 0; i < entries.Length; i++) { entries[i] = CacheEntryCustomSerializer.CreateFromStream(reader); } } #endregion #region ScopeName if (reader.ReadByte() == 0) { scopeName = null; } else { scopeName = reader.ReadString(); } #endregion #region ScopeProperties if (reader.ReadByte() == 0) { scopeProperties = null; } else { scopeProperties = new BuildPropertyGroup(); scopeProperties.CreateFromStream(reader); } #endregion #region ScopeToolsVersion if (reader.ReadByte() == 0) { scopeToolsVersion = null; } else { scopeToolsVersion = reader.ReadString(); } #endregion cacheContentType = (CacheContentType)reader.ReadByte(); }
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); } } }