Ejemplo n.º 1
0
        private void frmSpelling_FormClosing(object sender, FormClosingEventArgs e)
        {
            string message  = richTextBox1.Text;
            string message1 = string.Empty;
            string message2 = string.Empty;

            if (message.Length == 0)
            {
                return;
            }

            if (ischat)
            {
                instance.TabConsole.chatConsole.SendChat(richTextBox1.Text, ctype);
            }
            else
            {
                if (!isgroup)
                {
                    //netcom.SendInstantMessage(richTextBox1.Text, target, session);
                    if (message.Length > 1023)
                    {
                        message1 = message.Substring(0, 1022);
                        netcom.SendInstantMessage(message1, target, session);

                        if (message.Length > 2046)
                        {
                            message2 = message.Substring(1023, 2045);
                            netcom.SendInstantMessage(message2, target, session);
                        }
                    }
                    else
                    {
                        netcom.SendInstantMessage(message, target, session);;
                    }
                }
                else
                {
                    if (message.Length > 1023)
                    {
                        message1 = message.Substring(0, 1022);
                        netcom.SendInstantMessageGroup(message1, target, session);

                        if (message.Length > 2046)
                        {
                            message2 = message.Substring(1023, 2045);
                            netcom.SendInstantMessageGroup(message2, target, session);
                        }
                    }
                    else
                    {
                        netcom.SendInstantMessageGroup(message, target, session);;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void SendIM(string message)
        {
            if (message.Length == 0)
            {
                return;
            }

            message = message.TrimEnd();

            message = instance.CleanReplace("http://*****:*****@"[^a-zA-Z0-9]", "");
                //string[] swords = cword.Split(' ');
                string[] swords     = message.Split(' ');
                bool     hasmistake = false;
                bool     correct    = true;

                foreach (string word in swords)
                {
                    string cword = Regex.Replace(word, @"[^a-zA-Z0-9]", "");

                    try
                    {
                        correct = hunspell.Spell(cword);
                    }
                    catch (Exception ex)
                    {
                        if (ex.Message == "Dictionary is not loaded")
                        {
                            instance.Config.ApplyCurrentConfig();
                            //correct = hunspell.Spell(cword);
                        }
                        else
                        {
                            Logger.Log("Spellcheck error Group IM: " + ex.Message, Helpers.LogLevel.Error);
                        }
                    }

                    if (!correct)
                    {
                        hasmistake = true;
                        break;
                    }
                }

                if (hasmistake)
                {
                    (new frmSpelling(instance, message, swords, true, target, session)).Show();

                    ClearIMInput();
                    hasmistake = false;
                    return;
                }
            }

            string message1 = string.Empty;
            string message2 = string.Empty;

            if (message.Length > 1023)
            {
                message1 = message.Substring(0, 1022);
                netcom.SendInstantMessageGroup(message1, target, session);

                if (message.Length > 2046)
                {
                    message2 = message.Substring(1023, 2045);
                    netcom.SendInstantMessageGroup(message2, target, session);
                }
            }
            else
            {
                netcom.SendInstantMessageGroup(message, target, session);;
            }

            this.ClearIMInput();
        }