Compare commits

...

16 Commits
0.1 ... v0.5

Author SHA1 Message Date
nerdunit
bfe2ad2aad Update README.md 2020-06-14 13:37:15 +03:00
nerdunit
cebd440de2 Add files via upload 2020-06-14 13:36:58 +03:00
nerdunit
86bbb2d929 Update README.md 2020-06-06 20:10:10 +03:00
nerdunit
684408e8f2 Quick BugFix 2020-06-06 20:07:31 +03:00
nerdunit
d6bb14e8a4 Update version 2020-06-06 20:00:11 +03:00
nerdunit
616deec235 Add files via upload 2020-06-06 20:00:03 +03:00
nerdunit
7f9efc49f8 Add files via upload 2020-06-06 19:53:41 +03:00
nerdunit
684a65f432 bugfix 2020-06-06 09:02:26 +03:00
nerdunit
13d12affc6 Update version 2020-05-29 14:07:47 +03:00
nerdunit
215f992a82 Update README.md 2020-05-29 14:06:17 +03:00
nerdunit
1d140c514d Update README.md 2020-05-29 14:05:29 +03:00
nerdunit
79eab9d1e4 Create README.md 2020-05-29 14:04:57 +03:00
nerdunit
36a0060396 Updated to v0,3 2020-05-29 14:04:43 +03:00
nerdunit
bd9c51c037 Add files via upload 2020-05-29 00:20:33 +03:00
nerdunit
5cb06ad9b5 Update version 2020-05-29 00:15:38 +03:00
nerdunit
828ca9a46a Updated to 0.2
added prototype firmwareflash added few tooltips renamed buttons
2020-05-29 00:15:24 +03:00
11 changed files with 712 additions and 165 deletions

BIN
7z.dll Normal file

Binary file not shown.

BIN
7z.exe Normal file

Binary file not shown.

View File

@@ -46,6 +46,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="customAdbCommandForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="customAdbCommandForm.Designer.cs">
<DependentUpon>customAdbCommandForm.cs</DependentUpon>
</Compile>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
@@ -54,6 +60,9 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="customAdbCommandForm.resx">
<DependentUpon>customAdbCommandForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>

224
Form1.Designer.cs generated
View File

