Compare commits

...

36 Commits
v0.8 ... v1.0

Author SHA1 Message Date
nerdunit
9cd02f1860 Delete main.exe 2020-07-06 05:23:51 -07:00
nerdunit
12c1ba0c93 Add files via upload 2020-07-06 05:23:11 -07:00
nerdunit
ebbf0ae066 Delete AndroidSideloader.exe 2020-07-06 04:27:42 -07:00
nerdunit
09a98a4262 Add files via upload 2020-07-06 04:00:22 -07:00
nerdunit
e8c0e313cc v0.15HF1 2020-07-02 09:07:33 -07:00
nerdunit
7047089f0d Update version 2020-07-02 09:07:03 -07:00
nerdunit
d7ddeff532 Update README.md 2020-07-02 08:01:31 -07:00
nerdunit
7b8f806be6 v0.15 2020-07-02 08:00:15 -07:00
nerdunit
cd58002295 Update version 2020-07-02 07:59:39 -07:00
nerdunit
31120a8735 Add files via upload 2020-07-01 13:46:51 -07:00
nerdunit
b2d4dca283 Add files via upload 2020-06-28 22:39:24 +03:00
nerdunit
4a121e1e83 Update version 2020-06-28 22:38:52 +03:00
nerdunit
a785127de3 Update version 2020-06-28 19:17:26 +03:00
nerdunit
fd8bb084f8 Add files via upload 2020-06-28 19:16:46 +03:00
nerdunit
ca69955211 Add files via upload 2020-06-27 16:38:50 +03:00
nerdunit
6ed41a5443 Update version 2020-06-27 16:37:55 +03:00
nerdunit
6dddadb5e6 Update changelog.txt 2020-06-24 20:27:49 +03:00
nerdunit
3b5fc52e31 Update version 2020-06-24 20:25:21 +03:00
nerdunit
2152f08bc3 v0.12 2020-06-24 20:23:25 +03:00
nerdunit
e6d2c9604a Add files via upload 2020-06-24 10:30:36 +03:00
nerdunit
235b378f9f Update version 2020-06-24 10:29:36 +03:00
nerdunit
39339c2583 Update README.md 2020-06-24 10:28:35 +03:00
nerdunit
72e0d4fba4 Add files via upload 2020-06-24 10:20:27 +03:00
nerdunit
efc1b3b773 Update README.md 2020-06-23 12:15:36 +03:00
nerdunit
4dbc236b31 Update README.md 2020-06-23 12:10:47 +03:00
nerdunit
730c88316e v0.10 2020-06-23 12:07:45 +03:00
nerdunit
3641a8ec1d Update version 2020-06-23 12:07:10 +03:00
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
39 changed files with 4858 additions and 429 deletions

View File

@@ -27,18 +27,57 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>
</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<StartupObject>AndroidSideloader.Program</StartupObject>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</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>
</Reference>
<Reference Include="MetroFramework, Version=1.2.0.3, Culture=neutral, PublicKeyToken=5f91a84759bf584a, processorArchitecture=MSIL">
<HintPath>packages\MetroFramework.RunTime.1.2.0.3\lib\net40-Client\MetroFramework.dll</HintPath>
</Reference>
<Reference Include="MetroFramework.Design, Version=1.2.0.3, Culture=neutral, PublicKeyToken=5f91a84759bf584a, processorArchitecture=MSIL">
<HintPath>packages\MetroFramework.Design.1.2.0.3\lib\net40\MetroFramework.Design.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="MetroFramework.Fonts, Version=1.2.0.3, Culture=neutral, PublicKeyToken=5f91a84759bf584a, processorArchitecture=MSIL">
<HintPath>packages\MetroFramework.Fonts.1.2.0.3\lib\net40\MetroFramework.Fonts.dll</HintPath>
</Reference>
<Reference Include="SergeUtils">
<HintPath>.\SergeUtils.dll</HintPath>
</Reference>
@@ -53,25 +92,31 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<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>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="SettingsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SettingsForm.Designer.cs">
<DependentUpon>SettingsForm.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" />
<EmbeddedResource Include="customAdbCommandForm.resx">
<DependentUpon>customAdbCommandForm.cs</DependentUpon>
</EmbeddedResource>
<Compile Include="SelectFolder.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
@@ -83,7 +128,14 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="SettingsForm.resx">
<DependentUpon>SettingsForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="usernameForm.resx">
<DependentUpon>usernameForm.cs</DependentUpon>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@@ -98,6 +150,10 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="icon.ico" />
<Content Include="MetroFramework.txt" />
</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">

View File

@@ -8,13 +8,19 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CC8BE9F0-CE07-406A-A378-81D9CFE4CC1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC8BE9F0-CE07-406A-A378-81D9CFE4CC1D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC8BE9F0-CE07-406A-A378-81D9CFE4CC1D}.Debug|x64.ActiveCfg = Debug|x64
{CC8BE9F0-CE07-406A-A378-81D9CFE4CC1D}.Debug|x64.Build.0 = Debug|x64
{CC8BE9F0-CE07-406A-A378-81D9CFE4CC1D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC8BE9F0-CE07-406A-A378-81D9CFE4CC1D}.Release|Any CPU.Build.0 = Release|Any CPU
{CC8BE9F0-CE07-406A-A378-81D9CFE4CC1D}.Release|x64.ActiveCfg = Release|x64
{CC8BE9F0-CE07-406A-A378-81D9CFE4CC1D}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -1,6 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="AndroidSideloader.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<userSettings>
<AndroidSideloader.Properties.Settings>
<setting name="checkForUpdates" serializeAs="String">
<value>True</value>
</setting>
<setting name="enableMessageBoxes" serializeAs="String">
<value>True</value>
</setting>
<setting name="copyMessageToClipboard" serializeAs="String">
<value>False</value>
</setting>
<setting name="firstRun" serializeAs="String">
<value>True</value>
</setting>
<setting name="useTor" serializeAs="String">
<value>False</value>
</setting>
</AndroidSideloader.Properties.Settings>
</userSettings>
</configuration>

79
Changelog.txt Normal file
View File

@@ -0,0 +1,79 @@
0.12
+ Added settings form
+ Added progress bar (again)
+ Added a new user.json
= Fixed crash on some systems (PerformanceCounter)
= Fixed crash because of file name inconsistency
- Removed performance counters because they made the software not work for some people
0.11
+ Changed normal message boxes to flexible ones
+ Added changelog to update message
= Improved update message
- Removed progressbar
0.10
+ Added few tooltips
+ Sideload folder now works for all apks (recursive search)
= Obb copy and Sideload progress bar problems should be fixed
= Fixed user.json not working if the any of folder had spaces
= Switched back to Message Boxes
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
0.7
= 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
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

862
FlexibleMessageBox.cs Normal file
View File

