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

📄 importform.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 5 页
字号:
                        ClientLogger.WriteException("导入失败", exception3);
                        this.DoNextError("导入失败,请检查文件格式是否正确。");
                        return;
                    }
                }
                this.DoNextError("确认文件路径是否正确。");
            }
            return;
        Label_03B4:
            this.FormatForm();
            if (this._step == 2)
            {
                this.btnNext.Enabled = this.CanImport();
            }
            else if ((this._step != 3) && (this._step == this._maxStep))
            {
                this.Import();
            }
        }

        private void DoNextError(string message)
        {
            if (!base.IsDisposed)
            {
                this.progressOutLook.Visible = false;
                this._step--;
                if (this.ImportObject.Type == ImportContactType.Outlook)
                {
                    this._step = 1;
                }
                this._frameworkWin.UnifiedMessageBox.ShowInfo(this, message);
            }
        }

        private void DoPrevious()
        {
            if (this._step > 1)
            {
                this._step--;
                if (this._step == 2)
                {
                    this._step--;
                }
            }
            this.FormatForm();
        }

        private void FormatForm()
        {
            this.btnPrevious.Enabled = this._step > 1;
            if (this._step == this._maxStep)
            {
                this.btnNext.Enabled = false;
                this.btnPrevious.Enabled = false;
            }
            else
            {
                this.btnNext.Text = "下一步(&N)";
                if (this._step == 1)
                {
                    this.checkBoxSelAll.Checked = false;
                    this.txtFilePath.Text = string.Empty;
                    this.btnNext.Enabled = true;
                    this.rbFile.Enabled = true;
                    if (this.rbFile.Checked)
                    {
                        this.btnNext.Enabled = false;
                    }
                    if (this.rbOutlook.Checked)
                    {
                        this.panelOutlookDes.Dock = DockStyle.Fill;
                        this.panelOutlookDes.BringToFront();
                    }
                }
                else if (this._step == 3)
                {
                    this.btnNext.Enabled = this._totalChecked > 0;
                }
                else if (this._step == (this._maxStep - 1))
                {
                    this.btnNext.Text = "导入(&I)";
                }
            }
            if (this._step == 1)
            {
                this.pnlStep_SelSource.Dock = DockStyle.Fill;
                this.pnlStep_SelSource.BringToFront();
            }
            else if (this._step != 2)
            {
                if (this._step == 3)
                {
                    this.pnlStep_SelContact.Dock = DockStyle.Fill;
                    this.pnlStep_SelContact.BringToFront();
                }
                else if (this._step == 4)
                {
                    this.pnlStep_MyInfo.Dock = DockStyle.Fill;
                    this.pnlStep_MyInfo.BringToFront();
                }
                else if (this._step == 5)
                {
                    this.pnlStep_Result.Dock = DockStyle.Fill;
                    this.pnlStep_Result.BringToFront();
                }
            }
        }

        private void FormatSelectInfo()
        {
            this.lblSelectInfo.Text = string.Format("{0} / {1}", this._totalChecked, this._totalUsers);
            if (this._totalUsers == 0)
            {
                this.checkBoxSelAll.CheckState = CheckState.Unchecked;
            }
            else if (this._totalChecked == this._totalUsers)
            {
                this.checkBoxSelAll.CheckState = CheckState.Checked;
            }
            else if (this._totalChecked == 0)
            {
                this.checkBoxSelAll.CheckState = CheckState.Unchecked;
            }
            else
            {
                this.checkBoxSelAll.CheckState = CheckState.Indeterminate;
            }
        }

        private string GetNodeValue(XmlNode node, string name)
        {
            XmlNode node2 = node.SelectSingleNode(name);
            if (node2 != null)
            {
                return node2.InnerText;
            }
            return null;
        }

        private void Import()
        {
            try
            {
                if (this.lstContacts.Items.Count != 0)
                {
                    this.lst = new List<XmlNode>();
                    foreach (ListViewItem item in this.lstContacts.Items)
                    {
                        if (item.Checked)
                        {
                            this.lst.Add(item.Tag as XmlNode);
                        }
                    }
                    this.progressBarExport.Maximum = this.lst.get_Count();
                    this.progressBarExport.Minimum = 0;
                    if (this.comboBoxGroup.SelectedItem != null)
                    {
                        this.groupID = new int?(Convert.ToInt32((this.comboBoxGroup.SelectedItem as ComboBoxItem).Value.ToString()));
                    }
                    ThreadPool.QueueUserWorkItem(new WaitCallback(this.ImportContactsInThread));
                }
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
        }

        private void ImportContact(XmlNode node)
        {
            string nodeValue = this.GetNodeValue(node, "FetionId");
            string mobileNo = this.GetNodeValue(node, "MobileNo");
            string text3 = this.GetNodeValue(node, "Name");
            string text4 = this.GetNodeValue(node, "Nickname");
            string localName = string.IsNullOrEmpty(text3) ? (text4 ?? string.Empty) : text3;
            Info contextForUi = new Info();
            AsyncBizOperation op = new AsyncBizOperation(contextForUi);
            op.IsImpsErrorHandled = true;
            op.ImpsError += new EventHandler<ImpsErrorEventArgs>(this, (IntPtr) this.op_ImpsError);
            op.Successed += new EventHandler(this.op_Successed);
            if (!string.IsNullOrEmpty(mobileNo))
            {
                contextForUi.IsMobileNo = true;
                contextForUi.DispalyName = localName;
                contextForUi.Id = mobileNo;
                this._frameworkWin.ContactManager.AddBuddyByMobileNo(mobileNo, string.Empty, this.groupID, localName, this.textBoxMyName.Text, false, true, new bool?(this.chkInviteStartService.Checked), op);
            }
            else
            {
                long sid;
                if (!string.IsNullOrEmpty(nodeValue) && long.TryParse(nodeValue, ref sid))
                {
                    contextForUi.IsMobileNo = false;
                    contextForUi.DispalyName = localName;
                    contextForUi.Id = sid.ToString();
                    this._frameworkWin.ContactManager.AddBuddyBySid(sid, string.Empty, this.groupID, localName, this.textBoxMyName.Text, false, true, op);
                }
            }
        }

        private void ImportContactsInThread(object state)
        {
            if ((this.lst != null) && (this.lst.get_Count() > 0))
            {
                try
                {
                    if (!base.IsDisposed)
                    {
                        XmlNode node = this.lst.get_Item(this.i);
                        this.ImportContact(node);
                    }
                }
                catch (Exception exception)
                {
                    ClientLogger.WriteException(exception);
                }
            }
        }

        private void ImportForm_Load(object sender, EventArgs e)
        {
            try
            {
                this._list = this._manager.GetImportPlugins();
                this.rbOutlook.Checked = true;
                this.labelRealName.Text = "<font face=宋体 color='black' size='9'>您的姓名将出现在对方收到的手机短信/邀请函中,为了便于对方识别,</font><font face=宋体 color='red' size='9'>建议您填写真实姓名</font>。";
                this.FormatForm();
                this.initGroup();
                this.textBoxMyName.MaxLength = Imps.Client.Core.FixedClientSetting.Instance.MaxInviteRequestNameLength;
                string text = (this.CurrentUser.PersonalInfo.Name.Value.Trim().Length != 0) ? this.CurrentUser.PersonalInfo.Name.Value.Trim() : this.CurrentUser.PersonalInfo.Nickname.Value.Trim();
                if (text.Length > Imps.Client.Core.FixedClientSetting.Instance.MaxInviteRequestNameLength)
                {
                    text = text.Substring(0, Imps.Client.Core.FixedClientSetting.Instance.MaxInviteRequestNameLength);
                }
                this.textBoxMyName.Text = text;
                this.lblImportContactName.Text = string.Empty;
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
        }

        private void ImportOutLook(object context)
        {
            try
            {
                this._importXMLContent = (context as IImportContacts).GetContactsXML(this, null);
                if (this._importXMLContent.Length != 0)
                {
                    if (!base.IsDisposed)
                    {
                        base.Invoke(new ImportOutlookSuccess(this.DoNext));
                    }
                }
                else if (!base.IsDisposed)
                {
                    base.Invoke(new ImportOutLookFailed(this.DoNextError), new object[] { "Microsoft Outlook 中没有联系人导入!" });
                }
            }
            catch (Exception exception)
            {
                if (!base.IsDisposed)
                {
                    base.Invoke(new ImportOutLookFailed(this.DoNextError), new object[] { "确认是否安装Microsoft Outlook!" });
                    base.Invoke(new SetButtonEnabled(this.setButton), new object[] { this.btnNext, true });
                    base.Invoke(new InitOutlook(this.initOutlookPanelWhenError));
                    base.Invoke(new DoPre(this.DoPrevious));
                }
                ClientLogger.WriteException("导入Outlook失败", exception);
            }
        }

        private void initGroup()
        {

⌨️ 快捷键说明

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