Advertisement
Guest User

Untitled

a guest
Aug 30th, 2015
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.35 KB | None | 0 0
  1. #include<iostream>
  2.     #include<cstring>
  3.     using namespace std;
  4.     class A
  5.     {
  6.     public:
  7.         begin()
  8.         {
  9.             int j;
  10.             cout << "Choose your option:\n\n";
  11.             cout << "1. List Devices\n";
  12.             cout << "2. Install APK\n";
  13.             cout << "3. Reboot Options\n";
  14.             cout << "4. Screenshot\n";
  15.             cout << "5. Push file to SDCard\n";
  16.             cout << "\n";
  17.             cin >> j;
  18.             cout << "\n";
  19.    
  20.             switch(j)
  21.             {
  22.             case 1: devices();
  23.                 break;
  24.             case 2: install();
  25.                 break;
  26.             case 3: reboot();
  27.                 break;
  28.             case 4: screenshot();
  29.                 break;
  30.             case 5: push();
  31.                 break;
  32.             }
  33.         }
  34.    
  35.         devices()
  36.         {
  37.             system("adb devices");
  38.         }
  39.    
  40.         reboot()
  41.         {
  42.             int i;
  43.             cout << "Reboot Options\n\n";
  44.             cout << "1. Reboot System\n";
  45.             cout << "2. Reboot into Recovery\n";
  46.             cout << "3. Reboot into Bootloader\n\n";
  47.             cin >> i;
  48.             switch(i)
  49.             {
  50.             case 1: cout << "Rebooting System...";
  51.                 system("adb reboot");
  52.                 break;
  53.             case 2: cout << "Rebooting into Recovery...";
  54.                 system("adb reboot recovery");
  55.                 break;
  56.             case 3: cout << "Rebooting into Bootloader...";
  57.                 system("adb reboot bootloader");
  58.                 break;
  59.             }
  60.         }
  61.    
  62.         install()
  63.         {
  64.             char path[100], command[100];
  65.             cout << "Drag and Drop an APK file here and press enter to install.\n";
  66.             cin.sync();
  67.             cin.get(path, 100);
  68.             strcpy(command, "adb install ");
  69.             strcat(command, path);
  70.             cout << "Installing APK...";
  71.             system(command);
  72.    
  73.         }
  74.    
  75.         screenshot()
  76.         {
  77.             system("adb shell screencap -p /sdcard/Screenshot.png");
  78.             system("adb pull /sdcard/Screenshot.png \"%UserProfile%\\Desktop\\Screenshot.png\"");
  79.             system("adb shell rm /sdcard/Screenshot.png");
  80.             cout << "Screenshot saved to Desktop.";
  81.         }
  82.    
  83.         push()
  84.         {
  85.             char path[100], command[200];
  86.             cout << "Drag and Drop a file here and press enter to send it to the SD Card.\n";
  87.             cin.sync();
  88.             cin.get(path, 100);
  89.             strcpy(command, "adb push ");
  90.             strcat(command, path);
  91.             strcat(command, " ");
  92.             strcat(command, " /sdcard/");
  93.             system(command);
  94.         }
  95.     };
  96.    
  97.     int main()
  98.     {
  99.         A a;
  100.         a.begin();
  101.         return 0;
  102.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement