添加项目文件。

This commit is contained in:
mjsoftware 2025-01-09 14:10:10 +08:00
parent 439a45c1ae
commit 519b56cb27
20 changed files with 1024 additions and 0 deletions

25
AdbTools.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.34407.143
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdbTools", "AdbTools\AdbTools.csproj", "{D80557CC-6756-4A53-BE06-2A0B21224607}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D80557CC-6756-4A53-BE06-2A0B21224607}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D80557CC-6756-4A53-BE06-2A0B21224607}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D80557CC-6756-4A53-BE06-2A0B21224607}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D80557CC-6756-4A53-BE06-2A0B21224607}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3CCE653D-C7AC-497B-8A49-23884780D1EB}
EndGlobalSection
EndGlobal

122
AdbTools/AdbTools.csproj Normal file
View File

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D80557CC-6756-4A53-BE06-2A0B21224607}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>AdbTools</RootNamespace>
<AssemblyName>AdbTools</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<StartupObject>AdbTools.App</StartupObject>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>ico.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="CmdExecutor.cs" />
<Compile Include="Globals.cs" />
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="App.config" />
<None Include="app.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="adb.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="AdbWinApi.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="AdbWinUsbApi.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dotNetFx40 在线安装包.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Resource Include="ico.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

BIN
AdbTools/AdbWinApi.dll Normal file

Binary file not shown.

BIN
AdbTools/AdbWinUsbApi.dll Normal file

Binary file not shown.

3
AdbTools/App.config Normal file
View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
</configuration>

9
AdbTools/App.xaml Normal file
View File

@ -0,0 +1,9 @@
<Application x:Class="AdbTools.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:AdbTools"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

16
AdbTools/App.xaml.cs Normal file
View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
namespace AdbTools
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
}
}

67
AdbTools/CmdExecutor.cs Normal file
View File

@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace AdbTools
{
public class CmdExecutor
{
public static string ExecuteCommandAndReturn(string command)
{
using (Process process = new Process())
{
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.Start();
process.StandardInput.WriteLine(command);
process.StandardInput.WriteLine("exit");
process.WaitForExit(2000);
return process.StandardOutput.ReadToEnd();
}
}
public static void ExecuteCommandByShell(string command)
{
using (Process process = new Process())
{
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.UseShellExecute = true;
process.StartInfo.CreateNoWindow = false;
process.StartInfo.Arguments = $"/c {command}";
process.Start();
process.WaitForExit();
//process.StandardInput.WriteLine(command);
}
}
public static void ExecuteCommandAndQuit(string command)
{
using (Process process = new Process())
{
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.Start();
process.StandardInput.WriteLine(command);
process.StandardInput.WriteLine("exit");
process.WaitForExit(2000);
}
}
}
}

137
AdbTools/Globals.cs Normal file
View File

