public void WriteToStream(PacketStream stream) { stream.WriteUInt16((UInt16)PromptId); stream.WriteUInt16((UInt16)Type); switch (Type) { case DMValueType.Null: break; case DMValueType.Text: stream.WriteString((string)Value); break; case DMValueType.Num: stream.WriteInt32((Int32)Value); break; case DMValueType.Message: stream.WriteString((string)Value); break; default: throw new Exception("Invalid prompt response type '" + Type + "'"); } }