Example #1
0
        private void SetDevice(AdbSocket adbSocket)
        {
            if (String.IsNullOrEmpty(DeviceSerialNumber))
            {
                throw new AdbException("No device selected");
            }

            adbSocket.SendCommand($"host:transport:{DeviceSerialNumber}");
        }
Example #2
0
        private String SendSyncCommand(AdbSocket adbSocket, String command, String parameter, Boolean readResponse = true)
        {
            if (null == parameter)
            {
                throw new ArgumentNullException(nameof(parameter));
            }

            SetDevice(adbSocket);

            adbSocket.SendCommand("sync:");

            return(adbSocket.SendSyncCommand(command, parameter, readResponse));
        }
Example #3
0
        private AdbFileInfo GetFileInfo(AdbSocket adbSocket, String fullName, String directoryName)
        {
            var mode = adbSocket.ReadInt32();
            var size = adbSocket.ReadInt32();
            var time = AdbHelpers.FromUnixTime(adbSocket.ReadInt32());

            var name = "";

            if (String.IsNullOrEmpty(fullName))
            {
                name = adbSocket.ReadSyncString();
                if (name.Equals(".") || name.Equals(".."))
                {
                    return(null);
                }
                fullName = AdbHelpers.CombinePath(directoryName, name);
            }
            else
            {
                name = Path.GetFileName(fullName);
            }

            return(new AdbFileInfo(fullName, name, size, mode, time));
        }