public bool ReadBoolean() { FailIfWriteOnlyMsgBody(); FailIfBytesInBuffer(); bool result; object value = cloak.Peek(); if (value == null) { result = Convert.ToBoolean(value); } else { result = ConversionSupport.ConvertNMSType <bool>(value); } cloak.Pop(); return(result); }
public string ReadString() { FailIfWriteOnlyMsgBody(); FailIfBytesInBuffer(); string result; object value = cloak.Peek(); if (value == null) { result = Convert.ToString(null); } else { result = ConversionSupport.ConvertNMSType <string>(value); } cloak.Pop(); return(result); }
public float ReadSingle() { FailIfWriteOnlyMsgBody(); FailIfBytesInBuffer(); float result; object value = cloak.Peek(); if (value == null) { result = Convert.ToSingle(null); } else { result = ConversionSupport.ConvertNMSType <float>(value); } cloak.Pop(); return(result); }
public int ReadInt32() { FailIfWriteOnlyMsgBody(); FailIfBytesInBuffer(); int result; object value = cloak.Peek(); if (value == null) { result = Convert.ToInt32(null); } else { result = ConversionSupport.ConvertNMSType <int>(value); } cloak.Pop(); return(result); }
public double ReadDouble() { FailIfWriteOnlyMsgBody(); FailIfBytesInBuffer(); double result; object value = cloak.Peek(); if (value == null) { result = Convert.ToDouble(null); } else { result = ConversionSupport.ConvertNMSType <double>(value); } cloak.Pop(); return(result); }
public char ReadChar() { FailIfWriteOnlyMsgBody(); FailIfBytesInBuffer(); char result; object value = cloak.Peek(); if (value == null) { throw new NullReferenceException("Cannot convert NULL value to char."); } else { result = ConversionSupport.ConvertNMSType <char>(value); } cloak.Pop(); return(result); }