Compare commits

...

9 Commits
v0.8 ... v0.10

Author SHA1 Message Date
nerdunit
003ad447a1 Update version 2020-06-21 18:41:21 +03:00
nerdunit
cb1b2c2e5e 0.9 2020-06-21 18:09:18 +03:00
nerdunit
dbe8df01e0 Update version 2020-06-21 18:05:31 +03:00
nerdunit
d800f29459 Updated to 0.9 2020-06-21 18:02:25 +03:00
nerdunit
597f3c43cd Update README.md 2020-06-19 12:10:28 +03:00
nerdunit
05d9112637 Update version 2020-06-19 12:08:56 +03:00
nerdunit
646e38a737 Added auto update + bugfix 2020-06-19 12:05:50 +03:00
nerdunit
d86bb17b4d Add files via upload 2020-06-19 11:04:04 +03:00
nerdunit
d65f471ccd Update version 2020-06-19 11:03:04 +03:00
11 changed files with 2530 additions and 95 deletions

View File

@@ -35,6 +35,10 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>
</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Costura, Version=4.1.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>packages\Costura.Fody.4.1.0\lib\net40\Costura.dll</HintPath>
@@ -53,6 +57,7 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="customAdbCommandForm.cs">
@@ -67,8 +72,15 @@
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="usernameForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="usernameForm.Designer.cs">
<DependentUpon>usernameForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SelectFolder.cs" />
<EmbeddedResource Include="customAdbCommandForm.resx">
<DependentUpon>customAdbCommandForm.cs</DependentUpon>
</EmbeddedResource>
@@ -84,6 +96,9 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="usernameForm.resx">
<DependentUpon>usernameForm.cs</DependentUpon>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@@ -98,6 +113,9 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="packages\Fody.6.0.0\build\Fody.targets" Condition="Exists('packages\Fody.6.0.0\build\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

86
Form1.Designer.cs generated
View File