@@ -0,0 +1,862 @@
using System;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Windows.Forms;
namespace JR.Utils.GUI.Forms
{
/* FlexibleMessageBox A flexible replacement for the .NET MessageBox
*
* Author: Jörg Reichert (public@jreichert.de)
* Contributors: Thanks to: David Hall, Roink
* Version: 1.3
* Published at: http://www.codeproject.com/Articles/601900/FlexibleMessageBox
*
************************************************************************************************************
* Features:
* - It can be simply used instead of MessageBox since all important static "Show"-Functions are supported
* - It is small, only one source file, which could be added easily to each solution
* - It can be resized and the content is correctly word-wrapped
* - It tries to auto-size the width to show the longest text row
* - It never exceeds the current desktop working area
* - It displays a vertical scrollbar when needed
* - It does support hyperlinks in text
*
* Because the interface is identical to MessageBox, you can add this single source file to your project
* and use the FlexibleMessageBox almost everywhere you use a standard MessageBox.
* The goal was NOT to produce as many features as possible but to provide a simple replacement to fit my
* own needs. Feel free to add additional features on your own, but please left my credits in this class.
*
************************************************************************************************************
* Usage examples:
*
* FlexibleMessageBox.Show("Just a text");
*
* FlexibleMessageBox.Show("A text",
* "A caption");
*
* FlexibleMessageBox.Show("Some text with a link: www.google.com",
* "Some caption",
* MessageBoxButtons.AbortRetryIgnore,
* MessageBoxIcon.Information,
* MessageBoxDefaultButton.Button2);
*
* var dialogResult = FlexibleMessageBox.Show("Do you know the answer to life the universe and everything?",
* "One short question",
* MessageBoxButtons.YesNo);
*
************************************************************************************************************
* THE SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS", WITHOUT WARRANTY
* OF ANY KIND, EXPRESS OR IMPLIED. IN NO EVENT SHALL THE AUTHOR BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF THIS
* SOFTWARE.
*
************************************************************************************************************
* History:
* Version 1.3 - 19.Dezember 2014
* - Added refactoring function GetButtonText()
* - Used CurrentUICulture instead of InstalledUICulture
* - Added more button localizations. Supported languages are now: ENGLISH, GERMAN, SPANISH, ITALIAN
* - Added standard MessageBox handling for "copy to clipboard" with <Ctrl> + <C> and <Ctrl> + <Insert>
* - Tab handling is now corrected (only tabbing over the visible buttons)
* - Added standard MessageBox handling for ALT-Keyboard shortcuts
* - SetDialogSizes: Refactored completely: Corrected sizing and added caption driven sizing
*
* Version 1.2 - 10.August 2013
* - Do not ShowInTaskbar anymore (original MessageBox is also hidden in taskbar)
* - Added handling for Escape-Button
* - Adapted top right close button (red X) to behave like MessageBox (but hidden instead of deactivated)
*
* Version 1.1 - 14.June 2013
* - Some Refactoring
* - Added internal form class
* - Added missing code comments, etc.
*
* Version 1.0 - 15.April 2013
* - Initial Version
*/
public class FlexibleMessageBox
{
#region Public statics
/// <summary>
/// Defines the maximum width for all FlexibleMessageBox instances in percent of the working area.
///
/// Allowed values are 0.2 - 1.0 where:
/// 0.2 means: The FlexibleMessageBox can be at most half as wide as the working area.
/// 1.0 means: The FlexibleMessageBox can be as wide as the working area.
///
/// Default is: 70% of the working area width.
/// </summary>
public static double MAX_WIDTH_FACTOR = 0.7;
/// <summary>
/// Defines the maximum height for all FlexibleMessageBox instances in percent of the working area.
///
/// Allowed values are 0.2 - 1.0 where:
/// 0.2 means: The FlexibleMessageBox can be at most half as high as the working area.
/// 1.0 means: The FlexibleMessageBox can be as high as the working area.
///
/// Default is: 90% of the working area height.
/// </summary>
public static double MAX_HEIGHT_FACTOR = 0.9;
/// <summary>
/// Defines the font for all FlexibleMessageBox instances.
///
/// Default is: SystemFonts.MessageBoxFont
/// </summary>
public static Font FONT = SystemFonts.MessageBoxFont;
#endregion
#region Public show functions
/// <summary>
/// Shows the specified message box.
/// </summary>
/// <param name="text">The text.</param>
/// <returns>The dialog result.</returns>
public static DialogResult Show(string text)
{
return FlexibleMessageBoxForm.Show(null, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
}
/// <summary>
/// Shows the specified message box.
/// </summary>
/// <param name="owner">The owner.</param>
/// <param name="text">The text.</param>
/// <returns>The dialog result.</returns>
public static DialogResult Show(IWin32Window owner, string text)
{
return FlexibleMessageBoxForm.Show(owner, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
}
/// <summary>
/// Shows the specified message box.
/// </summary>
/// <param name="text">The text.</param>
/// <param name="caption">The caption.</param>
/// <returns>The dialog result.</returns>
public static DialogResult Show(string text, string caption)
{
return FlexibleMessageBoxForm.Show(null, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
}
/// <summary>
/// Shows the specified message box.
/// </summary>
/// <param name="owner">The owner.</param>
/// <param name="text">The text.</param>
/// <param name="caption">The caption.</param>
/// <returns>The dialog result.</returns>
public static DialogResult Show(IWin32Window owner, string text, string caption)
{
return FlexibleMessageBoxForm.Show(owner, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
}
/// <summary>
/// Shows the specified message box.
/// </summary>
/// <param name="text">The text.</param>
/// <param name="caption">The caption.</param>
/// <param name="buttons">The buttons.</param>
/// <returns>The dialog result.</returns>
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons)
{
return FlexibleMessageBoxForm.Show(null, text, caption, buttons, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
}
/// <summary>
/// Shows the specified message box.
/// </summary>
/// <param name="owner">The owner.</param>
/// <param name="text">The text.</param>
/// <param name="caption">The caption.</param>
/// <param name="buttons">The buttons.</param>
/// <returns>The dialog result.</returns>
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons)
{
return FlexibleMessageBoxForm.Show(owner, text, caption, buttons, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
}
/// <summary>
/// Shows the specified message box.
/// </summary>
/// <param name="text">The text.</param>
/// <param name="caption">The caption.</param>
/// <param name="buttons">The buttons.</param>
/// <param name="icon">The icon.</param>
/// <returns></returns>
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
{
return FlexibleMessageBoxForm.Show(null, text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
}
/// <summary>
/// Shows the specified message box.
/// </summary>
/// <param name="owner">The owner.</param>
/// <param name="text">The text.</param>
/// <param name="caption">The caption.</param>
/// <param name="buttons">The buttons.</param>
/// <param name="icon">The icon.</param>
/// <returns>The dialog result.</returns>
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
{
return FlexibleMessageBoxForm.Show(owner, text, caption, buttons, icon, MessageBoxDefaultButton.Button1);
}
/// <summary>
/// Shows the specified message box.
/// </summary>
/// <param name="text">The text.</param>
/// <param name="caption">The caption.</param>
/// <param name="buttons">The buttons.</param>
/// <param name="icon">The icon.</param>
/// <param name="defaultButton">The default button.</param>
/// <returns>The dialog result.</returns>
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
{
return FlexibleMessageBoxForm.Show(null, text, caption, buttons, icon, defaultButton);
}
/// <summary>
/// Shows the specified message box.
/// </summary>
/// <param name="owner">The owner.</param>
/// <param name="text">The text.</param>
/// <param name="caption">The caption.</param>
/// <param name="buttons">The buttons.</param>
/// <param name="icon">The icon.</param>
/// <param name="defaultButton">The default button.</param>
/// <returns>The dialog result.</returns>
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
{
return FlexibleMessageBoxForm.Show(owner, text, caption, buttons, icon, defaultButton);
}
#endregion
#region Internal form class
/// <summary>
/// The form to show the customized message box.
/// It is defined as an internal class to keep the public interface of the FlexibleMessageBox clean.
/// </summary>
class FlexibleMessageBoxForm : Form
{
#region Form-Designer generated code
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.button1 = new System.Windows.Forms.Button();
this.richTextBoxMessage = new System.Windows.Forms.RichTextBox();
this.FlexibleMessageBoxFormBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.panel1 = new System.Windows.Forms.Panel();
this.pictureBoxForIcon = new System.Windows.Forms.PictureBox();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.FlexibleMessageBoxFormBindingSource)).BeginInit();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxForIcon)).BeginInit();
this.SuspendLayout();
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button1.AutoSize = true;
this.button1.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button1.Location = new System.Drawing.Point(11, 67);
this.button1.MinimumSize = new System.Drawing.Size(0, 24);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 24);
this.button1.TabIndex = 2;
this.button1.Text = "OK";
this.button1.UseVisualStyleBackColor = true;
this.button1.Visible = false;
//
// richTextBoxMessage
//
this.richTextBoxMessage.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.richTextBoxMessage.BackColor = System.Drawing.Color.White;
this.richTextBoxMessage.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.richTextBoxMessage.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.FlexibleMessageBoxFormBindingSource, "MessageText", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
this.richTextBoxMessage.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.richTextBoxMessage.Location = new System.Drawing.Point(50, 26);
this.richTextBoxMessage.Margin = new System.Windows.Forms.Padding(0);
this.richTextBoxMessage.Name = "richTextBoxMessage";
this.richTextBoxMessage.ReadOnly = true;
this.richTextBoxMessage.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
this.richTextBoxMessage.Size = new System.Drawing.Size(200, 20);
this.richTextBoxMessage.TabIndex = 0;
this.richTextBoxMessage.TabStop = false;
this.richTextBoxMessage.Text = "<Message>";
this.richTextBoxMessage.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.richTextBoxMessage_LinkClicked);
//
// panel1
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.BackColor = System.Drawing.Color.White;
this.panel1.Controls.Add(this.pictureBoxForIcon);
this.panel1.Controls.Add(this.richTextBoxMessage);
this.panel1.Location = new System.Drawing.Point(-3, -4);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(268, 59);
this.panel1.TabIndex = 1;
//
// pictureBoxForIcon
//
this.pictureBoxForIcon.BackColor = System.Drawing.Color.Transparent;
this.pictureBoxForIcon.Location = new System.Drawing.Point(15, 19);
this.pictureBoxForIcon.Name = "pictureBoxForIcon";
this.pictureBoxForIcon.Size = new System.Drawing.Size(32, 32);
this.pictureBoxForIcon.TabIndex = 8;
this.pictureBoxForIcon.TabStop = false;
//
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button2.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button2.Location = new System.Drawing.Point(92, 67);
this.button2.MinimumSize = new System.Drawing.Size(0, 24);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 24);
this.button2.TabIndex = 3;
this.button2.Text = "OK";
this.button2.UseVisualStyleBackColor = true;
this.button2.Visible = false;
//
// button3
//
this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button3.AutoSize = true;
this.button3.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button3.Location = new System.Drawing.Point(173, 67);
this.button3.MinimumSize = new System.Drawing.Size(0, 24);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 24);
this.button3.TabIndex = 0;
this.button3.Text = "OK";
this.button3.UseVisualStyleBackColor = true;
this.button3.Visible = false;
//
// FlexibleMessageBoxForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(260, 102);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.panel1);
this.Controls.Add(this.button1);
this.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.FlexibleMessageBoxFormBindingSource, "CaptionText", true));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(276, 140);
this.Name = "FlexibleMessageBoxForm";
this.ShowIcon = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "<Caption>";
this.Shown += new System.EventHandler(this.FlexibleMessageBoxForm_Shown);
((System.ComponentModel.ISupportInitialize)(this.FlexibleMessageBoxFormBindingSource)).EndInit();
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBoxForIcon)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
private System.Windows.Forms.Button button1;
private System.Windows.Forms.BindingSource FlexibleMessageBoxFormBindingSource;
private System.Windows.Forms.RichTextBox richTextBoxMessage;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.PictureBox pictureBoxForIcon;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
#endregion
#region Private constants
//These separators are used for the "copy to clipboard" standard operation, triggered by Ctrl + C (behavior and clipboard format is like in a standard MessageBox)
private static readonly String STANDARD_MESSAGEBOX_SEPARATOR_LINES = "---------------------------\n";
private static readonly String STANDARD_MESSAGEBOX_SEPARATOR_SPACES = " ";
//These are the possible buttons (in a standard MessageBox)
private enum ButtonID { OK = 0, CANCEL, YES, NO, ABORT, RETRY, IGNORE };
//These are the buttons texts for different languages.
//If you want to add a new language, add it here and in the GetButtonText-Function
private enum TwoLetterISOLanguageID { en, de, es, it };
private static readonly String[] BUTTON_TEXTS_ENGLISH_EN = { "OK", "Cancel", "&Yes", "&No", "&Abort", "&Retry", "&Ignore" }; //Note: This is also the fallback language
private static readonly String[] BUTTON_TEXTS_GERMAN_DE = { "OK", "Abbrechen", "&Ja", "&Nein", "&Abbrechen", "&Wiederholen", "&Ignorieren" };
private static readonly String[] BUTTON_TEXTS_SPANISH_ES = { "Aceptar", "Cancelar", "&Sí", "&No", "&Abortar", "&Reintentar", "&Ignorar" };
private static readonly String[] BUTTON_TEXTS_ITALIAN_IT = { "OK", "Annulla", "&Sì", "&No", "&Interrompi", "&Riprova", "&Ignora" };
#endregion
#region Private members
private MessageBoxDefaultButton defaultButton;
private int visibleButtonsCount;
private TwoLetterISOLanguageID languageID = TwoLetterISOLanguageID.en;
#endregion
#region Private constructor
/// <summary>
/// Initializes a new instance of the <see cref="FlexibleMessageBoxForm"/> class.
/// </summary>
private FlexibleMessageBoxForm()
{
InitializeComponent();
//Try to evaluate the language. If this fails, the fallback language English will be used
Enum.TryParse<TwoLetterISOLanguageID>(CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, out this.languageID);
this.KeyPreview = true;
this.KeyUp += FlexibleMessageBoxForm_KeyUp;
}
#endregion
#region Private helper functions
/// <summary>
/// Gets the string rows.
/// </summary>
/// <param name="message">The message.</param>
/// <returns>The string rows as 1-dimensional array</returns>
private static string[] GetStringRows(string message)
{
if (string.IsNullOrEmpty(message)) return null;
var messageRows = message.Split(new char[] { '\n' }, StringSplitOptions.None);
return messageRows;
}
/// <summary>
/// Gets the button text for the CurrentUICulture language.
/// Note: The fallback language is English
/// </summary>
/// <param name="buttonID">The ID of the button.</param>
/// <returns>The button text</returns>
private string GetButtonText(ButtonID buttonID)
{
var buttonTextArrayIndex = Convert.ToInt32(buttonID);
switch (this.languageID)
{
case TwoLetterISOLanguageID.de: return BUTTON_TEXTS_GERMAN_DE[buttonTextArrayIndex];
case TwoLetterISOLanguageID.es: return BUTTON_TEXTS_SPANISH_ES[buttonTextArrayIndex];
case TwoLetterISOLanguageID.it: return BUTTON_TEXTS_ITALIAN_IT[buttonTextArrayIndex];
default: return BUTTON_TEXTS_ENGLISH_EN[buttonTextArrayIndex];
}
}
/// <summary>
/// Ensure the given working area factor in the range of 0.2 - 1.0 where:
///
/// 0.2 means: 20 percent of the working area height or width.
/// 1.0 means: 100 percent of the working area height or width.
/// </summary>
/// <param name="workingAreaFactor">The given working area factor.</param>
/// <returns>The corrected given working area factor.</returns>
private static double GetCorrectedWorkingAreaFactor(double workingAreaFactor)
{
const double MIN_FACTOR = 0.2;
const double MAX_FACTOR = 1.0;
if (workingAreaFactor < MIN_FACTOR) return MIN_FACTOR;
if (workingAreaFactor > MAX_FACTOR) return MAX_FACTOR;
return workingAreaFactor;
}
/// <summary>
/// Set the dialogs start position when given.
/// Otherwise center the dialog on the current screen.
/// </summary>
/// <param name="flexibleMessageBoxForm">The FlexibleMessageBox dialog.</param>
/// <param name="owner">The owner.</param>
private static void SetDialogStartPosition(FlexibleMessageBoxForm flexibleMessageBoxForm, IWin32Window owner)
{
//If no owner given: Center on current screen
if (owner == null)
{
var screen = Screen.FromPoint(Cursor.Position);
flexibleMessageBoxForm.StartPosition = FormStartPosition.Manual;
flexibleMessageBoxForm.Left = screen.Bounds.Left + screen.Bounds.Width / 2 - flexibleMessageBoxForm.Width / 2;
flexibleMessageBoxForm.Top = screen.Bounds.Top + screen.Bounds.Height / 2 - flexibleMessageBoxForm.Height / 2;
}
}
/// <summary>
/// Calculate the dialogs start size (Try to auto-size width to show longest text row).
/// Also set the maximum dialog size.
/// </summary>
/// <param name="flexibleMessageBoxForm">The FlexibleMessageBox dialog.</param>
/// <param name="text">The text (the longest text row is used to calculate the dialog width).</param>
/// <param name="text">The caption (this can also affect the dialog width).</param>
private static void SetDialogSizes(FlexibleMessageBoxForm flexibleMessageBoxForm, string text, string caption)
{
//First set the bounds for the maximum dialog size
flexibleMessageBoxForm.MaximumSize = new Size(Convert.ToInt32(SystemInformation.WorkingArea.Width * FlexibleMessageBoxForm.GetCorrectedWorkingAreaFactor(MAX_WIDTH_FACTOR)),
Convert.ToInt32(SystemInformation.WorkingArea.Height * FlexibleMessageBoxForm.GetCorrectedWorkingAreaFactor(MAX_HEIGHT_FACTOR)));
//Get rows. Exit if there are no rows to render...
var stringRows = GetStringRows(text);
if (stringRows == null) return;
//Calculate whole text height
var textHeight = TextRenderer.MeasureText(text, FONT).Height;
//Calculate width for longest text line
const int SCROLLBAR_WIDTH_OFFSET = 15;
var longestTextRowWidth = stringRows.Max(textForRow => TextRenderer.MeasureText(textForRow, FONT).Width);
var captionWidth = TextRenderer.MeasureText(caption, SystemFonts.CaptionFont).Width;
var textWidth = Math.Max(longestTextRowWidth + SCROLLBAR_WIDTH_OFFSET, captionWidth);
//Calculate margins
var marginWidth = flexibleMessageBoxForm.Width - flexibleMessageBoxForm.richTextBoxMessage.Width;
var marginHeight = flexibleMessageBoxForm.Height - flexibleMessageBoxForm.richTextBoxMessage.Height;
//Set calculated dialog size (if the calculated values exceed the maximums, they were cut by windows forms automatically)
flexibleMessageBoxForm.Size = new Size(textWidth + marginWidth,
textHeight + marginHeight);
}
/// <summary>
/// Set the dialogs icon.
/// When no icon is used: Correct placement and width of rich text box.
/// </summary>
/// <param name="flexibleMessageBoxForm">The FlexibleMessageBox dialog.</param>
/// <param name="icon">The MessageBoxIcon.</param>
private static void SetDialogIcon(FlexibleMessageBoxForm flexibleMessageBoxForm, MessageBoxIcon icon)
{
switch (icon)
{
case MessageBoxIcon.Information:
flexibleMessageBoxForm.pictureBoxForIcon.Image = SystemIcons.Information.ToBitmap();
break;
case MessageBoxIcon.Warning:
flexibleMessageBoxForm.pictureBoxForIcon.Image = SystemIcons.Warning.ToBitmap();
break;
case MessageBoxIcon.Error:
flexibleMessageBoxForm.pictureBoxForIcon.Image = SystemIcons.Error.ToBitmap();
break;
case MessageBoxIcon.Question:
flexibleMessageBoxForm.pictureBoxForIcon.Image = SystemIcons.Question.ToBitmap();
break;
default:
//When no icon is used: Correct placement and width of rich text box.
flexibleMessageBoxForm.pictureBoxForIcon.Visible = false;
flexibleMessageBoxForm.richTextBoxMessage.Left -= flexibleMessageBoxForm.pictureBoxForIcon.Width;
flexibleMessageBoxForm.richTextBoxMessage.Width += flexibleMessageBoxForm.pictureBoxForIcon.Width;
break;
}
}
/// <summary>
/// Set dialog buttons visibilities and texts.
/// Also set a default button.
/// </summary>
/// <param name="flexibleMessageBoxForm">The FlexibleMessageBox dialog.</param>
/// <param name="buttons">The buttons.</param>
/// <param name="defaultButton">The default button.</param>
private static void SetDialogButtons(FlexibleMessageBoxForm flexibleMessageBoxForm, MessageBoxButtons buttons, MessageBoxDefaultButton defaultButton)
{
//Set the buttons visibilities and texts
switch (buttons)
{
case MessageBoxButtons.AbortRetryIgnore:
flexibleMessageBoxForm.visibleButtonsCount = 3;
flexibleMessageBoxForm.button1.Visible = true;
flexibleMessageBoxForm.button1.Text = flexibleMessageBoxForm.GetButtonText(ButtonID.ABORT);
flexibleMessageBoxForm.button1.DialogResult = DialogResult.Abort;
flexibleMessageBoxForm.button2.Visible = true;
flexibleMessageBoxForm.button2.Text = flexibleMessageBoxForm.GetButtonText(ButtonID.RETRY);
flexibleMessageBoxForm.button2.DialogResult = DialogResult.Retry;
flexibleMessageBoxForm.button3.Visible = true;
flexibleMessageBoxForm.button3.Text = flexibleMessageBoxForm.GetButtonText(ButtonID.IGNORE);
flexibleMessageBoxForm.button3.DialogResult = DialogResult.Ignore;
flexibleMessageBoxForm.ControlBox = false;
break;
case MessageBoxButtons.OKCancel:
flexibleMessageBoxForm.visibleButtonsCount = 2;
flexibleMessageBoxForm.button2.Visible = true;
flexibleMessageBoxForm.button2.Text = flexibleMessageBoxForm.GetButtonText(ButtonID.OK);
flexibleMessageBoxForm.button2.DialogResult = DialogResult.OK;
flexibleMessageBoxForm.button3.Visible = true;
flexibleMessageBoxForm.button3.Text = flexibleMessageBoxForm.GetButtonText(ButtonID.CANCEL);
flexibleMessageBoxForm.button3.DialogResult = DialogResult.Cancel;
flexibleMessageBoxForm.CancelButton = flexibleMessageBoxForm.button3;
break;
case MessageBoxButtons.RetryCancel:
flexibleMessageBoxForm.visibleButtonsCount = 2;
flexibleMessageBoxForm.button2.Visible = true;
flexibleMessageBoxForm.button2.Text = flexibleMessageBoxForm.GetButtonText(ButtonID.RETRY);
flexibleMessageBoxForm.button2.DialogResult = DialogResult.Retry;
flexibleMessageBoxForm.button3.Visible = true;
flexibleMessageBoxForm.button3.Text = flexibleMessageBoxForm.GetButtonText(ButtonID.CANCEL);
flexibleMessageBoxForm.button3.DialogResult = DialogResult.Cancel;
flexibleMessageBoxForm.CancelButton = flexibleMessageBoxForm.button3;
break;
case MessageBoxButtons.YesNo:
flexibleMessageBoxForm.visibleButtonsCount = 2;
flexibleMessageBoxForm.button2.Visible = true;
flexibleMessageBoxForm.button2.Text = flexibleMessageBoxForm.GetButtonText(ButtonID.YES);
flexibleMessageBoxForm.button2.DialogResult = DialogResult.Yes;
flexibleMessageBoxForm.button3.Visible = true;
flexibleMessageBoxForm.button3.Text = flexibleMessageBoxForm.GetButtonText(ButtonID.NO);
flexibleMessageBoxForm.button3.DialogResult = DialogResult.No;
flexibleMessageBoxForm.ControlBox = false;
break;
case MessageBoxButtons.YesNoCancel:
flexibleMessageBoxForm.visibleButtonsCount = 3;
flexibleMessageBoxForm.button1.Visible = true;
flexibleMessageBoxForm.button1.Text = flexibleMessageBoxForm.GetButtonText(ButtonID.YES);
flexibleMessageBoxForm.button1.DialogResult = DialogResult.Yes;
flexibleMessageBoxForm.button2.Visible = true;
flexibleMessageBoxForm.button2.Text = flexibleMessageBoxForm.GetButtonText(ButtonID.NO);
flexibleMessageBoxForm.button2.DialogResult = DialogResult.No;
flexibleMessageBoxForm.button3.Visible = true;
flexibleMessageBoxForm.button3.Text = flexibleMessageBoxForm.GetButtonText(ButtonID.CANCEL);
flexibleMessageBoxForm.button3.DialogResult = DialogResult.Cancel;
flexibleMessageBoxForm.CancelButton = flexibleMessageBoxForm.button3;
break;
case MessageBoxButtons.OK:
default:
flexibleMessageBoxForm.visibleButtonsCount = 1;
flexibleMessageBoxForm.button3.Visible = true;
flexibleMessageBoxForm.button3.Text = flexibleMessageBoxForm.GetButtonText(ButtonID.OK);
flexibleMessageBoxForm.button3.DialogResult = DialogResult.OK;
flexibleMessageBoxForm.CancelButton = flexibleMessageBoxForm.button3;
break;
}
//Set default button (used in FlexibleMessageBoxForm_Shown)
flexibleMessageBoxForm.defaultButton = defaultButton;
}
#endregion
#region Private event handlers
/// <summary>
/// Handles the Shown event of the FlexibleMessageBoxForm control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void FlexibleMessageBoxForm_Shown(object sender, EventArgs e)
{
int buttonIndexToFocus = 1;
Button buttonToFocus;
//Set the default button...
switch (this.defaultButton)
{
case MessageBoxDefaultButton.Button1:
default:
buttonIndexToFocus = 1;
break;
case MessageBoxDefaultButton.Button2:
buttonIndexToFocus = 2;
break;
case MessageBoxDefaultButton.Button3:
buttonIndexToFocus = 3;
break;
}
if (buttonIndexToFocus > this.visibleButtonsCount) buttonIndexToFocus = this.visibleButtonsCount;
if (buttonIndexToFocus == 3)
{
buttonToFocus = this.button3;
}
else if (buttonIndexToFocus == 2)
{
buttonToFocus = this.button2;
}
else
{
buttonToFocus = this.button1;
}
buttonToFocus.Focus();
}
/// <summary>
/// Handles the LinkClicked event of the richTextBoxMessage control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Windows.Forms.LinkClickedEventArgs"/> instance containing the event data.</param>
private void richTextBoxMessage_LinkClicked(object sender, LinkClickedEventArgs e)
{
try
{
Cursor.Current = Cursors.WaitCursor;
Process.Start(e.LinkText);
}
catch (Exception)
{
//Let the caller of FlexibleMessageBoxForm decide what to do with this exception...
throw;
}
finally
{
Cursor.Current = Cursors.Default;
}
}
/// <summary>
/// Handles the KeyUp event of the richTextBoxMessage control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Windows.Forms.KeyEventArgs"/> instance containing the event data.</param>
void FlexibleMessageBoxForm_KeyUp(object sender, KeyEventArgs e)
{
//Handle standard key strikes for clipboard copy: "Ctrl + C" and "Ctrl + Insert"
if (e.Control && (e.KeyCode == Keys.C || e.KeyCode == Keys.Insert))
{
var buttonsTextLine = (this.button1.Visible ? this.button1.Text + STANDARD_MESSAGEBOX_SEPARATOR_SPACES : string.Empty)
+ (this.button2.Visible ? this.button2.Text + STANDARD_MESSAGEBOX_SEPARATOR_SPACES : string.Empty)
+ (this.button3.Visible ? this.button3.Text + STANDARD_MESSAGEBOX_SEPARATOR_SPACES : string.Empty);
//Build same clipboard text like the standard .Net MessageBox
var textForClipboard = STANDARD_MESSAGEBOX_SEPARATOR_LINES
+ this.Text + Environment.NewLine
+ STANDARD_MESSAGEBOX_SEPARATOR_LINES
+ this.richTextBoxMessage.Text + Environment.NewLine
+ STANDARD_MESSAGEBOX_SEPARATOR_LINES
+ buttonsTextLine.Replace("&", string.Empty) + Environment.NewLine
+ STANDARD_MESSAGEBOX_SEPARATOR_LINES;
//Set text in clipboard
Clipboard.SetText(textForClipboard);
}
}
#endregion
#region Properties (only used for binding)
/// <summary>
/// The text that is been used for the heading.
/// </summary>
public string CaptionText { get; set; }
/// <summary>
/// The text that is been used in the FlexibleMessageBoxForm.
/// </summary>
public string MessageText { get; set; }
#endregion
#region Public show function
/// <summary>
/// Shows the specified message box.
/// </summary>
/// <param name="owner">The owner.</param>
/// <param name="text">The text.</param>
/// <param name="caption">The caption.</param>
/// <param name="buttons">The buttons.</param>
/// <param name="icon">The icon.</param>
/// <param name="defaultButton">The default button.</param>
/// <returns>The dialog result.</returns>
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
{
//Create a new instance of the FlexibleMessageBox form
var flexibleMessageBoxForm = new FlexibleMessageBoxForm();
flexibleMessageBoxForm.ShowInTaskbar = false;
//Bind the caption and the message text
flexibleMessageBoxForm.CaptionText = caption;
flexibleMessageBoxForm.MessageText = text;
flexibleMessageBoxForm.FlexibleMessageBoxFormBindingSource.DataSource = flexibleMessageBoxForm;
//Set the buttons visibilities and texts. Also set a default button.
SetDialogButtons(flexibleMessageBoxForm, buttons, defaultButton);
//Set the dialogs icon. When no icon is used: Correct placement and width of rich text box.
SetDialogIcon(flexibleMessageBoxForm, icon);
//Set the font for all controls
flexibleMessageBoxForm.Font = FONT;
flexibleMessageBoxForm.richTextBoxMessage.Font = FONT;
//Calculate the dialogs start size (Try to auto-size width to show longest text row). Also set the maximum dialog size.
SetDialogSizes(flexibleMessageBoxForm, text, caption);
//Set the dialogs start position when given. Otherwise center the dialog on the current screen.
SetDialogStartPosition(flexibleMessageBoxForm, owner);
//Show the dialog
return flexibleMessageBoxForm.ShowDialog(owner);
}
#endregion
} //class FlexibleMessageBoxForm
#endregion
}
}

