Exemple #1
0
        void HandleLogOnResponse(IPacketMsg packetMsg)
        {
            if (!packetMsg.IsProto)
            {
                // a non proto ClientLogonResponse can come in as a result of connecting but never sending a ClientLogon
                // in this case, it always fails, so we don't need to do anything special here
                DebugLog.WriteLine("CMClient", "Got non-proto logon response, this is indicative of no logon attempt after connecting.");
                return;
            }

            var logonResp = new ClientMsgProtobuf <CMsgClientLogonResponse>(packetMsg);

            if (logonResp.Body.eresult == ( int )EResult.OK)
            {
                SessionID = logonResp.ProtoHeader.client_sessionid;
                SteamID   = logonResp.ProtoHeader.steamid;

                CellID = logonResp.Body.cell_id;

                int hbDelay = logonResp.Body.out_of_game_heartbeat_seconds;

                // restart heartbeat
                heartBeatFunc.Stop();
                heartBeatFunc.Delay = TimeSpan.FromSeconds(hbDelay);
                heartBeatFunc.Start();
            }
        }
Exemple #2
0
        void HandleLogOnResponse(IPacketMsg packetMsg)
        {
            if (!packetMsg.IsProto)
            {
                // a non proto ClientLogonResponse can come in as a result of connecting but never sending a ClientLogon
                // in this case, it always fails, so we don't need to do anything special here
                LogDebug("CMClient", "Got non-proto logon response, this is indicative of no logon attempt after connecting.");
                return;
            }

            var logonResp   = new ClientMsgProtobuf <CMsgClientLogonResponse>(packetMsg);
            var logonResult = ( EResult )logonResp.Body.eresult;

            if (logonResult == EResult.OK)
            {
                SessionID = logonResp.ProtoHeader.client_sessionid;
                SteamID   = logonResp.ProtoHeader.steamid;

                CellID        = logonResp.Body.cell_id;
                PublicIP      = NetHelpers.GetIPAddress(logonResp.Body.deprecated_public_ip);
                IPCountryCode = logonResp.Body.ip_country_code;

                int hbDelay = logonResp.Body.out_of_game_heartbeat_seconds;

                // restart heartbeat
                heartBeatFunc.Stop();
                heartBeatFunc.Delay = TimeSpan.FromSeconds(hbDelay);
                heartBeatFunc.Start();
            }
            else if (logonResult == EResult.TryAnotherCM || logonResult == EResult.ServiceUnavailable)
            {
                Servers.TryMark(connection.CurrentEndPoint, connection.ProtocolTypes, ServerQuality.Bad);
            }
        }
Exemple #3
0
        private void scroll_to_smooth(DOMPoint location)
        {/* https://www.w3.org/TR/cssom-view-1/#concept-smooth-scroll */
            if (smooth_scroller == null)
            {
                smooth_scroller = new ScheduledFunction(this._smooth_scroll_tick, TimeSpan.FromMilliseconds(2));
            }

            /* Find distance between current position and target position */
            double distX = location.x - ScrollX;
            double distY = location.y - ScrollY;

            /* Calculate our delta step size so we know how much to add to our scroll position per tick */
            double deltaX = distX / (double)Smooth_Scroll_Anim_Time.Ticks;
            double deltaY = distY / (double)Smooth_Scroll_Anim_Time.Ticks;

            Smooth_Scroll_Target   = location;
            Smooth_Scroll_Distance = new DOMPoint(distX, distY);

            /* Set the end time */
            Smooth_Scroll_End_Time = (DateTime.Now + Smooth_Scroll_Anim_Time).Ticks;
            /* Start scrolling */
            smooth_scroller.Start();
        }
Exemple #4
0
        void HandleLogOnResponse(IPacketMsg packetMsg)
        {
            if (!packetMsg.IsProto)
            {
                DebugLog.WriteLine("CMClient", "HandleLogOnResponse got non-proto MsgClientLogonResponse!!");
                return;
            }


            var logonResp = new ClientMsgProtobuf <CMsgClientLogonResponse>(packetMsg);

            if (logonResp.Body.eresult == ( int )EResult.OK)
            {
                SessionID = logonResp.ProtoHeader.client_sessionid;
                SteamID   = logonResp.ProtoHeader.steamid;

                int hbDelay = logonResp.Body.out_of_game_heartbeat_seconds;

                // restart heartbeat
                heartBeatFunc.Stop();
                heartBeatFunc.Delay = TimeSpan.FromSeconds(hbDelay);
                heartBeatFunc.Start();
            }
        }