@@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.m_combo = new SergeUtils.EasyCompletionComboBox();
this.startsideloadbutton = new System.Windows.Forms.Button();
this.devicesbutton = new System.Windows.Forms.Button();
@@ -43,18 +44,24 @@
this.launchPackageTextBox = new System.Windows.Forms.TextBox();
this.launchApkButton = new System.Windows.Forms.Button();
this.uninstallAppButton = new System.Windows.Forms.Button();
this.sideloadFolderButton = new System.Windows.Forms.Button();
this.aboutBtn = new System.Windows.Forms.Button();
this.label = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.progressBar = new System.Windows.Forms.ProgressBar();
this.userjsonButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// m_combo
//
this.m_combo.Location = new System.Drawing.Point(12, 134);
this.m_combo.Name = "m_combo";
this.m_combo.Size = new System.Drawing.Size(426, 21);
this.m_combo.Size = new System.Drawing.Size(427, 21);
this.m_combo.TabIndex = 16;
//
// startsideloadbutton
//
this.startsideloadbutton.Location = new System.Drawing.Point(100, 13);
this.startsideloadbutton.Location = new System.Drawing.Point(100, 12);
this.startsideloadbutton.Name = "startsideloadbutton";
this.startsideloadbutton.Size = new System.Drawing.Size(87, 33);
this.startsideloadbutton.TabIndex = 2;
@@ -94,9 +101,9 @@
//
// backupbutton
//
this.backupbutton.Location = new System.Drawing.Point(13, 52);
this.backupbutton.Location = new System.Drawing.Point(12, 52);
this.backupbutton.Name = "backupbutton";
this.backupbutton.Size = new System.Drawing.Size(81, 34);
this.backupbutton.Size = new System.Drawing.Size(82, 34);
this.backupbutton.TabIndex = 5;
this.backupbutton.Text = "Backup Gamedata";
this.backupbutton.UseVisualStyleBackColor = true;
@@ -190,11 +197,74 @@
this.uninstallAppButton.UseVisualStyleBackColor = true;
this.uninstallAppButton.Click += new System.EventHandler(this.uninstallAppButton_Click);
//
// sideloadFolderButton
//
this.sideloadFolderButton.Location = new System.Drawing.Point(375, 12);
this.sideloadFolderButton.Name = "sideloadFolderButton";
this.sideloadFolderButton.Size = new System.Drawing.Size(92, 33);
this.sideloadFolderButton.TabIndex = 17;
this.sideloadFolderButton.Text = "Sideload Folder";
this.sideloadFolderButton.UseVisualStyleBackColor = true;
this.sideloadFolderButton.Click += new System.EventHandler(this.sideloadFolderButton_Click);
//
// aboutBtn
//
this.aboutBtn.Location = new System.Drawing.Point(574, 94);
this.aboutBtn.Name = "aboutBtn";
this.aboutBtn.Size = new System.Drawing.Size(64, 34);
this.aboutBtn.TabIndex = 18;
this.aboutBtn.Text = "About";
this.aboutBtn.UseVisualStyleBackColor = true;
this.aboutBtn.Click += new System.EventHandler(this.aboutBtn_Click);
//
// label
//
this.label.AutoSize = true;
this.label.Location = new System.Drawing.Point(27, 363);
this.label.Name = "label";
this.label.Size = new System.Drawing.Size(35, 13);
this.label.TabIndex = 19;
this.label.Text = "label1";
this.label.Visible = false;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(27, 389);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(35, 13);
this.label1.TabIndex = 20;
this.label1.Text = "label1";
this.label1.Visible = false;
//
// progressBar
//
this.progressBar.Location = new System.Drawing.Point(12, 157);
this.progressBar.Name = "progressBar";
this.progressBar.Size = new System.Drawing.Size(427, 23);
this.progressBar.TabIndex = 21;
//
// userjsonButton
//
this.userjsonButton.Location = new System.Drawing.Point(473, 13);
this.userjsonButton.Name = "userjsonButton";
this.userjsonButton.Size = new System.Drawing.Size(92, 33);
this.userjsonButton.TabIndex = 22;
this.userjsonButton.Text = "Create user.json";
this.userjsonButton.UseVisualStyleBackColor = true;
this.userjsonButton.Click += new System.EventHandler(this.userjsonButton_Click);
//
// Form1
//
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.userjsonButton);
this.Controls.Add(this.progressBar);
this.Controls.Add(this.label1);
this.Controls.Add(this.label);
this.Controls.Add(this.aboutBtn);
this.Controls.Add(this.sideloadFolderButton);
this.Controls.Add(this.uninstallAppButton);
this.Controls.Add(this.launchApkButton);
this.Controls.Add(this.launchPackageTextBox);
@@ -210,6 +280,8 @@
this.Controls.Add(this.instructionsbutton);
this.Controls.Add(this.devicesbutton);
this.Controls.Add(this.startsideloadbutton);
this.HelpButton = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximumSize = new System.Drawing.Size(666, 1000);
this.MinimumSize = new System.Drawing.Size(466, 450);
this.Name = "Form1";
@@ -236,6 +308,12 @@
private System.Windows.Forms.TextBox launchPackageTextBox;
private System.Windows.Forms.Button launchApkButton;
private System.Windows.Forms.Button uninstallAppButton;
private System.Windows.Forms.Button sideloadFolderButton;
private System.Windows.Forms.Button aboutBtn;
private System.Windows.Forms.Label label;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ProgressBar progressBar;
private System.Windows.Forms.Button userjsonButton;
}
}

274
Form1.cs
View File

