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

📄 customemotionaddform.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 3 页
字号:

        private void bwImport_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            this.pbState.Value = e.get_ProgressPercentage();
        }

        private void bwImport_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (!Convert.ToBoolean(e.get_Result()))
            {
                if ((this != null) && !base.IsDisposed)
                {
                    this._frameworkWin.UnifiedMessageBox.ShowInfo(this, "请使用飞信的表情库文件。");
                }
                else
                {
                    this._frameworkWin.UnifiedMessageBox.ShowInfo("请使用飞信的表情库文件。");
                }
                this.ChangeControlEnabled(true);
            }
            else if (this._errList.get_Count() == 0)
            {
                if ((this != null) && !base.IsDisposed)
                {
                    this._frameworkWin.UnifiedMessageBox.ShowInfo(this, string.Format("成功导入{0}个表情!", this._successCount));
                    base.Close();
                }
                else
                {
                    this._frameworkWin.UnifiedMessageBox.ShowInfo(string.Format("成功导入{0}个表情!", this._successCount));
                }
            }
            else
            {
                this.ShowResult();
            }
        }

        private void ChangeControlEnabled(bool enabled)
        {
            if (this._operateType == OperateTypeEnum.Edit)
            {
                this.btnBrowse.Enabled = false;
            }
            else
            {
                this.btnBrowse.Enabled = enabled;
            }
            this.cbAssignName.Enabled = enabled;
            this.cbAssignShotCut.Enabled = enabled;
            this.btnOk.Enabled = enabled;
        }

        private void CustomEmotionAddForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            this.bwBatchAdd.CancelAsync();
            this.bwImport.CancelAsync();
            if ((this._ceResultForm != null) && !this._ceResultForm.IsDisposed)
            {
                this._ceResultForm.Dispose();
            }
        }

        private void CustomEmotionAddForm_Load(object sender, EventArgs e)
        {
            this.btnBrowse.Focus();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private bool ExistShortCut(string shortCut, string id)
        {
            if (ImpsEmoticons.Instance.ContainsKey(shortCut))
            {
                return true;
            }
            Imps.Client.Core.CustomEmotion.CustomEmotion emotionByShortCut = this._iceManager.OwnerEmotions.GetEmotionByShortCut(shortCut);
            return (((emotionByShortCut != null) && !emotionByShortCut.Id.Equals(id)) || (this._iceManager.ExistSameStartShortCutInSystemEmotions(shortCut) || this._iceManager.ExistSameStartShortCut(shortCut, id)));
        }

        private string GetFileName(int index)
        {
            return this.GetFileName(this._fileNames[index]);
        }

        private string GetFileName(string filePath)
        {
            int startIndex = filePath.LastIndexOf('\\') + 1;
            int num2 = filePath.LastIndexOf('.');
            return filePath.Substring(startIndex, num2 - startIndex);
        }

        private string GetShortCut(string fileName)
        {
            if (fileName.Length <= 8)
            {
                return fileName;
            }
            return fileName.Substring(0, 8);
        }

        private void ImportAdd()
        {
            string fileName = this.GetFileName(0);
            string dirPath = Path.Combine(ImpsPathInfo.ApplicationDataDir, string.Format(@"temp\{0}\", fileName));
            bool flag = false;
            try
            {
                GZipCompressXml.DeCompress(this._fileNames[0], dirPath);
                flag = true;
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException("自定义表情 -> 解压表情文件", exception);
            }
            if (!flag)
            {
                this._frameworkWin.UnifiedMessageBox.ShowError(this, "文件读取失败,请选择正确的表情文件。");
                this.ChangeControlEnabled(true);
            }
            else if (!this.bwImport.get_IsBusy())
            {
                this.bwImport.RunWorkerAsync(dirPath);
            }
        }

        private void ImportAddPerCustomEmotion(string shortCut, string name, string filePath, int index, int count)
        {
            if (!base.IsDisposed)
            {
                this.AddCustomEmotion(shortCut, name, filePath);
                double num = ((double) index) / ((double) count);
                this.bwImport.ReportProgress((int) (num * 100));
                Thread.Sleep(50);
            }
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(CustomEmotionAddForm));
            this.lTitle = new Label();
            this.tbFileNames = new XTextBox();
            this.btnBrowse = new XButton();
            this.lItem1 = new Label();
            this.lItem2 = new Label();
            this.tbShotCut = new XTextBox();
            this.lItem3 = new Label();
            this.tbName = new XTextBox();
            this.lItem4 = new Label();
            this.btnCancel = new XButton();
            this.btnOk = new XButton();
            this.opdBrowse = new OpenFileDialog();
            this.pBatchAdd = new Panel();
            this.upPicture = new UPanel();
            this.pbState = new ProgressBar();
            this.cbAssignName = new CheckBox();
            this.cbAssignShotCut = new CheckBox();
            this.pSingleAdd = new Panel();
            this.bwBatchAdd = new BackgroundWorker();
            this.bwImport = new BackgroundWorker();
            this.panel1 = new Panel();
            this.pBatchAdd.SuspendLayout();
            this.upPicture.SuspendLayout();
            this.pSingleAdd.SuspendLayout();
            this.panel1.SuspendLayout();
            base.SuspendLayout();
            this.lTitle.set_AutoSize(true);
            this.lTitle.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.lTitle.Location = new System.Drawing.Point(9, 12);
            this.lTitle.Name = "lTitle";
            this.lTitle.Size = new Size(0xa3, 13);
            this.lTitle.TabIndex = 0;
            this.lTitle.Text = "请按提示设置您的自定义表情";
            this.tbFileNames.BackColor = Color.FromArgb(240, 240, 240);
            this.tbFileNames.BorderStyle = BorderStyle.FixedSingle;
            this.tbFileNames.EmptyTextTip = "";
            this.tbFileNames.EmptyTextTipColor = Color.DarkGray;
            this.tbFileNames.Location = new System.Drawing.Point(14, 0x4c);
            this.tbFileNames.Name = "tbFileNames";
            this.tbFileNames.ReadOnly = true;
            this.tbFileNames.Size = new Size(0xef, 20);
            this.tbFileNames.TabIndex = 2;
            this.tbFileNames.TabStop = false;
            this.tbFileNames.TextChanged += new EventHandler(this.tbFileNames_TextChanged);
            this.btnBrowse.AutoArrangementX = true;
            this.btnBrowse.AutoSizeToImage = false;
            this.btnBrowse.BackColor = Color.Transparent;
            this.btnBrowse.BackgroundImage = (Image) manager.GetObject("btnBrowse.BackgroundImage");
            this.btnBrowse.BackgroundImageDisable = (Image) manager.GetObject("btnBrowse.BackgroundImageDisable");
            this.btnBrowse.BackgroundImageDown = (Image) manager.GetObject("btnBrowse.BackgroundImageDown");
            this.btnBrowse.BackgroundImageHover = (Image) manager.GetObject("btnBrowse.BackgroundImageHover");
            this.btnBrowse.ChangeSkin = false;
            this.btnBrowse.Location = new System.Drawing.Point(0x106, 0x4c);
            this.btnBrowse.Name = "btnBrowse";
            this.btnBrowse.Size = new Size(0x3d, 0x15);
            this.btnBrowse.TabIndex = 0;
            this.btnBrowse.Text = "浏览...";
            this.btnBrowse.set_UseVisualStyleBackColor(false);
            this.btnBrowse.Click += new EventHandler(this.btnBrowse_Click);
            this.lItem1.set_AutoSize(true);
            this.lItem1.Location = new System.Drawing.Point(12, 0x2a);
            this.lItem1.Name = "lItem1";
            this.lItem1.Size = new Size(0xf8, 0x1a);
            this.lItem1.TabIndex = 4;
            this.lItem1.Text = "1、请选择表情图片位置(文件不要超过50K)\r\n   支持jpg,gif,png,bmp格式";
            this.lItem2.set_AutoSize(true);
            this.lItem2.Location = new System.Drawing.Point(3, 11);
            this.lItem2.Name = "lItem2";
            this.lItem2.Size = new Size(0xeb, 0x1a);
            this.lItem2.TabIndex = 6;
            this.lItem2.Text = "2、设置表情键盘输入快捷键,8个字符以内\r\n   例如:prz";
            this.tbShotCut.BackColor = Color.White;
            this.tbShotCut.BorderStyle = BorderStyle.FixedSingle;
            this.tbShotCut.EmptyTextTip = "";
            this.tbShotCut.EmptyTextTipColor = Color.DarkGray;
            this.tbShotCut.Location = new System.Drawing.Point(5, 0x2d);
            this.tbShotCut.MaxLength = 8;
            this.tbShotCut.Name = "tbShotCut";
            this.tbShotCut.Size = new Size(0xef, 20);
            this.tbShotCut.TabIndex = 0;
            this.tbShotCut.TextChanged += new EventHandler(this.tbShotCut_TextChanged);
            this.tbShotCut.KeyDown += new KeyEventHandler(this.tbShotCut_KeyDown);
            this.lItem3.set_AutoSize(true);
            this.lItem3.Location = new System.Drawing.Point(3, 0x4c);
            this.lItem3.Name = "lItem3";
            this.lItem3.Size = new Size(0x91, 13);
            this.lItem3.TabIndex = 8;
            this.lItem3.Text = "3、设置表情名称(可选)";
            this.tbName.BackColor = Color.White;
            this.tbName.BorderStyle = BorderStyle.FixedSingle;
            this.tbName.EmptyTextTip = "";
            this.tbName.EmptyTextTipColor = Color.DarkGray;
            this.tbName.Location = new System.Drawing.Point(5, 0x62);
            this.tbName.MaxLength = 8;
            this.tbName.Name = "tbName";
            this.tbName.Size = new Size(0xef, 20);
            this.tbName.TabIndex = 1;
            this.tbName.KeyDown += new KeyEventHandler(this.tbName_KeyDown);
            this.lItem4.set_AutoSize(true);
            this.lItem4.Location = new System.Drawing.Point(3, 11);
            this.lItem4.Name = "lItem4";
            this.lItem4.Size = new Size(0xaf, 13);
            this.lItem4.TabIndex = 9;
            this.lItem4.Text = "您批量添加自定义表情,飞信将";
            this.btnCancel.AutoArrangementX = true;
            this.btnCancel.AutoSizeToImage = false;
            this.btnCancel.BackColor = Color.Transparent;
            this.btnCancel.BackgroundImageDisable = null;
            this.btnCancel.BackgroundImageDown = null;
            this.btnCancel.BackgroundImageHover = null;
            this.btnCancel.ChangeSkin = true;
            this.btnCancel.DialogResult = DialogResult.Cancel;
            this.btnCancel.Location = new System.Drawing.Point(0x10d, 0x110);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new Size(0x4b, 0x17);
            this.btnCancel.TabIndex = 2;
            this.btnCancel.Text = "取消";
            this.btnCancel.set_UseVisualStyleBackColor(false);
            this.btnCancel.Click += new EventHandler(this.btnCancel_Click);
            this.btnOk.AutoArrangementX = true;
            this.btnOk.AutoSizeToImage = false;
            this.btnOk.BackColor = Color.Transparent;
            this.btnOk.BackgroundImageDisable = null;
            this.btnOk.BackgroundImageDown = null;
            this.btnOk.BackgroundImageHover = null;
            this.btnOk.ChangeSkin = true;
            this.btnOk.Enabled = false;
            this.btnOk.Location = new System.Drawing.Point(0xb8, 0x110);
            this.btnOk.Name = "btnOk";
            this.btnOk.Size = new Size(0x4b, 0x17);
            this.btnOk.TabIndex = 1;
            this.btnOk.Text = "确定";
            this.btnOk.set_UseVisualStyleBackColor(false);
            this.btnOk.Click += new EventHandler(this.btnOk_Click);
            this.opdBrowse.Filter = "Image Files(*.BMP;*.JPG;*.GIF;*.PNG)|*.BMP;*.JPG;*.GIF;*.PNG|All files (*.*)|*.*";
            this.opdBrowse.Multiselect = true;
            this.opdBrowse.Title = "选择表情";
            this.pBatchAdd.Controls.Add(this.upPicture);
            this.pBatchAdd.Controls.Add(this.cbAssignName);
            this.pBatchAdd.Controls.Add(this.cbAssignShotCut);
            this.pBatchAdd.Controls.Add(this.lItem4);
            this.pBatchAdd.Location = new System.Drawing.Point(9, 0xf8);
            this.pBatchAdd.Name = "pBatchAdd";
            this.pBatchAdd.Size = new Size(0x148, 0x7a);
            this.pBatchAdd.TabIndex = 2;
            this.pBatchAdd.Visible = false;
            this.upPicture.BorderColor = Color.FromArgb(0xcb, 0xd4, 0xde);
            this.upPicture.BorderInsideColor = Color.White;
            this.upPicture.BorderInsideWidth = 1;
            this.upPicture.BorderWidth = 1;
            this.upPicture.Controls.Add(this.pbState);
            this.upPicture.Location = new System.Drawing.Point(5, 0x53);
            this.upPicture.Name = "upPicture";
            this.upPicture.set_Padding(new Padding(3));
            this.upPicture.Size = new Size(0x135, 0x17);
            this.upPicture.TabIndex = 14;
            this.pbState.Location = new System.Drawing.Point(0, 0);
            this.pbState.Name = "pbState";
            this.pbState.Size = new Size(0x134, 0x16);
            this.pbState.TabIndex = 12;
            this.cbAssignName.set_AutoSize(true);
            this.cbAssignName.Checked = true;
            this.cbAssignName.CheckState = CheckState.Checked;
            this.cbAssignName.Location = new System.Drawing.Point(5, 0x39);
            this.cbAssignName.Name = "cbAssignName";
            this.cbAssignName.Size = new Size(0x92, 0x11);
            this.cbAssignName.TabIndex = 1;
            this.cbAssignName.Text = "使用文件名做表情名称";
            this.cbAssignName.set_UseVisualStyleBackColor(true);
            this.cbAssignShotCut.set_AutoSize(true);
            this.cbAssignShotCut.Checked = true;
            this.cbAssignShotCut.CheckState = CheckState.Checked;
            this.cbAssignShotCut.Location = new System.Drawing.Point(5, 0x20);
            this.cbAssignShotCut.Name = "cbAssignShotCut";
            this.cbAssignShotCut.Size = new Size(0x9e, 0x11);
            this.cbAssignShotCut.TabIndex = 0;
            this.cbAssignShotCut.Text = "系统分配键盘输入快捷键";
            this.cbAssignShotCut.set_UseVisualStyleBackColor(true);
            this.pSingleAdd.Controls.Add(this.tbName);
            this.pSingleAdd.Controls.Add(this.tbShotCut);
            this.pSingleAdd.Controls.Add(this.lItem2);
            this.pSingleAdd.Controls.Add(this.lItem3);
            this.pSingleAdd.Location = new System.Drawing.Point(9, 0x68);
            this.pSingleAdd.Name = "pSingleAdd";
            this.pSingleAdd.Size = new Size(0xfd, 0x88);
            this.pSingleAdd.TabIndex = 1;
            this.bwBatchAdd.set_WorkerReportsProgress(true);
            this.bwBatchAdd.set_WorkerSupportsCancellation(true);

⌨️ 快捷键说明

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