static UnitySoftDebuggerEngine() { UnityPlayers = new Dictionary <uint, PlayerConnection.PlayerInfo> (); ConnectorRegistry = new ConnectorRegistry(); bool run = true; MonoDevelop.Ide.IdeApp.Exiting += (sender, args) => run = false; try { // HACK: Poll Unity players unityPlayerConnection = new PlayerConnection(); ThreadPool.QueueUserWorkItem(delegate { while (run) { lock (unityPlayerConnection) { unityPlayerConnection.Poll(); } Thread.Sleep(1000); } }); } catch (Exception e) { MonoDevelop.Core.LoggingService.LogError("Error launching player connection discovery service: Unity player discovery will be unavailable", e); } }
static UnitySoftDebuggerEngine () { UnityPlayers = new Dictionary<uint, PlayerConnection.PlayerInfo> (); ConnectorRegistry = new ConnectorRegistry(); bool run = true; MonoDevelop.Ide.IdeApp.Exiting += (sender, args) => run = false; try { // HACK: Poll Unity players unityPlayerConnection = new PlayerConnection (); ThreadPool.QueueUserWorkItem (delegate { while (run) { lock (unityPlayerConnection) { unityPlayerConnection.Poll (); } Thread.Sleep (1000); } }); } catch (Exception e) { MonoDevelop.Core.LoggingService.LogError ("Error launching player connection discovery service: Unity player discovery will be unavailable", e); } }
static UnityProcessDiscovery() { UnityPlayers = new Dictionary <uint, PlayerConnection.PlayerInfo>(); ConnectorRegistry = new ConnectorRegistry(); try { // HACK: Poll Unity players unityPlayerConnection = new PlayerConnection(); ThreadPool.QueueUserWorkItem(delegate { while (run) { lock (unityPlayerConnection) { unityPlayerConnection.Poll(); } Thread.Sleep(1000); } }); } catch (Exception e) { UnityDebug.Log.Write("Error launching player connection discovery service: Unity player discovery will be unavailable"); UnityDebug.Log.Write(e.ToString()); Log.Error("Error launching player connection discovery service: Unity player discovery will be unavailable", e); } }
static UnitySoftDebuggerEngine () { UnityPlayers = new Dictionary<uint, PlayerConnection.PlayerInfo> (); try { // HACK: Poll Unity players unityPlayerConnection = new PlayerConnection (); ThreadPool.QueueUserWorkItem (delegate { while (true) { lock (unityPlayerConnection) { unityPlayerConnection.Poll (); } Thread.Sleep (1000); } }); } catch (Exception e) { MonoDevelop.Core.LoggingService.LogError ("Error launching player connection discovery service: Unity player discovery will be unavailable", e); } }
static UnitySoftDebuggerEngine() { UnityPlayers = new Dictionary <uint, PlayerConnection.PlayerInfo> (); try { // HACK: Poll Unity players unityPlayerConnection = new PlayerConnection(); ThreadPool.QueueUserWorkItem(delegate { while (true) { lock (unityPlayerConnection) { unityPlayerConnection.Poll(); } Thread.Sleep(1000); } }); } catch (Exception e) { MonoDevelop.Core.LoggingService.LogError("Error launching player connection discovery service: Unity player discovery will be unavailable", e); } }
public static List <UnityProcessInfo> GetUnityPlayerProcesses(bool block) { int index = 1; List <UnityProcessInfo> processes = new List <UnityProcessInfo>(); if (null == unityPlayerConnection) { return(processes); } UnityDebug.Log.Write("UnityPlayerConnection is constructed"); if (block) { Monitor.Enter(unityPlayerConnection); UnityDebug.Log.Write("Known size of available Players: " + unityPlayerConnection.AvailablePlayers.Count()); for (int i = 0; i < 12 && !unityPlayerConnection.AvailablePlayers.Any(); ++i) { unityPlayerConnection.Poll(); Thread.Sleep(250); } } else if (!Monitor.TryEnter(unityPlayerConnection)) { return(processes); } UnityDebug.Log.Write("New size of available Players: " + unityPlayerConnection.AvailablePlayers.Count()); foreach (var availablePlayer in unityPlayerConnection.AvailablePlayers) { UnityDebug.Log.Write($"Available player: {availablePlayer}"); } try { foreach (string player in unityPlayerConnection.AvailablePlayers) { try { PlayerConnection.PlayerInfo info = PlayerConnection.PlayerInfo.Parse(player); if (info.m_AllowDebugging) { UnityPlayers[info.m_Guid] = info; processes.Add(new UnityProcessInfo(info.m_Guid, info.m_Id, info.m_ProjectName)); ++index; } } catch (Exception e) { UnityDebug.Log.Write($"{player}: could not be parsed: {e.Message}"); // Don't care; continue } } } finally { Monitor.Exit(unityPlayerConnection); } return(processes); }