ham dump

mail@pastecode.io avatar
unknown
csharp
2 years ago
860 B
4
Indexable
Never
public string dump(string deviceID)
        {
            if (emu)
            {
                deviceID = "emulator-" + (Convert.ToInt32(deviceID.Split(':')[1]) - 1).ToString();
            }
            int z = 0;
        zz:
            string a = Getstring(txt_LD.Text, @"adb -s " + deviceID + " shell uiautomator dump /sdcard/1.xml\r\nadb -s " + deviceID + " shell cat /sdcard/1.xml");
            if (a.Contains("UI hierchary dumped to"))
            {
                a = Getstring(txt_LD.Text, @"adb -s " + deviceID + " shell cat /sdcard/1.xml");
            }
            if (a.Contains("No such file") || !a.Contains("?xml"))
            {
                if (z >= 2)
                {
                    return "";
                }
                z++;
                goto zz;
            }
            return a;
        }