public void Update()
        {
            if (_presenceTask == null || _presenceTask.IsCompleted)
            {
                _presenceTask = Task.Run(async() =>
                {
                    if (_client == null)
                    {
                        _client = _editorClientProvider.GetClient <PresenceClient>();
                    }

                    _consoleHandle.LogInfo("Checking for editor presence from {0}...", Assembly.GetEntryAssembly().GetName().Name);

                    try
                    {
                        await _client.CheckAsync(new CheckPresenceRequest(), deadline: DateTime.UtcNow.AddSeconds(3));
                    }
                    catch
                    {
                        System.Console.Error.WriteLine("Unable to contact editor; automatically exiting!");
                        Environment.Exit(1);
                    }

                    await Task.Delay(10000);
                });
            }
        }
Esempio n. 2
0
        IEnumerator RequestPresence()
        {
            var task = PresenceClient.GetPresenceAsync(ClientURL, ClientIsCluster, ApplicationKey, AuthToken, Channel);

            yield return(StartCoroutine(task.WaitRoutine()));

            if (task.IsFaulted)
            {
                Terminal.LogError(String.Format("Error: {0}", task.Exception.Message));
            }
            else
            {
                var result = task.Result;

                Log(String.Format("Subscriptions {0}", result.Subscriptions));

                if (result.Metadata != null)
                {
                    foreach (var metadata in result.Metadata)
                    {
                        Log(metadata.Key + " - " + metadata.Value);
                    }
                }
            }
        }
Esempio n. 3
0
 public PresenceClient getPresenceClient()
 {
     if (presenceClient == null)
     {
         presenceClient = new PresenceClient(this);
     }
     return(presenceClient);
 }
Esempio n. 4
0
        IEnumerator DisablePresence()
        {
            var task = PresenceClient.DisablePresenceAsync(ClientURL, ClientIsCluster, ApplicationKey, PrivateKey, Channel);

            yield return(StartCoroutine(task.WaitRoutine()));

            if (task.IsFaulted)
            {
                Terminal.LogError(String.Format("Error: {0}", task.Exception.Message));
            }
            else
            {
                Log(task.Result);
            }
        }