@@ -28,121 +28,175 @@
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.startsideloadbutton = new System.Windows.Forms.Button();
this.devicesbutton = new System.Windows.Forms.Button();
this.instructionsbutton = new System.Windows.Forms.Button();
this.obbcopybutton = new System.Windows.Forms.Button();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.backupbutton = new System.Windows.Forms.Button();
this.debugbutton = new System.Windows.Forms.Button();
this.restorebutton = new System.Windows.Forms.Button();
this.customadbcmdbutton = new System.Windows.Forms.Button();
this.ListApps = new System.Windows.Forms.Button();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.getApkButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
// startsideloadbutton
//
this.button1.Location = new System.Drawing.Point(12, 38);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(82, 34);
this.button1.TabIndex = 0;
this.button1.Text = "Select Apk";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
this.startsideloadbutton.Location = new System.Drawing.Point(100, 13);
this.startsideloadbutton.Name = "startsideloadbutton";
this.startsideloadbutton.Size = new System.Drawing.Size(87, 33);
this.startsideloadbutton.TabIndex = 2;
this.startsideloadbutton.Text = "Sideload APK";
this.startsideloadbutton.UseVisualStyleBackColor = true;
this.startsideloadbutton.Click += new System.EventHandler(this.startsideloadbutton_Click);
//
// textBox1
// devicesbutton
//
this.textBox1.Location = new System.Drawing.Point(12, 12);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(373, 20);
this.textBox1.TabIndex = 1;
this.devicesbutton.Location = new System.Drawing.Point(12, 12);
this.devicesbutton.Name = "devicesbutton";
this.devicesbutton.Size = new System.Drawing.Size(82, 34);
this.devicesbutton.TabIndex = 3;
this.devicesbutton.Text = "Adb devices";
this.devicesbutton.UseVisualStyleBackColor = true;
this.devicesbutton.Click += new System.EventHandler(this.devicesbutton_Click);
//
// button2
// instructionsbutton
//
this.button2.Location = new System.Drawing.Point(298, 39);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(87, 33);
this.button2.TabIndex = 2;
this.button2.Text = "Start Sideload";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
this.instructionsbutton.Location = new System.Drawing.Point(281, 12);
this.instructionsbutton.Name = "instructionsbutton";
this.instructionsbutton.Size = new System.Drawing.Size(88, 34);
this.instructionsbutton.TabIndex = 4;
this.instructionsbutton.Text = "Instructions";
this.instructionsbutton.UseVisualStyleBackColor = true;
this.instructionsbutton.Click += new System.EventHandler(this.instructionsbutton_Click);
//
// button3
// obbcopybutton
//
this.button3.Location = new System.Drawing.Point(12, 78);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(82, 34);
this.button3.TabIndex = 3;
this.button3.Text = "Adb devices";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(298, 79);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(88, 30);
this.button4.TabIndex = 4;
this.button4.Text = "Instructions";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(145, 75);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(82, 34);
this.button5.TabIndex = 5;
this.button5.Text = "Copy Obb";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button6
//
this.button6.Location = new System.Drawing.Point(145, 39);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(82, 34);
this.button6.TabIndex = 6;
this.button6.Text = "Select Obb";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click);
this.obbcopybutton.Location = new System.Drawing.Point(193, 12);
this.obbcopybutton.Name = "obbcopybutton";
this.obbcopybutton.Size = new System.Drawing.Size(82, 34);
this.obbcopybutton.TabIndex = 5;
this.obbcopybutton.Text = "Copy Obb";
this.obbcopybutton.UseVisualStyleBackColor = true;
this.obbcopybutton.Click += new System.EventHandler(this.obbcopybutton_Click);
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(13, 119);
this.progressBar1.Location = new System.Drawing.Point(13, 161);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(373, 20);
this.progressBar1.Size = new System.Drawing.Size(426, 20);
this.progressBar1.TabIndex = 7;
//
// backupbutton
//
this.backupbutton.Location = new System.Drawing.Point(13, 52);
this.backupbutton.Name = "backupbutton";
this.backupbutton.Size = new System.Drawing.Size(81, 34);
this.backupbutton.TabIndex = 9;
this.backupbutton.Text = "Backup Gamedata";
this.backupbutton.UseVisualStyleBackColor = true;
this.backupbutton.Click += new System.EventHandler(this.backupbutton_Click);
//
// debugbutton
//
this.debugbutton.Location = new System.Drawing.Point(1, 2);
this.debugbutton.Name = "debugbutton";
this.debugbutton.Size = new System.Drawing.Size(75, 23);
this.debugbutton.TabIndex = 10;
this.debugbutton.Text = "button1";
this.debugbutton.UseVisualStyleBackColor = true;
this.debugbutton.Click += new System.EventHandler(this.debugbutton_Click);
//
// restorebutton
//
this.restorebutton.Location = new System.Drawing.Point(100, 52);
this.restorebutton.Name = "restorebutton";
this.restorebutton.Size = new System.Drawing.Size(87, 34);
this.restorebutton.TabIndex = 11;
this.restorebutton.Text = "Restore Gamedata";
this.restorebutton.UseVisualStyleBackColor = true;
this.restorebutton.Click += new System.EventHandler(this.restorebutton_Click);
//
// customadbcmdbutton
//
this.customadbcmdbutton.Location = new System.Drawing.Point(193, 52);
this.customadbcmdbutton.Name = "customadbcmdbutton";
this.customadbcmdbutton.Size = new System.Drawing.Size(82, 34);
this.customadbcmdbutton.TabIndex = 12;
this.customadbcmdbutton.Text = "Run Adb Command";
this.customadbcmdbutton.UseVisualStyleBackColor = true;
this.customadbcmdbutton.Click += new System.EventHandler(this.customadbcmdbutton_Click);
//
// ListApps
//
this.ListApps.Location = new System.Drawing.Point(12, 92);
this.ListApps.Name = "ListApps";
this.ListApps.Size = new System.Drawing.Size(82, 34);
this.ListApps.TabIndex = 13;
this.ListApps.Text = "List Apps";
this.ListApps.UseVisualStyleBackColor = true;
this.ListApps.Click += new System.EventHandler(this.ListApps_Click);
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(13, 134);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(426, 21);
this.comboBox1.TabIndex = 14;
this.comboBox1.Text = "Please Press List Apps First";
//
// getApkButton
//
this.getApkButton.Location = new System.Drawing.Point(100, 92);
this.getApkButton.Name = "getApkButton";
this.getApkButton.Size = new System.Drawing.Size(87, 34);
this.getApkButton.TabIndex = 15;
this.getApkButton.Text = "Get Apk";
this.getApkButton.UseVisualStyleBackColor = true;
this.getApkButton.Click += new System.EventHandler(this.getApkButton_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(398, 154);
this.ClientSize = new System.Drawing.Size(447, 193);
this.Controls.Add(this.getApkButton);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.ListApps);
this.Controls.Add(this.customadbcmdbutton);
this.Controls.Add(this.restorebutton);
this.Controls.Add(this.debugbutton);
this.Controls.Add(this.backupbutton);
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.button6);
this.Controls.Add(this.button5);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button1);
this.Controls.Add(this.obbcopybutton);
this.Controls.Add(this.instructionsbutton);
this.Controls.Add(this.devicesbutton);
this.Controls.Add(this.startsideloadbutton);
this.MaximumSize = new System.Drawing.Size(463, 232);
this.MinimumSize = new System.Drawing.Size(463, 232);
this.Name = "Form1";
this.Text = "Rookie SideLoader";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button startsideloadbutton;
private System.Windows.Forms.Button devicesbutton;
private System.Windows.Forms.Button instructionsbutton;
private System.Windows.Forms.Button obbcopybutton;
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Button backupbutton;
private System.Windows.Forms.Button debugbutton;
private System.Windows.Forms.Button restorebutton;
private System.Windows.Forms.Button customadbcmdbutton;
private System.Windows.Forms.Button ListApps;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Button getApkButton;
}
}

