forked from amolkamble47/windows-adb-remote
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
417 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 2012 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "adb remote", "adb remote\adb remote.csproj", "{6F0FC5C4-53D5-4B6C-AFA5-F589184D437B}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{6F0FC5C4-53D5-4B6C-AFA5-F589184D437B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{6F0FC5C4-53D5-4B6C-AFA5-F589184D437B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{6F0FC5C4-53D5-4B6C-AFA5-F589184D437B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{6F0FC5C4-53D5-4B6C-AFA5-F589184D437B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,297 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace adb_remote | ||
{ | ||
class Program | ||
{ | ||
static string IPAddress = "192.168.178.60"; | ||
|
||
static void Main(string[] args) | ||
{ | ||
if (IPAddress == string.Empty) | ||
{ | ||
Console.Write("Welcome.\r\nPlease enter the IP Address of the ADB Device: "); | ||
IPAddress = Console.ReadLine(); | ||
} | ||
adbCommand("kill-server"); | ||
adbCommand("start-server"); | ||
adbCommand("connect " + IPAddress); | ||
|
||
while (true) | ||
{ | ||
Console.Clear(); | ||
PrintMainMenu(); | ||
|
||
ConsoleKeyInfo cki; | ||
cki = Console.ReadKey(); | ||
|
||
switch (cki.Key) | ||
{ | ||
case ConsoleKey.D1: | ||
RemoteControlMode(); | ||
break; | ||
|
||
case ConsoleKey.D2: | ||
ADBMode(); | ||
break; | ||
|
||
case ConsoleKey.D3: | ||
ExitApplication(); | ||
break; | ||
|
||
default: | ||
PrintMainMenu(); | ||
break; | ||
} | ||
} | ||
|
||
} | ||
|
||
static void adbCommand(string adbCommand) | ||
{ | ||
var p = new Process(); | ||
p.StartInfo = new ProcessStartInfo("adb", adbCommand) | ||
{ | ||
UseShellExecute = false | ||
}; | ||
p.Start(); | ||
p.WaitForExit(); | ||
|
||
} | ||
|
||
static void PrintMainMenu() | ||
{ | ||
Console.WriteLine("Connected to: " + IPAddress); | ||
Console.WriteLine("--------------------------------"); | ||
Console.WriteLine("1) Remote Control"); | ||
Console.WriteLine("2) ADB Mode"); | ||
Console.WriteLine("3) Exit"); | ||
} | ||
|
||
static void ADBMode() | ||
{ | ||
Console.Clear(); | ||
Console.WriteLine("ADB Mode (F5 for Mainmenu)"); | ||
|
||
bool getOut = false; | ||
while (!getOut) | ||
{ | ||
ConsoleKeyInfo cki = Console.ReadKey(); | ||
if (cki.Key != ConsoleKey.F5) | ||
{ | ||
string command = Console.ReadLine(); | ||
adbCommand(command); | ||
} | ||
else | ||
{ | ||
getOut = true; | ||
} | ||
|
||
} | ||
} | ||
|
||
static void RemoteControlMode() | ||
{ | ||
Console.Clear(); | ||
Console.WriteLine("Remote Control Mode (F5 for Mainmenu)"); | ||
|
||
bool getOut = false; | ||
while (!getOut) | ||
{ | ||
ConsoleKeyInfo cki = Console.ReadKey(); | ||
|
||
switch (cki.Key) | ||
{ | ||
case ConsoleKey.UpArrow: | ||
adbCommand("shell input keyevent 19"); | ||
break; | ||
case ConsoleKey.DownArrow: | ||
adbCommand("shell input keyevent 20"); | ||
break; | ||
case ConsoleKey.LeftArrow: | ||
adbCommand("shell input keyevent 21"); | ||
break; | ||
case ConsoleKey.RightArrow: | ||
adbCommand("shell input keyevent 22"); | ||
break; | ||
case ConsoleKey.Escape: | ||
adbCommand("shell input keyevent 3"); | ||
break; | ||
case ConsoleKey.Backspace: | ||
adbCommand("shell input keyevent 4"); | ||
break; | ||
case ConsoleKey.Enter: | ||
adbCommand("shell input keyevent 66"); | ||
break; | ||
|
||
case ConsoleKey.A: | ||
adbCommand("shell input keyevent 29"); | ||
break; | ||
|
||
case ConsoleKey.B: | ||
adbCommand("shell input keyevent 30"); | ||
break; | ||
|
||
case ConsoleKey.C: | ||
adbCommand("shell input keyevent 31"); | ||
break; | ||
|
||
case ConsoleKey.D: | ||
adbCommand("shell input keyevent 32"); | ||
break; | ||
|
||
case ConsoleKey.E: | ||
adbCommand("shell input keyevent 33"); | ||
break; | ||
|
||
case ConsoleKey.F: | ||
adbCommand("shell input keyevent 34"); | ||
break; | ||
|
||
case ConsoleKey.G: | ||
adbCommand("shell input keyevent 35"); | ||
break; | ||
|
||
case ConsoleKey.H: | ||
adbCommand("shell input keyevent 36"); | ||
break; | ||
|
||
case ConsoleKey.I: | ||
adbCommand("shell input keyevent 37"); | ||
break; | ||
|
||
case ConsoleKey.J: | ||
adbCommand("shell input keyevent 38"); | ||
break; | ||
|
||
case ConsoleKey.K: | ||
adbCommand("shell input keyevent 39"); | ||
break; | ||
|
||
case ConsoleKey.L: | ||
adbCommand("shell input keyevent 40"); | ||
break; | ||
|
||
case ConsoleKey.M: | ||
adbCommand("shell input keyevent 41"); | ||
break; | ||
|
||
case ConsoleKey.N: | ||
adbCommand("shell input keyevent 42"); | ||
break; | ||
|
||
case ConsoleKey.O: | ||
adbCommand("shell input keyevent 43"); | ||
break; | ||
|
||
case ConsoleKey.P: | ||
adbCommand("shell input keyevent 44"); | ||
break; | ||
|
||
case ConsoleKey.Q: | ||
adbCommand("shell input keyevent 45"); | ||
break; | ||
|
||
case ConsoleKey.R: | ||
adbCommand("shell input keyevent 46"); | ||
break; | ||
|
||
case ConsoleKey.S: | ||
adbCommand("shell input keyevent 47"); | ||
break; | ||
|
||
case ConsoleKey.T: | ||
adbCommand("shell input keyevent 48"); | ||
break; | ||
|
||
case ConsoleKey.U: | ||
adbCommand("shell input keyevent 49"); | ||
break; | ||
|
||
case ConsoleKey.V: | ||
adbCommand("shell input keyevent 50"); | ||
break; | ||
|
||
case ConsoleKey.W: | ||
adbCommand("shell input keyevent 51"); | ||
break; | ||
|
||
case ConsoleKey.X: | ||
adbCommand("shell input keyevent 52"); | ||
break; | ||
|
||
case ConsoleKey.Y: | ||
adbCommand("shell input keyevent 53"); | ||
break; | ||
|
||
case ConsoleKey.Z: | ||
adbCommand("shell input keyevent 54"); | ||
break; | ||
|
||
case ConsoleKey.D0: | ||
adbCommand("shell input keyevent 7"); | ||
break; | ||
|
||
case ConsoleKey.D1: | ||
adbCommand("shell input keyevent 8"); | ||
break; | ||
|
||
case ConsoleKey.D2: | ||
adbCommand("shell input keyevent 9"); | ||
break; | ||
|
||
case ConsoleKey.D3: | ||
adbCommand("shell input keyevent 10"); | ||
break; | ||
|
||
case ConsoleKey.D4: | ||
adbCommand("shell input keyevent 11"); | ||
break; | ||
|
||
case ConsoleKey.D5: | ||
adbCommand("shell input keyevent 12"); | ||
break; | ||
|
||
case ConsoleKey.D6: | ||
adbCommand("shell input keyevent 13"); | ||
break; | ||
|
||
case ConsoleKey.D7: | ||
adbCommand("shell input keyevent 14"); | ||
break; | ||
|
||
case ConsoleKey.D8: | ||
adbCommand("shell input keyevent 15"); | ||
break; | ||
|
||
case ConsoleKey.D9: | ||
adbCommand("shell input keyevent 16"); | ||
break; | ||
|
||
case ConsoleKey.OemPeriod: | ||
adbCommand("shell input keyevent 56"); | ||
break; | ||
|
||
case ConsoleKey.OemComma: | ||
adbCommand("shell input keyevent 55"); | ||
break; | ||
case ConsoleKey.F5: | ||
getOut = true; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
static void ExitApplication() | ||
{ | ||
adbCommand("disconnect"); | ||
adbCommand("kill-server"); | ||
Environment.Exit(0); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("adb remote")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("adb remote")] | ||
[assembly: AssemblyCopyright("Copyright © 2014")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("110c2b07-93a9-4725-b5a8-3ac78d03caa9")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Oops, something went wrong.