diff --git a/MetaforceInstaller.Core/MetaforceInstaller.Core.csproj b/MetaforceInstaller.Core/MetaforceInstaller.Core.csproj index 0a85bfc..e1484a8 100644 --- a/MetaforceInstaller.Core/MetaforceInstaller.Core.csproj +++ b/MetaforceInstaller.Core/MetaforceInstaller.Core.csproj @@ -7,20 +7,21 @@ - - - + + + PreserveNewest + AdbWinApi.dll + + + PreserveNewest + AdbWinUsbApi.dll + - - - - - - - - + + + diff --git a/MetaforceInstaller.Core/Services/AdbService.cs b/MetaforceInstaller.Core/Services/AdbService.cs index ddf790f..8ff60f7 100644 --- a/MetaforceInstaller.Core/Services/AdbService.cs +++ b/MetaforceInstaller.Core/Services/AdbService.cs @@ -53,8 +53,6 @@ public class AdbService : IAdbService if (File.Exists(adbPath)) return adbPath; ExtractResource("MetaforceInstaller.Core.adb.adb.exe", adbPath); - ExtractResource("MetaforceInstaller.Core.adb.AdbWinApi.dll", Path.Combine(tempDir, "AdbWinApi.dll")); - ExtractResource("MetaforceInstaller.Core.adb.AdbWinUsbApi.dll", Path.Combine(tempDir, "AdbWinUsbApi.dll")); return adbPath; } diff --git a/MetaforceInstaller.UI/MainWindow.axaml b/MetaforceInstaller.UI/MainWindow.axaml index 61a426d..e3c5bbc 100644 --- a/MetaforceInstaller.UI/MainWindow.axaml +++ b/MetaforceInstaller.UI/MainWindow.axaml @@ -45,12 +45,19 @@ HorizontalAlignment="Stretch" /> - - + + + + + ()?.Version; + + _ = InitializeAdbAsync(); CheckAndEnableInstallButton(); @@ -40,6 +41,19 @@ public partial class MainWindow : Window InstallButton.Click += OnInstallClicked; } + private async Task InitializeAdbAsync() + { + LogMessage("Инициализация ADB сервера..."); + await Task.Run(() => + { + _adbService = new AdbService(); + _adbService.ProgressChanged += OnAdbProgressChanged; + _adbService.StatusChanged += OnAdbStatusChanged; + }); + + LogMessage("ADB сервер готов"); + } + private void OnAdbProgressChanged(object? sender, ProgressInfo e) { Dispatcher.UIThread.InvokeAsync(() => @@ -179,6 +193,12 @@ public partial class MainWindow : Window return; } + if (_adbService == null) + { + LogMessage("ADB сервис еще инициализируется, попробуйте позже"); + return; + } + _adbService.RefreshDeviceData(); InstallButton.IsEnabled = false; diff --git a/MetaforceInstaller.UI/MetaforceInstaller.UI.csproj b/MetaforceInstaller.UI/MetaforceInstaller.UI.csproj index 26ffaf3..51d3fc6 100644 --- a/MetaforceInstaller.UI/MetaforceInstaller.UI.csproj +++ b/MetaforceInstaller.UI/MetaforceInstaller.UI.csproj @@ -8,7 +8,7 @@ true app.manifest true - 1.2.1 + 1.2.2