530
Form1.Designer.cs generated
View File

@@ -28,193 +28,499 @@
/// </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();
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();
this.changePermsBtn = new System.Windows.Forms.Button();
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.progressBar1 = new System.Windows.Forms.ProgressBar();
this.copyBulkObbButton = new System.Windows.Forms.Button();
this.DragDropLbl = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.gamesComboBox = new SergeUtils.EasyCompletionComboBox();
this.panel1 = new System.Windows.Forms.Panel();
this.donateButton = new System.Windows.Forms.Button();
this.aboutBtn = new System.Windows.Forms.Button();
this.settingsButton = new System.Windows.Forms.Button();
this.checkHashButton = new System.Windows.Forms.Button();
this.userjsonButton = new System.Windows.Forms.Button();
this.backupContainer = new System.Windows.Forms.Panel();
this.backupDrop = new System.Windows.Forms.Button();
this.sideloadContainer = new System.Windows.Forms.Panel();
this.listApkButton = new System.Windows.Forms.Button();
this.sideloadDrop = new System.Windows.Forms.Button();
this.panel1.SuspendLayout();
this.backupContainer.SuspendLayout();
this.sideloadContainer.SuspendLayout();
this.SuspendLayout();
//
// m_combo
//
this.m_combo.Location = new System.Drawing.Point(12, 134);
this.m_combo.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(45)))), ((int)(((byte)(45)))));
this.m_combo.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.m_combo.ForeColor = System.Drawing.Color.White;
this.m_combo.Location = new System.Drawing.Point(284, 13);
this.m_combo.Margin = new System.Windows.Forms.Padding(4);
this.m_combo.Name = "m_combo";
this.m_combo.Size = new System.Drawing.Size(426, 21);
this.m_combo.Size = new System.Drawing.Size(568, 24);
this.m_combo.TabIndex = 16;
//
// startsideloadbutton
//
this.startsideloadbutton.Location = new System.Drawing.Point(100, 13);
this.startsideloadbutton.Dock = System.Windows.Forms.DockStyle.Top;
this.startsideloadbutton.FlatAppearance.BorderSize = 0;
this.startsideloadbutton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.startsideloadbutton.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.startsideloadbutton.ForeColor = System.Drawing.Color.White;
this.startsideloadbutton.Location = new System.Drawing.Point(0, 175);
this.startsideloadbutton.Margin = new System.Windows.Forms.Padding(4);
this.startsideloadbutton.Name = "startsideloadbutton";
this.startsideloadbutton.Size = new System.Drawing.Size(87, 33);
this.startsideloadbutton.TabIndex = 2;
this.startsideloadbutton.Padding = new System.Windows.Forms.Padding(31, 0, 0, 0);
this.startsideloadbutton.Size = new System.Drawing.Size(267, 35);
this.startsideloadbutton.TabIndex = 4;
this.startsideloadbutton.Text = "Sideload APK";
this.startsideloadbutton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.startsideloadbutton.UseVisualStyleBackColor = true;
this.startsideloadbutton.Click += new System.EventHandler(this.startsideloadbutton_Click);
//
// devicesbutton
//
this.devicesbutton.Location = new System.Drawing.Point(12, 12);
this.devicesbutton.Dock = System.Windows.Forms.DockStyle.Top;
this.devicesbutton.FlatAppearance.BorderSize = 0;
this.devicesbutton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.devicesbutton.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.devicesbutton.ForeColor = System.Drawing.SystemColors.ButtonFace;
this.devicesbutton.Location = new System.Drawing.Point(0, 0);
this.devicesbutton.Margin = new System.Windows.Forms.Padding(4);
this.devicesbutton.Name = "devicesbutton";
this.devicesbutton.Size = new System.Drawing.Size(82, 34);
this.devicesbutton.Size = new System.Drawing.Size(267, 35);
this.devicesbutton.TabIndex = 1;
this.devicesbutton.Text = "Adb devices";
this.devicesbutton.Text = "ADB DEVICES";
this.devicesbutton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
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.Dock = System.Windows.Forms.DockStyle.Top;
this.obbcopybutton.FlatAppearance.BorderSize = 0;
this.obbcopybutton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.obbcopybutton.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.obbcopybutton.ForeColor = System.Drawing.Color.White;
this.obbcopybutton.Location = new System.Drawing.Point(0, 0);
this.obbcopybutton.Margin = new System.Windows.Forms.Padding(4);
this.obbcopybutton.Name = "obbcopybutton";
this.obbcopybutton.Size = new System.Drawing.Size(87, 34);
this.obbcopybutton.TabIndex = 3;
this.obbcopybutton.Padding = new System.Windows.Forms.Padding(31, 0, 0, 0);
this.obbcopybutton.Size = new System.Drawing.Size(267, 35);
this.obbcopybutton.TabIndex = 5;
this.obbcopybutton.Text = "Copy Obb";
this.obbcopybutton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.obbcopybutton.UseVisualStyleBackColor = true;
this.obbcopybutton.Click += new System.EventHandler(this.obbcopybutton_Click);
//
// backupbutton
//
this.backupbutton.Location = new System.Drawing.Point(13, 52);
this.backupbutton.Dock = System.Windows.Forms.DockStyle.Top;
this.backupbutton.FlatAppearance.BorderSize = 0;
this.backupbutton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.backupbutton.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.backupbutton.ForeColor = System.Drawing.Color.White;
this.backupbutton.Location = new System.Drawing.Point(0, 35);
this.backupbutton.Margin = new System.Windows.Forms.Padding(4);
this.backupbutton.Name = "backupbutton";
this.backupbutton.Size = new System.Drawing.Size(81, 34);
this.backupbutton.TabIndex = 5;
this.backupbutton.Padding = new System.Windows.Forms.Padding(31, 0, 0, 0);
this.backupbutton.Size = new System.Drawing.Size(267, 35);
this.backupbutton.TabIndex = 9;
this.backupbutton.Text = "Backup Gamedata";
this.backupbutton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.backupbutton.UseVisualStyleBackColor = true;
this.backupbutton.Click += new System.EventHandler(this.backupbutton_Click);
//
// restorebutton
//
this.restorebutton.Location = new System.Drawing.Point(100, 52);
this.restorebutton.Dock = System.Windows.Forms.DockStyle.Top;
this.restorebutton.FlatAppearance.BorderSize = 0;
this.restorebutton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.restorebutton.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.restorebutton.ForeColor = System.Drawing.Color.White;
this.restorebutton.Location = new System.Drawing.Point(0, 0);
this.restorebutton.Margin = new System.Windows.Forms.Padding(4);
this.restorebutton.Name = "restorebutton";
this.restorebutton.Size = new System.Drawing.Size(87, 34);
this.restorebutton.TabIndex = 6;
this.restorebutton.Padding = new System.Windows.Forms.Padding(31, 0, 0, 0);
this.restorebutton.Size = new System.Drawing.Size(267, 35);
this.restorebutton.TabIndex = 10;
this.restorebutton.Text = "Restore Gamedata";
this.restorebutton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
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.Name = "ListApps";
this.ListApps.Size = new System.Drawing.Size(82, 34);
this.ListApps.TabIndex = 8;
this.ListApps.Text = "Refresh Apps";
this.ListApps.UseVisualStyleBackColor = true;
this.ListApps.Click += new System.EventHandler(this.ListApps_Click);
//
// getApkButton
//
this.getApkButton.Location = new System.Drawing.Point(100, 92);
this.getApkButton.Dock = System.Windows.Forms.DockStyle.Top;
this.getApkButton.FlatAppearance.BorderSize = 0;
this.getApkButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.getApkButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.getApkButton.ForeColor = System.Drawing.Color.White;
this.getApkButton.Location = new System.Drawing.Point(0, 70);
this.getApkButton.Margin = new System.Windows.Forms.Padding(4);
this.getApkButton.Name = "getApkButton";
this.getApkButton.Size = new System.Drawing.Size(87, 34);
this.getApkButton.TabIndex = 9;
this.getApkButton.Padding = new System.Windows.Forms.Padding(31, 0, 0, 0);
this.getApkButton.Size = new System.Drawing.Size(267, 35);
this.getApkButton.TabIndex = 13;
this.getApkButton.Text = "Get Apk";
this.getApkButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.getApkButton.UseVisualStyleBackColor = true;
this.getApkButton.Click += new System.EventHandler(this.getApkButton_Click);
//
// listApkPermsButton
//
this.listApkPermsButton.Location = new System.Drawing.Point(193, 92);
this.listApkPermsButton.Name = "listApkPermsButton";
this.listApkPermsButton.Size = new System.Drawing.Size(87, 34);
this.listApkPermsButton.TabIndex = 10;
this.listApkPermsButton.Text = "List Apk Perms";
this.listApkPermsButton.UseVisualStyleBackColor = true;
this.listApkPermsButton.Click += new System.EventHandler(this.listApkPermsButton_Click);
//
// changePermsBtn
//
this.changePermsBtn.Location = new System.Drawing.Point(282, 92);
this.changePermsBtn.Name = "changePermsBtn";
this.changePermsBtn.Size = new System.Drawing.Size(87, 34);
this.changePermsBtn.TabIndex = 11;
this.changePermsBtn.Text = "Change Permissions";
this.changePermsBtn.UseVisualStyleBackColor = true;
this.changePermsBtn.Click += new System.EventHandler(this.changePermsBtn_Click);
//
// launchPackageTextBox
//
this.launchPackageTextBox.Location = new System.Drawing.Point(446, 134);
this.launchPackageTextBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(45)))), ((int)(((byte)(45)))));
this.launchPackageTextBox.ForeColor = System.Drawing.Color.White;
this.launchPackageTextBox.Location = new System.Drawing.Point(597, 113);
this.launchPackageTextBox.Margin = new System.Windows.Forms.Padding(4);
this.launchPackageTextBox.Name = "launchPackageTextBox";
this.launchPackageTextBox.Size = new System.Drawing.Size(192, 20);
this.launchPackageTextBox.TabIndex = 15;
this.launchPackageTextBox.Size = new System.Drawing.Size(255, 22);
this.launchPackageTextBox.TabIndex = 68;
this.launchPackageTextBox.Text = "de.eye_interactive.atvl.settings";
//
// launchApkButton
//
this.launchApkButton.Location = new System.Drawing.Point(446, 161);
this.launchApkButton.Location = new System.Drawing.Point(597, 140);
this.launchApkButton.Margin = new System.Windows.Forms.Padding(4);
this.launchApkButton.Name = "launchApkButton";
this.launchApkButton.Size = new System.Drawing.Size(192, 20);
this.launchApkButton.TabIndex = 13;
this.launchApkButton.Size = new System.Drawing.Size(255, 25);
this.launchApkButton.TabIndex = 69;
this.launchApkButton.Text = "Launch Apk By Package Name";
this.launchApkButton.UseVisualStyleBackColor = true;
this.launchApkButton.Click += new System.EventHandler(this.launchApkButton_Click);
//
// uninstallAppButton
//
this.uninstallAppButton.Location = new System.Drawing.Point(375, 92);
this.uninstallAppButton.Dock = System.Windows.Forms.DockStyle.Top;
this.uninstallAppButton.FlatAppearance.BorderSize = 0;
this.uninstallAppButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.uninstallAppButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.uninstallAppButton.ForeColor = System.Drawing.Color.White;
this.uninstallAppButton.Location = new System.Drawing.Point(0, 105);
this.uninstallAppButton.Margin = new System.Windows.Forms.Padding(4);
this.uninstallAppButton.Name = "uninstallAppButton";
this.uninstallAppButton.Size = new System.Drawing.Size(64, 34);
this.uninstallAppButton.TabIndex = 12;
this.uninstallAppButton.Text = "Uninstall app";
this.uninstallAppButton.Padding = new System.Windows.Forms.Padding(31, 0, 0, 0);
this.uninstallAppButton.Size = new System.Drawing.Size(267, 35);
this.uninstallAppButton.TabIndex = 14;
this.uninstallAppButton.Text = "Uninstall App";
this.uninstallAppButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.uninstallAppButton.UseVisualStyleBackColor = true;
this.uninstallAppButton.Click += new System.EventHandler(this.uninstallAppButton_Click);
//
// sideloadFolderButton
//
this.sideloadFolderButton.Dock = System.Windows.Forms.DockStyle.Top;
this.sideloadFolderButton.FlatAppearance.BorderSize = 0;
this.sideloadFolderButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.sideloadFolderButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.sideloadFolderButton.ForeColor = System.Drawing.Color.White;
this.sideloadFolderButton.Location = new System.Drawing.Point(0, 140);
this.sideloadFolderButton.Margin = new System.Windows.Forms.Padding(4);
this.sideloadFolderButton.Name = "sideloadFolderButton";
this.sideloadFolderButton.Padding = new System.Windows.Forms.Padding(31, 0, 0, 0);
this.sideloadFolderButton.Size = new System.Drawing.Size(267, 35);
this.sideloadFolderButton.TabIndex = 7;
this.sideloadFolderButton.Text = "Sideload Folder";
this.sideloadFolderButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.sideloadFolderButton.UseVisualStyleBackColor = true;
this.sideloadFolderButton.Click += new System.EventHandler(this.sideloadFolderButton_Click);
//
// progressBar1
//
this.progressBar1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.progressBar1.ForeColor = System.Drawing.Color.Purple;
this.progressBar1.Location = new System.Drawing.Point(286, 45);
this.progressBar1.Margin = new System.Windows.Forms.Padding(4);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(565, 25);
this.progressBar1.TabIndex = 23;
//
// copyBulkObbButton
//
this.copyBulkObbButton.Dock = System.Windows.Forms.DockStyle.Top;
this.copyBulkObbButton.FlatAppearance.BorderSize = 0;
this.copyBulkObbButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.copyBulkObbButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.copyBulkObbButton.ForeColor = System.Drawing.Color.White;
this.copyBulkObbButton.Location = new System.Drawing.Point(0, 35);
this.copyBulkObbButton.Margin = new System.Windows.Forms.Padding(4);
this.copyBulkObbButton.Name = "copyBulkObbButton";
this.copyBulkObbButton.Padding = new System.Windows.Forms.Padding(31, 0, 0, 0);
this.copyBulkObbButton.Size = new System.Drawing.Size(267, 35);
this.copyBulkObbButton.TabIndex = 8;
this.copyBulkObbButton.Text = "Copy Bulk Obb";
this.copyBulkObbButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.copyBulkObbButton.UseVisualStyleBackColor = true;
this.copyBulkObbButton.Click += new System.EventHandler(this.copyBulkObbButton_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.ForeColor = System.Drawing.Color.White;
this.DragDropLbl.Location = new System.Drawing.Point(275, 486);
this.DragDropLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.DragDropLbl.Name = "DragDropLbl";
this.DragDropLbl.Size = new System.Drawing.Size(526, 91);
this.DragDropLbl.TabIndex = 27;
this.DragDropLbl.Text = "DragDropLBL";
this.DragDropLbl.Visible = false;
//
// button1
//
this.button1.Location = new System.Drawing.Point(284, 113);
this.button1.Margin = new System.Windows.Forms.Padding(4);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(256, 28);
this.button1.TabIndex = 71;
this.button1.Text = "Download Game";
this.button1.UseVisualStyleBackColor = true;
this.button1.Visible = false;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// gamesComboBox
//
this.gamesComboBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(45)))), ((int)(((byte)(45)))));
this.gamesComboBox.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.gamesComboBox.ForeColor = System.Drawing.Color.White;
this.gamesComboBox.Location = new System.Drawing.Point(284, 81);
this.gamesComboBox.Margin = new System.Windows.Forms.Padding(4);
this.gamesComboBox.Name = "gamesComboBox";
this.gamesComboBox.Size = new System.Drawing.Size(568, 24);
this.gamesComboBox.TabIndex = 72;
this.gamesComboBox.Visible = false;
//
// panel1
//
this.panel1.AutoScroll = true;
this.panel1.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.panel1.Controls.Add(this.donateButton);
this.panel1.Controls.Add(this.aboutBtn);
this.panel1.Controls.Add(this.settingsButton);
this.panel1.Controls.Add(this.checkHashButton);
this.panel1.Controls.Add(this.userjsonButton);
this.panel1.Controls.Add(this.backupContainer);
this.panel1.Controls.Add(this.backupDrop);
this.panel1.Controls.Add(this.sideloadContainer);
this.panel1.Controls.Add(this.sideloadDrop);
this.panel1.Controls.Add(this.devicesbutton);
this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(267, 786);
this.panel1.TabIndex = 73;
//
// donateButton
//
this.donateButton.Dock = System.Windows.Forms.DockStyle.Top;
this.donateButton.FlatAppearance.BorderSize = 0;
this.donateButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.donateButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.donateButton.ForeColor = System.Drawing.SystemColors.ButtonFace;
this.donateButton.Location = new System.Drawing.Point(0, 573);
this.donateButton.Margin = new System.Windows.Forms.Padding(4);
this.donateButton.Name = "donateButton";
this.donateButton.Size = new System.Drawing.Size(267, 58);
this.donateButton.TabIndex = 85;
this.donateButton.Text = "DONATE";
this.donateButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.donateButton.UseVisualStyleBackColor = true;
this.donateButton.Click += new System.EventHandler(this.donateButton_Click);
//
// aboutBtn
//
this.aboutBtn.Dock = System.Windows.Forms.DockStyle.Top;
this.aboutBtn.FlatAppearance.BorderSize = 0;
this.aboutBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.aboutBtn.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.aboutBtn.ForeColor = System.Drawing.SystemColors.ButtonFace;
this.aboutBtn.Location = new System.Drawing.Point(0, 538);
this.aboutBtn.Margin = new System.Windows.Forms.Padding(4);
this.aboutBtn.Name = "aboutBtn";
this.aboutBtn.Size = new System.Drawing.Size(267, 35);
this.aboutBtn.TabIndex = 84;
this.aboutBtn.Text = "ABOUT";
this.aboutBtn.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.aboutBtn.UseVisualStyleBackColor = true;
this.aboutBtn.Click += new System.EventHandler(this.aboutBtn_Click);
//
// settingsButton
//
this.settingsButton.Dock = System.Windows.Forms.DockStyle.Top;
this.settingsButton.FlatAppearance.BorderSize = 0;
this.settingsButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.settingsButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.settingsButton.ForeColor = System.Drawing.SystemColors.MenuBar;
this.settingsButton.Location = new System.Drawing.Point(0, 503);
this.settingsButton.Margin = new System.Windows.Forms.Padding(4);
this.settingsButton.Name = "settingsButton";
this.settingsButton.Size = new System.Drawing.Size(267, 35);
this.settingsButton.TabIndex = 83;
this.settingsButton.Text = "SETTINGS";
this.settingsButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.settingsButton.UseVisualStyleBackColor = true;
this.settingsButton.Click += new System.EventHandler(this.settingsButton_Click);
//
// checkHashButton
//
this.checkHashButton.Dock = System.Windows.Forms.DockStyle.Top;
this.checkHashButton.FlatAppearance.BorderSize = 0;
this.checkHashButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.checkHashButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.checkHashButton.ForeColor = System.Drawing.SystemColors.ButtonFace;
this.checkHashButton.Location = new System.Drawing.Point(0, 468);
this.checkHashButton.Margin = new System.Windows.Forms.Padding(4);
this.checkHashButton.Name = "checkHashButton";
this.checkHashButton.Size = new System.Drawing.Size(267, 35);
this.checkHashButton.TabIndex = 80;
this.checkHashButton.Text = "VIEW HASH";
this.checkHashButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.checkHashButton.UseVisualStyleBackColor = true;
this.checkHashButton.Click += new System.EventHandler(this.checkHashButton_Click);
//
// userjsonButton
//
this.userjsonButton.Dock = System.Windows.Forms.DockStyle.Top;
this.userjsonButton.FlatAppearance.BorderSize = 0;
this.userjsonButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.userjsonButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.userjsonButton.ForeColor = System.Drawing.SystemColors.ButtonFace;
this.userjsonButton.Location = new System.Drawing.Point(0, 433);
this.userjsonButton.Margin = new System.Windows.Forms.Padding(4);
this.userjsonButton.Name = "userjsonButton";
this.userjsonButton.Size = new System.Drawing.Size(267, 35);
this.userjsonButton.TabIndex = 81;
this.userjsonButton.Text = "USER.JSON";
this.userjsonButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.userjsonButton.UseVisualStyleBackColor = true;
this.userjsonButton.Click += new System.EventHandler(this.userjsonButton_Click);
//
// backupContainer
//
this.backupContainer.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.backupContainer.Controls.Add(this.backupbutton);
this.backupContainer.Controls.Add(this.restorebutton);
this.backupContainer.Dock = System.Windows.Forms.DockStyle.Top;
this.backupContainer.Location = new System.Drawing.Point(0, 356);
this.backupContainer.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.backupContainer.Name = "backupContainer";
this.backupContainer.Size = new System.Drawing.Size(267, 77);
this.backupContainer.TabIndex = 76;
//
// backupDrop
//
this.backupDrop.Dock = System.Windows.Forms.DockStyle.Top;
this.backupDrop.FlatAppearance.BorderSize = 0;
this.backupDrop.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.backupDrop.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.backupDrop.ForeColor = System.Drawing.SystemColors.ButtonFace;
this.backupDrop.Location = new System.Drawing.Point(0, 321);
this.backupDrop.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.backupDrop.Name = "backupDrop";
this.backupDrop.Padding = new System.Windows.Forms.Padding(9, 0, 0, 0);
this.backupDrop.Size = new System.Drawing.Size(267, 35);
this.backupDrop.TabIndex = 75;
this.backupDrop.Text = "BACKUP";
this.backupDrop.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.backupDrop.UseVisualStyleBackColor = true;
this.backupDrop.Click += new System.EventHandler(this.backupDrop_Click);
//
// sideloadContainer
//
this.sideloadContainer.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.sideloadContainer.Controls.Add(this.listApkButton);
this.sideloadContainer.Controls.Add(this.startsideloadbutton);
this.sideloadContainer.Controls.Add(this.sideloadFolderButton);
this.sideloadContainer.Controls.Add(this.uninstallAppButton);
this.sideloadContainer.Controls.Add(this.getApkButton);
this.sideloadContainer.Controls.Add(this.copyBulkObbButton);
this.sideloadContainer.Controls.Add(this.obbcopybutton);
this.sideloadContainer.Dock = System.Windows.Forms.DockStyle.Top;
this.sideloadContainer.Location = new System.Drawing.Point(0, 70);
this.sideloadContainer.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.sideloadContainer.Name = "sideloadContainer";
this.sideloadContainer.Size = new System.Drawing.Size(267, 251);
this.sideloadContainer.TabIndex = 74;
//
// listApkButton
//
this.listApkButton.Dock = System.Windows.Forms.DockStyle.Top;
this.listApkButton.FlatAppearance.BorderSize = 0;
this.listApkButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.listApkButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.listApkButton.ForeColor = System.Drawing.Color.White;
this.listApkButton.Location = new System.Drawing.Point(0, 210);
this.listApkButton.Margin = new System.Windows.Forms.Padding(4);
this.listApkButton.Name = "listApkButton";
this.listApkButton.Padding = new System.Windows.Forms.Padding(31, 0, 0, 0);
this.listApkButton.Size = new System.Drawing.Size(267, 35);
this.listApkButton.TabIndex = 15;
this.listApkButton.Text = "Refresh Apk List";
this.listApkButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.listApkButton.UseVisualStyleBackColor = true;
this.listApkButton.Click += new System.EventHandler(this.listApkButton_Click);
//
// sideloadDrop
//
this.sideloadDrop.Dock = System.Windows.Forms.DockStyle.Top;
this.sideloadDrop.FlatAppearance.BorderSize = 0;
this.sideloadDrop.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.sideloadDrop.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.sideloadDrop.ForeColor = System.Drawing.SystemColors.ButtonFace;
this.sideloadDrop.Location = new System.Drawing.Point(0, 35);
this.sideloadDrop.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.sideloadDrop.Name = "sideloadDrop";
this.sideloadDrop.Padding = new System.Windows.Forms.Padding(9, 0, 0, 0);
this.sideloadDrop.Size = new System.Drawing.Size(267, 35);
this.sideloadDrop.TabIndex = 2;
this.sideloadDrop.Text = "SIDELOAD";
this.sideloadDrop.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.sideloadDrop.UseVisualStyleBackColor = true;
this.sideloadDrop.Click += new System.EventHandler(this.sideloadContainer_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(650, 411);
this.Controls.Add(this.uninstallAppButton);
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(45)))), ((int)(((byte)(45)))));
this.ClientSize = new System.Drawing.Size(862, 786);
this.Controls.Add(this.panel1);
this.Controls.Add(this.gamesComboBox);
this.Controls.Add(this.button1);
this.Controls.Add(this.DragDropLbl);
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.launchApkButton);
this.Controls.Add(this.launchPackageTextBox);
this.Controls.Add(this.changePermsBtn);
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.MaximumSize = new System.Drawing.Size(666, 1000);
this.MinimumSize = new System.Drawing.Size(466, 450);
this.HelpButton = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(4);
this.MaximumSize = new System.Drawing.Size(880, 1216);
this.MinimumSize = new System.Drawing.Size(880, 539);
this.Name = "Form1";
this.Text = "Rookie SideLoader";
this.Load += new System.EventHandler(this.Form1_Load);
this.Shown += new System.EventHandler(this.Form1_Shown);
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.panel1.ResumeLayout(false);
this.backupContainer.ResumeLayout(false);
this.sideloadContainer.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@@ -223,19 +529,31 @@
#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;
private System.Windows.Forms.Button changePermsBtn;
private SergeUtils.EasyCompletionComboBox m_combo;
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.ProgressBar progressBar1;
private System.Windows.Forms.Button copyBulkObbButton;
private System.Windows.Forms.Label DragDropLbl;
private System.Windows.Forms.Button button1;
private SergeUtils.EasyCompletionComboBox gamesComboBox;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button donateButton;
private System.Windows.Forms.Button aboutBtn;
private System.Windows.Forms.Button settingsButton;
private System.Windows.Forms.Button checkHashButton;
private System.Windows.Forms.Button userjsonButton;
private System.Windows.Forms.Panel backupContainer;
private System.Windows.Forms.Button backupDrop;
private System.Windows.Forms.Panel sideloadContainer;
private System.Windows.Forms.Button sideloadDrop;
private System.Windows.Forms.Button listApkButton;
}
}

