Exemplo n.º 1
0
        private void HandleEndpointSignOut(object sender, EndpointEventArgs eventArgs)
        {
            using (m_Diagnostics.Profiler.Measure(CommunicationConstants.TimingGroup, "Endpoint disconnected - removing proxies."))
            {
                lock (m_Lock)
                {
                    if (HasProxyFor(eventArgs.Endpoint))
                    {
                        m_Diagnostics.Log(
                            LevelToLog.Trace,
                            CommunicationConstants.DefaultLogTextPrefix,
                            string.Format(
                                CultureInfo.InvariantCulture,
                                "Removing {0} for endpoint [{1}].",
                                TraceNameForProxyObjects(),
                                eventArgs.Endpoint));

                        RemoveProxiesFor(eventArgs.Endpoint);
                    }
                }

                using (m_Diagnostics.Profiler.Measure(CommunicationConstants.TimingGroup, "Notifying of proxy removal."))
                {
                    RaiseOnEndpointDisconnected(eventArgs.Endpoint);
                }
            }
        }
        private void HandleOnEndpointConnected(object sender, EndpointEventArgs args)
        {
            var endpoint      = args.Endpoint;
            var notifications = m_RemoteNotifications.NotificationsFor <ITestNotificationSet>(endpoint);

            notifications.OnNotify += (s, e) => AddNewMessage(endpoint, "Received notification");
        }
Exemplo n.º 3
0
 private void Endpoint_Disabled(object sender, EndpointEventArgs e)
 {
     if (e.IsOperationCompleteFailed)
     {
         ShowDisconnectWindow(new EndpointEventArgs[] { e, });
     }
 }
Exemplo n.º 4
0
        //private void BindVideo()
        //{
        //    if (videoLarge.Child != Endpoint.AvSession1)
        //    {
        //        if (Endpoint.AvSession1 != null && Endpoint.AvSession1.VideoInChannelCount > 0)
        //        {
        //            Endpoint.AvSession1.VideoWindow.IsVideo2Visible = ViewLocalVideo;

        //            videoLarge.Child = Endpoint.AvSession1.VideoWindow;
        //            videoLarge.Visibility = Visibility.Visible;
        //        }
        //        else
        //        {
        //            videoLarge.Child = null;
        //            videoLarge.Visibility = Visibility.Collapsed;
        //        }
        //    }
        //}

        //private void Endpoint_PropertyChanged(object sender, PropertyChangedEventArgs e)
        //{
        //    if (e.PropertyName == @"AvSession1")
        //    {
        //        if (Endpoint.AvSession1 != null)
        //            Endpoint.AvSession1.PropertyChanged += AvSession1_PropertyChanged;
        //        BindVideo();
        //    }
        //}

        //private void AvSession1_PropertyChanged(object sender, PropertyChangedEventArgs e)
        //{
        //    if (e.PropertyName == @"VideoInChannelCount")
        //        BindVideo();
        //}

        private void Endpoint_Disabled(object sender, EndpointEventArgs e)
        {
            if (Endpoint.AvSession1 != null)
            {
                Endpoint.AvSession1.Destroy();
            }
        }
Exemplo n.º 5
0
 private void HandleEndpointSignIn(object sender, EndpointEventArgs e)
 {
     lock (m_Lock)
     {
         // Potentially a new endpoint so store it
         StorePotentialEndpoint(e.Endpoint);
         InitiateHandshakeWith(e.Endpoint);
     }
 }
Exemplo n.º 6
0
        //event for passing in new founded endpoint
        private void FoundedNewEndpointChanged(object sender, EndpointEventArgs e)
        {
            endpointsList.Add(e.EndpointsList[0]);
            StartObtainingData(e.EndpointsList[0]);

            var logger = NLog.LogManager.GetCurrentClassLogger();

            logger.Info("Found new endpoint: " + e.EndpointsList[0]);
        }
Exemplo n.º 7
0
        // How do we handle endpoints disappearing and then reappearing. If the remote process
        // crashed then we'll have an enpoint on the same machine but with another process id.
        // The catch is that we can't just look for the machine name because there is a possibility
        // that there will be more than one process on the machine .... Gah
        //
        // Also note that it is quite easily possible to fake being another endpoint. All you have
        // to do is send a message saying that you're a different endpoint and then the evil is
        // done. Not quite sure how to make that not happen though ...
        private void HandleEndpointSignedOut(object sender, EndpointEventArgs args)
        {
            if (m_Layer.Id.Equals(args.Endpoint))
            {
                return;
            }

            RemoveEndpoint(args.Endpoint);
        }
Exemplo n.º 8
0
        private void HandleOnConfirmChannelIntegrity(object sender, EndpointEventArgs e)
        {
            ConnectionMap map;

            if (m_RegisteredConnections.TryGetValue(e.Endpoint, out map))
            {
                map.NextConnectionTime         = m_Now() + m_MaximumTimeBetweenConnectionConfirmations;
                map.NumberOfConnectionFailures = 0;
            }
        }
Exemplo n.º 9
0
        private void HandleOnEndpointConnected(object sender, EndpointEventArgs e)
        {
            var map = new ConnectionMap(e.Endpoint)
            {
                NextConnectionTime         = m_Now() + m_MaximumTimeBetweenConnectionConfirmations,
                NumberOfConnectionFailures = 0,
            };

            m_RegisteredConnections.TryAdd(e.Endpoint, map);
        }
Exemplo n.º 10
0
 //event for finished process of searching for makao host service endpoints
 private void FinishedSearchingForEndpoints(object sender, EndpointEventArgs e)
 {
     if (endpointsList.Count == 0)
     {
         NoHostsFoundInfo.Visibility         = Visibility.Visible;
         AdEndpointManuallyButton.Visibility = Visibility.Visible;
     }
     else
     {
         AdEndpointManuallyButton.Visibility = Visibility.Collapsed;
     }
     ChangeVisibilityOfSearchInProgressText(false);
     ManagePossibilityOfConnectionToHost(true);
 }
Exemplo n.º 11
0
        // How do we handle endpoints disappearing and then reappearing. If the remote process
        // crashed then we'll have an enpoint on the same machine but with another process id.
        // The catch is that we can't just look for the machine name because there is a possibility
        // that there will be more than one process on the machine .... Gah
        //
        // Also note that it is quite easily possible to fake being another endpoint. All you have
        // to do is send a message saying that you're a different endpoint and then the evil is
        // done. Not quite sure how to make that not happen though ...
        private void HandleEndpointDisconnecting(object sender, EndpointEventArgs args)
        {
            if (m_Id.Equals(args.Endpoint))
            {
                return;
            }

            var connection = RetrieveEndpointConnection(args.Endpoint);

            if (connection == null)
            {
                return;
            }

            foreach (var pair in m_OpenConnections)
            {
                pair.Value.Item1.EndpointDisconnected(connection.ProtocolInformation);
                pair.Value.Item2.OnEndpointSignedOff(args.Endpoint);
            }
        }
Exemplo n.º 12
0
        private void OnEndpointEvent(object src, EndpointEventArgs args)
        {
            if (args.EventType == "Update" && args.URI == "/lol-gameflow/v1/session")
            {
                var phase = args.JSON["phase"].Value <string>();

                if (phase == "EndOfGame" && downloadAllReplaysCheckbox.Checked)
                {
                    var gameId = args.JSON["gameData"]["gameId"].Value <long>();
                    try
                    {
                        QsoApi.DownloadReplay(gameId);
                        Console.WriteLine($"Downloading replay for game {gameId}");
                        trayIcon.ShowBalloonTip(2500, "Qso Client", "Downloading replay of your latest game!", ToolTipIcon.Info);
                        if (alertWhenManyReplaysCheckbox.Checked)
                        {
                            DirectoryInfo d = new DirectoryInfo(QsoApi.GetReplaysPath());
                            if (d.GetFiles().Length >= 50)
                            {
                                long size = 0;
                                d.GetFiles().Select(f => f.Length).ToList().ForEach(s => size += s);
                                MessageBox.Show($"Your replay folder currently contains {d.GetFiles().Length} files, sitting at {size / 1048576}MB. You should clean it out to save space on your drive.", "Replay Folder Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                        }
                    }
                    catch (QsoEndpointException)
                    {
                        trayIcon.ShowBalloonTip(2500, "Qso Client", "Failed to download latest replay.", ToolTipIcon.Error);
                    }
                }
                else if (phase == "ReadyCheck" && autoAcceptQueueCheckbox.Checked)
                {
                    QsoApi.AcceptQueue();
                }
            }
        }
Exemplo n.º 13
0
        private void HandleOnEndpointDisconnected(object sender, EndpointEventArgs e)
        {
            ConnectionMap map;

            m_RegisteredConnections.TryRemove(e.Endpoint, out map);
        }