コード例 #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
        /// <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);
        }
コード例 #3
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public int EnumPorts(out IEnumDebugPorts2 ppEnum)
        {
            //
            // Retrieves a list of all the ports supplied by a port supplier.
            //

            LoggingUtils.PrintFunction();

            try
            {
                IDebugPort2 [] ports = new IDebugPort2 [m_registeredPorts.Count];

                m_registeredPorts.Values.CopyTo(ports, 0);

                ppEnum = new DebugPortEnumerator(ports);

                return(Constants.S_OK);
            }
            catch (Exception e)
            {
                LoggingUtils.HandleException(e);

                ppEnum = null;

                return(Constants.E_FAIL);
            }
        }
コード例 #4
0
 /// <inheritdoc />
 public int Clone(out IEnumDebugPorts2 ppEnum)
 {
     ppEnum = new EmuliciousPortEnumerator(ports)
     {
         position = position
     };
     return(VSConstants.S_OK);
 }
コード例 #5
0
            new public int EnumPorts(out IEnumDebugPorts2 ppEnum)
            {
                List <IDebugPort2> ports = new List <IDebugPort2>();

                foreach (NanoDeviceBase device in NanoFrameworkPackage.NanoDeviceCommService.DebugClient.NanoFrameworkDevices)
                {
                    ports.Add(new DebugPort(device, this));
                }

                ppEnum = new CorDebugEnum(ports, typeof(IDebugPort2), typeof(IEnumDebugPorts2));
                return(COM_HResults.S_OK);
            }
コード例 #6
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;
        }
コード例 #7
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);
        }
コード例 #8
0
ファイル: AD7PortSupplier.cs プロジェクト: yizhang82/MIEngine
        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);
        }
コード例 #9
0
        public int EnumPorts(out IEnumDebugPorts2 portsEnum)
        {
            var debugSessionMetrics = new DebugSessionMetrics(_metrics);

            debugSessionMetrics.UseNewDebugSessionId();
            var actionRecorder = new ActionRecorder(debugSessionMetrics);

            var action        = actionRecorder.CreateToolAction(ActionType.GameletsList);
            var gameletClient = _gameletClientFactory.Create(_cloudRunner.Intercept(action));
            var gameletsTask  = _cancelableTaskFactory.Create(
                "Querying instances...", () => gameletClient.ListGameletsAsync(onlyOwned: false));

            try
            {
                gameletsTask.RunAndRecord(action);
                List <Gamelet> gamelets = gameletsTask.Result;
                // show reserved instances first
                gamelets.Sort((g1, g2) =>
                {
                    if (g1.ReserverEmail != _developerAccount &&
                        g2.ReserverEmail != _developerAccount)
                    {
                        return(string.CompareOrdinal(g2.ReserverEmail, g1.ReserverEmail));
                    }

                    if (g1.ReserverEmail == _developerAccount &&
                        g2.ReserverEmail == _developerAccount)
                    {
                        return(string.CompareOrdinal(g2.DisplayName, g1.DisplayName));
                    }

                    return(g1.ReserverEmail == _developerAccount ? 1 : -1);
                });
                _ports = gamelets
                         .Select(gamelet => _debugPortFactory.Create(
                                     gamelet, this, debugSessionMetrics.DebugSessionId))
                         .ToList();
            }
            catch (CloudException e)
            {
                Trace.WriteLine(e.ToString());
                _dialogUtil.ShowError(e.Message);
                _ports.Clear();
            }

            portsEnum = new PortsEnum(_ports.ToArray());
            return(VSConstants.S_OK);
        }