@ -0,0 +1,137 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Media;
namespace AdbTools
{
public class Globals
{
/// <summary>
/// Config配置文件读取
/// </summary>
public class AppSettings
{
private static string _LAST_DEVICE_ADDRESS = null;
private static List<string> _DEVICE_ADDRESS_HISTORY = null;
/// <summary>
///
/// </summary>
public static string LAST_DEVICE_ADDRESS
{
get
{
if (null == _LAST_DEVICE_ADDRESS)
{
_LAST_DEVICE_ADDRESS = GetKeyVlaue("LAST_DEVICE_ADDRESS");
}
if (null == _LAST_DEVICE_ADDRESS)
{
_LAST_DEVICE_ADDRESS = "";
}
return _LAST_DEVICE_ADDRESS;
}
set
{
UpdateAppConfig("LAST_DEVICE_ADDRESS", value);
_LAST_DEVICE_ADDRESS = value;
}
}
/// <summary>
///
/// </summary>
public static List<string> DEVICE_ADDRESS_HISTORY
{
get
{
if (null == _DEVICE_ADDRESS_HISTORY)
{
string v = GetKeyVlaue("DEVICE_ADDRESS_HISTORY");
if (!string.IsNullOrWhiteSpace(v))
{
_DEVICE_ADDRESS_HISTORY = new List<string>(v.Split(','));
}
}
if (null == _DEVICE_ADDRESS_HISTORY)
{
_DEVICE_ADDRESS_HISTORY = new List<string>();
}
return _DEVICE_ADDRESS_HISTORY;
}
set
{
UpdateAppConfig("DEVICE_ADDRESS_HISTORY", string.Join(",", value));
_DEVICE_ADDRESS_HISTORY = value;
}
}
/// <summary>
/// 获取配置的值
/// </summary>
/// <param name="key">key</param>
/// <returns>读取错误时为null</returns>
public static string GetKeyVlaue(string key)
{
try
{
return ConfigurationManager.AppSettings[key];
}
catch (Exception e)
{
return null;
}
}
///<summary>
///在*.exe.config文件中appSettings配置节增加一对键、值对
///</summary>
///<param name="newKey"></param>
///<param name="newValue"></param>
public static void UpdateAppConfig(string newKey, string newValue)
{
try
{
bool isModified = false;
foreach (string key in ConfigurationManager.AppSettings)
{
if (key == newKey)
{
isModified = true;
}
}
// Open App.Config of executable
Configuration config =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
// You need to remove the old settings object before you can replace it
if (isModified)
{
config.AppSettings.Settings.Remove(newKey);
}
// Add an Application Setting.
config.AppSettings.Settings.Add(newKey, newValue);
// Save the changes in App.config file.
config.Save(ConfigurationSaveMode.Modified);
// Force a reload of a changed section.
ConfigurationManager.RefreshSection("appSettings");
}
catch (Exception e)
{
}
}
}
}
}

43
AdbTools/MainWindow.xaml Normal file
View File

@ -0,0 +1,43 @@
<Window x:Class="AdbTools.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:AdbTools"
mc:Ignorable="d"
Title="Adb无线连接工具" Height="450" Width="350" FontSize="16" ResizeMode="CanMinimize" WindowStartupLocation="CenterScreen" Loaded="Window_Loaded" Unloaded="Window_Unloaded">
<Window.Resources>
<ContextMenu x:Key="ListBoxItemContextMenu">
<MenuItem x:Name="installApkItem" Header="安装应用" Click="installApkItem_Click" Cursor="Hand" />
<MenuItem x:Name="disconnectDeviceItem" Header="断开设备" Click="disconnectDeviceItem_Click" Cursor="Hand"/>
<Separator/>
<MenuItem x:Name="disconnectAllDeviceItem" Header="断开所有设备" Click="disconnectAllDeviceItem_Click" Cursor="Hand" />
</ContextMenu>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Grid.ColumnSpan="3">
<Label Content="已连接列表(每10秒自动刷新)" Margin="10,125,10,0" VerticalAlignment="Top" HorizontalContentAlignment="Center"/>
<ListBox x:Name="deviceList" Margin="10,160,10,10" ToolTip="右键连接的设备进行操作">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" ContextMenu="{StaticResource ListBoxItemContextMenu}" Cursor="Hand"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
<Grid Grid.Column="0" Grid.ColumnSpan="3">
<Label Content="指定连接设备的IP和端口" Margin="10,10,10,0" VerticalAlignment="Top" HorizontalContentAlignment="Center"/>
<ComboBox x:Name="deviceAddress" IsEditable="True" Margin="10,45,10,0" Height="30" VerticalAlignment="Top" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
<Button x:Name="connectDevice" Content="连接设备" ToolTip="输入连接的IP和端口进行连接" Margin="10,85,0,0" VerticalAlignment="Top" Height="30" HorizontalAlignment="Left" Width="90" Click="connectDevice_Click" Cursor="Hand"/>
<Button x:Name="deleteAllHistory" ToolTip="删除所有历史记录" Content="清空历史" Margin="0,85,0,0" VerticalAlignment="Top" Height="30" HorizontalAlignment="Center" Width="90" Click="deleteAllHistory_Click" Cursor="Hand"/>
<Button x:Name="pairDevice" Content="配对设备" ToolTip="输入配对的IP和端口进行配对" Margin="0,85,10,0" VerticalAlignment="Top" Height="30" HorizontalAlignment="Right" Width="90" Click="pairDevice_Click" Cursor="Hand"/>
</Grid>
</Grid>
</Window>

