Ejemplo n.º 1
0
        //overrides the method in the parent class
        public override void ProcessMessage()
        {
            //extract ID and sender
            this.Id     = Message.Header;
            this.Sender = Message.Body[0].Clean();
            if (!this.Sender.ValidateTwitterUser())
            {
                throw new Exception("Invalid twitter username!");
            }

            string text = StringHelper.GetMessageBody(Message.Body, 2);

            MessageText = text;

            MessageText.StoreMentions();
            MessageText.GetHashTags();

            if (text.Length < 141)
            {
                this.MessageText = StringHelper.ReplaceTextSpeak(text);
            }
            else
            {
                throw new ArgumentOutOfRangeException("Tweet text cannot be longer than 140 characters!");
            }

            JSONHelper.WriteTweet(this);
        }