Compare commits

..

6 commits

5 changed files with 50 additions and 24 deletions

View file

@ -7,20 +7,21 @@
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="adb\adb.exe" />
<EmbeddedResource Include="adb\AdbWinApi.dll" />
<EmbeddedResource Include="adb\AdbWinUsbApi.dll" />
<EmbeddedResource Include="adb\adb.exe"/>
<EmbeddedResource Include="adb\AdbWinApi.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>AdbWinApi.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="adb\AdbWinUsbApi.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>AdbWinUsbApi.dll</Link>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="AlphaOmega.ApkReader" Version="2.0.5" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="AdvancedSharpAdbClient" Version="3.4.14" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AdvancedSharpAdbClient" Version="3.4.14" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.3" />
<PackageReference Include="AlphaOmega.ApkReader" Version="2.0.5"/>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0"/>
<PackageReference Include="AdvancedSharpAdbClient" Version="3.4.14"/>
</ItemGroup>
</Project>

View file

@ -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;
}

View file

@ -45,12 +45,19 @@
HorizontalAlignment="Stretch" />
</StackPanel>
<Image Grid.Column="0"
Margin="20"
VerticalAlignment="Bottom"
Source="{DynamicResource Logo}"
HorizontalAlignment="Center">
</Image>
<StackPanel Grid.Column="0" Margin="20" Spacing="15" VerticalAlignment="Bottom">
<Image
Margin="20"
VerticalAlignment="Bottom"
Source="{DynamicResource Logo}"
HorizontalAlignment="Center">
</Image>
<TextBlock
Name="VersionTextBlock"
FontFamily="Consolas,Courier New,monospace"
FontSize="14"
HorizontalAlignment="Center" />
</StackPanel>
<!-- Right Panel - Logs -->
<TextBox Grid.Column="1" Name="LogsTextBox"

View file

@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using Avalonia.Controls;
using Avalonia.Interactivity;
@ -28,10 +29,10 @@ public partial class MainWindow : Window
InitializeComponent();
LogMessage("MetaforceInstaller by slavagm");
_adbService = new AdbService();
_adbService.ProgressChanged += OnAdbProgressChanged;
_adbService.StatusChanged += OnAdbStatusChanged;
VersionTextBlock.Text = Assembly.GetExecutingAssembly()
.GetCustomAttribute<AssemblyFileVersionAttribute>()?.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;

View file

@ -8,7 +8,7 @@
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
<FileVersion>1.2.1</FileVersion>
<FileVersion>1.2.2</FileVersion>
</PropertyGroup>
<ItemGroup>