@@ -6,16 +6,21 @@ using System.Threading;
using System.Windows;
using System.Threading.Tasks;
using System.Net.Http;
using System.Timers;
using System.Reflection;
using System.Windows.Threading;
using System.Net;
using SergeUtils;
/* <a target="_blank" href="https://icons8.com/icons/set/van">Van icon</a> icon by <a target="_blank" href="https://icons8.com">Icons8</a>
* The icon of the app contains an icon made by icon8.com
*/
namespace AndroidSideloader
{
public partial class Form1 : Form
{
#if DEBUG
@@ -26,15 +31,21 @@ namespace AndroidSideloader
string path;
string obbPath = "";
string obbFile;
int size;
string allText;
bool exit = false;
string debugPath = "debug.log";
public string adbPath = Environment.CurrentDirectory + "\\adb\\";
public static string debugPath = "debug.log";
public static string adbPath = Environment.CurrentDirectory + "\\adb\\";
string[] line;
public Form1()
{
InitializeComponent();
Timer99.Tick += Timer99_Tick; // don't freeze the ui
Timer99.Interval = new TimeSpan(0, 0, 0, 0, 1024);
Timer99.IsEnabled = true;
Timer99.Stop();
}
public void changeTitle(string txt)
@@ -95,7 +106,6 @@ namespace AndroidSideloader
private async void startsideloadbutton_Click(object sender, EventArgs e)
{
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
openFileDialog.Filter = "Android apps (*.apk)|*.apk";
@@ -107,24 +117,42 @@ namespace AndroidSideloader
else
return;
}
progressBar.Value = 0;
FileInfo fi = new FileInfo(path);
size = (int)fi.Length / 1024;
progressBar.Maximum = size;
if (path == "" || path.EndsWith(".apk") == false)
MessageBox.Show("You must select an apk");
else
{
Task.Delay(100).ContinueWith(t => Timer99.Start()); //Delete notification after 5 seconds
await Task.Run(() => sideload(path));
Timer99.Stop();
progressBar.Value = size;
await Task.Run(() => sideload(path));
MessageBox.Show(allText);
}
notify(allText);
}
private void devicesbutton_Click(object sender, EventArgs e)
{
runAdbCommand("devices");
changeTitlebarToDevice();
MessageBox.Show(allText);
notify(allText);
}
public static void notify(string message)
{
var notifyIcon = new System.Windows.Forms.NotifyIcon();
//notifyIcon.Icon = System.Drawing.SystemIcons.Application;
notifyIcon.Icon = System.Drawing.SystemIcons.Asterisk;
notifyIcon.BalloonTipTitle = "AndroidSideloader";
notifyIcon.BalloonTipText = message;
notifyIcon.Visible = true;
notifyIcon.BalloonTipClicked += (sender, e) => {
Clipboard.SetText(message);
};
notifyIcon.ShowBalloonTip(3000);
Task.Delay(5000).ContinueWith(t => notifyIcon.Dispose()); //Delete notification after 5 seconds
}
private void instructionsbutton_Click(object sender, EventArgs e)
@@ -162,30 +190,29 @@ namespace AndroidSideloader
private async void obbcopybutton_Click(object sender, EventArgs e)
{
using (var fbd = new FolderBrowserDialog())
var dialog = new FolderSelectDialog
{
DialogResult result = fbd.ShowDialog();
if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
{
string[] files = Directory.GetFiles(fbd.SelectedPath);
obbFile = files[0];
obbPath = fbd.SelectedPath;
}
else return;
}
if (obbPath.Length>0)
Title = "Select your obb folder"
};
if (dialog.Show(Handle))
{
await Task.Run(() => obbcopy(obbPath));
MessageBox.Show(allText);
}
else
{
MessageBox.Show("You forgot to select the obb folder");
string[] files = Directory.GetFiles(dialog.FileName);
obbFile = files[0];
obbPath = dialog.FileName;
}
else return;
progressBar.Value = 0;
FileInfo fi = new FileInfo(obbFile);
size = (int)fi.Length / 1024;
progressBar.Maximum = size;
Task.Delay(100).ContinueWith(t => Timer99.Start()); //Delete notification after 5 seconds
await Task.Run(() => obbcopy(obbPath));
Timer99.Stop();
progressBar.Value = size;
notify(allText);
}
private void changeTitlebarToDevice()
@@ -198,12 +225,11 @@ namespace AndroidSideloader
private void Form1_Load(object sender, EventArgs e)
{
runAdbCommand("devices");
changeTitlebarToDevice();
//comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; //can remove if u want to not show the box 2 times
//comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems;
if (debugMode==true)
{
label.Visible = true;
label1.Visible = true;
}
if (File.Exists(debugPath))
File.Delete(debugPath);
if (Directory.Exists(adbPath)==false)
@@ -236,6 +262,9 @@ namespace AndroidSideloader
}
}
runAdbCommand("devices");
changeTitlebarToDevice();
if (debugMode==false)
checkForUpdate();
intToolTips();
@@ -246,22 +275,55 @@ namespace AndroidSideloader
void intToolTips()
{
ToolTip ListAppsToolTip = new ToolTip();
ListAppsToolTip.SetToolTip(this.ListApps, "Press this to show what packages you have installed");
ListAppsToolTip.SetToolTip(this.ListApps, "Shows what apps are installed in the list below (in the combo box)");
ToolTip ListDevicesToolTip = new ToolTip();
ListDevicesToolTip.SetToolTip(this.devicesbutton, "Lists the devices in a message box, also updates title bar");
ToolTip SideloadAPKToolTip = new ToolTip();
SideloadAPKToolTip.SetToolTip(this.startsideloadbutton, "Sideloads/Installs one apk on the android device");
ToolTip OBBToolTip = new ToolTip();
OBBToolTip.SetToolTip(this.obbcopybutton, "Copies an obb folder to the Android/Obb folder from the device, some games/apps need this");
ToolTip BackupGameDataToolTip = new ToolTip();
BackupGameDataToolTip.SetToolTip(this.backupbutton, "Saves the game and apps data to the sideloader folder, does not save apk's and obb's");
ToolTip RestoreGameDataToolTip = new ToolTip();
RestoreGameDataToolTip.SetToolTip(this.restorebutton, "Restores the game and apps data to the device, first use Backup Game Data button");
ToolTip GetAPKToolTip = new ToolTip();
GetAPKToolTip.SetToolTip(this.getApkButton, "Saves the selected apk to the folder where the sideloader is");
ToolTip ListAppPermsToolTip = new ToolTip();
ListAppPermsToolTip.SetToolTip(this.listApkPermsButton, "Lists the permissions for the selected apk");
ToolTip ChangeAppPermsToolTip = new ToolTip();
ChangeAppPermsToolTip.SetToolTip(this.changePermsBtn, "Applies the permissions for the apk, first press list app perms");
}
void checkForUpdate()
{
try
string localVersion = "0.9";
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)
{
string localVersion = "0.7";
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
DialogResult dialogResult = MessageBox.Show("There is a new update, do you want to update?", "New version " + currentVersion + " available", MessageBoxButtons.YesNo);
if (dialogResult != DialogResult.Yes)
return;
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", "Android Sideloader v" + currentVersion + ".exe");
}
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 + "\\Android Sideloader v" + currentVersion + ".exe");
Environment.Exit(0);
//MessageBox.Show("Your version is outdated, the latest version is " + currentVersion + " you can download it from https://github.com/nerdunit/", "OUTDATED");
}
}
@@ -296,12 +358,7 @@ namespace AndroidSideloader
File.AppendAllText(debugPath, ex.ToString());
}
MessageBox.Show(allText);
}
private void debugbutton_Click(object sender, EventArgs e)
{
notify(allText);
}
private void restore()
@@ -336,7 +393,7 @@ namespace AndroidSideloader
}
await Task.Run(() => restore());
MessageBox.Show(allText);
notify(allText);
}
private void customadbcmdbutton_Click(object sender, EventArgs e)
@@ -403,6 +460,12 @@ namespace AndroidSideloader
private async void getApkButton_Click(object sender, EventArgs e)
{
if (m_combo.Items.Count == 0)
{
MessageBox.Show("Please select an app first");
return;
}
string package = m_combo.SelectedItem.ToString().Remove(m_combo.SelectedItem.ToString().Length - 1);
await Task.Run(() => getapk(package));
@@ -425,7 +488,7 @@ namespace AndroidSideloader
File.Move(Environment.CurrentDirectory + "\\adb\\" + currApkPath, Environment.CurrentDirectory + "\\" + package + ".apk");
MessageBox.Show("Done");
notify(allText);
}
private void listappperms(string package)
@@ -441,6 +504,12 @@ namespace AndroidSideloader
private async void listApkPermsButton_Click(object sender, EventArgs e)
{
if(m_combo.Items.Count == 0)
{
MessageBox.Show("Please select an app first");
return;
}
string package = m_combo.SelectedItem.ToString().Remove(m_combo.SelectedItem.ToString().Length - 1);
await Task.Run(() => listappperms(package));
@@ -488,6 +557,12 @@ namespace AndroidSideloader
private async void changePermsBtn_Click(object sender, EventArgs e)
{
if (m_combo.Items.Count == 0)
{
MessageBox.Show("Please select an app first");
return;
}
string package = m_combo.SelectedItem.ToString().Remove(m_combo.SelectedItem.ToString().Length - 1);
foreach (Control c in Controls)
@@ -507,7 +582,7 @@ namespace AndroidSideloader
}
MessageBox.Show("Done!");
notify("Changed Permissions");
}
@@ -535,8 +610,19 @@ namespace AndroidSideloader
}
private bool checkForDevice()
{
return true;
}
private async void uninstallAppButton_Click(object sender, EventArgs e)
{
if (m_combo.Items.Count == 0)
{
MessageBox.Show("Please select an app first");
return;
}
allText = "";
string package = m_combo.SelectedItem.ToString().Remove(m_combo.SelectedItem.ToString().Length - 1);
@@ -546,7 +632,7 @@ namespace AndroidSideloader
await Task.Run(() => uninstallPackage(package));
MessageBox.Show(allText);
notify(allText);
}
private void uninstallPackage(string package)
@@ -565,6 +651,70 @@ namespace AndroidSideloader
MethodItem mi = (MethodItem)m_combo.SelectedItem;
m_combo.MatchingMethod = mi.Value;
}
private async void sideloadFolderButton_Click(object sender, EventArgs e)
{
var dialog = new FolderSelectDialog
{
Title = "Select your folder with APKs"
};
if (dialog.Show(Handle))
{
string[] files = Directory.GetFiles(dialog.FileName);
foreach (string file in files)
{
await Task.Run(() => sideload(file));
}
}
else return;
notify("Done Mass Sideloading");
}
private void aboutBtn_Click(object sender, EventArgs e)
{
string about = @" - The icon of the app contains an icon made by icon8.com
- Software orignally coded by rookie.lol#7897
- Thanks to https://stackoverflow.com/users/57611/erike for the folder browser dialog code
- Thanks to Serge Weinstock for developing SergeUtils, it is used to search the combo box";
MessageBox.Show(about);
}
/*Progress bar stuff
*
*/
DispatcherTimer Timer99 = new DispatcherTimer();
public PerformanceCounter myCounter =
new PerformanceCounter("PhysicalDisk", "Disk Read Bytes/sec", "_Total");
public PerformanceCounter myCounter2 =
new PerformanceCounter("PhysicalDisk", "Disk Write Bytes/sec", "_Total");
public Int32 j = 0;
public Int32 k = 0;
public void Timer99_Tick(System.Object sender, System.EventArgs e)
{
//Console.Clear();
j = Convert.ToInt32(myCounter.NextValue());
j = j / 1024;
k = Convert.ToInt32(myCounter2.NextValue());
k = k / 1024;
try { progressBar.Value += k*10; } catch { progressBar.Maximum = 100; progressBar.Value = 90; Timer99.Stop(); } //fake progress bar, for some reason performance counters are retarded or i am
//Console.WriteLine(j);
label.Text = "Read " + j.ToString();
label1.Text = "Write " + k.ToString();
}
private void userjsonButton_Click(object sender, EventArgs e)
{
usernameForm usernameForm1 = new usernameForm();
usernameForm1.Show();
}
}
public class MethodItem