721
Form1.cs
View File

@@ -4,37 +4,54 @@ using System.Windows.Forms;
using System.IO;
using System.Threading;
using System.Windows;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Net.Http;
using System.Reflection;
using System.Timers;
using System.Security.Cryptography;
using System.Windows.Threading;
using System.Net;
using System.Runtime.InteropServices;
using SergeUtils;
using System.Drawing.Text;
using JR.Utils.GUI.Forms;
using System.Drawing;
/* <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
bool debugMode = true;
public static bool debugMode = true;
#else
bool debugMode = false;
public static bool debugMode = false;
#endif
string path;
string result;
string obbPath = "";
string obbFile;
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();
//calling the design to hide the pannels until onclick
customizeDesign();
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)
@@ -45,13 +62,63 @@ namespace AndroidSideloader
this.Text = txt;
}
//adding the styling to the form
private void customizeDesign()
{
sideloadContainer.Visible = false;
backupContainer.Visible = false;
}
private void hideSubMenu()
{
if(sideloadContainer.Visible == true)
{
sideloadContainer.Visible = false;
}
if(backupContainer.Visible == true)
{
backupContainer.Visible = false;
}
}
//does the fancy stuff
private void showSubMenu(Panel subMenu)
{
if (subMenu.Visible == false)
{
hideSubMenu();
subMenu.Visible = true;
}
else
{
subMenu.Visible = false;
}
}
public void changeStyle(int style)
{
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)
{
string oldTitle = this.Text;
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;
@@ -74,28 +141,26 @@ 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 + '"');
runAdbCommand("install -d -r " + '"' + path + '"');
});
t1.IsBackground = true;
t1.Start();
t1.Join();
if (allText.Length == 0)
notify("Install Failed, apk may be corrupt");
}
private async void startsideloadbutton_Click(object sender, EventArgs e)
{
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
openFileDialog.Filter = "Android apps (*.apk)|*.apk";
@@ -108,38 +173,36 @@ namespace AndroidSideloader
return;
}
if (path == "" || path.EndsWith(".apk") == false)
MessageBox.Show("You must select an apk");
else
{
await Task.Run(() => sideload(path));
MessageBox.Show(allText);
}
await Task.Run(() => sideload(path));
notify(allText);
}
private void devicesbutton_Click(object sender, EventArgs e)
{
runAdbCommand("devices");
changeTitlebarToDevice();
MessageBox.Show(allText);
notify(allText);
}
private void instructionsbutton_Click(object sender, EventArgs e)
public static void notify(string message)
{
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";
MessageBox.Show(instructions);
if (Properties.Settings.Default.enableMessageBoxes == true)
{
FlexibleMessageBox.Show(new Form { TopMost = true, StartPosition = FormStartPosition.CenterScreen }, message);
if (Properties.Settings.Default.copyMessageToClipboard == true)
Clipboard.SetText(message);
}
}
public void ExtractFile(string sourceArchive, string destination)
{
changeStyle(1);
oldTitle = this.Text;
changeTitle("Rookie Sideloader | Extracting archive " + sourceArchive);
string zPath = "7z.exe"; //add to proj and set CopyToOuputDir
ProcessStartInfo pro = new ProcessStartInfo();
pro.WindowStyle = ProcessWindowStyle.Hidden;
@@ -147,6 +210,8 @@ namespace AndroidSideloader
pro.Arguments = string.Format("x \"{0}\" -y -o\"{1}\"", sourceArchive, destination);
Process x = Process.Start(pro);
x.WaitForExit();
changeStyle(0);
changeTitle(oldTitle);
}
private void obbcopy(string obbPath)
@@ -162,30 +227,21 @@ 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);
obbPath = dialog.FileName;
}
else return;
await Task.Run(() => obbcopy(obbPath));
notify(allText);
}
private void changeTitlebarToDevice()
@@ -196,19 +252,26 @@ 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)
{
runAdbCommand("devices");
changeTitlebarToDevice();
//comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; //can remove if u want to not show the box 2 times
//comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems;
this.CenterToScreen();
if (File.Exists(debugPath))
File.Delete(debugPath);
if (Directory.Exists(adbPath)==false)
File.Delete(debugPath); //clear debug.log each start
if (File.Exists(Environment.CurrentDirectory + "\\7z.exe") == false)
{
MessageBox.Show("Please wait for the software to download and install the adb");
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");
}
}
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
{
using (var client = new WebClient())
@@ -221,12 +284,10 @@ namespace AndroidSideloader
}
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!");
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");
@@ -236,32 +297,96 @@ namespace AndroidSideloader
}
}
if (debugMode==false)
checkForUpdate();
if (Properties.Settings.Default.checkForUpdates==true)
checkForUpdate();
if (debugMode == true)
{
button1.Visible = true;
gamesComboBox.Visible = true;
}
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();
ListAppsToolTip.SetToolTip(this.ListApps, "Press this to show what packages you have installed");
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 sideloadFolderToolTip = new ToolTip();
sideloadFolderToolTip.SetToolTip(this.sideloadFolderButton, "Sideloads every apk from a folder");
ToolTip uninstallAppToolTip = new ToolTip();
uninstallAppToolTip.SetToolTip(this.uninstallAppButton, "Uninstalls selected app");
ToolTip userjsonToolTip = new ToolTip();
userjsonToolTip.SetToolTip(this.userjsonButton, "After you enter your username it will create an user.json file needed for some games");
}
void checkForUpdate()
{
try
try
{
string localVersion = "0.7";
string localVersion = "0.15HF1";
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");
{
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
catch
{
//No need for messages, the user has no internet
}
}
@@ -279,11 +404,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
@@ -296,12 +416,7 @@ namespace AndroidSideloader
File.AppendAllText(debugPath, ex.ToString());
}
MessageBox.Show(allText);
}
private void debugbutton_Click(object sender, EventArgs e)
{
notify(allText);
}
private void restore()
@@ -317,11 +432,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())
{
@@ -336,13 +446,7 @@ namespace AndroidSideloader
}
await Task.Run(() => restore());
MessageBox.Show(allText);
}
private void customadbcmdbutton_Click(object sender, EventArgs e)
{
customAdbCommandForm adbCommandForm = new customAdbCommandForm();
adbCommandForm.Show();
notify(allText);
}
private void listapps()
@@ -356,11 +460,6 @@ namespace AndroidSideloader
t1.Join();
}
private void ListApps_Click(object sender, EventArgs e)
{
listappsBtn();
}
private async void listappsBtn()
{
allText = "";
@@ -375,8 +474,6 @@ namespace AndroidSideloader
m_combo.Items.Add(obj.Remove(0, 8));
}
m_combo.MatchingMethod = StringMatchingMethod.NoWildcards;
//if (allText.Length > 0)
// MessageBox.Show("Fetched apks with success");
}
private void getapk(string package)
@@ -403,6 +500,12 @@ namespace AndroidSideloader
private async void getApkButton_Click(object sender, EventArgs e)
{
if (m_combo.Items.Count == 0 || m_combo.SelectedItem.ToString().Length == 0)
{
notify("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,118 +528,27 @@ namespace AndroidSideloader
File.Move(Environment.CurrentDirectory + "\\adb\\" + currApkPath, Environment.CurrentDirectory + "\\" + package + ".apk");
MessageBox.Show("Done");
}
private void listappperms(string package)
{
Thread t1 = new Thread(() =>
{
runAdbCommand("shell dumpsys package " + package);
});
t1.IsBackground = true;
t1.Start();
t1.Join();
}
private async void listApkPermsButton_Click(object sender, EventArgs e)
{
string package = m_combo.SelectedItem.ToString().Remove(m_combo.SelectedItem.ToString().Length - 1);
await Task.Run(() => listappperms(package));
var grantedPerms = allText.Substring(allText.LastIndexOf("install permissions:") + 22);
grantedPerms.Substring(0, grantedPerms.IndexOf("User 0:"));
line = grantedPerms.Split('\n');
int pos1 = 12;
int pos2 = 187;
for (int i=0; i< line.Length; i++)
{
if (line[i].Contains("android.permission."))
{
CheckBox chk = new CheckBox();
if (line[i].Contains("true"))
chk.Checked = true;
else
chk.Checked = false;
line[i] = line[i].Substring(0, line[i].IndexOf(": granted"));
line[i] = line[i].Substring(line[i].LastIndexOf(" "));
chk.Location = new System.Drawing.Point(pos1, pos2);
chk.Width = 420;
chk.Height = 17;
chk.Text = line[i];
chk.CheckedChanged += new EventHandler(CheckBox_Checked);
Controls.Add(chk);
pos2 += 20;
}
}
}
private void CheckBox_Checked(object sender, EventArgs e)
{
}
private async void changePermsBtn_Click(object sender, EventArgs e)
{
string package = m_combo.SelectedItem.ToString().Remove(m_combo.SelectedItem.ToString().Length - 1);
foreach (Control c in Controls)
{
if ((c is CheckBox))
{
exit = false;
if (((CheckBox)c).Checked==true)
{
await Task.Run(() => changePerms(c, package, "grant"));
}
else
{
await Task.Run(() => changePerms(c, package, "revoke"));
}
}
}
MessageBox.Show("Done!");
}
private void changePerms(Control c, string package, string grant)
{
Thread t1 = new Thread(() =>
{
runAdbCommand("shell pm " + grant + " " + package + " " + c.Text);
});
t1.IsBackground = true;
t1.Start();
t1.Join();
notify(allText);
}
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)
{
if (m_combo.Items.Count == 0 || m_combo.SelectedItem.ToString().Length == 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 +558,7 @@ namespace AndroidSideloader
await Task.Run(() => uninstallPackage(package));
MessageBox.Show(allText);
notify(allText);
}
private void uninstallPackage(string package)
@@ -560,16 +572,297 @@ namespace AndroidSideloader
t1.Join();
}
private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e)
private void sideloadFolderButton_Click(object sender, EventArgs e)
{
MethodItem mi = (MethodItem)m_combo.SelectedItem;
m_combo.MatchingMethod = mi.Value;
var dialog = new FolderSelectDialog
{
Title = "Select your folder with APKs"
};
if (dialog.Show(Handle))
{
recursiveSideload(dialog.FileName);
}
else return;
notify("Done bulk sideloading");
}
private async void recursiveSideload(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 == ".apk")
{
await Task.Run(() => sideload(files[i]));
}
}
for (int i = 0; i < childDirectories.Length; i++)
{
recursiveSideload(childDirectories[i]);
}
}
/*Progress bar stuff
*
*/
DispatcherTimer Timer99 = new DispatcherTimer();
public void Timer99_Tick(System.Object sender, System.EventArgs e)
{
var rnd = new Random();
var redColor = System.Drawing.Color.FromArgb(rnd.Next(0,256), rnd.Next(0, 256), rnd.Next(0, 256));
donateButton.BackColor = redColor;
}
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]);
}
}
public 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;
}
private void Form1_Shown(object sender, EventArgs e)
{
Timer99.Start();
}
private void downloadOverTor(string url, string path)
{
WebProxy oWebProxy = new WebProxy(IPAddress.Loopback.ToString(), 4711);
WebClient oWebClient = new WebClient();
oWebClient.Proxy = oWebProxy;
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
oWebClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
oWebClient.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
oWebClient.DownloadFileAsync(new Uri(url), path);
}
bool isInDownload = false;
private async void button1_Click(object sender, EventArgs e)
{
string gameName = "game.zip"; //get selected game name instead
string url = "";
string path = Environment.CurrentDirectory + "\\game.zip";
string gamePath = Environment.CurrentDirectory + "\\" + gameName;
isInDownload = true;
changeStyle(1);
if (Properties.Settings.Default.useTor == true)
{
if (Directory.Exists(Environment.CurrentDirectory + "\\Tor") == false)
{
DialogResult dialogResult = FlexibleMessageBox.Show(new Form { TopMost = true }, "You have download over tor enabled in settings, do you want to download tor?", "Download", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.No)
return;
using (var client = new WebClient())
{
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
client.DownloadFile("https://github.com/nerdunit/androidsideloader/raw/master/Tor.7z", "Tor.7z");
}
ExtractFile(Environment.CurrentDirectory + "\\Tor.7z", Environment.CurrentDirectory);
File.Delete(Environment.CurrentDirectory + "\\Tor.7z");
}
string filename = Path.Combine(Environment.CurrentDirectory + "\\Tor", "tor.exe");
var proc = System.Diagnostics.Process.Start(filename, "--HTTPTunnelPort 4711");
downloadOverTor(url, path);
}
else
startDownload(url, path);
while (isInDownload == true)
{
await Task.Delay(25);
}
changeStyle(0);
//Extract the game
await Task.Run(() => ExtractFile(gamePath, Environment.CurrentDirectory));
recursiveSideload(gamePath); //in case there are multiple apk's
string[] filesindirectory = Directory.GetDirectories(gamePath + "\\obb"); //in case there are multiple obb's
foreach (string dir in filesindirectory)
await Task.Run(() => obbcopy(dir));
notify("Game installed");
}
private void startDownload(string url, string path)
{
WebClient client = new WebClient();
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
client.DownloadFileAsync(new Uri(url), path);
}
void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
changeTitle("Rookie's Sideloader | Downloaded " + e.BytesReceived + " of " + e.TotalBytesToReceive);
}
void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
changeStyle(0);
isInDownload = false;
}
private void sideloadContainer_Click(object sender, EventArgs e)
{
showSubMenu(sideloadContainer);
}
private void backupDrop_Click(object sender, EventArgs e)
{
showSubMenu(backupContainer);
}
private void settingsButton_Click(object sender, EventArgs e)
{
SettingsForm settingsForm = new SettingsForm();
settingsForm.Show();
}
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 badcoder5000#4598 for redesigning the UI
- Thanks to https://stackoverflow.com/users/57611/erike for the folder browser dialog code
- Thanks to Serge Weinstock for developing SergeUtils, which is used to search the combo box
- Thanks to Mike Gold https://www.c-sharpcorner.com/members/mike-gold2 for the scrollable message box";
FlexibleMessageBox.Show(about);
}
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");
}
private void userjsonButton_Click(object sender, EventArgs e)
{
usernameForm usernameForm1 = new usernameForm();
usernameForm1.Show();
}
private void donateButton_Click(object sender, EventArgs e)
{
Clipboard.SetText("https://steamcommunity.com/tradeoffer/new/?partner=189719028&token=qCee3jwp");
notify("Donate steam stuff to me if you want, my trade link has been copied to your clipboard also here's the link https://steamcommunity.com/tradeoffer/new/?partner=189719028&token=qCee3jwp");
}
private void listApkButton_Click(object sender, EventArgs e)
{
listappsBtn();
}
}
public class MethodItem
{
public string Name { get; set; }
public StringMatchingMethod Value { get; set; }
}
}

