public static void ExecuteAdbCommandNoReturn(AdbCommand cmd) { lock (_lock) { Command.RunProcessNoReturn(RESOURCEDIR + ADB_EXE, cmd.Command, cmd.Timeout); } }
public static string Execute7zCommand(AdbCommand cmd, bool forceRegular = false) { string result = ""; lock (_lock) { result = Command.RunProcessReturnOutput(RESOURCEDIR + ZIP_EXE, cmd.Command, forceRegular, cmd.Timeout); } return(result); }
public static object ExecuteAdbCommandReturnExitCode(AdbCommand cmd) { int result = -1; lock (_lock) { result = Command.RunProcessReturnExitCode(RESOURCEDIR + ADB_EXE, cmd.Command, cmd.Timeout); } return(result); }
public bool RemountSystem(MountType _type) { if (!_device.HasRoot) { return(false); } AdbCommand adbCmd = Adb.FormAdbShellCommand(_device, true, "mount", "-o", "remount,rw", "/system"); Adb.ExecuteAdbCommandNoReturn(adbCmd); if (_device.FileSystem.SystemMountInfo.MountType == _type) { return(true); } else { return(false); } }
public ListingType FileOrDirectory(string location) { if (!_device.BusyBox.IsInstalled) { return(ListingType.ERR); } AdbCommand isFile = Adb.FormAdbShellCommand(_device, false, string.Format(IS_FILE, location)); AdbCommand isDir = Adb.FormAdbShellCommand(_device, false, string.Format(IS_DIRECTORY, location)); string _isFile = Adb.ExecuteAdbCommand(isFile); string _isDir = Adb.ExecuteAdbCommand(isDir); if (_isFile.Contains("1")) { return(ListingType.FILE); } else if (_isDir.Contains("1")) { return(ListingType.DIRECTORY); } return(ListingType.NONE); }
public Dictionary <string, ListingType> GetFilesAndDirectories(string location) { if (location == null || string.IsNullOrEmpty(location) || Regex.IsMatch(location, "\\s")) { throw new ArgumentException("rootDir must not be null or empty!"); } Dictionary <string, ListingType> filesAndDirs = new Dictionary <string, ListingType>(); AdbCommand cmd = null; if (_device.BusyBox.IsInstalled) { cmd = Adb.FormAdbShellCommand(_device, true, "busybox", "ls", "-a", "-p", "l", location); } else { cmd = Adb.FormAdbShellCommand(_device, true, "ls", "-a", "-p", "-l", location); } using (StringReader reader = new StringReader(Adb.ExecuteAdbCommand(cmd))) { string line = null; while (reader.Peek() != -1) { line = reader.ReadLine(); if (!string.IsNullOrEmpty(line) && !Regex.IsMatch(line, "\\s")) { filesAndDirs.Add(line, line.EndsWith("/") ? ListingType.DIRECTORY : ListingType.FILE); } } } return(filesAndDirs); }