コード例 #1
0
ファイル: CsStructure.cs プロジェクト: gregorypilar/interlace
        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\".");
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: gregorypilar/interlace
        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));
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: gregorypilar/interlace
        private void ServerMessageReceived(PropertyDictionary message)
        {
            if (!message.HasStringFor(ChatroomKeys.Message)) return;//Ignore potential hacked message

            string chat = message.StringFor(ChatroomKeys.Message);

            AddToChat(chat);
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: gregorypilar/interlace
        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);
        }