mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-07-21 22:11:26 +08:00
54 lines
1.2 KiB
Rust
54 lines
1.2 KiB
Rust
//! 客户端发现接口
|
|
|
|
use async_trait::async_trait;
|
|
use bat_core::domain::{GameClient, GameRegion};
|
|
|
|
/// 客户端发现接口
|
|
///
|
|
/// 在系统中自动发现已安装的游戏客户端
|
|
#[async_trait]
|
|
pub trait ClientDiscovery: Send + Sync {
|
|
/// 发现所有客户端
|
|
///
|
|
/// 在系统的常见位置搜索游戏客户端
|
|
///
|
|
/// # 返回
|
|
///
|
|
/// - 成功:返回找到的客户端列表
|
|
/// - 失败:返回错误
|
|
async fn discover_all(&self) -> Result<Vec<GameClient>, String>;
|
|
|
|
/// 验证客户端
|
|
///
|
|
/// 验证给定路径是否是有效的游戏客户端
|
|
///
|
|
/// # 参数
|
|
///
|
|
/// - `path`: 客户端路径
|
|
///
|
|
/// # 返回
|
|
///
|
|
/// - true: 是有效的客户端
|
|
/// - false: 不是有效的客户端
|
|
async fn verify_client(&self, path: &str) -> bool;
|
|
|
|
/// 检测客户端区域
|
|
///
|
|
/// 根据客户端文件特征检测区域
|
|
///
|
|
/// # 参数
|
|
///
|
|
/// - `path`: 客户端路径
|
|
///
|
|
/// # 返回
|
|
///
|
|
/// - 成功:返回区域
|
|
/// - 失败:返回错误
|
|
async fn detect_region(&self, path: &str) -> Result<GameRegion, String>;
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
// 测试将在实现时添加
|
|
}
|