Beispiel #1
0
 /// <summary>
 /// Connects to target.
 /// If platform doesn't require connection, just return true.
 /// IMPORTANT:
 /// Since NetCheat connects and attaches a few times after the user does (Constant write thread, searching, ect)
 /// You must have it automatically use the settings that the user input, instead of asking again
 /// This can be reset on Disconnect()
 /// </summary>
 public bool Connect()
 {
     this.xbManager = new XboxManager();
     this.xbCon     = this.xbManager.OpenConsole(this.xbManager.DefaultConsole);
     this.Xbox      = this.xbCon.OpenConnection(null);
     return(this.xbCon.Name != "");
 }
Beispiel #2
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;
    }
Beispiel #3
0
        /// <summary>
        ///     Open a connection to the XBox Console
        /// </summary>
        /// <returns>true if the connection was successful.</returns>
        public bool Connect()
        {
            if (!IsConnected)
            {
                try
                {
                    _xboxManager        = new XboxManager();
                    _xboxConsole        = _xboxManager.OpenConsole(DeviceIdent);
                    _xboxDebugTarget    = _xboxConsole.DebugTarget;
                    _xboxConnectionCode = _xboxConsole.OpenConnection(null);
                }
                catch
                {
                    _xboxManager     = null;
                    _xboxConsole     = null;
                    _xboxDebugTarget = null;
                    return(false);
                }

                try
                {
                    XboxType = _xboxConsole.ConsoleType.ToString();
                }
                catch
                {
                    XboxType = "Unable to get.";
                }

                IsConnected = true;
            }
            return(true);
        }
Beispiel #4
0
        public bool ConnectToConsole()
        {
            if (!this.activeConnection)
            {
                this.xbManager = new XboxManager();
                this.xbCon     = this.xbManager.OpenConsole(this.xbManager.DefaultConsole);

                try {
                    this.xboxConnection = this.xbCon.OpenConnection(null);
                }
                catch (Exception) {
                    ConnectionStatusLabel.Text = "Could not connect to console: " + this.xbManager.DefaultConsole;
                    return(false);
                }
                if (this.xbCon.DebugTarget.IsDebuggerConnected(out this.debuggerName, out this.userName))
                {
                    this.activeConnection      = true;
                    ConnectionStatusLabel.Text = "Connection to " + xbCon.Name + " established!";
                    return(true);
                }
                else
                {
                    this.xbCon.DebugTarget.ConnectAsDebugger("Xbox Toolbox", XboxDebugConnectFlags.Force);
                    if (!this.xbCon.DebugTarget.IsDebuggerConnected(out this.debuggerName, out this.userName))
                    {
                        ConnectionStatusLabel.Text = "Attempted to connect to console: " + xbCon.Name + " but failed";
                        return(false);
                    }
                    else
                    {
                        this.activeConnection      = true;
                        ConnectionStatusLabel.Text = "Connection to " + xbCon.Name + " established!";
                        return(true);
                    }
                }
            }
            else if (this.xbCon.DebugTarget.IsDebuggerConnected(out this.debuggerName, out this.userName))
            {
                ConnectionStatusLabel.Text = "Connection to " + xbCon.Name + " already established!";
                return(true);
            }
            else
            {
                this.activeConnection = false;
                return(ConnectToConsole());
            }
        }
Beispiel #5
0
        /// <summary>
        ///     Close the connection to the XBox Console
        /// </summary>
        public void Disconnect()
        {
            if (!IsConnected)
            {
                return;
            }

            if (_xboxConsole != null)
            {
                _xboxConsole.CloseConnection(_xboxConnectionCode);
            }

            _xboxManager     = null;
            _xboxDebugTarget = null;
            _xboxConsole     = null;
            IsConnected      = false;
        }
Beispiel #6
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();
     }
 }
Beispiel #7
0
 public void initialize()
 {
     if (!this.activeConnection)
     {
         this.xboxMgr = (IXboxManager) new XboxManagerClass();
         this.xbCon   = (\u002F\u002FboxConsolf)this.xboxMgr.OpenConsole(this.xboxMgr.DefaultConsole);
         try
         {
             this.xbConnection = this.xbCon.OpenConnection((string)null);
         }
         catch (Exception ex)
         {
             return;
         }
         string DebuggerName;
         string UserName;
         if (this.xbCon.DebugTarget.IsDebuggerConnected(out DebuggerName, out UserName))
         {
             this.activeConnection = true;
         }
         else
         {
             this.xbCon.DebugTarget.ConnectAsDebugger(nameof(XRPC), XboxDebugConnectFlags.Force);
             if (!this.xbCon.DebugTarget.IsDebuggerConnected(out DebuggerName, out UserName))
             {
                 return;
             }
             this.activeConnection = true;
         }
     }
     else
     {
         string DebuggerName;
         string UserName;
         if (this.xbCon.DebugTarget.IsDebuggerConnected(out DebuggerName, out UserName))
         {
             return;
         }
         this.activeConnection = false;
         this.Connect();
     }
 }
Beispiel #8
0
        public void initialize()
        {
            string str;
            string str2;

            if (!this.activeConnection)
            {
                this.xboxMgr = new XboxManager();
                this.xbCon   = this.xboxMgr.OpenConsole(this.xboxMgr.DefaultConsole);
                try
                {
                    this.xbConnection = this.xbCon.OpenConnection(null);
                }
                catch (Exception)
                {
                    return;
                }
                if (this.xbCon.DebugTarget.IsDebuggerConnected(out str, out str2))
                {
                    this.activeConnection = true;
                }
                else
                {
                    this.xbCon.DebugTarget.ConnectAsDebugger("XRPC", XboxDebugConnectFlags.Force);
                    if (this.xbCon.DebugTarget.IsDebuggerConnected(out str, out str2))
                    {
                        this.activeConnection = true;
                    }
                }
            }
            else if (!this.xbCon.DebugTarget.IsDebuggerConnected(out str, out str2))
            {
                this.activeConnection = false;
                this.Connect();
            }
        }
Beispiel #9
0
        /// <summary>
        /// Open a connection to the XBox Console
        /// </summary>
        /// <returns>true if the connection was successful.</returns>
        public bool Connect()
        {
            if (!IsConnected)
            {
                try
                {
                    _xboxManager = new XboxManager();
                    _xboxConsole = _xboxManager.OpenConsole(DeviceIdent);
                    _xboxDebugTarget = _xboxConsole.DebugTarget;
                    _xboxConnectionCode = _xboxConsole.OpenConnection(null);
                }
                catch
                {
                    _xboxManager = null;
                    _xboxConsole = null;
                    _xboxDebugTarget = null;
                    return false;
                }

                try { XboxType = _xboxConsole.ConsoleType.ToString(); }
                catch { XboxType = "Unable to get."; }

                IsConnected = true;
            }
            return true;
        }
Beispiel #10
0
        /// <summary>
        /// Close the connection to the XBox Console
        /// </summary>
        public void Disconnect()
        {
            if (!IsConnected) return;

            if (_xboxConsole != null)
                _xboxConsole.CloseConnection(_xboxConnectionCode);

            _xboxManager = null;
            _xboxDebugTarget = null;
            _xboxConsole = null;
            IsConnected = false;
        }
Beispiel #11
0
 public void Connect(string Console = "", bool ShowPopupMessages = false)
 {
     string[] strArray = Console.Split(new char[] { '.' });
     if (!this.xbdmConnection)
     {
         string str;
         string str2;
         this.xbManager = new XboxManager();
         this.xbConsole = this.xbManager.OpenConsole((Console == "") ? this.xbManager.DefaultConsole : Console);
         try
         {
             this.xbConsolenection = this.xbConsole.OpenConnection(null);
         }
         catch (Exception)
         {
             return;
         }
         if (this.xbConsole.DebugTarget.IsDebuggerConnected(out str, out str2))
         {
             this.xbdmConnection = true;
         }
         else
         {
             this.xbConsole.DebugTarget.ConnectAsDebugger("JRPC", XboxDebugConnectFlags.Force);
             if (!this.xbConsole.DebugTarget.IsDebuggerConnected(out str, out str2))
             {
                 MessageBox.Show("tried to connect to " + ((Console == "") ? this.xbManager.DefaultConsole : Console) + " and failed :(");
             }
             else
             {
                 this.xbdmConnection = true;
             }
         }
     }
     if (this.xbdmConnection)
     {
         this.client                        = new TcpClient((Console == "") ? this.XboxIP() : Console, 0x581);
         this.client.NoDelay                = true;
         this.client.LingerState.Enabled    = true;
         this.client.LingerState.LingerTime = 5;
         this.client.SendBufferSize         = 0x2134;
         this.client.ReceiveBufferSize      = 0x3e8;
         this.JRPC_BReader                  = new BinaryReader(this.client.GetStream());
         this.JRPC_Reader                   = new StreamReader(this.client.GetStream());
         this.JRPC_Writer                   = new StreamWriter(this.client.GetStream());
         if (this.Recv() != "JRPC2 connected")
         {
             this.activeConnection = false;
             if (ShowPopupMessages)
             {
                 MessageBox.Show("JRPC Couldn't Connect!\n\nPlease Try Again!");
             }
         }
         else
         {
             this.activeConnection = true;
             if (ShowPopupMessages)
             {
                 MessageBox.Show("JRPC Connected to " + this.xbManager.DefaultConsole);
             }
         }
     }
     else
     {
         this.activeConnection = false;
         if (ShowPopupMessages)
         {
             MessageBox.Show("JRPC Couldn't Connect!\n\nPlease Try Again!");
         }
     }
 }