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

📄 conversationsetting.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 2 页
字号:
namespace Imps.Client.Core
{
    using Imps.Client.Resource;
    using System;
    using System.Drawing;
    using System.Text;
    using System.Xml;

    public class ConversationSetting : PropertyDictionary, IUserConfig
    {
        private string _currentPortraitFileInfo = string.Empty;
        private string _defaultMsgHistoryDir = string.Empty;
        private string _DefaultShareContentSavePath = string.Empty;
        private int _GroupWindowState = 1;
        private int _lastHeight;
        private int _LastInputAreaHeight;
        private int _lastWidth;
        private int _lastX;
        private int _lastY;
        private Imps.Client.Core.User _owner;
        private int _printScreenType;
        private bool _ShowPersonalGroupDetail = true;
        private bool _ShowPortrait = true;
        private int _WindowState = 1;
        private System.Drawing.Color c = System.Drawing.Color.Black;
        private System.Drawing.Font f = new System.Drawing.Font("宋体", 10.5f, FontStyle.Regular);

        internal ConversationSetting(Imps.Client.Core.User owner)
        {
            this._owner = owner;
        }

        internal override void Clear()
        {
            base.Clear();
            this._defaultMsgHistoryDir = string.Empty;
            this._DefaultShareContentSavePath = (string) new ProposedData<string>(ImpsPathInfo.DefaultShareContentSavePath);
        }

        public void ClearLocalUserCfg()
        {
        }

        public void ClearUserCfg()
        {
            base.TryRemove("ShowLatestMessages");
            base.TryRemove("ShowTimestampEveryMsg");
            base.TryRemove("save-message");
            base.TryRemove("EnterToSend");
            base.TryRemove("AutoReplyEnabled");
            base.TryRemove("AutoReplyIndex");
            this._defaultMsgHistoryDir = string.Empty;
        }

        public void ClearWndCfg()
        {
            base.TryRemove("LastX");
            base.TryRemove("LastY");
            base.TryRemove("LastWidth");
            base.TryRemove("LastHeight");
            base.TryRemove("LastInputAreaHeight");
            base.TryRemove("ShowPortrait");
            base.TryRemove("DefaultShareContentSavePath");
            base.TryRemove("Font");
        }

        public void LoadLocalUserCfg(XmlNode node)
        {
            foreach (XmlNode node2 in node.ChildNodes)
            {
                switch (node2.Name)
                {
                    case "DefaultMsgDir":
                    {
                        this._defaultMsgHistoryDir = node2.InnerText;
                        continue;
                    }
                    case "PrintScreenType":
                    {
                        int num = 0;
                        int.TryParse(node2.InnerText, ref num);
                        this._printScreenType = num;
                        continue;
                    }
                    case "CurrentPortraitFileInfo":
                        break;

                    default:
                    {
                        continue;
                    }
                }
                this._currentPortraitFileInfo = node2.InnerText;
            }
        }

        public void LoadWndXml(XmlNode xmlNode)
        {
            int num = 0;
            foreach (XmlNode node in xmlNode.ChildNodes)
            {
                switch (node.Name)
                {
                    case "Font":
                    {
                        this.ParseFontString(node.InnerText);
                        continue;
                    }
                    case "LastX":
                    {
                        int.TryParse(node.InnerText, ref num);
                        this._lastX = num;
                        continue;
                    }
                    case "LastY":
                    {
                        int.TryParse(node.InnerText, ref num);
                        this._lastY = num;
                        continue;
                    }
                    case "LastWidth":
                    {
                        int.TryParse(node.InnerText, ref num);
                        this._lastWidth = num;
                        continue;
                    }
                    case "LastHeight":
                    {
                        int.TryParse(node.InnerText, ref num);
                        this._lastHeight = num;
                        continue;
                    }
                    case "LastInputAreaHeight":
                    {
                        int.TryParse(node.InnerText, ref num);
                        this._LastInputAreaHeight = num;
                        continue;
                    }
                    case "ShowPortrait":
                    {
                        bool flag = false;
                        bool.TryParse(node.InnerText, ref flag);
                        this._ShowPortrait = flag;
                        continue;
                    }
                    case "DefaultShareContentSavePath":
                    {
                        this.DefaultShareContentSavePath = node.InnerText;
                        continue;
                    }
                    case "WindowState":
                    {
                        int.TryParse(node.InnerText, ref num);
                        this._WindowState = num;
                        continue;
                    }
                    case "GroupWindowState":
                    {
                        int.TryParse(node.InnerText, ref num);
                        this._GroupWindowState = num;
                        continue;
                    }
                    case "ShowPersonalGroupDetail":
                    {
                        bool flag2;
                        bool.TryParse(node.InnerText, ref flag2);
                        this._ShowPersonalGroupDetail = flag2;
                        continue;
                    }
                }
            }
        }

        public void LoadXml(XmlNode xmlNode)
        {
            foreach (XmlNode node in xmlNode.ChildNodes)
            {
                string name;
                if (((name = node.Name) != null) && (name == "AutoReplyIndex"))
                {
                    int num = 0;
                    int.TryParse(node.InnerText, ref num);
                    base.InnerSetPropertyValue<ProposedData<int>>("AutoReplyIndex", (ProposedData<int>) num);
                    continue;
                }
                bool flag = false;
                bool.TryParse(node.InnerText, ref flag);
                base.InnerSetPropertyValue<ProposedData<bool>>(node.Name, (ProposedData<bool>) flag);
            }
        }