1788
Form1.resx

File diff suppressed because it is too large Load Diff

View File

@@ -2,50 +2,61 @@
Changelog
0.9
+ Added the buggy progress bar back, uses different "logic"
+ Added an icon (Increased the exe size by like 300% just with that)
+ Added sideload folder button
+ Added Creat user.json button and form
+ Changed Message Boxes to notifications
0.8.5
+ Added auto update download
= Fixed a bug where if you didn't have the adb folder it would crash
0.8
- Every command now shows progress on title bar
- Automatically run Adb Devices and List Apps on form startup
- You can now search the App List Combo Box
- Cleaned some code
+ Every command now shows progress on title bar
+ Automatically run Adb Devices and List Apps on form startup
+ You can now search the App List Combo Box
= Cleaned some code
0.7
- Fixed UI Freezes
- Added Uninstall APK Button
- Added Launch package Button
= Fixed UI Freezes
+ Added Uninstall APK Button
+ Added Launch package Button
- Removed loading bar
0.6
- Added List Apk Perms button
- Added Change Permissions button
- Added dinamically added checkbox for permisssions
- The software now downloads adb from master instead of v0.3 release
+ Added List Apk Perms button
+ Added Change Permissions button
+ Added dinamically added checkbox for permisssions
= The software now downloads adb from master instead of v0.3 release
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
= 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
+ 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
+ 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
+ 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
+ Added Flash Firmware button
+ Added few tooltips
+ Renamed buttons
0.1
- Initial Release
+ Initial Release

