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

📄 dialog.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 5 页
字号:
            if (documentElement.ChildNodes[2] != null)
            {
                innerText = documentElement.ChildNodes[2].InnerText;
            }
            if (!string.IsNullOrEmpty(path))
            {
                try
                {
                    if (Array.IndexOf<string>((base.Owner.Configuration.SystemSetting.FileShareSetting.ForbiddenShareContentType + ",lnk").ToLower().Split(new char[] { ',', ';' }), Path.GetExtension(path).Replace(".", string.Empty).ToLower()) < 0)
                    {
                        goto Label_0286;
                    }
                    ClientLogger.WriteGeneral("接收到不符合格式的文件");
                    ShareContent content = this.FindShareContentByID(id);
                    if (content is DownLoadShareContent)
                    {
                        content.CancelShareContent();
                    }
                }
                catch (Exception)
                {
                }
                return;
            }
        Label_0286:
            base.Owner.ConversationManager.RaiseFindConversationForm(this._conv, contact, string.Format(StringTable.Conversation.MsgReceiveShareContent, "{0}", path));
            DownLoadShareContent download = null;
            if (!string.IsNullOrEmpty(id))
            {
                ShareContent shareContent = this.FindShareContentByID(id);
                if (shareContent is DownLoadShareContent)
                {
                    download = shareContent as DownLoadShareContent;
                    if (flag)
                    {
                        download.CloseP2PTransport();
                    }
                    download.FileName = path;
                    download.FileSize = size;
                    download.DownLoadUrl = remoteUri;
                    download.Transmittype = transmittype;
                    download.SessionId = text;
                    download.PreviewImageBase64String = innerText;
                    this.GenerateaShareContentInfo(text3, size, path, download);
                    if (!flag)
                    {
                        this.RaiseAddShareContent(new ShareContentEventArgs(shareContent));
                    }
                    else
                    {
                        download.P2pFailedToRelay = true;
                        download.AsyncSendAcceptInfo();
                        ClientLogger.WriteGeneral("发送方P2P失败  尝试用Relay方式重新下载文件!" + download.FileName);
                    }
                }
            }
            if (download == null)
            {
                download = new DownLoadShareContent(this, contact, remoteUri, path, size, transmittype);
                this.GenerateaShareContentInfo(text3, size, path, download);
                download.PreviewImageBase64String = innerText;
                download.SessionId = text;
                this._shareContents.Add(download, true);
            }
            ShareContentMessage message = new ShareContentMessage(this, string.Format(StringTable.Conversation.MsgReceiveShareContent, "", path), contact.DisplayName, contact.Uri.Raw, false);
            message.MessageType = Imps.Client.Core.MessageType.ImFile;
            message.Time = Imps.Client.Core.User.ServerTime;
            message.SaveMessage();
            this.DoAddChatFriend(contact);
        }

        private void DoReceiveShareContentAcceptInfo(string url, string id, long complete)
        {
            UploadShareContent content = null;
            if (!string.IsNullOrEmpty(url))
            {
                content = this.FindShareContentByUrl(url) as UploadShareContent;
            }
            else if (!string.IsNullOrEmpty(id))
            {
                content = this.FindShareContentByID(id) as UploadShareContent;
            }
            if (content != null)
            {
                if (content.Transmittype == ShareContentTransmitType.P2P)
                {
                    content.LastTimeCompleteSize = complete;
                    content.AsyncStartP2P();
                }
                else
                {
                    if (complete != 0)
                    {
                        content.LastTimeCompleteSize = complete;
                    }
                    content.ResumeRelayUpload();
                }
            }
        }

        private void DoReceiveShareContentCancelInfo(string url, string id)
        {
            ShareContent content = null;
            if (!string.IsNullOrEmpty(url))
            {
                content = this.FindShareContentByUrl(url);
            }
            else if (!string.IsNullOrEmpty(id))
            {
                content = this.FindShareContentByID(id);
            }
            if (content != null)
            {
                content.CancelShareContent();
            }
        }

        private void DoReceiveShareContentInfo(XmlDocument doc, Imps.Client.Core.Contact contact)
        {
            string url = doc.DocumentElement.FirstChild.Attributes["url"].Value;
            string id = string.Empty;
            if (doc.DocumentElement.FirstChild.Attributes["id"] != null)
            {
                id = doc.DocumentElement.FirstChild.Attributes["id"].Value;
            }
            string text3 = doc.DocumentElement.Attributes["action"].Value;
            if (text3 != null)
            {
                if (text3 != "cancel")
                {
                    if (text3 != "accept")
                    {
                        return;
                    }
                }
                else
                {
                    this.DoReceiveShareContentCancelInfo(url, id);
                    return;
                }
                long complete = 0;
                if (doc.DocumentElement.FirstChild.Attributes["completesize"] != null)
                {
                    complete = long.Parse(doc.DocumentElement.FirstChild.Attributes["completesize"].Value);
                }
                this.DoReceiveShareContentAcceptInfo(url, id, complete);
            }
        }

        private void DoReceiveShareContentOption(SipRequest req)
        {
            SipResponse msg = base.CreateSipResponse(req);
            StringWriter tw = new StringWriter();
            XmlHelper.CreateXmlWriterForSipMessage(tw, this.ParserEndPoints(req.Message.Body), new XmlHelper.WriteXmlContentDelegate(this.WriteDownloadOptionXmlContent), "share-content");
            msg.Message.Body = tw.ToString();
            base.SendSipMessage(msg);
        }

        private void DoReceiveStateInfo(XmlDocument doc, Imps.Client.Core.Contact contact)
        {
            try
            {
                if (contact != null)
                {
                    XmlNode node = doc.SelectSingleNode("//state");
                    if (node != null)
                    {
                        string text2;
                        string text = node.InnerText.ToLower();
                        if (!string.IsNullOrEmpty(text) && (((text2 = text) != null) && (text2 == "nudge")))
                        {
                            this.DoReciveNodgeInfo(contact);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
        }

        private void DoReceiveSupportHtmlRequire(SipRequest req)
        {
            this.ContentType = MessageContentType.HtmlFragment;
            SipResponse msg = base.CreateSipResponse(req);
            msg.Message.AddHeader(new SipcSupportedHeader("text/html-fragment"));
            base.SendSipMessage(msg);
        }

        private void DoReceiveTempGroupNotify(SipRequest req)
        {
            XmlDocument document = new XmlDocument();
            document.LoadXml(req.Message.Body);
            foreach (XmlNode node in document.DocumentElement.ChildNodes)
            {
                foreach (XmlNode node2 in node.ChildNodes)
                {
                    string uri = node2.Attributes[0].Value;
                    Imps.Client.Core.Contact contact = base.Owner.ContactList.FindOrCreateContact(uri, new AsyncBizOperation());
                    if (contact != null)
                    {
                        if (node.Attributes["type"].Value == "UserEntered")
                        {
                            this.InnerAddParticipants(new Imps.Client.Core.Contact[] { contact });
                            continue;
                        }
                        this.Participants.Remove(contact);
                    }
                }
            }
        }

        private void DoReciveNodgeInfo(Imps.Client.Core.Contact contact)
        {
            try
            {
                if (!this.CurrentConversation.OwnerFormCreated)
                {
                    base.Owner.ConversationManager.RaiseFindConversationForm(this._conv, contact, string.Format(StringTable.Conversation.MsgNudgeReceive, contact.DisplayName));
                }
                this.RaiseReceiveNudgeRequest(new ParticipantEventArgs(new ConversationParticipant(contact, this)));
                this.DoAddChatFriend(contact);
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
        }

        protected virtual void DoSaveMessage(Message msg)
        {
            msg.SaveMessage();
        }

        protected virtual void DoSendMessageResponse(SipResponseReceivedEventArgs e, SipRequest request)
        {
            try
            {
                Message message = request.Context as Message;
                if (e.Response.Message.StatusCode < 300)
                {
                    if (e.Response.Message.StatusCode >= 200)
                    {
                        SipResponse response = e.Response;
                        if (response.Message.DateHeader != null)
                        {
                            DateTime now = DateTime.Now;
                            try
                            {
                                if (DateTime.TryParse(response.Message.DateHeader.Value, ref now))
                                {
                                    message.Time = now;
                                }
                            }
                            catch
                            {
                            }
                        }
                        if (response.Message.MessageIDHeader != null)
                        {
                            message.MessageId = response.Message.MessageIDHeader.Value;
                        }
                        message.SaveMessage();
                    }
                }
                else if (((e.Response.Message.StatusCode == 0x1e1) && !this.IsMulitiConversation) && (!(this is PersonalGroupDialog) && (this.Participants.Count > 0)))
                {
                    base.Owner.ConversationManager.OpenConversation(this.Participants[0].Contact).CurrentDialog.AsyncSendIm((request.Context as Message).Content);
                    this.Close(false);
                }
                else
                {
                    string error = ConversationManager.GetSendMessageErrorDes(e, this.IsMulitiConversation);
                    this.RaiseSendMessageFailed(new MessageSendFailedEventArgs(request.Context as Message, request, null, error));
                    ClientLogger.WriteGeneral(string.Format("消息发送失败:{0} {1} 【{2}】", e.Response.Message.StatusCode.ToString(), e.Response.Message.ReasonPhrase, (request.Context as Message).Content));
                }
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
            finally
            {
                this.WaitingMessageResponseCount--;
            }
        }

        internal string EndPointToString(IPEndPoint point)
        {
            try
            {
                if (point == null)
                {
                    return string.Empty;
                }
                return (point.Address + ":" + point.Port);
            }
            catch (Exception)
            {
                return string.Empty;
            }
        }

        public ConversationParticipant FindParticipantByContact(Imps.Client.Core.Contact contact)
        {
            using (IEnumerator<ConversationParticipant> enumerator = this.Participants.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ConversationParticipant participant = enumerator.get_Current();
                    if (participant.Contact == contact)

⌨️ 快捷键说明

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