コード例 #10
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public int EnumPersistedPorts(BSTR_ARRAY PortNames, out IEnumDebugPorts2 ppEnum)
        {
            //
            // This method retrieves an object that allows enumeration of the list of persisted ports.
            //

            LoggingUtils.PrintFunction();

            try
            {
#if false
                AndroidAdb.Refresh();

                if (PortNames.dwCount > 0)
                {
                    // TODO: This conversion process is tricky, and still broken.
                    _BSTR_ARRAY portNames = (_BSTR_ARRAY)Marshal.PtrToStructure(PortNames.Members, typeof(_BSTR_ARRAY));

                    for (int i = 0; i < PortNames.dwCount; ++i)
                    {
                        IDebugPort2 ppPort;

                        AndroidDevice device = AndroidAdb.GetConnectedDeviceById(portNames.Members [i]);

                        LoggingUtils.RequireOk(AddPort(new DevicePortRequest(device), out ppPort));
                    }
                }
#endif

                LoggingUtils.RequireOk(EnumPorts(out ppEnum));

                return(Constants.S_OK);
            }
            catch (Exception e)
            {
                LoggingUtils.HandleException(e);

                ppEnum = null;

                return(Constants.E_FAIL);
            }
        }
コード例 #11
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public int EnumPersistedPorts(BSTR_ARRAY PortNames, out IEnumDebugPorts2 ppEnum)
        {
            //
            // This method retrieves an object that allows enumeration of the list of persisted ports.
            //

            LoggingUtils.PrintFunction();

            ppEnum = null;

            try
            {
                throw new NotImplementedException();
            }
            catch (NotImplementedException e)
            {
                LoggingUtils.HandleException(e);

                return(Constants.E_NOTIMPL);
            }
        }
コード例 #12
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public int EnumPorts(out IEnumDebugPorts2 ppEnum)
        {
            //
            // Retrieves a list of all the ports supplied by a port supplier.
            //

            LoggingUtils.PrintFunction();

            try
            {
                AndroidAdb.Refresh();

                AndroidDevice [] connectedDevices = AndroidAdb.GetConnectedDevices();

                foreach (AndroidDevice device in connectedDevices)
                {
                    IDebugPort2 ppPort;

                    LoggingUtils.RequireOk(AddPort(new DevicePortRequest(device), out ppPort));
                }

                IDebugPort2 [] ports = new IDebugPort2 [m_registeredPorts.Count];

                m_registeredPorts.Values.CopyTo(ports, 0);

                ppEnum = new DebugPortEnumerator(ports);

                return(Constants.S_OK);
            }
            catch (Exception e)
            {
                LoggingUtils.HandleException(e);

                ppEnum = null;

                return(Constants.E_FAIL);
            }
        }
コード例 #13
0
 public int Clone(out IEnumDebugPorts2 ppEnum)
 {
     ppEnum = (IEnumDebugPorts2)Clone();
     return(COM_HResults.S_OK);
 }
コード例 #14
0
 public int EnumPorts(out IEnumDebugPorts2 ppEnum)
 {
     ppEnum = null;
     return(0);
 }
コード例 #15
0
 new public int EnumPorts(out IEnumDebugPorts2 ppEnum)
 {
     ppEnum = new CorDebugEnum(m_ports, typeof(IDebugPort2), typeof(IEnumDebugPorts2));
     return Utility.COM_HResults.S_OK;
 }
コード例 #16
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;
        }
コード例 #17
0
 public int EnumPorts(out IEnumDebugPorts2 ppEnum)
 {
     ppEnum = new AD7DebugPortsEnum(_ports.ToArray());
     return(VSConstants.S_OK);
 }
コード例 #18
0
 public int EnumPorts(out IEnumDebugPorts2 ppEnum)
 {
     throw new NotImplementedException();
 }
コード例 #19
0
 public int EnumPorts(out IEnumDebugPorts2 ppEnum)
 {
     ppEnum = null;
     return(VSConstants.S_OK);
 }
コード例 #20
0
 public int Clone(out IEnumDebugPorts2 ppEnum)
 {
     ppEnum = (IEnumDebugPorts2) Clone();
     return Utility.COM_HResults.S_OK;
 }
コード例 #21
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;
        }
コード例 #22
0
 public int EnumPorts(out IEnumDebugPorts2 ppEnum)
 {
     return(s_portSupplier.EnumPorts(out ppEnum));
 }
コード例 #23
0
 new public int EnumPorts(out IEnumDebugPorts2 ppEnum)
 {
     ppEnum = new CorDebugEnum(_ports, typeof(IDebugPort2), typeof(IEnumDebugPorts2));
     return(COM_HResults.S_OK);
 }
コード例 #24
0
 public int EnumPorts(out IEnumDebugPorts2 ppEnum)
 {
     return s_portSupplier.EnumPorts(out ppEnum);
 }
コード例 #25
0
 /// <summary>
 /// Enumerate all ports
 /// </summary>
 public int EnumPorts(out IEnumDebugPorts2 ppEnum)
 {
     DLog.Debug(DContext.VSDebuggerComCall, "DebugPortSupplier.EnumPorts");
     ppEnum = new PortEnum(ports.Values.Cast <IDebugPort2>().ToArray());
     return(VSConstants.S_OK);
 }
コード例 #26
0
 public override int EnumPersistedPorts(BSTR_ARRAY portNames, out IEnumDebugPorts2 portEnum)
 {
     // This should never be called since CanPersistPorts returns S_OK
     Debug.Fail("Why is EnumPersistedPorts called?");
     throw new NotImplementedException();
 }
コード例 #27
0
ファイル: DebugPortSupplier.cs プロジェクト: Xtremrules/dot42
 /// <summary>
 /// Enumerate all ports
 /// </summary>
 public int EnumPorts(out IEnumDebugPorts2 ppEnum)
 {
     DLog.Debug(DContext.VSDebuggerComCall, "DebugPortSupplier.EnumPorts");
     ppEnum = new PortEnum(ports.Values.Cast<IDebugPort2>().ToArray());
     return VSConstants.S_OK;
 }
コード例 #28
0
 public int EnumPersistedPorts(BSTR_ARRAY PortNames, out IEnumDebugPorts2 ppEnum)
 {
     throw new NotImplementedException();
 }
コード例 #29
0
 public int EnumPorts(out IEnumDebugPorts2 ppEnum) {
     ppEnum = null;
     return VSConstants.S_OK;
 }
コード例 #30
0
 /// <summary>
 /// Retrieves a list of all the ports supplied by a port supplier.
 /// </summary>
 /// <param name="ppEnum">Returns an IEnumDebugPorts2 object containing a list of ports supplied.</param>
 /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns>
 public virtual int EnumPorts(out IEnumDebugPorts2 ppEnum)
 {
     Logger.Debug(string.Empty);
     ppEnum = null;
     return(VSConstants.E_NOTIMPL);
 }
コード例 #31
0
 public int EnumPorts(out IEnumDebugPorts2 ppEnum)
 {
     return(((IDebugPortSupplier2)_portSupplier).EnumPorts(out ppEnum));
 }
コード例 #32
0
 public int EnumPorts(out IEnumDebugPorts2 ppEnum)
 {
     ppEnum = null;
     return 0;
 }
コード例 #33
0
 /// <summary>
 /// Retrieves a list of all the ports supplied by a port supplier.
 /// </summary>
 /// <param name="ppEnum">Returns an IEnumDebugPorts2 object containing a list of ports supplied.</param>
 /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns>
 public virtual int EnumPorts( out IEnumDebugPorts2 ppEnum )
 {
     Logger.Debug( string.Empty );
     ppEnum = null;
     return VSConstants.E_NOTIMPL;
 }
コード例 #34
0
 /// <summary>
 /// If CanPersistPorts() returns false, the SDM will cache the ports and EnumPersistedPorts() needs to be implemented
 /// </summary>
 /// <param name="portNames"></param>
 /// <param name="portEnum"></param>
 /// <returns></returns>
 public abstract int EnumPersistedPorts(BSTR_ARRAY portNames, out IEnumDebugPorts2 portEnum);
コード例 #35
0
ファイル: AD7PortSupplier.cs プロジェクト: hkopparru/VSPlugin
 int IDebugPortSupplier2.EnumPorts(out IEnumDebugPorts2 ppEnum)
 {
     throw new NotImplementedException();
 }
コード例 #36
0
 int IDebugPortSupplier2.EnumPorts(out IEnumDebugPorts2 ppEnum)
 {
     throw new NotImplementedException();
 }
コード例 #37
0
 int IDebugPortSupplier2.EnumPorts(out IEnumDebugPorts2 ppEnum)
 {
     ppEnum = null;
     return(VSConstants.E_NOTIMPL);
 }