Example #1
0
        private static TweetTap PrepareTappedText(string source)
        {
            var tap = new TweetTap();

            if (source.StartsWith("http://") || source.StartsWith("https://"))
            {
                tap.Value = source.Trim();
                return(tap);
            }
            if (source.StartsWith("bit.ly/"))
            {
                tap.Value = "http://" + source.Trim();
                return(tap);
            }
            if (source [0] == '@')
            {
                source = source.Trim();
                if (source.EndsWith(":") || source.EndsWith("."))
                {
                    tap.Value = source.Substring(0, source.Length - 1);
                    tap.Type  = TweetType.Mention;
                    return(tap);
                }
                tap.Value = source;
                tap.Type  = TweetType.Mention;
                return(tap);
            }
            if (source[0] == '#')
            {
                tap.Value = source.Trim();
                tap.Type  = TweetType.Hashtag;
            }

            return(tap);
        }
Example #2
0
		private static TweetTap PrepareTappedText(string source)
		{
			var tap = new TweetTap();
			
			if (source.StartsWith ("http://") || source.StartsWith ("https://"))
			{
				tap.Value = source.Trim();
				return tap;
			}
			if (source.StartsWith ("bit.ly/"))
			{
				tap.Value = "http://" + source.Trim();
				return tap;
			}
			if (source [0] == '@')
			{
				source = source.Trim ();
				if (source.EndsWith(":") || source.EndsWith ("."))
				{
					tap.Value = source.Substring (0, source.Length-1);
					tap.Type = TweetType.Mention;
					return tap;
				}
				tap.Value = source;
				tap.Type = TweetType.Mention;
				return tap;
			}			
			if (source[0] == '#')
			{
				tap.Value = source.Trim();
				tap.Type = TweetType.Hashtag;
			}
			
			return tap;
		}