1788
Form1.resx

File diff suppressed because it is too large Load Diff

25
MetroFramework.txt Normal file
View File

@@ -0,0 +1,25 @@
MetroFramework - Modern UI for WinForms
Copyright (c) 2013 Jens Thiel, http://thielj.github.io/MetroFramework
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in the
Software without restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Portions of this software are:
Copyright (c) 2011 Sven Walter, http://github.com/viperneo

View File

@@ -8,10 +8,10 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace AndroidSideloader.Properties
{
namespace AndroidSideloader.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
@@ -19,51 +19,43 @@ namespace AndroidSideloader.Properties
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AndroidSideloader.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}

View File

@@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@@ -60,6 +60,7 @@
: 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">
@@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<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">
@@ -85,9 +87,10 @@
<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" msdata:Ordinal="1" />
<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">
@@ -109,9 +112,9 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -8,23 +8,79 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace AndroidSideloader.Properties
{
namespace AndroidSideloader.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.6.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool checkForUpdates {
get {
return ((bool)(this["checkForUpdates"]));
}
set {
this["checkForUpdates"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool enableMessageBoxes {
get {
return ((bool)(this["enableMessageBoxes"]));
}
set {
this["enableMessageBoxes"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool copyMessageToClipboard {
get {
return ((bool)(this["copyMessageToClipboard"]));
}
set {
this["copyMessageToClipboard"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool firstRun {
get {
return ((bool)(this["firstRun"]));
}
set {
this["firstRun"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool useTor {
get {
return ((bool)(this["useTor"]));
}
set {
this["useTor"] = value;
}
}
}
}

View File

@@ -1,7 +1,21 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="AndroidSideloader.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="checkForUpdates" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="enableMessageBoxes" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="copyMessageToClipboard" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="firstRun" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="useTor" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@@ -1,51 +1,9 @@
# androidsideloader
Changelog
The icon of the app contains an icon made by icon8.com
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
0.7
- 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
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
Special thanks to
- badcoder5000#4598 for the awesome ui update
- https://stackoverflow.com/users/57611/erike for the folder browser dialog code
- Serge Weinstock for developing SergeUtils, which is used to search the combo box
- Mike Gold https://www.c-sharpcorner.com/members/mike-gold2 for the scrollable message box

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; } }
}
}
}

146
SettingsForm.Designer.cs generated Normal file
View File

@@ -0,0 +1,146 @@
namespace AndroidSideloader
{
partial class SettingsForm
{
/// <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.checkForUpdatesCheckBox = new System.Windows.Forms.CheckBox();
this.applyButton = new System.Windows.Forms.Button();
this.enableMessageBoxesCheckBox = new System.Windows.Forms.CheckBox();
this.copyMessageToClipboardCheckBox = new System.Windows.Forms.CheckBox();
this.resetSettingsButton = new System.Windows.Forms.Button();
this.useTorCheckBox = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// checkForUpdatesCheckBox
//
this.checkForUpdatesCheckBox.AutoSize = true;
this.checkForUpdatesCheckBox.Location = new System.Drawing.Point(17, 16);
this.checkForUpdatesCheckBox.Margin = new System.Windows.Forms.Padding(4);
this.checkForUpdatesCheckBox.Name = "checkForUpdatesCheckBox";
this.checkForUpdatesCheckBox.Size = new System.Drawing.Size(145, 21);
this.checkForUpdatesCheckBox.TabIndex = 0;
this.checkForUpdatesCheckBox.Text = "Check for updates";
this.checkForUpdatesCheckBox.UseVisualStyleBackColor = true;
this.checkForUpdatesCheckBox.CheckedChanged += new System.EventHandler(this.checkForUpdatesCheckBox_CheckedChanged);
//
// applyButton
//
this.applyButton.BackColor = System.Drawing.Color.White;
this.applyButton.ForeColor = System.Drawing.Color.Black;
this.applyButton.Location = new System.Drawing.Point(476, 225);
this.applyButton.Margin = new System.Windows.Forms.Padding(4);
this.applyButton.Name = "applyButton";
this.applyButton.Size = new System.Drawing.Size(100, 28);
this.applyButton.TabIndex = 1;
this.applyButton.Text = "Apply";
this.applyButton.UseVisualStyleBackColor = false;
this.applyButton.Click += new System.EventHandler(this.applyButton_Click);
//
// enableMessageBoxesCheckBox
//
this.enableMessageBoxesCheckBox.AutoSize = true;
this.enableMessageBoxesCheckBox.Location = new System.Drawing.Point(17, 44);
this.enableMessageBoxesCheckBox.Margin = new System.Windows.Forms.Padding(4);
this.enableMessageBoxesCheckBox.Name = "enableMessageBoxesCheckBox";
this.enableMessageBoxesCheckBox.Size = new System.Drawing.Size(296, 21);
this.enableMessageBoxesCheckBox.TabIndex = 2;
this.enableMessageBoxesCheckBox.Text = "Enable Message Boxes on task completed";
this.enableMessageBoxesCheckBox.UseVisualStyleBackColor = true;
this.enableMessageBoxesCheckBox.CheckedChanged += new System.EventHandler(this.enableMessageBoxesCheckBox_CheckedChanged);
//
// copyMessageToClipboardCheckBox
//
this.copyMessageToClipboardCheckBox.AutoSize = true;
this.copyMessageToClipboardCheckBox.Location = new System.Drawing.Point(17, 73);
this.copyMessageToClipboardCheckBox.Margin = new System.Windows.Forms.Padding(4);
this.copyMessageToClipboardCheckBox.Name = "copyMessageToClipboardCheckBox";
this.copyMessageToClipboardCheckBox.Size = new System.Drawing.Size(201, 21);
this.copyMessageToClipboardCheckBox.TabIndex = 3;
this.copyMessageToClipboardCheckBox.Text = "Copy message to clipboard";
this.copyMessageToClipboardCheckBox.UseVisualStyleBackColor = true;
this.copyMessageToClipboardCheckBox.CheckedChanged += new System.EventHandler(this.copyMessageToClipboardCheckBox_CheckedChanged);
//
// resetSettingsButton
//
this.resetSettingsButton.BackColor = System.Drawing.Color.White;
this.resetSettingsButton.ForeColor = System.Drawing.Color.Black;
this.resetSettingsButton.Location = new System.Drawing.Point(341, 225);
this.resetSettingsButton.Margin = new System.Windows.Forms.Padding(4);
this.resetSettingsButton.Name = "resetSettingsButton";
this.resetSettingsButton.Size = new System.Drawing.Size(127, 28);
this.resetSettingsButton.TabIndex = 4;
this.resetSettingsButton.Text = "Reset Settings";
this.resetSettingsButton.UseVisualStyleBackColor = false;
this.resetSettingsButton.Click += new System.EventHandler(this.resetSettingsButton_Click);
//
// useTorCheckBox
//
this.useTorCheckBox.AutoSize = true;
this.useTorCheckBox.Location = new System.Drawing.Point(17, 102);
this.useTorCheckBox.Margin = new System.Windows.Forms.Padding(4);
this.useTorCheckBox.Name = "useTorCheckBox";
this.useTorCheckBox.Size = new System.Drawing.Size(212, 21);
this.useTorCheckBox.TabIndex = 5;
this.useTorCheckBox.Text = "Download games through tor";
this.useTorCheckBox.UseVisualStyleBackColor = true;
this.useTorCheckBox.CheckedChanged += new System.EventHandler(this.useTorCheckBox_CheckedChanged);
//
// SettingsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.ClientSize = new System.Drawing.Size(592, 268);
this.Controls.Add(this.useTorCheckBox);
this.Controls.Add(this.resetSettingsButton);
this.Controls.Add(this.copyMessageToClipboardCheckBox);
this.Controls.Add(this.enableMessageBoxesCheckBox);
this.Controls.Add(this.applyButton);
this.Controls.Add(this.checkForUpdatesCheckBox);
this.ForeColor = System.Drawing.Color.White;
this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "SettingsForm";
this.ShowIcon = false;
this.Text = "SettingsForm";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SettingsForm_FormClosing);
this.Load += new System.EventHandler(this.SettingsForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.CheckBox checkForUpdatesCheckBox;
private System.Windows.Forms.Button applyButton;
private System.Windows.Forms.CheckBox enableMessageBoxesCheckBox;
private System.Windows.Forms.CheckBox copyMessageToClipboardCheckBox;
private System.Windows.Forms.Button resetSettingsButton;
private System.Windows.Forms.CheckBox useTorCheckBox;
}
}

85
SettingsForm.cs Normal file
View File

@@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AndroidSideloader
{
public partial class SettingsForm : Form
{
public SettingsForm()
{
InitializeComponent();
}
private void SettingsForm_Load(object sender, EventArgs e)
{
this.CenterToParent();
intSettings();
intToolTips();
}
private void intSettings()
{
checkForUpdatesCheckBox.Checked = Properties.Settings.Default.checkForUpdates;
enableMessageBoxesCheckBox.Checked = Properties.Settings.Default.enableMessageBoxes;
copyMessageToClipboardCheckBox.Checked = Properties.Settings.Default.copyMessageToClipboard;
useTorCheckBox.Checked = Properties.Settings.Default.useTor;
}
void intToolTips()
{
ToolTip checkForUpdatesToolTip = new ToolTip();
checkForUpdatesToolTip.SetToolTip(this.checkForUpdatesCheckBox, "If this is checked, the software will check for available updates");
ToolTip enableMessageBoxesToolTip = new ToolTip();
enableMessageBoxesToolTip.SetToolTip(this.enableMessageBoxesCheckBox, "If this is checked, the software will display message boxes after every completed task");
ToolTip copyMessageToClipboardToolTip = new ToolTip();
copyMessageToClipboardToolTip.SetToolTip(this.copyMessageToClipboardCheckBox, "If this is checked, after each task the software will set the result message to your clipboard");
ToolTip useTorToolTip = new ToolTip();
useTorToolTip.SetToolTip(this.useTorCheckBox, "If this is checked, the software will use tor to download the games");
}
private void applyButton_Click(object sender, EventArgs e)
{
Properties.Settings.Default.Save();
}
private void SettingsForm_FormClosing(object sender, FormClosingEventArgs e)
{
}
private void checkForUpdatesCheckBox_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.checkForUpdates = checkForUpdatesCheckBox.Checked;
}
private void enableMessageBoxesCheckBox_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.enableMessageBoxes = enableMessageBoxesCheckBox.Checked;
}
private void copyMessageToClipboardCheckBox_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.copyMessageToClipboard = copyMessageToClipboardCheckBox.Checked;
}
private void resetSettingsButton_Click(object sender, EventArgs e)
{
Properties.Settings.Default.Reset();
intSettings();
}
private void useTorCheckBox_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.useTor = useTorCheckBox.Checked;
}
}
}

120
SettingsForm.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>

BIN
Tor.7z Normal file

Binary file not shown.

110
changelog.txt Normal file
View File

@@ -0,0 +1,110 @@
0.15HF1
+ Added list apps button back
= Fixed Uninstall apk and get apk
0.15
= MASSIVE UI REDESIGN
+ Added toggle for tor/clearnet
+ Added download games through tor but still waiting for someone to help me host the files
+ Added download with progress
= Changed adb sideload command to allow downgrades too
- Removed perms stuff, was too buggy
0.14HF1
+ Added donate button
= Fixed ui order
- Removed warning from bulk obb sideload button
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)
+ Added a new user.json
= Fixed crash on some systems (PerformanceCounter)
= Fixed crash because of file name inconsistency
- Removed performance counters because they made the software not work for some people
0.11
+ Changed normal message boxes to flexible ones
+ Added changelog to update message
= Improved update message
- Removed progressbar
0.10
+ Added few tooltips
+ Sideload folder now works for all apks (recursive search)
= Obb copy and Sideload progress bar problems should be fixed
= Fixed user.json not working if the any of folder had spaces
= Switched back to Message Boxes
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
0.7
= 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
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

BIN
icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

View File

@@ -2,4 +2,8 @@
<packages>
<package id="Costura.Fody" version="4.1.0" targetFramework="net452" />
<package id="Fody" version="6.0.0" targetFramework="net452" developmentDependency="true" />
<package id="MetroFramework" version="1.2.0.3" targetFramework="net452" />
<package id="MetroFramework.Design" version="1.2.0.3" targetFramework="net452" />
<package id="MetroFramework.Fonts" version="1.2.0.3" targetFramework="net452" />
<package id="MetroFramework.RunTime" version="1.2.0.3" targetFramework="net452" />
</packages>

View File

@@ -0,0 +1,25 @@
MetroFramework - Modern UI for WinForms
Copyright (c) 2013 Jens Thiel, http://thielj.github.io/MetroFramework
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in the
Software without restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Portions of this software are:
Copyright (c) 2011 Sven Walter, http://github.com/viperneo

Binary file not shown.

View File

@@ -0,0 +1,10 @@
NOTE:
To make use of designers, you must reference both MetroFramework.dll and MetroFramework.Design.dll
from your project. I recommend to change the properties for the Design dll to "Copy local: false"
as you do not need to redistribute it. This also helps to make your application independent of
System.Design.dll and compatible with the .NET client profile, a subset of the full .NET framework.
Project Site: http://thielj.github.io/MetroFramework

View File

@@ -0,0 +1,10 @@
NOTE:
To make use of designers, you must reference both MetroFramework.dll and MetroFramework.Design.dll
from your project. I recommend to change the properties for the Design dll to "Copy local: false"
as you do not need to redistribute it. This also helps to make your application independent of
System.Design.dll and compatible with the .NET client profile, a subset of the full .NET framework.
Project Site: http://thielj.github.io/MetroFramework

View File

@@ -0,0 +1,9 @@
param($installPath, $toolsPath, $package, $project)
foreach ($reference in $project.Object.References)
{
if($reference.Name -eq "MetroFramework.Design")
{
$reference.CopyLocal = $false;
}
}

View File

@@ -0,0 +1,10 @@
NOTE:
To make use of designers, you must reference both MetroFramework.dll and MetroFramework.Design.dll
from your project. I recommend to change the properties for the Design dll to "Copy local: false"
as you do not need to redistribute it. This also helps to make your application independent of
System.Design.dll and compatible with the .NET client profile, a subset of the full .NET framework.
Project Site: http://thielj.github.io/MetroFramework

View File

@@ -0,0 +1,10 @@
NOTE:
To make use of designers, you must reference both MetroFramework.dll and MetroFramework.Design.dll
from your project. I recommend to change the properties for the Design dll to "Copy local: false"
as you do not need to redistribute it. This also helps to make your application independent of
System.Design.dll and compatible with the .NET client profile, a subset of the full .NET framework.
Project Site: http://thielj.github.io/MetroFramework

85
usernameForm.Designer.cs generated Normal file
View File

@@ -0,0 +1,85 @@
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.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.textBox1.ForeColor = System.Drawing.Color.White;
this.textBox1.Location = new System.Drawing.Point(17, 16);
this.textBox1.Margin = new System.Windows.Forms.Padding(4);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(532, 22);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "Enter your username here";
//
// button1
//
this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.button1.ForeColor = System.Drawing.Color.White;
this.button1.Location = new System.Drawing.Point(17, 48);
this.button1.Margin = new System.Windows.Forms.Padding(0);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(533, 28);
this.button1.TabIndex = 1;
this.button1.Text = "Create User.Json";
this.button1.UseVisualStyleBackColor = false;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// usernameForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(564, 81);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
this.ForeColor = System.Drawing.Color.White;
this.Margin = new System.Windows.Forms.Padding(4);
this.MaximumSize = new System.Drawing.Size(582, 128);
this.MinimumSize = new System.Drawing.Size(582, 128);
this.Name = "usernameForm";
this.ShowIcon = false;
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;
}
}

80
usernameForm.cs Normal file
View File

@@ -0,0 +1,80 @@
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 + "\"}");
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;
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();
StreamWriter sw = File.AppendText(Form1.debugPath);
sw.Write("Action name = " + command + '\n');
sw.Write(allText);
sw.Write("\n--------------------------------------------------------------------\n");
sw.Flush();
sw.Close();
}
}
}

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.15HF1