131
SelectFolder.cs Normal file
View File

@@ -0,0 +1,131 @@
using System;
using System.Reflection;
using System.Windows.Forms;
namespace AndroidSideloader
{
/// <summary>
/// Present the Windows Vista-style open file dialog to select a folder. Fall back for older Windows Versions
/// </summary>
public class FolderSelectDialog
{
private string _initialDirectory;
private string _title;
private string _fileName = "";
public string InitialDirectory
{
get { return string.IsNullOrEmpty(_initialDirectory) ? Environment.CurrentDirectory : _initialDirectory; }
set { _initialDirectory = value; }
}
public string Title
{
get { return _title ?? "Select a folder"; }
set { _title = value; }
}
public string FileName { get { return _fileName; } }
public bool Show() { return Show(IntPtr.Zero); }
/// <param name="hWndOwner">Handle of the control or window to be the parent of the file dialog</param>
/// <returns>true if the user clicks OK</returns>
public bool Show(IntPtr hWndOwner)
{
var result = Environment.OSVersion.Version.Major >= 6
? VistaDialog.Show(hWndOwner, InitialDirectory, Title)
: ShowXpDialog(hWndOwner, InitialDirectory, Title);
_fileName = result.FileName;
return result.Result;
}
private struct ShowDialogResult
{
public bool Result { get; set; }
public string FileName { get; set; }
}
private static ShowDialogResult ShowXpDialog(IntPtr ownerHandle, string initialDirectory, string title)
{
var folderBrowserDialog = new FolderBrowserDialog
{
Description = title,
SelectedPath = initialDirectory,
ShowNewFolderButton = false
};
var dialogResult = new ShowDialogResult();
if (folderBrowserDialog.ShowDialog(new WindowWrapper(ownerHandle)) == DialogResult.OK)
{
dialogResult.Result = true;
dialogResult.FileName = folderBrowserDialog.SelectedPath;
}
return dialogResult;
}
private static class VistaDialog
{
private const string c_foldersFilter = "Folders|\n";
private const BindingFlags c_flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
private readonly static Assembly s_windowsFormsAssembly = typeof(FileDialog).Assembly;
private readonly static Type s_iFileDialogType = s_windowsFormsAssembly.GetType("System.Windows.Forms.FileDialogNative+IFileDialog");
private readonly static MethodInfo s_createVistaDialogMethodInfo = typeof(OpenFileDialog).GetMethod("CreateVistaDialog", c_flags);
private readonly static MethodInfo s_onBeforeVistaDialogMethodInfo = typeof(OpenFileDialog).GetMethod("OnBeforeVistaDialog", c_flags);
private readonly static MethodInfo s_getOptionsMethodInfo = typeof(FileDialog).GetMethod("GetOptions", c_flags);
private readonly static MethodInfo s_setOptionsMethodInfo = s_iFileDialogType.GetMethod("SetOptions", c_flags);
private readonly static uint s_fosPickFoldersBitFlag = (uint)s_windowsFormsAssembly
.GetType("System.Windows.Forms.FileDialogNative+FOS")
.GetField("FOS_PICKFOLDERS")
.GetValue(null);
private readonly static ConstructorInfo s_vistaDialogEventsConstructorInfo = s_windowsFormsAssembly
.GetType("System.Windows.Forms.FileDialog+VistaDialogEvents")
.GetConstructor(c_flags, null, new[] { typeof(FileDialog) }, null);
private readonly static MethodInfo s_adviseMethodInfo = s_iFileDialogType.GetMethod("Advise");
private readonly static MethodInfo s_unAdviseMethodInfo = s_iFileDialogType.GetMethod("Unadvise");
private readonly static MethodInfo s_showMethodInfo = s_iFileDialogType.GetMethod("Show");
public static ShowDialogResult Show(IntPtr ownerHandle, string initialDirectory, string title)
{
var openFileDialog = new OpenFileDialog
{
AddExtension = false,
CheckFileExists = false,
DereferenceLinks = true,
Filter = c_foldersFilter,
InitialDirectory = initialDirectory,
Multiselect = false,
Title = title
};
var iFileDialog = s_createVistaDialogMethodInfo.Invoke(openFileDialog, new object[] { });
s_onBeforeVistaDialogMethodInfo.Invoke(openFileDialog, new[] { iFileDialog });
s_setOptionsMethodInfo.Invoke(iFileDialog, new object[] { (uint)s_getOptionsMethodInfo.Invoke(openFileDialog, new object[] { }) | s_fosPickFoldersBitFlag });
var adviseParametersWithOutputConnectionToken = new[] { s_vistaDialogEventsConstructorInfo.Invoke(new object[] { openFileDialog }), 0U };
s_adviseMethodInfo.Invoke(iFileDialog, adviseParametersWithOutputConnectionToken);
try
{
int retVal = (int)s_showMethodInfo.Invoke(iFileDialog, new object[] { ownerHandle });
return new ShowDialogResult
{
Result = retVal == 0,
FileName = openFileDialog.FileName
};
}
finally
{
s_unAdviseMethodInfo.Invoke(iFileDialog, new[] { adviseParametersWithOutputConnectionToken[1] });
}
}
}
// Wrap an IWin32Window around an IntPtr
private class WindowWrapper : IWin32Window
{
private readonly IntPtr _handle;
public WindowWrapper(IntPtr handle) { _handle = handle; }
public IntPtr Handle { get { return _handle; } }
}
}
}

