Advertisement
Guest User

Untitled

a guest
Mar 10th, 2017
5,498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 11.96 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.IO;
  11. using System.Diagnostics;
  12.  
  13. namespace Swiss_ADB_utillity
  14. {
  15.     public partial class Form1 : Form
  16.     {
  17.         public Form1()
  18.         {
  19.             InitializeComponent();
  20.         }
  21.  
  22.         private void button1_Click(object sender, EventArgs e)
  23.         {
  24.             OpenFileDialog openfile = new OpenFileDialog();
  25.             openfile.Filter = "APK|*.apk";
  26.             openfile.Title = "Open a file..";
  27.             if (openfile.ShowDialog() == DialogResult.OK)
  28.             {
  29.                 apkTextbox.Text = openfile.FileName;
  30.             }
  31.         }
  32.  
  33.         private void button2_Click(object sender, EventArgs e)
  34.         {
  35.             Process process = new Process();
  36.             ProcessStartInfo startInfo = new ProcessStartInfo();
  37.             startInfo.WindowStyle = ProcessWindowStyle.Hidden;
  38.             startInfo.CreateNoWindow = true;
  39.             startInfo.UseShellExecute = false;
  40.             startInfo.RedirectStandardOutput = true;
  41.             startInfo.FileName = "adb.exe";
  42.             startInfo.Arguments = " install \"" + apkTextbox.Text + "\"";
  43.             process.StartInfo = startInfo;
  44.             process.Start();
  45.             Console.Text = Console.Text + process.StandardOutput.ReadToEnd();
  46.         }
  47.  
  48.         private void button4_Click(object sender, EventArgs e)
  49.         {
  50.             FolderBrowserDialog backupfolder = new FolderBrowserDialog();
  51.             backupfolder.Description = "Choose backup location";
  52.             if (backupfolder.ShowDialog() == DialogResult.OK)
  53.             {
  54.                 backupTextbox.Text = backupfolder.SelectedPath + "\\backup.ab";
  55.             }
  56.         }
  57.  
  58.         private void button3_Click(object sender, EventArgs e)
  59.         {
  60.             Process process = new Process();
  61.             ProcessStartInfo startInfo = new ProcessStartInfo();
  62.             startInfo.WindowStyle = ProcessWindowStyle.Hidden;
  63.             startInfo.CreateNoWindow = true;
  64.             startInfo.UseShellExecute = false;
  65.             startInfo.RedirectStandardOutput = true;
  66.             startInfo.FileName = "adb.exe";
  67.             startInfo.Arguments = " backup -all -f \"" + apkTextbox.Text + "\"";
  68.             process.StartInfo = startInfo;
  69.             process.Start();
  70.             Console.Text = Console.Text + process.StandardOutput.ReadToEnd();
  71.         }
  72.  
  73.         private void button6_Click(object sender, EventArgs e)
  74.         {
  75.             OpenFileDialog openfile = new OpenFileDialog();
  76.             openfile.Filter = "ZIP files|*.zip";
  77.             openfile.Title = "Open a file..";
  78.             if (openfile.ShowDialog() == DialogResult.OK)
  79.             {
  80.                 sideloadTextbox.Text = openfile.FileName;
  81.             }
  82.         }
  83.  
  84.         private void button5_Click(object sender, EventArgs e)
  85.         {
  86.             Process process = new Process();
  87.             ProcessStartInfo startInfo = new ProcessStartInfo();
  88.             startInfo.WindowStyle = ProcessWindowStyle.Hidden;
  89.             startInfo.CreateNoWindow = true;
  90.             startInfo.UseShellExecute = false;
  91.             startInfo.RedirectStandardOutput = true;
  92.             startInfo.FileName = "adb.exe";
  93.             startInfo.Arguments = " sideload \"" + sideloadTextbox.Text + "\"";
  94.             process.StartInfo = startInfo;
  95.             process.Start();
  96.             Console.Text = Console.Text + process.StandardOutput.ReadToEnd();
  97.         }
  98.  
  99.         private void button7_Click(object sender, EventArgs e)
  100.         {
  101.             Process process = new Process();
  102.             ProcessStartInfo startInfo = new ProcessStartInfo();
  103.             startInfo.WindowStyle = ProcessWindowStyle.Hidden;
  104.             startInfo.CreateNoWindow = true;
  105.             startInfo.UseShellExecute = false;
  106.             startInfo.RedirectStandardOutput = true;
  107.             startInfo.FileName = "adb.exe";
  108.             startInfo.Arguments = " reboot";
  109.             process.StartInfo = startInfo;
  110.             process.Start();
  111.             Console.Text = Console.Text + process.StandardOutput.ReadToEnd();
  112.         }
  113.  
  114.         private void button8_Click(object sender, EventArgs e)
  115.         {
  116.             Process process = new Process();
  117.             ProcessStartInfo startInfo = new ProcessStartInfo();
  118.             startInfo.WindowStyle = ProcessWindowStyle.Hidden;
  119.             startInfo.CreateNoWindow = true;
  120.             startInfo.UseShellExecute = false;
  121.             startInfo.RedirectStandardOutput = true;
  122.             startInfo.FileName = "adb.exe";
  123.             startInfo.Arguments = " reboot recovery";
  124.             process.StartInfo = startInfo;
  125.             process.Start();
  126.             Console.Text = Console.Text + process.StandardOutput.ReadToEnd();
  127.         }
  128.  
  129.         private void button9_Click(object sender, EventArgs e)
  130.         {
  131.             Process process = new Process();
  132.             ProcessStartInfo startInfo = new ProcessStartInfo();
  133.             startInfo.WindowStyle = ProcessWindowStyle.Hidden;
  134.             startInfo.CreateNoWindow = true;
  135.             startInfo.UseShellExecute = false;
  136.             startInfo.RedirectStandardOutput = true;
  137.             startInfo.FileName = "adb.exe";
  138.             startInfo.Arguments = " reboot bootloader";
  139.             process.StartInfo = startInfo;
  140.             process.Start();
  141.             Console.Text = Console.Text + process.StandardOutput.ReadToEnd();
  142.         }
  143.  
  144.         private void button10_Click(object sender, EventArgs e)
  145.         {
  146.             Process process = new Process();
  147.             ProcessStartInfo startInfo = new ProcessStartInfo();
  148.             startInfo.WindowStyle = ProcessWindowStyle.Hidden;
  149.             startInfo.CreateNoWindow = true;
  150.             startInfo.UseShellExecute = false;
  151.             startInfo.RedirectStandardOutput = true;
  152.             startInfo.FileName = "fastboot.exe";
  153.             startInfo.Arguments = " reboot";
  154.             process.StartInfo = startInfo;
  155.             process.Start();
  156.             Console.Text = Console.Text + process.StandardOutput.ReadToEnd();
  157.         }
  158.  
  159.         private void button11_Click(object sender, EventArgs e)
  160.         {
  161.             Process process = new Process();
  162.             ProcessStartInfo startInfo = new ProcessStartInfo();
  163.             startInfo.WindowStyle = ProcessWindowStyle.Hidden;
  164.             startInfo.CreateNoWindow = true;
  165.             startInfo.UseShellExecute = false;
  166.             startInfo.RedirectStandardOutput = true;
  167.             startInfo.FileName = "fastboot.exe";
  168.             startInfo.Arguments = " oem unlock";
  169.             process.StartInfo = startInfo;
  170.             process.Start();
  171.             Console.Text = Console.Text + process.StandardOutput.ReadToEnd();
  172.         }
  173.  
  174.         private void button13_Click(object sender, EventArgs e)
  175.         {
  176.             OpenFileDialog openfile = new OpenFileDialog();
  177.             openfile.Filter = "ZIP files|*.zip";
  178.             openfile.Title = "Open a file..";
  179.             if (openfile.ShowDialog() == DialogResult.OK)
  180.             {
  181.                 flashzipTextbox.Text = openfile.FileName;
  182.                 Process process = new Process();
  183.                 ProcessStartInfo startInfo = new ProcessStartInfo();
  184.                 startInfo.WindowStyle = ProcessWindowStyle.Hidden;
  185.                 startInfo.CreateNoWindow = true;
  186.                 startInfo.UseShellExecute = false;
  187.                 startInfo.RedirectStandardOutput = true;
  188.                 startInfo.FileName = "fastboot.exe";
  189.                 startInfo.Arguments = " flash \"" + openfile.FileName + "\"";
  190.                 process.StartInfo = startInfo;
  191.                 process.Start();
  192.                 Console.Text = Console.Text + process.StandardOutput.ReadToEnd();
  193.             }
  194.         }
  195.  
  196.         private void button12_Click(object sender, EventArgs e)
  197.         {
  198.             OpenFileDialog openfile = new OpenFileDialog();
  199.             openfile.Filter = "IMG files|*.img";
  200.             openfile.Title = "Open a file..";
  201.             if (openfile.ShowDialog() == DialogResult.OK)
  202.             {
  203.                 flashsystemTextbox.Text = openfile.FileName;
  204.                 Process process = new Process();
  205.                 ProcessStartInfo startInfo = new ProcessStartInfo();
  206.                 startInfo.WindowStyle = ProcessWindowStyle.Hidden;
  207.                 startInfo.CreateNoWindow = true;
  208.                 startInfo.UseShellExecute = false;
  209.                 startInfo.RedirectStandardOutput = true;
  210.                 startInfo.FileName = "fastboot.exe";
  211.                 startInfo.Arguments = " flash system \"" + openfile.FileName + "\"";
  212.                 process.StartInfo = startInfo;
  213.                 process.Start();
  214.                 Console.Text = Console.Text + process.StandardOutput.ReadToEnd();
  215.             }
  216.         }
  217.  
  218.         private void button14_Click(object sender, EventArgs e)
  219.         {
  220.             OpenFileDialog openfile = new OpenFileDialog();
  221.             openfile.Filter = "IMG files|*.img";
  222.             openfile.Title = "Open a file..";
  223.             if (openfile.ShowDialog() == DialogResult.OK)
  224.             {
  225.                 flashdataTextbox.Text = openfile.FileName;
  226.                 Process process = new Process();
  227.                 ProcessStartInfo startInfo = new ProcessStartInfo();
  228.                 startInfo.WindowStyle = ProcessWindowStyle.Hidden;
  229.                 startInfo.CreateNoWindow = true;
  230.                 startInfo.UseShellExecute = false;
  231.                 startInfo.RedirectStandardOutput = true;
  232.                 startInfo.FileName = "fastboot.exe";
  233.                 startInfo.Arguments = " flash data \"" + openfile.FileName + "\"";
  234.                 process.StartInfo = startInfo;
  235.                 process.Start();
  236.                 Console.Text = Console.Text + process.StandardOutput.ReadToEnd();
  237.             }
  238.         }
  239.  
  240.         private void button15_Click(object sender, EventArgs e)
  241.         {
  242.             OpenFileDialog openfile = new OpenFileDialog();
  243.             openfile.Filter = "IMG files|*.img";
  244.             openfile.Title = "Open a file..";
  245.             if (openfile.ShowDialog() == DialogResult.OK)
  246.             {
  247.                 flashrecoveryTextbox.Text = openfile.FileName;
  248.                 Process process = new Process();
  249.                 ProcessStartInfo startInfo = new ProcessStartInfo();
  250.                 startInfo.WindowStyle = ProcessWindowStyle.Hidden;
  251.                 startInfo.CreateNoWindow = true;
  252.                 startInfo.UseShellExecute = false;
  253.                 startInfo.RedirectStandardOutput = true;
  254.                 startInfo.FileName = "fastboot.exe";
  255.                 startInfo.Arguments = " flash recovery \"" + openfile.FileName + "\"";
  256.                 process.StartInfo = startInfo;
  257.                 process.Start();
  258.                 Console.Text = Console.Text + process.StandardOutput.ReadToEnd();
  259.             }
  260.         }
  261.  
  262.         private void button16_Click(object sender, EventArgs e)
  263.         {
  264.             OpenFileDialog openfile = new OpenFileDialog();
  265.             openfile.Filter = "IMG files|*.img";
  266.             openfile.Title = "Open a file..";
  267.             if (openfile.ShowDialog() == DialogResult.OK)
  268.             {
  269.                 flashbootTextbox.Text = openfile.FileName;
  270.                 Process process = new Process();
  271.                 ProcessStartInfo startInfo = new ProcessStartInfo();
  272.                 startInfo.WindowStyle = ProcessWindowStyle.Hidden;
  273.                 startInfo.CreateNoWindow = true;
  274.                 startInfo.UseShellExecute = false;
  275.                 startInfo.RedirectStandardOutput = true;
  276.                 startInfo.FileName = "fastboot.exe";
  277.                 startInfo.Arguments = " flash boot \"" + openfile.FileName + "\"";
  278.                 process.StartInfo = startInfo;
  279.                 process.Start();
  280.                 Console.Text = Console.Text + process.StandardOutput.ReadToEnd();
  281.             }
  282.         }
  283.     }
  284. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement