From a1ae807b6f117d9283bcb2cd189ab8991896b045 Mon Sep 17 00:00:00 2001 From: Atlas Date: Wed, 29 Sep 2021 19:14:30 -0400 Subject: [PATCH] little fixes --- ADBForwarder.csproj | 1 - Program.cs | 13 ++++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/ADBForwarder.csproj b/ADBForwarder.csproj index a8af947..0b7b19f 100644 --- a/ADBForwarder.csproj +++ b/ADBForwarder.csproj @@ -8,7 +8,6 @@ - diff --git a/Program.cs b/Program.cs index 15a7011..717e63f 100644 --- a/Program.cs +++ b/Program.cs @@ -4,7 +4,6 @@ using System.IO; using System.Collections.Generic; using Ionic.Zip; -using Usb.Events; namespace ADBForwarder { @@ -15,9 +14,7 @@ class Program static AdbServer server = new AdbServer(); static Uri uri = new Uri("https://dl.google.com/android/repository/platform-tools-latest-windows.zip"); static IPEndPoint endPoint = new IPEndPoint(IPAddress.Loopback, AdbClient.AdbServerPort); - List devices = new List(); - static void Main(string[] args) { @@ -35,15 +32,14 @@ static void Main(string[] args) } client.Connect(endPoint); - - DeviceMonitor monitor = new DeviceMonitor(new AdbSocket(endPoint)); + + var devices = client.GetDevices(); + + var monitor = new DeviceMonitor(new AdbSocket(endPoint)); monitor.DeviceConnected += Monitor_DeviceConnected; monitor.DeviceDisconnected += Monitor_DeviceDisconnected; - monitor.Start(); - List devices = client.GetDevices(); - while (true) { // Main thread needs to stay alive, 100ms is acceptable idle time @@ -58,7 +54,6 @@ private static void Monitor_DeviceDisconnected(object sender, DeviceDataEventArg private static void Monitor_DeviceConnected(object sender, DeviceDataEventArgs e) { - Console.WriteLine($"Event: Connection\n Device: {e.Device.Serial}"); System.Threading.Thread.Sleep(1000); // dont do shit immediately Forward();