Compare commits
6 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 808826fdc9 | |||
| dc7b0660fc | |||
| 302d5a3807 | |||
| 3d90099e20 | |||
| 8b94eadac0 | |||
| 6588bbd60d |
5 changed files with 50 additions and 24 deletions
|
|
@ -8,8 +8,14 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="adb\adb.exe"/>
|
<EmbeddedResource Include="adb\adb.exe"/>
|
||||||
<EmbeddedResource Include="adb\AdbWinApi.dll" />
|
<EmbeddedResource Include="adb\AdbWinApi.dll">
|
||||||
<EmbeddedResource Include="adb\AdbWinUsbApi.dll" />
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
<Link>AdbWinApi.dll</Link>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="adb\AdbWinUsbApi.dll">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
<Link>AdbWinUsbApi.dll</Link>
|
||||||
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
@ -18,9 +24,4 @@
|
||||||
<PackageReference Include="AdvancedSharpAdbClient" Version="3.4.14"/>
|
<PackageReference Include="AdvancedSharpAdbClient" Version="3.4.14"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="AdvancedSharpAdbClient" Version="3.4.14" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.3" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,6 @@ public class AdbService : IAdbService
|
||||||
|
|
||||||
if (File.Exists(adbPath)) return adbPath;
|
if (File.Exists(adbPath)) return adbPath;
|
||||||
ExtractResource("MetaforceInstaller.Core.adb.adb.exe", 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;
|
return adbPath;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,12 +45,19 @@
|
||||||
HorizontalAlignment="Stretch" />
|
HorizontalAlignment="Stretch" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<Image Grid.Column="0"
|
<StackPanel Grid.Column="0" Margin="20" Spacing="15" VerticalAlignment="Bottom">
|
||||||
|
<Image
|
||||||
Margin="20"
|
Margin="20"
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
Source="{DynamicResource Logo}"
|
Source="{DynamicResource Logo}"
|
||||||
HorizontalAlignment="Center">
|
HorizontalAlignment="Center">
|
||||||
</Image>
|
</Image>
|
||||||
|
<TextBlock
|
||||||
|
Name="VersionTextBlock"
|
||||||
|
FontFamily="Consolas,Courier New,monospace"
|
||||||
|
FontSize="14"
|
||||||
|
HorizontalAlignment="Center" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Right Panel - Logs -->
|
<!-- Right Panel - Logs -->
|
||||||
<TextBox Grid.Column="1" Name="LogsTextBox"
|
<TextBox Grid.Column="1" Name="LogsTextBox"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
|
|
@ -28,10 +29,10 @@ public partial class MainWindow : Window
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
LogMessage("MetaforceInstaller by slavagm");
|
LogMessage("MetaforceInstaller by slavagm");
|
||||||
|
VersionTextBlock.Text = Assembly.GetExecutingAssembly()
|
||||||
|
.GetCustomAttribute<AssemblyFileVersionAttribute>()?.Version;
|
||||||
|
|
||||||
_adbService = new AdbService();
|
_ = InitializeAdbAsync();
|
||||||
_adbService.ProgressChanged += OnAdbProgressChanged;
|
|
||||||
_adbService.StatusChanged += OnAdbStatusChanged;
|
|
||||||
|
|
||||||
CheckAndEnableInstallButton();
|
CheckAndEnableInstallButton();
|
||||||
|
|
||||||
|
|
@ -40,6 +41,19 @@ public partial class MainWindow : Window
|
||||||
InstallButton.Click += OnInstallClicked;
|
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)
|
private void OnAdbProgressChanged(object? sender, ProgressInfo e)
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.InvokeAsync(() =>
|
Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
|
|
@ -179,6 +193,12 @@ public partial class MainWindow : Window
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_adbService == null)
|
||||||
|
{
|
||||||
|
LogMessage("ADB сервис еще инициализируется, попробуйте позже");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_adbService.RefreshDeviceData();
|
_adbService.RefreshDeviceData();
|
||||||
|
|
||||||
InstallButton.IsEnabled = false;
|
InstallButton.IsEnabled = false;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||||
<FileVersion>1.2.1</FileVersion>
|
<FileVersion>1.2.2</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue