public CsStructure(Structure structure, PropertyDictionary options) { _structure = structure; _options = options; if (_options.HasStringFor("surrogate-for") && !_options.HasValueFor("surrogate-for-is-reference-type")) { throw new LanguageException("Any use of \"surrogate-for\" must be accompanied with \"surrogate-for-is-reference-type\"."); } }
private void BroadcastMessageReceived(PropertyDictionary message) { if (!message.HasStringFor(ChatroomKeys.SenderName)) return;//Ignore potential hacked message if (!message.HasStringFor(ChatroomKeys.Message)) return;//Ignore potential hacked message string name = message.StringFor(ChatroomKeys.SenderName); string chat = message.StringFor(ChatroomKeys.Message); AddToChat(string.Format("{0}: {1}", name, chat)); }
private void ServerMessageReceived(PropertyDictionary message) { if (!message.HasStringFor(ChatroomKeys.Message)) return;//Ignore potential hacked message string chat = message.StringFor(ChatroomKeys.Message); AddToChat(chat); }
private void LogInMessageReceived(PropertyDictionary message) { string dialogText = "Log in response received, however contained no message"; if (message.HasStringFor(ChatroomKeys.Message)) { switch (message.StringFor(ChatroomKeys.Message)) { case ChatroomKeys.LoginSuccess: _messageInput.Focus(); return;//No message required. Start chatting. case ChatroomKeys.LoginFail_UserNameInUse: dialogText = "Requested username already being used"; break; case ChatroomKeys.LoginFail_TooManyClients: dialogText = "Sorry, chat room is full. Please try again later."; break; default: break; } } MessageBox.Show(dialogText); }