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

📄 chateditctrlmanager.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 5 页
字号:
            }
            builder.Append(data.Text);
            if (data.TextFont.Strikeout && flag5)
            {
                builder.Append("</S>");
            }
            if (data.TextFont.Underline && flag4)
            {
                builder.Append("</U>");
            }
            if (data.TextFont.Italic && flag3)
            {
                builder.Append("</I>");
            }
            if (data.TextFont.Bold && flag2)
            {
                builder.Append("</B>");
            }
            if (flag)
            {
                builder.Append("</Font>");
            }
            return builder.ToString();
        }

        public string GetHtmlWithTags(params string[] tagFilters)
        {
            if (tagFilters.Length == 0)
            {
                return this.Text;
            }
            return this.GetHtml(0, this._richTextBox.TextLength, tagFilters);
        }

        private ChatEditLinkObject GetLink(int hotKey)
        {
            for (int i = this._linkObjectDict.get_Count() - 1; i >= 0; i--)
            {
                ChatEditLinkObject obj2 = this._linkObjectDict.get_Item(i);
                if (obj2.HotKey == hotKey)
                {
                    return obj2;
                }
            }
            return null;
        }

        private ChatEditLinkObject GetLinkFromPos(int iPos)
        {
            List<ChatEditLinkObject>.Enumerator enumerator = this._linkObjectDict.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    ChatEditLinkObject obj2 = enumerator.get_Current();
                    if ((iPos >= obj2.Pos) && (iPos <= (obj2.Pos + obj2.Text.Length)))
                    {
                        return obj2;
                    }
                }
            }
            finally
            {
                enumerator.Dispose();
            }
            return null;
        }

        public ChatEditOleObject GetOleObject(OleKey key)
        {
            if (key == null)
            {
                return null;
            }
            return this._oleObjDict.get_Item(key);
        }

        private SelectedData GetSelectionData(int nStart, int nEnd)
        {
            this._richTextBox.HideFocusSelection(true, false);
            this._richTextBox.Select(nStart, nEnd - nStart);
            string sText = this._richTextBox.SelectedText;
            if (sText == "\n")
            {
                sText = "\r\n";
            }
            return new SelectedData(sText, this._richTextBox.SelectionFont, this._richTextBox.SelectionColor);
        }

        public string GetText(int offset, int length)
        {
            if (offset < 0)
            {
                throw new ArgumentOutOfRangeException("offset");
            }
            if (length < 0)
            {
                length = this._richTextBox.TextLength - offset;
            }
            if (length == 0)
            {
                return string.Empty;
            }
            StringBuilder builder = new StringBuilder();
            string text = this._richTextBox.Text;
            try
            {
                List<REOBJECT> reObjs = this._richTextBox.GetOleObjects();
                for (int i = offset; i < (offset + length); i++)
                {
                    REOBJECT textFromObject = this.GetTextFromObject(reObjs, i);
                    if (textFromObject == null)
                    {
                        char ch = text[i];
                        if (ch == '\n')
                        {
                            builder.Append("\r\n");
                        }
                        else
                        {
                            builder.Append(ch);
                        }
                    }
                    else
                    {
                        ChatEditImageObject obj2 = this._oleObjIndexDict.get_Item((int) textFromObject.dwUser) as ChatEditImageObject;
                        if (obj2 != null)
                        {
                            builder.Append(obj2.Text);
                            reObjs.Remove(textFromObject);
                        }
                        else
                        {
                            builder.Append(text[i]);
                        }
                    }
                }
            }
            catch
            {
            }
            return builder.ToString();
        }

        private REOBJECT GetTextFromObject(List<REOBJECT> reObjs, int pos)
        {
            List<REOBJECT>.Enumerator enumerator = reObjs.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    REOBJECT reobject = enumerator.get_Current();
                    if (reobject.cp == pos)
                    {
                        return reobject;
                    }
                }
            }
            finally
            {
                enumerator.Dispose();
            }
            return null;
        }

        public bool InserProgressbar(int iPos, OleKey key, string text, AmigoImage image, string barText)
        {
            this._firedByFunction = true;
            this._richTextBox.SelectionStart = iPos;
            using (Graphics graphics = this._richTextBox.CreateGraphics())
            {
                ChatEditProgressBarObject obj2 = new ChatEditProgressBarObject(key, this._oleIndex, text);
                int fontSize = obj2.FontSize;
                using (Font font = new Font(obj2.FontFamilyName, (float) fontSize, FontStyle.Regular, GraphicsUnit.Pixel))
                {
                    SizeF ef = graphics.MeasureString(text, font, obj2.BarSize.Width);
                    SizeF ef2 = graphics.MeasureString(barText, font, obj2.BarSize.Width);
                    int height = (int) ef.Height;
                    if (ef2.Height > ef.Height)
                    {
                        height = (int) ef2.Height;
                    }
                    Size size = new Size(obj2.Width + obj2.Vertical, ((((image.Height + obj2.Vertical) + height) + obj2.Vertical) + obj2.BarSize.Height) + obj2.Vertical);
                    obj2.Height = size.Height;
                    obj2.BarImage = image;
                    obj2.BarImageText = barText;
                    if (this._richTextBox.InsertProgressBar(text, size, obj2.ProgressBarColor, obj2.ProgressBarTextColor, this._oleIndex, image, barText, obj2.FontFamilyName, obj2.FontSize, obj2.BarSize.Width, obj2.BarSize.Height))
                    {
                        this._oleObjDict.Add(key, obj2);
                        this._oleObjIndexDict.Add(this._oleIndex, obj2);
                        this._oleIndex++;
                        this._firedByFunction = false;
                        return true;
                    }
                    this._firedByFunction = false;
                }
            }
            return false;
        }

        public void InsertCRLF(int iPos)
        {
            int selectionStart = this._richTextBox.SelectionStart;
            this._richTextBox.SelectionStart = iPos;
            this._richTextBox.SelectionLength = this._richTextBox.Text.Length - iPos;
            string selectedText = this._richTextBox.SelectedText;
            this._richTextBox.SelectedText = "\n" + selectedText;
            this._richTextBox.SelectionLength = 0;
            this._richTextBox.SelectedText = string.Empty;
            this._richTextBox.SelectionStart = selectionStart + "\n".Length;
        }

        public void InsertCustomEmotion(Imps.Client.Core.CustomEmotion.CustomEmotion emotion, Image customEmotionImage)
        {
            this._richTextBox.SelectedText = string.Empty;
            this.InsertCustomEmotion(this.SelectionStart, emotion, customEmotionImage, null);
        }

        private void InsertCustomEmotion(int nPos, Imps.Client.Core.CustomEmotion.CustomEmotion emotion, Image customEmotionImage, OleKey key)
        {
            this.InsertCustomEmotionImage(nPos, emotion, customEmotionImage, this.SelectionFont, this._richTextBox.SelectionColor, key);
            if (this._autoParseCustomEmotion)
            {
                this.SelectionStart++;
            }
            else
            {
                this.SelectionStart += emotion.ShortCut.Length;
            }
        }

        public int InsertCustomEmotionImage(int iPos, Imps.Client.Core.CustomEmotion.CustomEmotion emotion, Image image, Font font, Color color, OleKey key)
        {
            int num = 0;
            this._firedByFunction = true;
            int selectionStart = this._richTextBox.SelectionStart;
            int selectionLength = this._richTextBox.SelectionLength;
            Color selectionColor = this._richTextBox.SelectionColor;
            Font selectionFont = this._richTextBox.SelectionFont;
            this._richTextBox.Select(iPos, 0);
            if (key == null)
            {
                this.InsertImage2(emotion, image, OleKeyManager.Instance.NewKey);
            }
            else
            {
                this.InsertImage2(emotion, image, key);
            }
            this._richTextBox.SelectionLength = 0;
            iPos++;
            num++;
            this._richTextBox.SelectionStart = selectionStart;
            this._richTextBox.SelectionColor = selectionColor;
            try
            {
                if (selectionFont != null)
                {
                    this._richTextBox.SelectionFont = selectionFont;
                }
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
            this._richTextBox.SelectionLength = selectionLength;
            this._firedByFunction = false;
            return num;
        }

        public void InsertEmoticon(string sEmoticon)
        {
            this._richTextBox.SelectedText = string.Empty;
            this.InsertEmoticon(this.SelectionStart, sEmoticon);
        }

        public void InsertEmoticon(int nPos, string sEmoticon)
        {
            if (ImpsEmoticons.Instance.ContainsKey(sEmoticon))
            {
                this.InsertRichTextString(this.SelectionStart, sEmoticon, this.SelectionFont, this._richTextBox.SelectionColor);
                if (this._convertSympol)
                {
                    this.SelectionStart++;
                }
                else
                {
                    this.SelectionStart += sEmoticon.Length;
                }
            }
        }

        private void InsertHtmlLink(int iPos, OleKey key, string LinkText, string commandName, string OnCommand, Color color)
        {
            Dictionary<string, string> command = new Dictionary<string, string>();
            command.Add(commandName, OnCommand);
            this.InsertLink(iPos, key, LinkText, LinkText, command, Keys.None);
        }

        public bool InsertImage(Image image, string sText, OleKey key)
        {
            return this.InsertImage(this.SelectionStart, image, sText, key, this._sympolSize, false);
        }

        public bool InsertImage(AmigoImage image, string sText, OleKey key, Size size)
        {
            return this.InsertImage(this.SelectionStart, image, sText, key, size, false);
        }

        public bool InsertImage(int iPos, AmigoImage amigoImage, string sText, OleKey key, Size size, bool bReplace)
        {
            try
            {
                this.LockUpdate(true);
                int selectionStart = this._richTextBox.SelectionStart;
                int selectionLength = this._richTextBox.SelectionLength;
                if (!bReplace)
                {
                    this._richTextBox.SelectionLength = 0;
                    this._richTextBox.SelectionStart = iPos;

⌨️ 快捷键说明

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