337
Form1.cs
View File

@@ -6,31 +6,42 @@ using System.Threading;
using System.Windows;
using System.Net.Http;
using System.Reflection;
using System.Net;
namespace AndroidSideloader
{
public partial class Form1 : Form
{
#if DEBUG
bool debugMode = true;
#else
bool debugMode = false;
#endif
string path;
string obbPath = "";
string obbFile;
string allText;
bool exit = false;
string debugPath = "debug.log";
string adbPath = Environment.CurrentDirectory + "\\adb\\";
public string adbPath = Environment.CurrentDirectory + "\\adb\\";
string[] line;
public Form1()
{
InitializeComponent();
}
void runAdbCommand(string command)
public void runAdbCommand(string command)
{
progressBar1.Value = 0;
exit = false;
MessageBox.Show("Action Started, may take some time...");
Process cmd = new Process();
cmd.StartInfo.FileName = "cmd.exe";
cmd.StartInfo.FileName = Environment.CurrentDirectory + "\\adb\\adb.exe";
cmd.StartInfo.Arguments = command;
cmd.StartInfo.RedirectStandardInput = true;
cmd.StartInfo.RedirectStandardOutput = true;
cmd.StartInfo.CreateNoWindow = true;
@@ -40,86 +51,79 @@ namespace AndroidSideloader
cmd.StandardInput.WriteLine(command);
cmd.StandardInput.Flush();
cmd.StandardInput.Close();
allText = cmd.StandardOutput.ReadToEnd();
cmd.WaitForExit();
var text = cmd.StandardOutput.ReadToEnd();
StreamWriter sw = File.AppendText(debugPath);
sw.Write(text);
sw.Write("\n--------------------------------------------------------------------");
sw.Write("Action name = " + command + '\n');
sw.Write(allText);
sw.Write("\n--------------------------------------------------------------------\n");
sw.Flush();
sw.Close();
line = text.Split('\n');
line = allText.Split('\n');
exit = true;
}
private void button1_Click(object sender, EventArgs e)
{
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
openFileDialog.Filter = "Android apps (*.apk)|*.apk";
openFileDialog.FilterIndex = 2;
openFileDialog.RestoreDirectory = true;
if (openFileDialog.ShowDialog() == DialogResult.OK)
textBox1.Text = openFileDialog.FileName;
}
}
void runLoadingBar(string filePath)
{
FileInfo fi = new FileInfo(filePath);
//fi.Length file size in bytes
PerformanceCounter disk = new PerformanceCounter("PhysicalDisk", "Disk Write Bytes/sec", "_total");
var bytes = 0f;
progressBar1.Maximum = (int)(fi.Length/128);
while (exit==false)
{
bytes += disk.NextValue();
try { progressBar1.Value = (int)(bytes); } catch { progressBar1.Maximum *= 2; }
Thread.Sleep(1000);
}
progressBar1.Maximum = (int)(fi.Length / 128);
while (exit == false)
{
bytes += disk.NextValue();
try { progressBar1.Value = (int)(bytes); } catch { progressBar1.Maximum *= 2; }
Thread.Sleep(1000);
}
progressBar1.Value = progressBar1.Maximum;
}
private void button2_Click(object sender, EventArgs e)
private void startsideloadbutton_Click(object sender, EventArgs e)
{
path = textBox1.Text;
if (path=="" || path.EndsWith(".apk")==false)
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
openFileDialog.Filter = "Android apps (*.apk)|*.apk";
openFileDialog.FilterIndex = 2;
openFileDialog.RestoreDirectory = true;
if (openFileDialog.ShowDialog() == DialogResult.OK)
path = openFileDialog.FileName;
else
return;
}
if (path == "" || path.EndsWith(".apk") == false)
MessageBox.Show("You must select an apk");
else
{
MessageBox.Show("Action Started, may take some time...");
Thread t1 = new Thread(() =>
{
runAdbCommand("adb.exe install -r " + '"' + path + '"');
runAdbCommand("install -r " + '"' + path + '"');
});
t1.IsBackground = true;
t1.Start();
runLoadingBar(path);
if (line[line.Length - 3].Contains("Success")==false)
{
MessageBox.Show("An error has occured, send the debug.log to rookie.lol");
}
else
MessageBox.Show(line[line.Length - 3]);
MessageBox.Show(allText);
}
}
private void button3_Click(object sender, EventArgs e)
private void devicesbutton_Click(object sender, EventArgs e)
{
runAdbCommand("adb.exe devices");
if (line[line.Length - 4].Contains("List of devices attached") == false)
MessageBox.Show(line[line.Length - 4]);
else
MessageBox.Show("No android device attached");
MessageBox.Show("Action Started, may take some time...");
runAdbCommand("devices");
MessageBox.Show(allText);
}
private void button4_Click(object sender, EventArgs e)
private void instructionsbutton_Click(object sender, EventArgs e)
{
string instructions = @"1. Plug in your Oculus Quest
2. Press adb devices and allow adb to connect from quest headset (one time only)
@@ -130,29 +134,18 @@ namespace AndroidSideloader
MessageBox.Show(instructions);
}
private void button5_Click(object sender, EventArgs e)
public void ExtractFile(string sourceArchive, string destination)
{
if (obbPath.Length>0)
{
Thread t1 = new Thread(() =>
{
runAdbCommand("adb push " + '"' + obbPath + '"' + " /sdcard/Android/obb");
});
t1.IsBackground = true;
t1.Start();
runLoadingBar(obbFile);
MessageBox.Show(line[line.Length - 3]);
}
else
{
MessageBox.Show("You forgot to select the obb folder");
}
string zPath = "7z.exe"; //add to proj and set CopyToOuputDir
ProcessStartInfo pro = new ProcessStartInfo();
pro.WindowStyle = ProcessWindowStyle.Hidden;
pro.FileName = zPath;
pro.Arguments = string.Format("x \"{0}\" -y -o\"{1}\"", sourceArchive, destination);
Process x = Process.Start(pro);
x.WaitForExit();
}
private void button6_Click(object sender, EventArgs e)
private void obbcopybutton_Click(object sender, EventArgs e)
{
using (var fbd = new FolderBrowserDialog())
{
@@ -165,28 +158,214 @@ namespace AndroidSideloader
obbPath = fbd.SelectedPath;
}
else return;
}
if (obbPath.Length>0)
{
MessageBox.Show("Action Started, may take some time...");
Thread t1 = new Thread(() =>
{
runAdbCommand("push " + '"' + obbPath + '"' + " /sdcard/Android/obb");
});
t1.IsBackground = true;
t1.Start();
runLoadingBar(obbFile);
MessageBox.Show(allText);
}
else
{
MessageBox.Show("You forgot to select the obb folder");
}
}
private void Form1_Load(object sender, EventArgs e)
{
if (debugMode == false)
debugbutton.Visible = false;
if (Directory.Exists(adbPath)==false)
{
MessageBox.Show("You need to have the adb folder in the same folder as this software");
Environment.Exit(600);
MessageBox.Show("Please wait for the software to download and install the adb");
try
{
using (var client = new WebClient())
{
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
client.DownloadFile("https://github.com/nerdunit/androidsideloader/raw/master/7z.exe", "7z.exe");
client.DownloadFile("https://github.com/nerdunit/androidsideloader/raw/master/7z.dll", "7z.dll");
client.DownloadFile("http://github.com/nerdunit/androidsideloader/releases/download/v0.3/adb.7z", "adb.7z");
}
ExtractFile(Environment.CurrentDirectory + "\\adb.7z", Environment.CurrentDirectory);
File.Delete("adb.7z");
File.Delete("7z.dll");
File.Delete("7z.exe");
}
catch (Exception ex)
{
MessageBox.Show("Cannot download adb because you are not connected to the internet!");
StreamWriter sw = File.AppendText(debugPath);
sw.Write("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
sw.Write(ex.ToString() + "\n");
sw.Flush();
sw.Close();
Environment.Exit(600);
}
}
checkForUpdate();
if (debugMode==false)
checkForUpdate();
intToolTips();
}
void intToolTips()
{
ToolTip ListAppsToolTip = new ToolTip();
ListAppsToolTip.SetToolTip(this.ListApps, "Press this to show what packages you have installed");
}
void checkForUpdate()
{
string localVersion = "0.1";
HttpClient client = new HttpClient();
string currentVersion = client.GetStringAsync("https://raw.githubusercontent.com/nerdunit/androidsideloader/master/version").Result;
currentVersion = currentVersion.Remove(currentVersion.Length - 1);
if (localVersion != currentVersion)
MessageBox.Show("Your version is outdated, the latest version is " + currentVersion + " you can download it from https://github.com/nerdunit/", "OUTDATED");
try
{
string localVersion = "0.5";
HttpClient client = new HttpClient();
string currentVersion = client.GetStringAsync("https://raw.githubusercontent.com/nerdunit/androidsideloader/master/version").Result;
currentVersion = currentVersion.Remove(currentVersion.Length - 1);
if (localVersion != currentVersion)
MessageBox.Show("Your version is outdated, the latest version is " + currentVersion + " you can download it from https://github.com/nerdunit/", "OUTDATED");
}
catch
{
//No need for messages, the user has no internet
}
}
private void backupbutton_Click(object sender, EventArgs e)
{
MessageBox.Show("Action Started, may take some time...");
Thread t1 = new Thread(() =>
{
runAdbCommand("pull " + '"' + "/sdcard/Android/data" + '"');
});
t1.IsBackground = true;
t1.Start();
while (exit == false)
Thread.Sleep(1000);
Directory.Move(adbPath + "data", Environment.CurrentDirectory + "\\data");
MessageBox.Show(allText);
}
private void debugbutton_Click(object sender, EventArgs e)
{
}
private void restorebutton_Click(object sender, EventArgs e)
{
using (var fbd = new FolderBrowserDialog())
{
DialogResult result = fbd.ShowDialog();
if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
{
string[] files = Directory.GetFiles(fbd.SelectedPath);
obbPath = fbd.SelectedPath;
}
else return;
}
MessageBox.Show("Action Started, may take some time...");
Thread t1 = new Thread(() =>
{
runAdbCommand("push " + '"' + obbPath + '"' + " /sdcard/Android/");
});
t1.IsBackground = true;
t1.Start();
while (exit == false)
Thread.Sleep(1000);
MessageBox.Show(allText);
}
private void customadbcmdbutton_Click(object sender, EventArgs e)
{
customAdbCommandForm adbCommandForm = new customAdbCommandForm();
adbCommandForm.Show();
}
private void ListApps_Click(object sender, EventArgs e)
{
allText = "";
comboBox1.Items.Clear();
Thread t1 = new Thread(() =>
{
runAdbCommand("shell pm list packages");
});
t1.IsBackground = true;
t1.Start();
while (exit == false)
Thread.Sleep(1000);
foreach (string obj in line)
{
comboBox1.Items.Add(obj);
}
if (allText.Length > 0)
MessageBox.Show("Fetched apks with success");
}
private void getApkButton_Click(object sender, EventArgs e)
{
string package;
allText = "";
try
{
package = comboBox1.SelectedItem.ToString().Remove(0,8); //remove package:
package = package.Remove(package.Length - 1);
} catch { MessageBox.Show("You must first run list items"); return; }
//MessageBox.Show(package);
exit = false;
Thread t1 = new Thread(() =>
{
runAdbCommand("shell pm path " + package);
});
t1.IsBackground = true;
t1.Start();
while (exit == false)
Thread.Sleep(1000);
allText = allText.Remove(allText.Length - 1);
//MessageBox.Show(allText);
string apkPath = allText.Remove(0, 8); //remove package:
apkPath = apkPath.Remove(apkPath.Length - 1);
//MessageBox.Show(adbPath);
Thread t2 = new Thread(() =>
{
runAdbCommand("pull " + apkPath);
});
t2.IsBackground = true;
t2.Start();
while (exit == false)
Thread.Sleep(1000);
string currApkPath = apkPath;
while (currApkPath.Contains("/"))
currApkPath = currApkPath.Substring(currApkPath.IndexOf("/") + 1);
Thread.Sleep(1000);
File.Copy(Environment.CurrentDirectory + "\\adb\\" + currApkPath, Environment.CurrentDirectory + "\\" + package + ".apk");
File.Delete(Environment.CurrentDirectory + "\\adb\\" + currApkPath);
}
}
}

