示例#1
0
 private void AddEmotionsImages(string text)
 {
     //For Happy Smiley
     if (text.Contains(":)"))
     {
         int _index;
         while ((_index = rtbChat.Find(":)")) > -1)
         {
             rtbChat.Select(_index, ":)".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Happy.png"));
         }
     }
     //For Wink Smiley
     if (text.Contains(";)"))
     {
         int _index;
         while ((_index = rtbChat.Find(";)")) > -1)
         {
             rtbChat.Select(_index, ";)".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Wink.png"));
         }
     }
     //For Sad Smiley
     if (text.Contains(":("))
     {
         int _index;
         while ((_index = rtbChat.Find(":(")) > -1)
         {
             rtbChat.Select(_index, ":(".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Sad.png"));
         }
     }
     //For Angry Smiley
     if (text.Contains(":@"))
     {
         int _index;
         while ((_index = rtbChat.Find(":@")) > -1)
         {
             rtbChat.Select(_index, ":@".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Angry.png"));
         }
     }
     //For Surprised Smiley
     if (text.Contains(":-O") || text.Contains(":-o"))
     {
         int _index;
         while ((_index = rtbChat.Find(":-O")) > -1)
         {
             rtbChat.Select(_index, ":-O".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Suprised.png"));
         }
     }
     //For Kiss Smiley
     if (text.Contains("(K)") || text.Contains("(k)"))
     {
         int _index;
         while ((_index = rtbChat.Find("(K)")) > -1)
         {
             rtbChat.Select(_index, "(K)".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Kiss.png"));
         }
     }
     //For Question Smiley
     if (text.Contains(":?"))
     {
         int _index;
         while ((_index = rtbChat.Find(":?")) > -1)
         {
             rtbChat.Select(_index, ":?".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Question.png"));
         }
     }
     //For Laughing Smiley
     if (text.Contains(":D") || text.Contains(":d"))
     {
         int _index;
         while ((_index = rtbChat.Find(":D")) > -1)
         {
             rtbChat.Select(_index, ":D".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Laughing.png"));
         }
     }
     //For Sleep Smiley
     if (text.Contains(":-)"))
     {
         int _index;
         while ((_index = rtbChat.Find(":-)")) > -1)
         {
             rtbChat.Select(_index, ":-)".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Sleep.png"));
         }
     }
     //For Unfair Smiley
     if (text.Contains(":|"))
     {
         int _index;
         while ((_index = rtbChat.Find(":|")) > -1)
         {
             rtbChat.Select(_index, ":|".Length);
             rtbChat.InsertImage(Image.FromFile(App.Model.Ap.FolderImages + @"smiley\" + "Unfair.png"));
         }
     }
 }
示例#2
0
        private void PutSmiley(int _findex)
        {
            if (this.rtb.InvokeRequired)
            {
                this.rtb.BeginInvoke((MethodInvoker) delegate { PutSmiley(_findex); });
            }
            else
            {
                if (hideSmileys)
                {
                    return;
                }

                try
                {
                    int _index;

                    // Angel smile
                    if ((_index = rtb.Find("angelsmile;", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "angelsmile;", Smileys.AngelSmile);
                    }
                    // Angry smile
                    if ((_index = rtb.Find("angry;", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "angry;", Smileys.AngrySmile);
                    }
                    // Beer
                    if ((_index = rtb.Find("beer;", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "beer;", Smileys.Beer);
                    }

                    if ((_index = rtb.Find("brokenheart;", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "brokenheart;", Smileys.BrokenHeart);
                    }

                    if ((_index = rtb.Find("bye", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "bye", Smileys.bye);
                    }

                    if ((_index = rtb.Find("clap;", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "clap;", Smileys.clap);
                    }

                    if ((_index = rtb.Find(":S", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, ":S", Smileys.ConfusedSmile);
                    }

                    if ((_index = rtb.Find("cry;", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "cry;", Smileys.CrySmile);
                    }

                    if ((_index = rtb.Find(";)", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, ";)", Smileys.wink);
                    }

                    if ((_index = rtb.Find("devil;", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "devil;", Smileys.DevilSmile);
                    }

                    if ((_index = rtb.Find("duh;", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "duh;", Smileys.duh);
                    }

                    if ((_index = rtb.Find("embarassed;", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "embarassed;", Smileys.EmbarassedSmile);
                    }

                    if ((_index = rtb.Find(":)", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, ":)", Smileys.happy0037);
                    }

                    if ((_index = rtb.Find("heart;", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "heart;", Smileys.heart);
                    }

                    if ((_index = rtb.Find("help", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "help", Smileys.help);
                    }

                    if ((_index = rtb.Find("liar;", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "liar;", Smileys.liar);
                    }

                    if ((_index = rtb.Find("lol", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "lol", Smileys.lol);
                    }

                    if ((_index = rtb.Find("cool;", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "cool;", Smileys.cool);
                    }

                    if ((_index = rtb.Find("oops", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "oops", Smileys.oops);
                    }

                    if ((_index = rtb.Find("shhh", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "shhh", Smileys.shhh);
                    }

                    if ((_index = rtb.Find("sigh", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "sigh", Smileys.sigh);
                    }

                    if ((_index = rtb.Find(":X", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, ":X", Smileys.silenced);
                    }

                    if ((_index = rtb.Find("thinking;", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "thinking;", Smileys.think);
                    }

                    if ((_index = rtb.Find("thumbsup;", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "thumbsup;", Smileys.ThumbsUp);
                    }

                    if ((_index = rtb.Find("whistle;", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "whistle;", Smileys.whistle);
                    }

                    if ((_index = rtb.Find("zzzzz", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "zzzzz", Smileys.zzzzz);
                    }

                    if ((_index = rtb.Find("wow", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "wow", Smileys.wow);
                    }

                    if ((_index = rtb.Find("muah;", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "muah;", Smileys.kiss);
                    }

                    if ((_index = rtb.Find(":(", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, ":(", Smileys.sad);
                    }

                    if ((_index = rtb.Find("yawn;", _findex, RichTextBoxFinds.NoHighlight)) > -1)
                    {
                        ReplaceWithSmiley(_index, "yawn;", Smileys.yawn);
                    }
                }
                catch {; }
            }
        }