Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a785127de3 | ||
|
|
fd8bb084f8 | ||
|
|
ca69955211 | ||
|
|
6ed41a5443 |
@@ -88,12 +88,6 @@
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="customAdbCommandForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="customAdbCommandForm.Designer.cs">
|
||||
<DependentUpon>customAdbCommandForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FlexibleMessageBox.cs" />
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
@@ -116,9 +110,6 @@
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SelectFolder.cs" />
|
||||
<EmbeddedResource Include="customAdbCommandForm.resx">
|
||||
<DependentUpon>customAdbCommandForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
<setting name="copyMessageToClipboard" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="firstRun" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</AndroidSideloader.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
102
Form1.Designer.cs
generated
102
Form1.Designer.cs
generated
@@ -32,11 +32,9 @@
|
||||
this.m_combo = new SergeUtils.EasyCompletionComboBox();
|
||||
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.backupbutton = 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.getApkButton = new System.Windows.Forms.Button();
|
||||
this.listApkPermsButton = new System.Windows.Forms.Button();
|
||||
@@ -49,6 +47,9 @@
|
||||
this.userjsonButton = new System.Windows.Forms.Button();
|
||||
this.progressBar1 = new System.Windows.Forms.ProgressBar();
|
||||
this.settingsButton = new System.Windows.Forms.Button();
|
||||
this.copyBulkObbButton = new System.Windows.Forms.Button();
|
||||
this.checkHashButton = new System.Windows.Forms.Button();
|
||||
this.DragDropLbl = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// m_combo
|
||||
@@ -78,19 +79,9 @@
|
||||
this.devicesbutton.UseVisualStyleBackColor = true;
|
||||
this.devicesbutton.Click += new System.EventHandler(this.devicesbutton_Click);
|
||||
//
|
||||
// instructionsbutton
|
||||
//
|
||||
this.instructionsbutton.Location = new System.Drawing.Point(282, 12);
|
||||
this.instructionsbutton.Name = "instructionsbutton";
|
||||
this.instructionsbutton.Size = new System.Drawing.Size(87, 34);
|
||||
this.instructionsbutton.TabIndex = 4;
|
||||
this.instructionsbutton.Text = "Instructions";
|
||||
this.instructionsbutton.UseVisualStyleBackColor = true;
|
||||
this.instructionsbutton.Click += new System.EventHandler(this.instructionsbutton_Click);
|
||||
//
|
||||
// obbcopybutton
|
||||
//
|
||||
this.obbcopybutton.Location = new System.Drawing.Point(193, 12);
|
||||
this.obbcopybutton.Location = new System.Drawing.Point(100, 50);
|
||||
this.obbcopybutton.Name = "obbcopybutton";
|
||||
this.obbcopybutton.Size = new System.Drawing.Size(87, 34);
|
||||
this.obbcopybutton.TabIndex = 3;
|
||||
@@ -100,9 +91,9 @@
|
||||
//
|
||||
// backupbutton
|
||||
//
|
||||
this.backupbutton.Location = new System.Drawing.Point(12, 52);
|
||||
this.backupbutton.Location = new System.Drawing.Point(291, 13);
|
||||
this.backupbutton.Name = "backupbutton";
|
||||
this.backupbutton.Size = new System.Drawing.Size(82, 34);
|
||||
this.backupbutton.Size = new System.Drawing.Size(80, 34);
|
||||
this.backupbutton.TabIndex = 5;
|
||||
this.backupbutton.Text = "Backup Gamedata";
|
||||
this.backupbutton.UseVisualStyleBackColor = true;
|
||||
@@ -110,27 +101,17 @@
|
||||
//
|
||||
// restorebutton
|
||||
//
|
||||
this.restorebutton.Location = new System.Drawing.Point(100, 52);
|
||||
this.restorebutton.Location = new System.Drawing.Point(291, 50);
|
||||
this.restorebutton.Name = "restorebutton";
|
||||
this.restorebutton.Size = new System.Drawing.Size(87, 34);
|
||||
this.restorebutton.Size = new System.Drawing.Size(80, 42);
|
||||
this.restorebutton.TabIndex = 6;
|
||||
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(87, 34);
|
||||
this.customadbcmdbutton.TabIndex = 7;
|
||||
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.Location = new System.Drawing.Point(12, 50);
|
||||
this.ListApps.Name = "ListApps";
|
||||
this.ListApps.Size = new System.Drawing.Size(82, 34);
|
||||
this.ListApps.TabIndex = 8;
|
||||
@@ -140,7 +121,7 @@
|
||||
//
|
||||
// getApkButton
|
||||
//
|
||||
this.getApkButton.Location = new System.Drawing.Point(100, 92);
|
||||
this.getApkButton.Location = new System.Drawing.Point(465, 12);
|
||||
this.getApkButton.Name = "getApkButton";
|
||||
this.getApkButton.Size = new System.Drawing.Size(87, 34);
|
||||
this.getApkButton.TabIndex = 9;
|
||||
@@ -150,7 +131,7 @@
|
||||
//
|
||||
// listApkPermsButton
|
||||
//
|
||||
this.listApkPermsButton.Location = new System.Drawing.Point(193, 92);
|
||||
this.listApkPermsButton.Location = new System.Drawing.Point(372, 13);
|
||||
this.listApkPermsButton.Name = "listApkPermsButton";
|
||||
this.listApkPermsButton.Size = new System.Drawing.Size(87, 34);
|
||||
this.listApkPermsButton.TabIndex = 10;
|
||||
@@ -160,7 +141,7 @@
|
||||
//
|
||||
// changePermsBtn
|
||||
//
|
||||
this.changePermsBtn.Location = new System.Drawing.Point(282, 92);
|
||||
this.changePermsBtn.Location = new System.Drawing.Point(372, 50);
|
||||
this.changePermsBtn.Name = "changePermsBtn";
|
||||
this.changePermsBtn.Size = new System.Drawing.Size(87, 34);
|
||||
this.changePermsBtn.TabIndex = 11;
|
||||
@@ -188,9 +169,9 @@
|
||||
//
|
||||
// uninstallAppButton
|
||||
//
|
||||
this.uninstallAppButton.Location = new System.Drawing.Point(375, 92);
|
||||
this.uninstallAppButton.Location = new System.Drawing.Point(465, 50);
|
||||
this.uninstallAppButton.Name = "uninstallAppButton";
|
||||
this.uninstallAppButton.Size = new System.Drawing.Size(64, 34);
|
||||
this.uninstallAppButton.Size = new System.Drawing.Size(87, 34);
|
||||
this.uninstallAppButton.TabIndex = 12;
|
||||
this.uninstallAppButton.Text = "Uninstall app";
|
||||
this.uninstallAppButton.UseVisualStyleBackColor = true;
|
||||
@@ -198,7 +179,7 @@
|
||||
//
|
||||
// sideloadFolderButton
|
||||
//
|
||||
this.sideloadFolderButton.Location = new System.Drawing.Point(375, 12);
|
||||
this.sideloadFolderButton.Location = new System.Drawing.Point(193, 12);
|
||||
this.sideloadFolderButton.Name = "sideloadFolderButton";
|
||||
this.sideloadFolderButton.Size = new System.Drawing.Size(92, 33);
|
||||
this.sideloadFolderButton.TabIndex = 17;
|
||||
@@ -218,9 +199,9 @@
|
||||
//
|
||||
// userjsonButton
|
||||
//
|
||||
this.userjsonButton.Location = new System.Drawing.Point(473, 13);
|
||||
this.userjsonButton.Location = new System.Drawing.Point(100, 90);
|
||||
this.userjsonButton.Name = "userjsonButton";
|
||||
this.userjsonButton.Size = new System.Drawing.Size(92, 33);
|
||||
this.userjsonButton.Size = new System.Drawing.Size(87, 38);
|
||||
this.userjsonButton.TabIndex = 22;
|
||||
this.userjsonButton.Text = "Create user.json";
|
||||
this.userjsonButton.UseVisualStyleBackColor = true;
|
||||
@@ -235,19 +216,54 @@
|
||||
//
|
||||
// settingsButton
|
||||
//
|
||||
this.settingsButton.Location = new System.Drawing.Point(504, 94);
|
||||
this.settingsButton.Location = new System.Drawing.Point(506, 94);
|
||||
this.settingsButton.Name = "settingsButton";
|
||||
this.settingsButton.Size = new System.Drawing.Size(64, 34);
|
||||
this.settingsButton.Size = new System.Drawing.Size(62, 34);
|
||||
this.settingsButton.TabIndex = 24;
|
||||
this.settingsButton.Text = "Settings";
|
||||
this.settingsButton.UseVisualStyleBackColor = true;
|
||||
this.settingsButton.Click += new System.EventHandler(this.settingsButton_Click);
|
||||
//
|
||||
// copyBulkObbButton
|
||||
//
|
||||
this.copyBulkObbButton.Location = new System.Drawing.Point(193, 50);
|
||||
this.copyBulkObbButton.Name = "copyBulkObbButton";
|
||||
this.copyBulkObbButton.Size = new System.Drawing.Size(92, 34);
|
||||
this.copyBulkObbButton.TabIndex = 25;
|
||||
this.copyBulkObbButton.Text = "Copy Bulk Obb";
|
||||
this.copyBulkObbButton.UseVisualStyleBackColor = true;
|
||||
this.copyBulkObbButton.Click += new System.EventHandler(this.copyBulkObbButton_Click);
|
||||
//
|
||||
// checkHashButton
|
||||
//
|
||||
this.checkHashButton.Location = new System.Drawing.Point(12, 90);
|
||||
this.checkHashButton.Name = "checkHashButton";
|
||||
this.checkHashButton.Size = new System.Drawing.Size(82, 31);
|
||||
this.checkHashButton.TabIndex = 26;
|
||||
this.checkHashButton.Text = "Check Hash";
|
||||
this.checkHashButton.UseVisualStyleBackColor = true;
|
||||
this.checkHashButton.Click += new System.EventHandler(this.checkHashButton_Click);
|
||||
//
|
||||
// DragDropLbl
|
||||
//
|
||||
this.DragDropLbl.AutoSize = true;
|
||||
this.DragDropLbl.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.DragDropLbl.Location = new System.Drawing.Point(12, 329);
|
||||
this.DragDropLbl.Name = "DragDropLbl";
|
||||
this.DragDropLbl.Size = new System.Drawing.Size(425, 73);
|
||||
this.DragDropLbl.TabIndex = 27;
|
||||
this.DragDropLbl.Text = "DragDropLBL";
|
||||
this.DragDropLbl.Visible = false;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(650, 411);
|
||||
this.Controls.Add(this.DragDropLbl);
|
||||
this.Controls.Add(this.checkHashButton);
|
||||
this.Controls.Add(this.copyBulkObbButton);
|
||||
this.Controls.Add(this.settingsButton);
|
||||
this.Controls.Add(this.progressBar1);
|
||||
this.Controls.Add(this.userjsonButton);
|
||||
@@ -260,12 +276,10 @@
|
||||
this.Controls.Add(this.listApkPermsButton);
|
||||
this.Controls.Add(this.getApkButton);
|
||||
this.Controls.Add(this.ListApps);
|
||||
this.Controls.Add(this.customadbcmdbutton);
|
||||
this.Controls.Add(this.restorebutton);
|
||||
this.Controls.Add(this.m_combo);
|
||||
this.Controls.Add(this.backupbutton);
|
||||
this.Controls.Add(this.obbcopybutton);
|
||||
this.Controls.Add(this.instructionsbutton);
|
||||
this.Controls.Add(this.devicesbutton);
|
||||
this.Controls.Add(this.startsideloadbutton);
|
||||
this.HelpButton = true;
|
||||
@@ -275,6 +289,9 @@
|
||||
this.Name = "Form1";
|
||||
this.Text = "Rookie SideLoader";
|
||||
this.Load += new System.EventHandler(this.Form1_Load);
|
||||
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.Form1_DragDrop);
|
||||
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.Form1_DragEnter);
|
||||
this.DragLeave += new System.EventHandler(this.Form1_DragLeave);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -283,11 +300,9 @@
|
||||
#endregion
|
||||
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.Button backupbutton;
|
||||
private System.Windows.Forms.Button restorebutton;
|
||||
private System.Windows.Forms.Button customadbcmdbutton;
|
||||
private System.Windows.Forms.Button ListApps;
|
||||
private System.Windows.Forms.Button getApkButton;
|
||||
private System.Windows.Forms.Button listApkPermsButton;
|
||||
@@ -301,6 +316,9 @@
|
||||
private System.Windows.Forms.Button userjsonButton;
|
||||
private System.Windows.Forms.ProgressBar progressBar1;
|
||||
private System.Windows.Forms.Button settingsButton;
|
||||
private System.Windows.Forms.Button copyBulkObbButton;
|
||||
private System.Windows.Forms.Button checkHashButton;
|
||||
private System.Windows.Forms.Label DragDropLbl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
288
Form1.cs
288
Form1.cs
@@ -8,6 +8,7 @@ using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.Timers;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using System.Windows.Threading;
|
||||
using System.Net;
|
||||
using SergeUtils;
|
||||
@@ -24,16 +25,15 @@ namespace AndroidSideloader
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
#if DEBUG
|
||||
public static bool debugMode = true;
|
||||
public static bool debugMode = true;
|
||||
#else
|
||||
public static bool debugMode = false;
|
||||
#endif
|
||||
string path;
|
||||
string result;
|
||||
string obbPath = "";
|
||||
string obbFile;
|
||||
string allText;
|
||||
|
||||
bool exit = false;
|
||||
public static string debugPath = "debug.log";
|
||||
public static string adbPath = Environment.CurrentDirectory + "\\adb\\";
|
||||
string[] line;
|
||||
@@ -55,13 +55,30 @@ namespace AndroidSideloader
|
||||
this.Text = txt;
|
||||
}
|
||||
|
||||
public void runAdbCommand(string command)
|
||||
public void changeStyle(int style)
|
||||
{
|
||||
|
||||
string oldTitle = this.Text;
|
||||
if (progressBar1.InvokeRequired)
|
||||
{
|
||||
if (style == 1)
|
||||
progressBar1.Invoke(new Action(() => progressBar1.Style = ProgressBarStyle.Marquee));
|
||||
else if (style == 0)
|
||||
progressBar1.Invoke(new Action(() => progressBar1.Style = ProgressBarStyle.Continuous));
|
||||
}
|
||||
else if (style == 1)
|
||||
progressBar1.Style = ProgressBarStyle.Marquee;
|
||||
else
|
||||
progressBar1.Style = ProgressBarStyle.Continuous;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void runAdbCommand(string command)
|
||||
{
|
||||
changeStyle(1);
|
||||
oldTitle = this.Text;
|
||||
changeTitle("Rookie's Sideloader | Running command " + command);
|
||||
|
||||
exit = false;
|
||||
Process cmd = new Process();
|
||||
cmd.StartInfo.FileName = Environment.CurrentDirectory + "\\adb\\adb.exe";
|
||||
cmd.StartInfo.Arguments = command;
|
||||
@@ -84,14 +101,13 @@ namespace AndroidSideloader
|
||||
sw.Flush();
|
||||
sw.Close();
|
||||
line = allText.Split('\n');
|
||||
exit = true;
|
||||
|
||||
changeTitle(oldTitle);
|
||||
changeStyle(0);
|
||||
}
|
||||
|
||||
private void sideload(string path)
|
||||
{
|
||||
|
||||
Thread t1 = new Thread(() =>
|
||||
{
|
||||
runAdbCommand("install -r " + '"' + path + '"');
|
||||
@@ -99,7 +115,6 @@ namespace AndroidSideloader
|
||||
t1.IsBackground = true;
|
||||
t1.Start();
|
||||
t1.Join();
|
||||
|
||||
}
|
||||
|
||||
private async void startsideloadbutton_Click(object sender, EventArgs e)
|
||||
@@ -117,9 +132,7 @@ namespace AndroidSideloader
|
||||
}
|
||||
|
||||
//Task.Delay(100).ContinueWith(t => Timer99.Start()); //Delete notification after 5 seconds
|
||||
progressBar1.Style = ProgressBarStyle.Marquee;
|
||||
await Task.Run(() => sideload(path));
|
||||
progressBar1.Style = ProgressBarStyle.Continuous;
|
||||
|
||||
notify(allText);
|
||||
|
||||
@@ -134,28 +147,25 @@ namespace AndroidSideloader
|
||||
notify(allText);
|
||||
}
|
||||
|
||||
public bool experimentalFeatureAccept(string message)
|
||||
{
|
||||
DialogResult dialogResult = FlexibleMessageBox.Show(new Form { TopMost = true }, message, "EXPERIMENTAL FEATURE", MessageBoxButtons.YesNo);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
public static void notify(string message)
|
||||
{
|
||||
if (Properties.Settings.Default.enableMessageBoxes == true)
|
||||
{
|
||||
FlexibleMessageBox.Show(message);
|
||||
FlexibleMessageBox.Show(new Form { TopMost = true, StartPosition = FormStartPosition.CenterScreen }, message);
|
||||
if (Properties.Settings.Default.copyMessageToClipboard == true)
|
||||
Clipboard.SetText(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
3. Press adb devices again and you should see a code and then 'device' (optional)
|
||||
4. Select your apk with select apk button.
|
||||
5. Press Sideload and wait...
|
||||
6. If the game has an obb folder, select it by using select obb then press copy obb";
|
||||
FlexibleMessageBox.Show(instructions);
|
||||
}
|
||||
|
||||
public void ExtractFile(string sourceArchive, string destination)
|
||||
{
|
||||
string zPath = "7z.exe"; //add to proj and set CopyToOuputDir
|
||||
@@ -187,15 +197,12 @@ namespace AndroidSideloader
|
||||
if (dialog.Show(Handle))
|
||||
{
|
||||
string[] files = Directory.GetFiles(dialog.FileName);
|
||||
obbFile = files[0];
|
||||
|
||||
obbPath = dialog.FileName;
|
||||
}
|
||||
else return;
|
||||
|
||||
//Task.Delay(100).ContinueWith(t => Timer99.Start()); //Delete notification after 5 seconds
|
||||
progressBar1.Style = ProgressBarStyle.Marquee;
|
||||
await Task.Run(() => obbcopy(obbPath));
|
||||
progressBar1.Style = ProgressBarStyle.Continuous;
|
||||
|
||||
notify(allText);
|
||||
}
|
||||
@@ -208,14 +215,14 @@ namespace AndroidSideloader
|
||||
this.Text = "Rookie Sideloader | No Device Connected";
|
||||
}
|
||||
|
||||
|
||||
//A lot of stuff to do when the form loads, centers the program,
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.CenterToScreen();
|
||||
|
||||
if (File.Exists(debugPath))
|
||||
File.Delete(debugPath);
|
||||
if (Directory.Exists(adbPath)==false)
|
||||
File.Delete(debugPath); //clear debug.log each start
|
||||
if (Directory.Exists(adbPath)==false) //if there is no adb folder, download and extract
|
||||
{
|
||||
FlexibleMessageBox.Show("Please wait for the software to download and install the adb");
|
||||
try
|
||||
@@ -235,7 +242,7 @@ namespace AndroidSideloader
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FlexibleMessageBox.Show("Cannot download adb because you are not connected to the internet!");
|
||||
FlexibleMessageBox.Show("Cannot download adb because you are not connected to the internet! You can manually download the zip here https://github.com/nerdunit/androidsideloader/raw/master/adb.7z after downloading move it to " + Environment.CurrentDirectory + " and unarchive it");
|
||||
StreamWriter sw = File.AppendText(debugPath);
|
||||
sw.Write("\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
|
||||
sw.Write(ex.ToString() + "\n");
|
||||
@@ -246,18 +253,26 @@ namespace AndroidSideloader
|
||||
|
||||
}
|
||||
|
||||
runAdbCommand("devices");
|
||||
changeTitlebarToDevice();
|
||||
|
||||
if (debugMode==false)
|
||||
if (Properties.Settings.Default.checkForUpdates==true)
|
||||
checkForUpdate();
|
||||
|
||||
runAdbCommand("devices"); //check if there is any device connected
|
||||
changeTitlebarToDevice();
|
||||
|
||||
if (line[1].Length > 1) //check for device connected
|
||||
if (Properties.Settings.Default.firstRun == true)
|
||||
{
|
||||
MessageBox.Show("YOU CAN NOW DRAG AND DROP TO INSTALL APK'S AND OBB FOLDERS!");
|
||||
Properties.Settings.Default.firstRun = false;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
|
||||
intToolTips();
|
||||
|
||||
listappsBtn();
|
||||
|
||||
}
|
||||
|
||||
void intToolTips()
|
||||
{
|
||||
ToolTip ListAppsToolTip = new ToolTip();
|
||||
@@ -288,38 +303,45 @@ namespace AndroidSideloader
|
||||
}
|
||||
void checkForUpdate()
|
||||
{
|
||||
string localVersion = "0.12";
|
||||
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)
|
||||
try
|
||||
{
|
||||
string changelog = client.GetStringAsync("https://raw.githubusercontent.com/nerdunit/androidsideloader/master/changelog.txt").Result;
|
||||
DialogResult dialogResult = FlexibleMessageBox.Show("There is a new update you have version " + localVersion + ", do you want to update?\nCHANGELOG\n" + changelog, "New version " + currentVersion + " available", MessageBoxButtons.YesNo);
|
||||
if (dialogResult != DialogResult.Yes)
|
||||
return;
|
||||
string localVersion = "0.14";
|
||||
HttpClient client = new HttpClient();
|
||||
string currentVersion = client.GetStringAsync("https://raw.githubusercontent.com/nerdunit/androidsideloader/master/version").Result;
|
||||
currentVersion = currentVersion.Remove(currentVersion.Length - 1);
|
||||
|
||||
//download updated version
|
||||
using (var fileClient = new WebClient())
|
||||
if (localVersion != currentVersion)
|
||||
{
|
||||
ServicePointManager.Expect100Continue = true;
|
||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
||||
fileClient.DownloadFile("https://github.com/nerdunit/androidsideloader/releases/download/v" + currentVersion + "/AndroidSideloader.exe", "AndroidSideloader v" + currentVersion + ".exe");
|
||||
string changelog = client.GetStringAsync("https://raw.githubusercontent.com/nerdunit/androidsideloader/master/changelog.txt").Result;
|
||||
DialogResult dialogResult = FlexibleMessageBox.Show("There is a new update you have version " + localVersion + ", do you want to update?\nCHANGELOG\n" + changelog, "Version " + currentVersion + " is available", MessageBoxButtons.YesNo);
|
||||
if (dialogResult != DialogResult.Yes)
|
||||
return;
|
||||
|
||||
//download updated version
|
||||
using (var fileClient = new WebClient())
|
||||
{
|
||||
ServicePointManager.Expect100Continue = true;
|
||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
|
||||
fileClient.DownloadFile("https://github.com/nerdunit/androidsideloader/releases/download/v" + currentVersion + "/AndroidSideloader.exe", "AndroidSideloader v" + currentVersion + ".exe");
|
||||
}
|
||||
|
||||
//melt
|
||||
Process.Start(new ProcessStartInfo()
|
||||
{
|
||||
Arguments = "/C choice /C Y /N /D Y /T 5 & Del \"" + Application.ExecutablePath + "\"",
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
CreateNoWindow = true,
|
||||
FileName = "cmd.exe"
|
||||
});
|
||||
|
||||
Process.Start(Environment.CurrentDirectory + "\\AndroidSideloader v" + currentVersion + ".exe");
|
||||
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
//melt
|
||||
Process.Start(new ProcessStartInfo()
|
||||
{
|
||||
Arguments = "/C choice /C Y /N /D Y /T 5 & Del \"" + Application.ExecutablePath + "\"",
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
CreateNoWindow = true,
|
||||
FileName = "cmd.exe"
|
||||
});
|
||||
|
||||
Process.Start(Environment.CurrentDirectory + "\\AndroidSideloader v" + currentVersion + ".exe");
|
||||
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,11 +359,6 @@ namespace AndroidSideloader
|
||||
|
||||
private async void backupbutton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (exit==false)
|
||||
{
|
||||
MessageBox.Show("Finish Previous action first!");
|
||||
return;
|
||||
}
|
||||
|
||||
await Task.Run(() => backup()); //we use async and await to not freeze the ui
|
||||
|
||||
@@ -370,11 +387,6 @@ namespace AndroidSideloader
|
||||
|
||||
private async void restorebutton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (exit == false)
|
||||
{
|
||||
MessageBox.Show("Finish Previous action first!");
|
||||
return;
|
||||
}
|
||||
|
||||
using (var fbd = new FolderBrowserDialog())
|
||||
{
|
||||
@@ -392,12 +404,6 @@ namespace AndroidSideloader
|
||||
notify(allText);
|
||||
}
|
||||
|
||||
private void customadbcmdbutton_Click(object sender, EventArgs e)
|
||||
{
|
||||
customAdbCommandForm adbCommandForm = new customAdbCommandForm();
|
||||
adbCommandForm.Show();
|
||||
}
|
||||
|
||||
private void listapps()
|
||||
{
|
||||
Thread t1 = new Thread(() =>
|
||||
@@ -456,15 +462,13 @@ namespace AndroidSideloader
|
||||
{
|
||||
if (m_combo.Items.Count == 0)
|
||||
{
|
||||
MessageBox.Show("Please select an app first");
|
||||
notify("Please select an app first");
|
||||
return;
|
||||
}
|
||||
|
||||
string package = m_combo.SelectedItem.ToString().Remove(m_combo.SelectedItem.ToString().Length - 1);
|
||||
|
||||
progressBar1.Style = ProgressBarStyle.Marquee;
|
||||
await Task.Run(() => getapk(package));
|
||||
progressBar1.Style = ProgressBarStyle.Continuous;
|
||||
|
||||
allText = allText.Remove(allText.Length - 1);
|
||||
//MessageBox.Show(allText);
|
||||
@@ -560,8 +564,6 @@ namespace AndroidSideloader
|
||||
{
|
||||
if ((c is CheckBox))
|
||||
{
|
||||
exit = false;
|
||||
progressBar1.Style = ProgressBarStyle.Marquee;
|
||||
if (((CheckBox)c).Checked==true)
|
||||
{
|
||||
await Task.Run(() => changePerms(c, package, "grant"));
|
||||
@@ -570,7 +572,6 @@ namespace AndroidSideloader
|
||||
{
|
||||
await Task.Run(() => changePerms(c, package, "revoke"));
|
||||
}
|
||||
progressBar1.Style = ProgressBarStyle.Continuous;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -593,14 +594,12 @@ namespace AndroidSideloader
|
||||
|
||||
private void launchApkButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
exit = false;
|
||||
Thread t1 = new Thread(() =>
|
||||
{
|
||||
runAdbCommand("shell am start -n " + launchPackageTextBox.Text);
|
||||
});
|
||||
t1.IsBackground = true;
|
||||
t1.Start();
|
||||
|
||||
}
|
||||
|
||||
private async void uninstallAppButton_Click(object sender, EventArgs e)
|
||||
@@ -618,9 +617,7 @@ namespace AndroidSideloader
|
||||
if (dialogResult != DialogResult.Yes)
|
||||
return;
|
||||
|
||||
progressBar1.Style = ProgressBarStyle.Marquee;
|
||||
await Task.Run(() => uninstallPackage(package));
|
||||
progressBar1.Style = ProgressBarStyle.Continuous;
|
||||
|
||||
notify(allText);
|
||||
}
|
||||
@@ -709,6 +706,121 @@ namespace AndroidSideloader
|
||||
SettingsForm settingsForm = new SettingsForm();
|
||||
settingsForm.Show();
|
||||
}
|
||||
|
||||
private void copyBulkObbButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool result = experimentalFeatureAccept("THIS IS AN EXPERIMENTAL FEATURE AND MIGHT NOT WORK, DO YOU WANT TO CONTINUE?");
|
||||
if (result == false)
|
||||
return;
|
||||
|
||||
var dialog = new FolderSelectDialog
|
||||
{
|
||||
Title = "Select your folder with APKs"
|
||||
};
|
||||
if (dialog.Show(Handle))
|
||||
{
|
||||
recursiveCopy(dialog.FileName);
|
||||
}
|
||||
else return;
|
||||
}
|
||||
|
||||
async void recursiveCopy(string location)
|
||||
{
|
||||
string[] files = Directory.GetFiles(location);
|
||||
string[] childDirectories = Directory.GetDirectories(location);
|
||||
for (int i = 0; i < files.Length; i++)
|
||||
{
|
||||
string extension = Path.GetExtension(files[i]);
|
||||
|
||||
if (extension == ".obb")
|
||||
{
|
||||
int index = files[i].LastIndexOf("\\");
|
||||
if (index > 0)
|
||||
files[i] = files[i].Substring(0, index);
|
||||
if (Directory.Exists(files[i])) //if it's a folder
|
||||
await Task.Run(() => obbcopy(files[i]));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < childDirectories.Length; i++)
|
||||
{
|
||||
recursiveCopy(childDirectories[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private async void checkHashButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
string file;
|
||||
|
||||
using (OpenFileDialog openFileDialog = new OpenFileDialog())
|
||||
{
|
||||
openFileDialog.FilterIndex = 2;
|
||||
openFileDialog.RestoreDirectory = true;
|
||||
|
||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||
file = openFileDialog.FileName;
|
||||
else
|
||||
return;
|
||||
}
|
||||
oldTitle = this.Text;
|
||||
changeTitle("Checking hash of file " + file);
|
||||
changeStyle(1);
|
||||
|
||||
await Task.Run(() => checkHashFunc(file));
|
||||
Clipboard.SetText(result);
|
||||
|
||||
changeStyle(0);
|
||||
changeTitle(oldTitle);
|
||||
FlexibleMessageBox.Show("The selected file hash is " + result + " and it was copied to clipboard");
|
||||
}
|
||||
|
||||
public async void checkHashFunc(string file)
|
||||
{
|
||||
using (FileStream stream = File.OpenRead(file))
|
||||
{
|
||||
SHA256Managed sha = new SHA256Managed();
|
||||
byte[] checksum = sha.ComputeHash(stream);
|
||||
result = BitConverter.ToString(checksum).Replace("-", String.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
private async void Form1_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
bool ok = false;
|
||||
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
foreach (string file in files)
|
||||
{
|
||||
Console.WriteLine(file);
|
||||
string extension = Path.GetExtension(file);
|
||||
if (extension == ".apk")
|
||||
{
|
||||
ok = true;
|
||||
await Task.Run(() => sideload(file));
|
||||
}
|
||||
else if (Directory.Exists(file))
|
||||
{
|
||||
ok = true;
|
||||
await Task.Run(() => obbcopy(file));
|
||||
}
|
||||
}
|
||||
DragDropLbl.Visible = false;
|
||||
if (ok)
|
||||
notify("Done");
|
||||
}
|
||||
string oldTitle;
|
||||
private void Form1_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy;
|
||||
oldTitle = this.Text;
|
||||
DragDropLbl.Visible = true;
|
||||
DragDropLbl.Text = "Drag apk or obb";
|
||||
changeTitle(DragDropLbl.Text);
|
||||
}
|
||||
|
||||
private void Form1_DragLeave(object sender, EventArgs e)
|
||||
{
|
||||
changeTitle(oldTitle);
|
||||
DragDropLbl.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public class MethodItem
|
||||
|
||||
@@ -1,3 +1,17 @@
|
||||
0.14
|
||||
+ Check file hash button
|
||||
+ Added first run check (will maybe be used to create user.json files)
|
||||
+ Added drag and drop for apk and obb files
|
||||
+ Progress bar now works for every adb command
|
||||
= Moved buttons
|
||||
- Instructions button
|
||||
- Removed run custom adb command button and form
|
||||
|
||||
0.13
|
||||
+ Added vrmoo.cn.json
|
||||
+ Added bulk obb copy
|
||||
= Message Box now top most
|
||||
|
||||
0.12
|
||||
+ Added settings form
|
||||
+ Added progress bar (again)
|
||||
@@ -76,4 +90,4 @@
|
||||
+ Renamed buttons
|
||||
|
||||
0.1
|
||||
+ Initial Release
|
||||
+ Initial Release
|
||||
@@ -22,7 +22,7 @@ namespace AndroidSideloader
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (textBox1.Text==defaultText || textBox1.Text.Length==0)
|
||||
if (textBox1.Text == defaultText || textBox1.Text.Length == 0)
|
||||
{
|
||||
MessageBox.Show("Please enter your username first");
|
||||
return;
|
||||
@@ -30,9 +30,29 @@ namespace AndroidSideloader
|
||||
|
||||
File.WriteAllText("user.json", "{\"username\":\"" + textBox1.Text + "\"}");
|
||||
|
||||
string command = "push \"" + Environment.CurrentDirectory + "\\user.json\" " + " /sdcard/";
|
||||
runAdbCommand("push \"" + Environment.CurrentDirectory + "\\user.json\" " + " /sdcard/");
|
||||
|
||||
File.Delete("user.json");
|
||||
|
||||
File.WriteAllText("vrmoo.cn.json", "{\"username\":\"" + textBox1.Text + "\"}");
|
||||
|
||||
runAdbCommand("push \"" + Environment.CurrentDirectory + "\\vrmoo.cn.json\" " + " /sdcard/");
|
||||
|
||||
File.Delete("vrmoo.cn.json");
|
||||
|
||||
|
||||
File.WriteAllText("qq1091481055.json", "{\n \"username\":\"" + textBox1.Text + "\"\n }");
|
||||
|
||||
runAdbCommand("push \"" + Environment.CurrentDirectory + "\\qq1091481055.json\" " + " /sdcard/");
|
||||
|
||||
File.Delete("qq1091481055.json");
|
||||
|
||||
Form1.notify("Done");
|
||||
|
||||
}
|
||||
|
||||
private void runAdbCommand(string command)
|
||||
{
|
||||
Process cmd = new Process();
|
||||
cmd.StartInfo.FileName = Environment.CurrentDirectory + "\\adb\\adb.exe";
|
||||
cmd.StartInfo.Arguments = command;
|
||||
@@ -48,7 +68,6 @@ namespace AndroidSideloader
|
||||
string allText = cmd.StandardOutput.ReadToEnd();
|
||||
cmd.WaitForExit();
|
||||
|
||||
File.Delete("user.json");
|
||||
|
||||
StreamWriter sw = File.AppendText(Form1.debugPath);
|
||||
sw.Write("Action name = " + command + '\n');
|
||||
@@ -56,9 +75,6 @@ namespace AndroidSideloader
|
||||
sw.Write("\n--------------------------------------------------------------------\n");
|
||||
sw.Flush();
|
||||
sw.Close();
|
||||
|
||||
|
||||
Form1.notify(allText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user