Ejemplo n.º 1
0
 private void updateMessages(JObject messages)
 {
     for (int i = messages["messages"].Count() - 1; i >= 0; i--)
     {
         int Id = int.Parse(messages["messages"][i]["id"].ToString());
         if (lastMsgId < Id)
         {
             lastMsgId = int.Parse(messages["messages"][i]["id"].ToString());
             SC2TVMessage message = new SC2TVMessage();
             message.Name = messages["messages"][i]["name"].ToString();
             message.Text = messages["messages"][i]["message"].ToString();
             if (message.Text.StartsWith("[b]"))
             {
                 int startIndex = 0;
                 int endIndex   = message.Text.IndexOf("[/b],", startIndex) + 5;
                 message.ToName = message.Text.Substring(startIndex, endIndex - startIndex);
                 message.Text   = message.Text.Replace(message.ToName, "");
                 message.ToName = message.ToName.Replace("[b]", "");
                 message.ToName = message.ToName.Replace("[/b],", "");
             }
             message.Text = message.Text.Replace("[url]", "");
             message.Text = message.Text.Replace("[/url]", "");
             message.Text = message.Text.Replace("&quot;", "\"");
             messageReceived(this, message);
             lastMsgId = Id;
         }
     }
 }
Ejemplo n.º 2
0
 private void updateMessages(JObject messages) {
     for (int i = messages["messages"].Count()-1; i >= 0; i--)
     {
         int Id = int.Parse(messages["messages"][i]["id"].ToString());
         if (lastMsgId < Id)
         {
             lastMsgId = int.Parse(messages["messages"][i]["id"].ToString());
             SC2TVMessage message = new SC2TVMessage();
             message.Name = messages["messages"][i]["name"].ToString();
             message.Text = messages["messages"][i]["message"].ToString();
             if (message.Text.StartsWith("[b]"))
             {
                 int startIndex = 0;
                 int endIndex = message.Text.IndexOf("[/b],", startIndex) + 5;
                 message.ToName = message.Text.Substring(startIndex, endIndex - startIndex);
                 message.Text = message.Text.Replace(message.ToName, "");
                 message.ToName = message.ToName.Replace("[b]", "");
                 message.ToName = message.ToName.Replace("[/b],", "");
             }
             message.Text = message.Text.Replace("[url]", "");
             message.Text = message.Text.Replace("[/url]", "");
             message.Text = message.Text.Replace("&quot;", "\"");
             messageReceived(this, message);
             lastMsgId = Id;
         }
     }
 }