private void UpdateMountPoints() { if (this.device.State != DeviceState.ONLINE) { this.systemMount = new MountInfo(null, null, MountType.NONE); return; } AdbCommand adbCmd = Adb.FormAdbShellCommand(this.device, false, "mount"); using (StringReader r = new StringReader(Adb.ExecuteAdbCommand(adbCmd))) { string line; string[] splitLine; string dir, mount; MountType type; while (r.Peek() != -1) { line = r.ReadLine(); splitLine = line.Split(' '); try { if (line.Contains(" on /system ")) { dir = splitLine[2]; mount = splitLine[0]; type = (MountType)Enum.Parse(typeof(MountType), splitLine[5].Substring(1, 2).ToUpper()); this.systemMount = new MountInfo(dir, mount, type); return; } if (line.Contains(" /system ")) { dir = splitLine[1]; mount = splitLine[0]; type = (MountType)Enum.Parse(typeof(MountType), splitLine[3].Substring(0, 2).ToUpper()); this.systemMount = new MountInfo(dir, mount, type); return; } } catch { dir = "/system"; mount = "ERROR"; type = MountType.NONE; this.systemMount = new MountInfo(dir, mount, type); } } } }
private void UpdateMountPoints() { if (this.device.State != DeviceState.ONLINE) { this.systemMount = new MountInfo(null, null, MountType.NONE); return; } AdbCommand adbCmd = Adb.FormAdbShellCommand(this.device, false, "mount"); using (StringReader r = new StringReader(Adb.ExecuteAdbCommand(adbCmd))) { string line; string[] splitLine; string dir, mount; MountType type; while (r.Peek() != -1) { line = r.ReadLine(); splitLine = line.Split(' '); try { if (line.Contains(" on /system ")) { dir = splitLine[2]; mount = splitLine[0]; type = (MountType)Enum.Parse(typeof(MountType), splitLine[5].Substring(1, 2).ToUpper()); this.systemMount = new MountInfo(dir, mount, type); return; } if (line.Contains(" /system ")) { dir = splitLine[1]; mount = splitLine[0]; type = (MountType)Enum.Parse(typeof(MountType), splitLine[3].Substring(0, 2).ToUpper()); this.systemMount = new MountInfo(dir, mount, type); return; } } catch { dir = "/system"; mount = "ERROR"; type = MountType.NONE; this.systemMount = new MountInfo(dir, mount, type); } } } }