246
AdbTools/MainWindow.xaml.cs Normal file
View File

@ -0,0 +1,246 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
namespace AdbTools
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
private string adbPath = "";
private DispatcherTimer timer;
private ObservableCollection<string> deviceAddressHistory;
public MainWindow()
{
InitializeComponent();
deviceAddressHistory = new ObservableCollection<string>();
}
private void refreshDeviceAddressHistory()
{
deviceAddressHistory.Clear();
Globals.AppSettings.DEVICE_ADDRESS_HISTORY.ForEach(s =>
{
deviceAddressHistory.Add(s);
});
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
string path = AppDomain.CurrentDomain.BaseDirectory + "adb.exe";
string adbDll1 = AppDomain.CurrentDomain.BaseDirectory + "AdbWinApi.dll";
string adbDll2 = AppDomain.CurrentDomain.BaseDirectory + "AdbWinUsbApi.dll";
if (!File.Exists(path) || !File.Exists(adbDll1) || !File.Exists(adbDll2))
{
MessageBox.Show("adb工具集丢失无法运行", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
Environment.Exit(0);
return;
}
adbPath = $"\"{path}\"";
deviceAddress.Text = Globals.AppSettings.LAST_DEVICE_ADDRESS;
deviceAddress.ItemsSource = deviceAddressHistory;
refreshDeviceAddressHistory();
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(10); // 设置计时器的时间间隔为1秒
timer.Tick += Timer_Tick; // 订阅Tick事件
timer.Start(); // 启动计时器
Timer_Tick(null, null);
}
private void Timer_Tick(object sender, EventArgs e)
{
deviceList.Items.Clear();
string content = CmdExecutor.ExecuteCommandAndReturn($"{adbPath} devices");
// 定义正则表达式模式
string pattern = @"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d+\b";
// 创建 Regex 对象
Regex regex = new Regex(pattern);
// 查找所有匹配项
MatchCollection matches = regex.Matches(content);
// 输出所有匹配项
foreach (Match match in matches)
{
deviceList.Items.Add(match.Value.Trim());
}
}
private void Window_Unloaded(object sender, RoutedEventArgs e)
{
timer.Stop();
}
private void connectDevice_Click(object sender, RoutedEventArgs e)
{
string address = deviceAddress.Text;
if (!IsValidIPEndPoint(address))
{
MessageBox.Show("设备连接地址输入错误!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
CmdExecutor.ExecuteCommandAndQuit($"{adbPath} connect {address}");
Globals.AppSettings.LAST_DEVICE_ADDRESS = $"{address}";
if (!Globals.AppSettings.DEVICE_ADDRESS_HISTORY.Contains(address))
{
Globals.AppSettings.DEVICE_ADDRESS_HISTORY.Insert(0, address);
Globals.AppSettings.DEVICE_ADDRESS_HISTORY = Globals.AppSettings.DEVICE_ADDRESS_HISTORY;
refreshDeviceAddressHistory();
}
Timer_Tick(null, null);
}
private void pairDevice_Click(object sender, RoutedEventArgs e)
{
string address = deviceAddress.Text;
if (!IsValidIPEndPoint(address))
{
MessageBox.Show("设备配对地址输入错误!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
CmdExecutor.ExecuteCommandByShell($"{adbPath} pair {address}");
}
private string SelectApkFile()
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "APK Files (*.apk)|*.apk";
openFileDialog.FilterIndex = 1;
openFileDialog.RestoreDirectory = true;
if (openFileDialog.ShowDialog() == true)
{
// 获取选中的文件路径
return openFileDialog.FileName;
}
return null;
}
private void installApkItem_Click(object sender, RoutedEventArgs e)
{
var menuItem = (MenuItem)sender;
var contextMenu = (ContextMenu)menuItem.Parent;
var textBlock = (TextBlock)contextMenu.PlacementTarget;
if (MessageBoxResult.OK != MessageBox.Show($"确定要安装应用到【{textBlock.Text}】吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question))
{
return;
}
string path = SelectApkFile();
if (string.IsNullOrWhiteSpace(path))
{
return;
}
CmdExecutor.ExecuteCommandByShell($"{adbPath} -s {textBlock.Text} install \"{path}\"");
}
private void disconnectDeviceItem_Click(object sender, RoutedEventArgs e)
{
var menuItem = (MenuItem)sender;
var contextMenu = (ContextMenu)menuItem.Parent;
var textBlock = (TextBlock)contextMenu.PlacementTarget;
if (MessageBoxResult.OK != MessageBox.Show($"确定要断开设备【{textBlock.Text}】的连接吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question))
{
return;
}
CmdExecutor.ExecuteCommandAndQuit($"{adbPath} disconnect {textBlock.Text}");
Timer_Tick(null, null);
}
private void disconnectAllDeviceItem_Click(object sender, RoutedEventArgs e)
{
if (MessageBoxResult.OK == MessageBox.Show("请确定要断开所有设备吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question))
{
CmdExecutor.ExecuteCommandAndQuit($"{adbPath} disconnect");
Timer_Tick(null, null);
}
}
public static bool IsValidIPEndPoint(string ipPort)
{
string[] parts = ipPort.Split(':');
if (parts.Length > 2)
{
return false;
}
if (parts.Length == 1)
{
if (!IPAddress.TryParse(ipPort, out _))
{
return false;
}
return true;
}
string ipAddress = parts[0];
string port = parts[1];
// 验证IP地址
if (!IPAddress.TryParse(ipAddress, out _))
{
return false;
}
// 验证端口号
if (!int.TryParse(port, out int portNumber))
{
return false;
}
if (portNumber <= 0 || portNumber > 65535)
{
return false;
}
return true;
}
//private void deleteHistory_Click(object sender, RoutedEventArgs e)
//{
// MenuItem menuItem = (MenuItem)sender;
// ComboBoxItem comboBoxItem = (ComboBoxItem)menuItem.DataContext;
// string selectedValue = comboBoxItem.Content.ToString();
// if (MessageBoxResult.OK != MessageBox.Show($"确定要删除历史记录【{selectedValue}】吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question))
// {
// return;
// }
// Globals.AppSettings.DEVICE_ADDRESS_HISTORY.Remove(selectedValue);
// Globals.AppSettings.DEVICE_ADDRESS_HISTORY = Globals.AppSettings.DEVICE_ADDRESS_HISTORY;
// refreshDeviceAddressHistory();
//}
private void deleteAllHistory_Click(object sender, RoutedEventArgs e)
{
if (MessageBoxResult.OK == MessageBox.Show("请确定要清空所有历史纪录吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question))
{
Globals.AppSettings.DEVICE_ADDRESS_HISTORY.Clear();
Globals.AppSettings.DEVICE_ADDRESS_HISTORY = Globals.AppSettings.DEVICE_ADDRESS_HISTORY;
refreshDeviceAddressHistory();
}
}
}
}

View File

@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("AdbTools")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdbTools")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
//若要开始生成可本地化的应用程序,请设置
//.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
//例如,如果您在源文件中使用的是美国英语,
//使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消
//对以下 NeutralResourceLanguage 特性的注释。 更新
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //主题特定资源词典所处位置
//(未在页面中找到资源时使用,
//或应用程序资源字典中找到时使用)
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
//(未在页面中找到资源时使用,
//、应用程序或任何主题专用资源字典中找到时使用)
)]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,70 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace AdbTools.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AdbTools.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

29
AdbTools/Properties/Settings.Designer.cs generated Normal file
View File

@ -0,0 +1,29 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace AdbTools.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

BIN
AdbTools/adb.exe Normal file

Binary file not shown.

78
AdbTools/app.manifest Normal file
View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC 清单选项
如果想要更改 Windows 用户帐户控制级别,请使用
以下节点之一替换 requestedExecutionLevel 节点。n
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
如果你的应用程序需要此虚拟化来实现向后兼容性,则删除此
元素。
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
Windows 版本的列表。取消评论适当的元素,
Windows 将自动选择最兼容的环境。 -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI无需
选择加入。选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。
将应用程序设为感知长路径。请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
-->
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>

Binary file not shown.

BIN
AdbTools/ico.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB