Esempio n. 1
0
        ChunkViewItem CreateChunkView(IDataChunk chunk)
        {
            switch (chunk)
            {
            case Packet tChunk: return(new RawData()
                {
                    Chunk = tChunk, ViewContent = this
                });

            case MessageData tChunk: return(new Message()
                {
                    Chunk = tChunk, ViewContent = this
                });

            default: throw new ArgumentException($"Unsupported chunk type: {chunk.GetType()}", nameof(chunk));
            }
        }
Esempio n. 2
0
        public void Write(IDataChunk chunk)
        {
            if (chunk is Packet packet)
            {
                Write(packet);
            }
            else if (chunk is MessageData message)
            {
                Write(message);
            }
            else
            {
                throw new InvalidOperationException("Unsupported data type: " + chunk.GetType());
            }

            BaseStream.Flush();
        }