View File

@@ -16,6 +16,7 @@ namespace AndroidSideloader
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}

33
README.md Normal file
View File

@@ -0,0 +1,33 @@
# androidsideloader
Changelog
0.5
- Removed Flash Firmware
- Redesigned UI
- Reworked RunAdbCommand function (now it will be possible to do stuff I wasnt able to do before)
- Replaced Ui Buttons, still needs work
- Added List apk button
- Added List apk combo box
- Added get apk function
- Cleaned a bit of code
0.4
- Added auto download of adb archive
- Added auto extraction of adb archive
0.3
- Added new form, you can run custom adb commands now
- Added recover and backup app data
- Removed Select APK and Select OBB Buttons
- Removed tooltips from removed buttons
- Sideload APK and Copy Obb buttons now also make you select the file/folder
- Improved firmware button
0.2
- Added Flash Firmware button
- Added few tooltips
- Renamed buttons
0.1
- Initial Release

85
customAdbCommandForm.Designer.cs generated Normal file
View File

@@ -0,0 +1,85 @@
namespace AndroidSideloader
{
partial class customAdbCommandForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.runcustomadbcmdbutton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(13, 13);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(775, 20);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "Enter your command here";
//
// richTextBox1
//
this.richTextBox1.Location = new System.Drawing.Point(13, 39);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(775, 365);
this.richTextBox1.TabIndex = 1;
this.richTextBox1.Text = "";
this.richTextBox1.TextChanged += new System.EventHandler(this.richTextBox1_TextChanged);
//
// runcustomadbcmdbutton
//
this.runcustomadbcmdbutton.Location = new System.Drawing.Point(13, 410);
this.runcustomadbcmdbutton.Name = "runcustomadbcmdbutton";
this.runcustomadbcmdbutton.Size = new System.Drawing.Size(93, 28);
this.runcustomadbcmdbutton.TabIndex = 2;
this.runcustomadbcmdbutton.Text = "Run";
this.runcustomadbcmdbutton.UseVisualStyleBackColor = true;
this.runcustomadbcmdbutton.Click += new System.EventHandler(this.runcustomadbcmdbutton_Click);
//
// customAdbCommandForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.runcustomadbcmdbutton);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.textBox1);
this.Name = "customAdbCommandForm";
this.Text = "customAdbCommandForm";
this.Load += new System.EventHandler(this.customAdbCommandForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Button runcustomadbcmdbutton;
}
}

