BlipFace.Presenter.StatusesPresenter.CountChars C# (CSharp) Method

CountChars() public method

public CountChars ( string message ) : int
message string
return int
        public int CountChars(string message)
        {
            /*
              * Aby obliczyć iloś znaków,
              * - nie liczymy początku wiadomości gdy jest prywatna lub skierowana
              * - każdy link jest przez blip'a skracany do postaci http://rdir.pl/1234 wobec czego zajmuje tylko
              *     19 znaków,
              * - cytowanie (blipnięcie) jest liczone normalnie
              * - link do youtube też jest liczony normalnie
              */

            int messageSize = BlipSize-message.Length;

            string matchText;

            if(BlipRegExp.PrivateStart.IsMatch(message))
            {
                matchText = BlipRegExp.PrivateStart.Match(message).Value;
                messageSize += matchText.Length;
            } else if (BlipRegExp.DirectStart.IsMatch(message))
            {
                matchText = BlipRegExp.DirectStart.Match(message).Value;
                messageSize += matchText.Length;
            }

            var linkMatches = BlipRegExp.Link.Matches(message);

            if (linkMatches.Count<1)
            {
                return messageSize;
            }

            for (int k = 0; k < linkMatches.Count; k++)
            {
                string linkUrl = linkMatches[k].Value;
                if (linkUrl.Contains("blip.pl"))
                {
                    //link do cytowania blipa
                }
                else if (linkUrl.Contains("youtube."))
                {
                }
                else
                {
                    //zwykły link i jego długość jest większa niż 19
                    int linkSize = linkUrl.Length - 19;
                    if(linkSize>0)
                    {
                        messageSize += linkSize;
                    }
                }

            }

            return messageSize;
        }