Skip to content
This repository has been archived by the owner on Sep 22, 2022. It is now read-only.

Commit

Permalink
little fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AtlasTheProto committed Sep 29, 2021
1 parent df74040 commit a1ae807
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
1 change: 0 additions & 1 deletion ADBForwarder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<ItemGroup>
<PackageReference Include="DotNetZip" Version="1.15.0" />
<PackageReference Include="SharpAdbClient" Version="2.3.23" />
<PackageReference Include="Usb.Events" Version="10.0.0" />
</ItemGroup>

</Project>
13 changes: 4 additions & 9 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.IO;
using System.Collections.Generic;
using Ionic.Zip;
using Usb.Events;

namespace ADBForwarder
{
Expand All @@ -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<DeviceData> devices = new List<DeviceData>();


static void Main(string[] args)
{

Expand All @@ -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<DeviceData> devices = client.GetDevices();

while (true)
{
// Main thread needs to stay alive, 100ms is acceptable idle time
Expand All @@ -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();
Expand Down

0 comments on commit a1ae807

Please sign in to comment.