public void ReadFromStream(PacketStream stream) { PromptId = stream.ReadUInt16(); Type = (DMValueType)stream.ReadUInt16(); switch (Type) { case DMValueType.Null: Value = null; break; case DMValueType.Text: Value = stream.ReadString(); break; case DMValueType.Num: Value = stream.ReadInt32(); break; case DMValueType.Message: Value = stream.ReadString(); break; default: throw new Exception("Invalid prompt response type '" + Type + "'"); } }