public static Whisper.Repos.Pipe.RequestCustomHash Deserialize (Stream stream, Whisper.Repos.Pipe.RequestCustomHash instance) { while (true) { ProtocolBuffers.Key key = null; int keyByte = stream.ReadByte (); if (keyByte == -1) break; //Optimized reading of known fields with field ID < 16 switch (keyByte) { case 10: //Field 1 LengthDelimited instance.CustomID = ProtocolParser.ReadBytes (stream); break; default: key = ProtocolParser.ReadKey ((byte)keyByte, stream); break; } if (key == null) continue; //Reading field ID > 16 and unknown field ID/wire type combinations switch (key.Field) { case 0: throw new InvalidDataException ("Invalid field id: 0, something went wrong in the stream"); default: ProtocolParser.SkipKey (stream, key); break; } } return instance; }
public static Whisper.Repos.Pipe.RequestCustomHash Read (byte[] buffer, Whisper.Repos.Pipe.RequestCustomHash instance) { using (MemoryStream ms = new MemoryStream(buffer)) Deserialize (ms, instance); return instance; }
public static void Write (Stream stream, Whisper.Repos.Pipe.RequestCustomHash instance) { Whisper.Repos.Pipe.RequestCustomHash.Serialize (stream, instance); }
public static Whisper.Repos.Pipe.RequestCustomHash Read (Stream stream, Whisper.Repos.Pipe.RequestCustomHash instance) { return Whisper.Repos.Pipe.RequestCustomHash.Deserialize (stream, instance); }