66
customAdbCommandForm.cs Normal file
View File

@@ -0,0 +1,66 @@
using System;
using System.Diagnostics;
using System.Windows.Forms;
using System.IO;
using System.Threading;
using System.Windows;
using System.Net.Http;
using System.Reflection;
namespace AndroidSideloader
{
public partial class customAdbCommandForm : Form
{
public customAdbCommandForm()
{
InitializeComponent();
}
string output;
private void runcustomadbcmdbutton_Click(object sender, EventArgs e)
{
var command = textBox1.Text;
if (command.StartsWith("adb "))
command = command.Remove(0, 4);
runAdbCommand(command);
}
public void runAdbCommand(string command)
{
Process cmd = new Process();
cmd.StartInfo.FileName = Environment.CurrentDirectory + "\\adb\\adb.exe";
cmd.StartInfo.Arguments = command;
cmd.StartInfo.RedirectStandardInput = true;
cmd.StartInfo.RedirectStandardOutput = true;
cmd.StartInfo.CreateNoWindow = true;
cmd.StartInfo.UseShellExecute = false;
cmd.StartInfo.WorkingDirectory = Environment.CurrentDirectory + "\\adb\\";
cmd.Start();
cmd.StandardInput.WriteLine(command);
cmd.StandardInput.Flush();
cmd.StandardInput.Close();
output = cmd.StandardOutput.ReadToEnd();
cmd.WaitForExit();
StreamWriter sw = File.AppendText("debugC.log");
sw.Write("Action name = " + command + '\n');
sw.Write(output);
sw.Write("\n--------------------------------------------------------------------\n");
sw.Flush();
sw.Close();
richTextBox1.Text = output;
}
private void customAdbCommandForm_Load(object sender, EventArgs e)
{
}
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
}
}
}

120
customAdbCommandForm.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -1 +1 @@
0.1
0.4