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

Commit a1ae807

Browse files
committed
little fixes
1 parent df74040 commit a1ae807

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

ADBForwarder.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<ItemGroup>
99
<PackageReference Include="DotNetZip" Version="1.15.0" />
1010
<PackageReference Include="SharpAdbClient" Version="2.3.23" />
11-
<PackageReference Include="Usb.Events" Version="10.0.0" />
1211
</ItemGroup>
1312

1413
</Project>

Program.cs

+4-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.IO;
55
using System.Collections.Generic;
66
using Ionic.Zip;
7-
using Usb.Events;
87

98
namespace ADBForwarder
109
{
@@ -15,9 +14,7 @@ class Program
1514
static AdbServer server = new AdbServer();
1615
static Uri uri = new Uri("https://dl.google.com/android/repository/platform-tools-latest-windows.zip");
1716
static IPEndPoint endPoint = new IPEndPoint(IPAddress.Loopback, AdbClient.AdbServerPort);
18-
List<DeviceData> devices = new List<DeviceData>();
1917

20-
2118
static void Main(string[] args)
2219
{
2320

@@ -35,15 +32,14 @@ static void Main(string[] args)
3532
}
3633

3734
client.Connect(endPoint);
38-
39-
DeviceMonitor monitor = new DeviceMonitor(new AdbSocket(endPoint));
35+
36+
var devices = client.GetDevices();
37+
38+
var monitor = new DeviceMonitor(new AdbSocket(endPoint));
4039
monitor.DeviceConnected += Monitor_DeviceConnected;
4140
monitor.DeviceDisconnected += Monitor_DeviceDisconnected;
42-
4341
monitor.Start();
4442

45-
List<DeviceData> devices = client.GetDevices();
46-
4743
while (true)
4844
{
4945
// Main thread needs to stay alive, 100ms is acceptable idle time
@@ -58,7 +54,6 @@ private static void Monitor_DeviceDisconnected(object sender, DeviceDataEventArg
5854

5955
private static void Monitor_DeviceConnected(object sender, DeviceDataEventArgs e)
6056
{
61-
6257
Console.WriteLine($"Event: Connection\n Device: {e.Device.Serial}");
6358
System.Threading.Thread.Sleep(1000); // dont do shit immediately
6459
Forward();

0 commit comments

Comments
 (0)