        private void ParseColor(string input)
        {
            try
            {
                string[] textArray = input.Split(new char[] { '.' });
                int alpha = 0;
                int red = 0;
                int green = 0;
                int blue = 0;
                for (int i = 0; i < textArray.Length; i++)
                {
                    switch (i)
                    {
                        case 0:
                            int.TryParse(textArray[i], ref alpha);
                            break;

                        case 1:
                            int.TryParse(textArray[i], ref red);
                            break;

                        case 2:
                            int.TryParse(textArray[i], ref green);
                            break;

                        case 3:
                            int.TryParse(textArray[i], ref blue);
                            break;
                    }
                }
                this.Color = System.Drawing.Color.FromArgb(alpha, red, green, blue);
            }
            catch
            {
            }
        }

        private void ParseFontString(string input)
        {
            try
            {
                string[] textArray = input.Split(new char[] { ',' });
                if (textArray.Length > 3)
                {
                    for (int i = 4; i < textArray.Length; i++)
                    {
                        string[] textArray3;
                        (textArray3 = textArray)[3] = textArray3[3] + "," + textArray[i];
                    }
                }
                StringBuilder builder = new StringBuilder("宋体");
                float emSize = 11f;
                FontStyle regular = FontStyle.Regular;
                for (int j = 0; j < 4; j++)
                {
                    string[] textArray2 = textArray[j].Split(new char[] { '=' });
                    switch (textArray2[0])
                    {
                        case "Name":
                            if (textArray2.Length >= 2)
                            {
                                builder.Remove(0, builder.Length);
                                builder.Append(textArray2[1]);
                            }
                            break;

                        case "Size":
                            if (textArray2.Length >= 2)
                            {
                                float.TryParse(textArray2[1], ref emSize);
                            }
                            break;

                        case "Style":
                            if (textArray2.Length >= 2)
                            {
                                regular = (FontStyle) Enum.Parse(typeof(FontStyle), textArray2[1]);
                            }
                            break;

                        case "Color":
                            if (textArray2.Length >= 2)
                            {
                                this.ParseColor(textArray2[1]);
                            }
                            break;
                    }
                }
                this.f = new System.Drawing.Font(builder.ToString(), emSize, regular);
            }
            catch
            {
            }
        }

        internal void ResetProposedProperties()
        {
            base.InnerResetProposedProperties();
        }

        public string ToLocalUserCfg()
        {
            return ((string.Format("<{0}>", "ConversationSetting") + string.Format("<{0}><![CDATA[{1}]]></{0}>", "DefaultMsgDir", this.DefaultMsgHistoryDir) + string.Format("<{0}><![CDATA[{1}]]></{0}>", "CurrentPortraitFileInfo", this.CurrentPortraitFileInfo)) + string.Format("<{0}>{1}</{0}>", "PrintScreenType", this.PrintScreenType.ToString()) + string.Format("</{0}>", "ConversationSetting"));
        }

        public override string ToString()
        {
            return ((((string.Format("<{0}>", "ConversationSetting") + string.Format("<{0}>{1}</{0}>", "ShowLatestMessages", this.ShowLatestMessages.ToString())) + string.Format("<{0}>{1}</{0}>", "ShowTimestampEveryMsg", this.ShowTimestampEveryMsg.ToString()) + string.Format("<{0}>{1}</{0}>", "EnterToSend", this.SendMessageByEnterKey.ToString())) + string.Format("<{0}>{1}</{0}>", "AutoReplyEnabled", this.AutoReplyEnabled.ToString()) + string.Format("<{0}>{1}</{0}>", "MessageToSMS", this.MessageToSMS.ToString())) + string.Format("<{0}>{1}</{0}>", "AutoReplyIndex", this.AutoReplyIndex) + string.Format("</{0}>", "ConversationSetting"));
        }

        public string ToWndXml()
        {
            return ((((((string.Format("<{0}>", "ConversationSetting") + string.Format("<{0}>{1}</{0}>", "DefaultShareContentSavePath", this._DefaultShareContentSavePath) + string.Format("<{0}>{1}</{0}>", "Font", this.StrFont)) + string.Format("<{0}>{1}</{0}>", "LastX", this.LastX) + string.Format("<{0}>{1}</{0}>", "LastY", this.LastY)) + string.Format("<{0}>{1}</{0}>", "LastWidth", this.LastWidth) + string.Format("<{0}>{1}</{0}>", "LastHeight", this.LastHeight)) + string.Format("<{0}>{1}</{0}>", "LastInputAreaHeight", this.LastInputAreaHeight) + string.Format("<{0}>{1}</{0}>", "ShowPortrait", this.ShowPortrait.ToString())) + string.Format("<{0}>{1}</{0}>", "WindowState", this.WindowState.ToString()) + string.Format("<{0}>{1}</{0}>", "GroupWindowState", this.GroupWindowState.ToString())) + string.Format("<{0}>{1}</{0}>", "ShowPersonalGroupDetail", this.ShowPersonalGroupDetail.ToString()) + string.Format("</{0}>", "ConversationSetting"));
        }

        [ConfigCategory(ConfigCategory.User)]
        public ProposedData<bool> AutoReplyEnabled
        {
            get
            {
                return base.InnerGetPropertyValue<ProposedData<bool>>("AutoReplyEnabled", new ProposedData<bool>(false));
            }
            internal set
            {
                base.InnerSetPropertyValue<ProposedData<bool>>("AutoReplyEnabled", value);
            }
        }

        [ConfigCategory(ConfigCategory.User)]
        public ProposedData<int> AutoReplyIndex
        {
            get

⌨️ 快捷键说明

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