예제 #1
0
        public override int EnumPorts(out IEnumDebugPorts2 ppEnum)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (_distros == null)
            {
                IVsUIShell shell = Package.GetGlobalService(typeof(SVsUIShell)) as IVsUIShell;

                try
                {
                    WSLCommandLine.EnsureInitialized();
                    _distros = WSLCommandLine.GetInstalledDistros();
                }
                catch (Exception ex)
                {
                    shell.SetErrorInfo(ex.HResult, ex.Message, 0, null, null);
                    shell.ReportErrorInfo(ex.HResult);
                    ppEnum = null;
                    return(VSConstants.E_ABORT);
                }
            }

            WSLPort[] ports = _distros.Select(name => new WSLPort(this, name, isInAddPort: false)).ToArray();
            ppEnum = new AD7PortEnum(ports);
            return(HR.S_OK);
        }
예제 #2
0
        public override unsafe int EnumPersistedPorts(BSTR_ARRAY portNames, out IEnumDebugPorts2 portEnum)
        {
            IDebugPort2[] ports = new IDebugPort2[portNames.dwCount];
            for (int c = 0; c < portNames.dwCount; c++)
            {
                char * bstrPortName = ((char **)portNames.Members)[c];
                string name         = new string(bstrPortName);

                ports[c] = new DockerPort(this, name, isInAddPort: false);
            }

            portEnum = new AD7PortEnum(ports);
            return(HR.S_OK);
        }
예제 #3
0
        public int EnumPorts(out IEnumDebugPorts2 ppEnum)
        {
            ConnectionInfoStore store = new ConnectionInfoStore();
            IDebugPort2[] ports = new IDebugPort2[store.Connections.Count];

            for (int i = 0; i < store.Connections.Count; i++)
            {
                ConnectionInfo connectionInfo = (ConnectionInfo)store.Connections[i];
                ports[i] = new AD7Port(this, ConnectionManager.GetFormattedConnectionName(connectionInfo), isInAddPort: false);
            }

            ppEnum = new AD7PortEnum(ports);
            return HR.S_OK;
        }
예제 #4
0
        public override int EnumPorts(out IEnumDebugPorts2 ppEnum)
        {
            ConnectionInfoStore store = new ConnectionInfoStore();

            IDebugPort2[] ports = new IDebugPort2[store.Connections.Count];

            for (int i = 0; i < store.Connections.Count; i++)
            {
                ConnectionInfo connectionInfo = (ConnectionInfo)store.Connections[i];
                ports[i] = new SSHPort(this, GetFormattedSSHConnectionName(connectionInfo), isInAddPort: false);
            }

            ppEnum = new AD7PortEnum(ports);
            return(HR.S_OK);
        }
예제 #5
0
        /// <summary>
        /// Retrieves a list of all the ports supplied by a port supplier. (http://msdn.microsoft.com/en-ca/library/bb146984.aspx)
        /// </summary>
        /// <param name="ppEnum"> Returns an IEnumDebugPorts2 object containing a list of ports supplied. </param>
        /// <returns> VSConstants.S_OK. </returns>
        public int EnumPorts(out IEnumDebugPorts2 ppEnum)
        {
            m_ports.Clear();
            int success = verifyAndAddPorts();
            AD7Port[] ports = new AD7Port[m_ports.Count()];

            if (m_ports.Count() > 0)
            {
                int i = 0;
                foreach (var p in m_ports)
                {
                    ports[i] = p.Value;
                    i++;
                }
            }
            else
            {
                if (success == 0)
                    MessageBox.Show("Visual Studio can debug only one BlackBerry application at a time.\n\nPlease, select a different transport or close the current debug session.", "Visual Studio is already debugging an application", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                else if (success == -1)
                    MessageBox.Show("You must select an API Level to be able to attach to a running process.\n\nPlease, use \"BlackBerry -> Settings -> Get more\" to download one.", "Missing NDK", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                else
                    MessageBox.Show("Missing Device/Simulator information. Please, use menu BlackBerry -> Settings to add any of those information.", "Missing Device/Simulator Data", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            ppEnum = new AD7PortEnum(ports);
            return VSConstants.S_OK;
        }
예제 #6
0
        public unsafe int EnumPersistedPorts(BSTR_ARRAY portNames, out IEnumDebugPorts2 portEnum)
        {
            IDebugPort2[] ports = new IDebugPort2[portNames.dwCount];
            for (int c = 0; c < portNames.dwCount; c++)
            {
                char* bstrPortName = ((char**)portNames.Members)[c];
                string name = new string(bstrPortName);

                ports[c] = new AD7Port(this, name, isInAddPort: false);
            }

            portEnum = new AD7PortEnum(ports);
            return HR.S_OK;
        }