⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chateditctrlmanager.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 5 页
字号:
            {
                ImpsClipboard.SetImpsText(this.SelectedText);
            }
            else
            {
                Clipboard.SetText(this.SelectedText);
            }
            this._richTextBox.SelectedText = string.Empty;
        }

        public void DoPaste()
        {
            this.DoPaste(ImpsDataFormat.ImpsHtml);
        }

        public void DoPaste(string format)
        {
            if (format == ImpsDataFormat.ImpsHtml)
            {
                bool isSystemClipBoard = false;
                string sourceString = ImpsClipboard.GetImpsHtml(ref isSystemClipBoard);
                if (sourceString != string.Empty)
                {
                    if (isSystemClipBoard && (this._convertString != null))
                    {
                        sourceString = this._convertString(sourceString);
                    }
                    this.InsertString(this._richTextBox.SelectionStart, sourceString, this._sympolSize);
                }
            }
            else if (format == ImpsDataFormat.ImpsText)
            {
                string impsText = ImpsClipboard.GetImpsText();
                if (this._convertString != null)
                {
                    impsText = this._convertString(impsText);
                }
                this.InsertRichTextString(this._richTextBox.SelectionStart, impsText, this._richTextBox.SelectionFont, this._richTextBox.SelectionColor);
            }
            else if (ImpsClipboard.ContainsData(format))
            {
                string data = (string) ImpsClipboard.GetData(format);
                if (this._convertString != null)
                {
                    data = this._convertString(data);
                }
                this.InsertRichTextString(this._richTextBox.SelectionStart, data, this._richTextBox.SelectionFont, this._richTextBox.SelectionColor);
            }
        }

        public void DoUndo()
        {
            this._richTextBox.Undo();
        }

        public bool Focus()
        {
            return this._richTextBox.Focus();
        }

        private bool FormatRichTextBox(string sChangedText, bool eventHandled, bool calcTextLength)
        {
            if (!this._convertSympol)
            {
                return false;
            }
            bool flag = false;
            try
            {
                this._firedByFunction = true;
                int selectionStart = this._richTextBox.SelectionStart;
                int nEnd = this._richTextBox.SelectionStart;
                int selectionLength = this._richTextBox.SelectionLength;
                int nStart = nEnd;
                int iPos = 0;
                int num6 = 0;
                iPos = nEnd;
                while (iPos > 0)
                {
                    if (!this._richTextBox.IsText(iPos - 1))
                    {
                        break;
                    }
                    num6++;
                    iPos--;
                }
                nStart = iPos;
                num6 = 0;
                iPos = nEnd;
                while (iPos < this._richTextBox.TextLength)
                {
                    if (!this._richTextBox.IsText(iPos))
                    {
                        iPos--;
                        break;
                    }
                    num6++;
                    if (num6 > this._maxSympol)
                    {
                        break;
                    }
                    iPos++;
                }
                int num7 = iPos;
                string selectedText = this._richTextBox.GetSelectedText(nStart, nEnd);
                string text2 = this._richTextBox.GetSelectedText(nEnd, num7);
                if (!eventHandled)
                {
                    selectedText = selectedText + sChangedText;
                }
                string strInput = selectedText + text2;
                List<object>.Enumerator enumerator = EmoticonParser.ParseString(this._user, strInput).GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        object obj2 = enumerator.get_Current();
                        if (obj2 is Imps.Client.Core.CustomEmotion.CustomEmotion)
                        {
                            Imps.Client.Core.CustomEmotion.CustomEmotion emotion = (Imps.Client.Core.CustomEmotion.CustomEmotion) obj2;
                            if (this._autoParseCustomEmotion && (this.GetCustomEmotionImage != null))
                            {
                                this._richTextBox.Select(nStart, emotion.ShortCut.Length);
                                string text1 = this._richTextBox.SelectedText;
                                this._richTextBox.SelectedText = string.Empty;
                                if (this.GetCustomEmotionImage != null)
                                {
                                    this.InsertImage2(nStart, emotion, this.GetCustomEmotionImage(emotion.Id), OleKeyManager.Instance.NewKey, true);
                                }
                                this._richTextBox.SelectionLength = 0;
                                nStart++;
                                flag = true;
                                if (this._richTextBox.SelectionStart < selectionStart)
                                {
                                    selectionStart -= emotion.ShortCut.Length - 1;
                                }
                            }
                            else
                            {
                                nStart += emotion.ShortCut.Length;
                            }
                        }
                        else if (obj2 is Emoticon)
                        {
                            Emoticon emoticon = (Emoticon) obj2;
                            this._richTextBox.Select(nStart, emoticon.SrcKey.Length);
                            string text5 = this._richTextBox.SelectedText;
                            AmigoImage amigoImage = emoticon.AmigoImage;
                            this._richTextBox.SelectedText = string.Empty;
                            this.InsertImage(nStart, amigoImage, emoticon.Key, OleKeyManager.Instance.NewKey, this._sympolSize, true);
                            this._richTextBox.SelectionLength = 0;
                            nStart++;
                            flag = true;
                            if (this._richTextBox.SelectionStart < selectionStart)
                            {
                                selectionStart -= emoticon.SrcKey.Length - 1;
                            }
                        }
                        else if (obj2 is string)
                        {
                            string text4 = (string) obj2;
                            nStart += text4.Length;
                        }
                    }
                }
                finally
                {
                    enumerator.Dispose();
                }
                this._richTextBox.SelectionStart = selectionStart;
                this._richTextBox.SelectionLength = selectionLength;
                this._richTextBox.HideFocusSelection(false, false);
            }
            finally
            {
                this._firedByFunction = false;
            }
            return flag;
        }

        [DllImport("user32.dll")]
        public static extern bool GetCursorPos(ref Point pt);
        private string GetHtml(int offset, int length, params string[] tagFilters)
        {
            if (offset < 0)
            {
                throw new ArgumentOutOfRangeException("offset");
            }
            if (length < 0)
            {
                length = this._richTextBox.TextLength - offset;
            }
            if (length == 0)
            {
                return string.Empty;
            }
            if (tagFilters.Length == 0)
            {
                return this.Text;
            }
            StringBuilder builder = new StringBuilder();
            try
            {
                SelectedData selectionData = null;
                SelectedData data2 = null;
                int selectionStart = this._richTextBox.SelectionStart;
                int selectionLength = this._richTextBox.SelectionLength;
                this._richTextBox.HideFocusSelection(true, false);
                this.LockUpdate(true);
                bool flag = false;
                for (int i = offset; i < (offset + length); i++)
                {
                    REOBJECT oleObjectFromPosition = null;
                    if (!flag)
                    {
                        oleObjectFromPosition = this._richTextBox.GetOleObjectFromPosition(i);
                    }
                    if (oleObjectFromPosition == null)
                    {
                        selectionData = this.GetSelectionData(i, i + 1);
                        if (this._convertString != null)
                        {
                            selectionData.Text = this._convertString(selectionData.Text);
                        }
                    }
                    else
                    {
                        ChatEditImageObject obj2 = this._oleObjIndexDict.get_Item((int) oleObjectFromPosition.dwUser) as ChatEditImageObject;
                        if (obj2 != null)
                        {
                            if (obj2.CustomEmotion == null)
                            {
                                selectionData = new SelectedData(obj2.Text, this.DefaultTextFont, this.ForeColor);
                            }
                            else
                            {
                                selectionData = new SelectedData(obj2.CustomEmotion.ToMessageXML(), this.DefaultTextFont, this.ForeColor);
                            }
                        }
                    }
                    if (data2 != null)
                    {
                        if (!data2.TextFont.Equals(selectionData.TextFont) || !data2.TextColor.Equals(selectionData.TextColor))
                        {
                            builder.Append(this.GetHTMLFromData(data2, false, tagFilters));
                            data2 = selectionData;
                        }
                        else
                        {
                            data2.Text = data2.Text + selectionData.Text;
                        }
                    }
                    else if (data2 == null)
                    {
                        data2 = selectionData;
                    }
                    else
                    {
                        data2.Text = data2.Text + selectionData.Text;
                    }
                }
                if (data2 != null)
                {
                    builder.Append(this.GetHTMLFromData(data2, false, tagFilters));
                }
                this._richTextBox.SelectionStart = selectionStart;
                this._richTextBox.SelectionLength = selectionLength;
                this._richTextBox.HideFocusSelection(false, false);
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
            finally
            {
                this.LockUpdate(false);
            }
            return builder.ToString();
        }

        private string GetHTMLFromData(SelectedData data, bool inner, params string[] tagFilters)
        {
            float size = data.TextFont.Size;
            StringBuilder builder = new StringBuilder();
            bool flag = false;
            bool flag2 = false;
            bool flag3 = false;
            bool flag4 = false;
            bool flag5 = false;
            if (this.ContainTag("font", tagFilters))
            {
                flag = true;
                builder.Append("<Font Face='");
                builder.Append(data.TextFont.Name);
                builder.Append("' Color='");
                builder.Append(data.TextColor.ToArgb().ToString());
                builder.Append("' Size='");
                builder.Append(size.ToString());
                builder.Append("'>");
            }
            if (this.ContainTag("b", tagFilters) && data.TextFont.Bold)
            {
                flag2 = true;
                builder.Append("<B>");
            }
            if (this.ContainTag("i", tagFilters) && data.TextFont.Italic)
            {
                flag3 = true;
                builder.Append("<I>");
            }
            if (this.ContainTag("u", tagFilters) && data.TextFont.Underline)
            {
                flag4 = true;
                builder.Append("<U>");
            }
            if (this.ContainTag("s", tagFilters) && data.TextFont.Strikeout)
            {
                flag5 = true;
                builder.Append("<S>");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -