Contains information about port forwarding configured by the Android Debug Bridge.
Beispiel #1
0
        /// <inheritdoc/>
        public IEnumerable <ForwardData> ListReverse(DeviceData device)
        {
            this.EnsureDevice(device);

            using (IAdbSocket socket = this.adbSocketFactory(this.EndPoint))
            {
                socket.SendAdbRequest("host:transport:" + device.Serial);
                var response = socket.ReadAdbResponse();

                if (!response.Okay)
                {
                    return(null);
                }

                socket.SendAdbRequest($"reverse:list-forward");
                response = socket.ReadAdbResponse();

                if (!response.Okay)
                {
                    return(null);
                }

                var data = socket.ReadString();

                var parts = data.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

                return(parts.Select(p => ForwardData.FromString(p)));
            }
        }
Beispiel #2
0
        /// <include file='IAdbClient.xml' path='/IAdbClient/ListForward/*'/>
        public IEnumerable <ForwardData> ListForward(DeviceData device)
        {
            using (IAdbSocket socket = Factories.AdbSocketFactory(this.EndPoint))
            {
                socket.SendAdbRequest($"host-serial:{device.Serial}:list-forward");
                var response = socket.ReadAdbResponse();

                var data = socket.ReadString();

                var parts = data.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

                return(parts.Select(p => ForwardData.FromString(p)));
            }
        }