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

📄 user.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 5 页
字号:
                    }
                    Thread.Sleep(0xea60);
                }
            }
        }

        private void DoSsiSignin(ref HttpWebRequest req)
        {
            try
            {
                string text2;
                string uriSsiAppSignIn = this.Configuration.SystemSetting.ServerUriSetting.UriSsiAppSignIn;
                if (FuncLimitedSetting.SSIEncryptLoginLimited)
                {
                    text2 = "&pwd=" + HttpWebRequestHelper.UrlEncode(this.Password);
                }
                else
                {
                    text2 = "&digest=" + this.Password;
                }
                if (this.Sid > 0)
                {
                    uriSsiAppSignIn = string.Format("{0}?sid={1}", uriSsiAppSignIn, this.Sid);
                }
                else
                {
                    if (string.IsNullOrEmpty(this.MobileNo))
                    {
                        return;
                    }
                    uriSsiAppSignIn = string.Format("{0}?mobileno={1}", uriSsiAppSignIn, this.MobileNo);
                }
                ClientLogger.WriteLogin("获取 credential", 0, uriSsiAppSignIn, 2);
                req = ConnectionFactory.CreateHttpWebRequest(uriSsiAppSignIn + text2, this, false, false);
                req.CookieContainer = new CookieContainer();
                Cookie cookie = null;
                using (HttpWebResponse response = ((HttpWebResponse) req.GetResponse()))
                {
                    cookie = response.Cookies["ssic"];
                }
                if (cookie == null)
                {
                    ClientLogger.WriteLogin("credential 获取失败", 20, "ssic为空", 2);
                    throw new SSIAuthException(StringTable.MsgLoginFailed);
                }
                this.SsiCredential = cookie.Value;
                ClientLogger.WriteLogin("credential 获取成功", 0, this._ssiCredential, 2);
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException("SSI Credential 获取失败", exception);
            }
        }

        private void EncodePassword(string password)
        {
            try
            {
                this._password = this._encryptor.Encrypt(password);
            }
            catch
            {
                this._password = password;
            }
        }

        internal void FireAutoLoginFailedInUiThread(ImpsErrorEventArgs e)
        {
            LogHelper.LogImpsError(e);
            if (this.Status == UserAccountStatus.Loginning)
            {
                this._loginCancelled = false;
                FuncDispatcher.InvokeEventHandlerInUiThread<ImpsErrorEventArgs>(this, this.AutoLoginFailed, e);
            }
        }

        internal void FireImpsErrorInUiThread(ImpsErrorEventArgs e)
        {
            LogHelper.LogImpsError(e);
            if ((this.Status == UserAccountStatus.Loginning) || (this.Status == UserAccountStatus.Logon))
            {
                FuncDispatcher.InvokeEventHandlerInUiThread<ImpsErrorEventArgs>(this, this.ImpsError, e);
            }
        }

        internal void FireImpsErrorInUiThread(ImpsErrorEventArgs e, AsyncBizOperation op)
        {
            if (op != null)
            {
                op.FireImpsErrorInUiThread(e);
            }
            if ((op == null) || !op.IsImpsErrorHandled)
            {
                this.FireImpsErrorInUiThread(e);
            }
        }

        private string GetExServiceName(string serviceId)
        {
            string text = string.Empty;
            string text2 = serviceId;
            if (text2 == null)
            {
                return text;
            }
            if (text2 != "Imps")
            {
                if (text2 != "VodafoneFederation")
                {
                    return text;
                }
            }
            else
            {
                return "Fetion服务";
            }
            return "与沃达丰(Vodafone)互通服务";
        }

        internal static int GetSSIExpirationTime(string ssic)
        {
            return BitConverter.ToInt32(Convert.FromBase64String(ssic), 1);
        }

        internal void GetUri(string sid, out string uriString, out string mobileNoString)
        {
            HttpWebRequest req = null;
            this.DoGetUri(ref req, sid, out uriString, out mobileNoString);
        }

        private void HandleImpsError(int err, string errMsg)
        {
            if (err == 0)
            {
                this.DoLoginFailed(new ImpsErrorEventArgs(errMsg));
            }
            else
            {
                this.DoLoginFailed(new ImpsErrorEventArgs(errMsg, err));
            }
        }

        private bool HandleReceiveRequest(SipRequest req)
        {
            string text;
            SipcEventHeader header = req.Message.Event;
            if ((header != null) && (((text = header.Value) != null) && (text == "registration")))
            {
                this.HandleRegistrationNotify(req);
                return true;
            }
            return false;
        }

        private void HandleRegistrationNotify(SipRequest req)
        {
            XmlDocument document = new XmlDocument();
            document.LoadXml(req.Message.Body);
            XmlNode node = document.DocumentElement.SelectSingleNode("event");
            if (node != null)
            {
                string text = XmlHelper.ReadXmlAttributeString(node, "type");
                string msgDeregistered = null;
                switch (text)
                {
                    case "deregistered":
                        msgDeregistered = StringTable.User.MsgDeregistered;
                        break;

                    case "unsubscribed":
                        msgDeregistered = StringTable.User.MsgUnsubscribed;
                        this.PersistentManager.DelById(this.Sid.ToString());
                        break;
                }
                if (msgDeregistered != null)
                {
                    FuncDispatcher.InvokeEventHandlerInUiThread<ImpsNotifyEventArgs>(this, this.RegistrationNotifyReceived, new ImpsNotifyEventArgs(msgDeregistered));
                    this.Status = UserAccountStatus.Logouting;
                    this.DoAfterLogout(SignoutMode.Normal);
                }
            }
        }

        public string HashPassword(byte[] password)
        {
            return DoHashPassword(password);
        }

        private void InitExServices()
        {
            this.SubscribedServices.Add("Imps", new ImpsService("Imps", "Fetion服务", string.Empty, true));
            if (Imps.Client.Core.FixedClientSetting.Instance.SupportVodafone)
            {
                this.SubscribedServices.Add("VodafoneFederation", new ImpsService("VodafoneFederation", "与沃达丰(Vodafone)互通服务", string.Empty, false));
            }
        }

        public void Initialize(long id, string password)
        {
            this.Clear();
            this._uri = new IicUri(string.Empty);
            this.Configuration.ClearSysCfg();
            this.Configuration.ClearImpsUserCfg();
            this.SsiCredential = string.Empty;
            if (ImpsHelper.IsCmccMobileNo(id))
            {
                this._sid = 0;
                this._info.MobileNo = id.ToString();
            }
            else
            {
                this.Sid = id;
                this._info.MobileNo = string.Empty;
            }
            this.Password = password;
            this.Status = UserAccountStatus.Initialized;
        }

        private void InitP2PManager()
        {
            this._p2pManager.LocalUser = this;
        }

        private void InnerBuildRegRequestBody(XmlWriter writer, object context)
        {
            writer.WriteStartElement("device");
            writer.WriteAttributeString("type", "PC");
            writer.WriteAttributeString("version", this.Configuration.UserSetting.CustomerCfgVersion.ToString());
            writer.WriteEndElement();
            writer.WriteStartElement("caps");
            writer.WriteAttributeString("value", "simple-im;im-session;temp-group");
            writer.WriteEndElement();
            writer.WriteStartElement("events");
            writer.WriteAttributeString("value", "contact;permission;system-message");
            writer.WriteEndElement();
            string oemTag = OemSetting.Instance.OemTag;
            if (!string.IsNullOrEmpty(oemTag))
            {
                writer.WriteStartElement("oem-tag");
                writer.WriteAttributeString("value", oemTag);
                writer.WriteEndElement();
            }
        }

        private SipcRequest InnerCreateSipcRequest(string method, ref long callId, int cSeq)
        {
            if (string.IsNullOrEmpty(method))
            {
                throw new ArgumentNullException("You should specify sipc method header!");
            }
            if (callId <= 0)
            {
                callId = (this.SipConnection == null) ? ((long) 0) : this.SipConnection.NextCallId();
            }
            if (string.IsNullOrEmpty(this.Domain))
            {
                throw new ArgumentNullException("Domain should not be null or String.Empty!");
            }
            string text = this.Sid.ToString();
            if (string.IsNullOrEmpty(text))
            {
                throw new ArgumentNullException("Sid should not be null or String.Empty!");
            }
            SipcRequest request = new SipcRequest(method, this.Domain);
            request.AddHeader(new SipcFromHeader(text));
            request.AddHeader(new SipcCallIdHeader(callId));
            request.AddHeader(new SipcCSeqHeader(cSeq, method));
            return request;
        }

        private void InnerFireAllPendingSipRequestReceived()
        {
            lock (this._syncObjPendingSipRequestReceived)
            {
                try
                {
                    if (this._pendingSipRequestReceived != null)
                    {
                        List<SipRequestReceivedEventArgs>.Enumerator enumerator = this._pendingSipRequestReceived.GetEnumerator();
                        try
                        {
                            while (enumerator.MoveNext())
                            {
                                SipRequestReceivedEventArgs e = enumerator.get_Current();
                                this.InnerFireSipRequestReceived(e);
                            }
                        }
                        finally
                        {
                            enumerator.Dispose();
                        }
                    }
                }
                catch
                {
                }
                finally
                {
                    this._pendingSipRequestReceived = null;
                }
            }
        }

        private void InnerFireSipRequestReceived(SipRequestReceivedEventArgs e)
        {
            SipRequest request = e.Request;
            if ((request.Message.Method == "N") || (request.Message.Method == "BN"))
            {
                FuncDispatcher.OnEventHandler<SipRequestReceivedEventArgs>(this, this.SipNotifyReceived, e);
            }
            else
            {
                FuncDispatcher.OnEventHandler<SipRequestReceivedEventArgs>(this, this.SipRequestReceived, e);
            }
        }

        public static bool IsAsLogon(UserAccountStatus status)
        {
            if (status != UserAccountStatus.OfflineLogon)
            {
                return (status == UserAccountStatus.Logon);
            }
            return true;
        }

        public bool IsPasswordCorrect(string password)
        {
            string b = DoHashPassword(Encoding.UTF8.GetBytes(password), ComputeAuthResponse.HexToBinary(this.Password.Substring(0, 8)));
            return string.Equals(this.Password, b);
        }

        public bool IsServiceSubscribed(string id)
        {
            if (this.SubscribedServices.ContainsKey(id))
            {
                return this.SubscribedServices.get_Item(id).Subscribed;
            }
            return false;
        }

⌨️ 快捷键说明

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