BIN
icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

75
usernameForm.Designer.cs generated Normal file
View File

@@ -0,0 +1,75 @@
namespace AndroidSideloader
{
partial class usernameForm
{
/// <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.button1 = 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(400, 20);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "Enter your username here";
//
// button1
//
this.button1.Location = new System.Drawing.Point(13, 39);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(400, 23);
this.button1.TabIndex = 1;
this.button1.Text = "Create User.Json";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// usernameForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(425, 74);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
this.MaximumSize = new System.Drawing.Size(441, 113);
this.MinimumSize = new System.Drawing.Size(441, 113);
this.Name = "usernameForm";
this.Text = "USER.JSON";
this.Load += new System.EventHandler(this.usernameForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
}
}

64
usernameForm.cs Normal file
View File

@@ -0,0 +1,64 @@
using System;
using System.Diagnostics;
using System.Windows.Forms;
using System.IO;
namespace AndroidSideloader
{
public partial class usernameForm : Form
{
public usernameForm()
{
InitializeComponent();
}
string defaultText;
private void usernameForm_Load(object sender, EventArgs e)
{
defaultText = textBox1.Text;
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text==defaultText || textBox1.Text.Length==0)
{
MessageBox.Show("Please enter your username first");
return;
}
File.WriteAllText("user.json", "{\"username\":\"" + textBox1.Text + "\"}");
string command = "push " + Environment.CurrentDirectory + "\\user.json " + " /sdcard/";
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 = Form1.adbPath;
cmd.Start();
cmd.StandardInput.WriteLine(command);
cmd.StandardInput.Flush();
cmd.StandardInput.Close();
string allText = cmd.StandardOutput.ReadToEnd();
cmd.WaitForExit();
File.Delete("user.json");
StreamWriter sw = File.AppendText(Form1.debugPath);
sw.Write("Action name = " + command + '\n');
sw.Write(allText);
sw.Write("\n--------------------------------------------------------------------\n");
sw.Flush();
sw.Close();
Form1.notify(allText);
}
}
}

120
usernameForm.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.7
0.9.1