Пример #1
0
    public static void Connect()
    {
        m_XboxManager = new XboxManager();
        m_XboxConsole = m_XboxManager.OpenConsole(m_XboxManager.DefaultConsole);

        try
        {
            m_XboxConnection = m_XboxConsole.OpenConnection(null);
        }
        catch (Exception)
        {
            throw new Exception("Couldn't connect to console: " + m_XboxManager.DefaultConsole);
        }

        if (!m_XboxConsole.DebugTarget.IsDebuggerConnected(out string debuggerName, out string userName))
        {
            m_XboxConsole.DebugTarget.ConnectAsDebugger("XboxTool", XboxDebugConnectFlags.Force);

            if (!m_XboxConsole.DebugTarget.IsDebuggerConnected(out debuggerName, out userName))
            {
                throw new Exception("Couldn't connect a debugger to console: " + m_XboxConsole.Name);
            }
        }

        m_ActiveConnection = true;
    }
Пример #2
0
 public void initialize()
 {
     if (!activeConnection)
     {
         xboxMgr = new XboxManagerClass();
         xbCon   = xboxMgr.OpenConsole(xboxMgr.DefaultConsole);
         try
         {
             xbConnection = xbCon.OpenConnection((string)null);
         }
         catch (Exception)
         {
             return;
         }
         string DebuggerName;
         string UserName;
         if (xbCon.DebugTarget.IsDebuggerConnected(out DebuggerName, out UserName))
         {
             activeConnection = true;
         }
         else
         {
             xbCon.DebugTarget.ConnectAsDebugger(nameof(XRPC), XboxDebugConnectFlags.Force);
             if (!xbCon.DebugTarget.IsDebuggerConnected(out DebuggerName, out UserName))
             {
                 return;
             }
             activeConnection = true;
         }
     }
     else
     {
         string DebuggerName;
         string UserName;
         if (xbCon.DebugTarget.IsDebuggerConnected(out DebuggerName, out UserName))
         {
             return;
         }
         activeConnection = false;
         Connect();
     }
 }