add existing settings
This commit is contained in:
57
src-tauri/src/cmds.rs
Normal file
57
src-tauri/src/cmds.rs
Normal file
@@ -0,0 +1,57 @@
|
||||
use crate::steam;
|
||||
use crate::tool::*;
|
||||
|
||||
#[tauri::command]
|
||||
pub fn greet(name: &str) -> String {
|
||||
format!("Hello, {}! You've been greeted from Rust!", name)
|
||||
}
|
||||
|
||||
// 工具
|
||||
|
||||
#[tauri::command]
|
||||
pub fn launch_game(steam_path: &str, launch_option: &str, server: &str) -> String {
|
||||
steam::launch_game(steam_path, launch_option, server).expect("启动失败");
|
||||
|
||||
format!(
|
||||
"Launching game on server: {}, with launch Option {}",
|
||||
server, launch_option
|
||||
)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn kill_game() -> String {
|
||||
common::kill("cs2.exe")
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn kill_steam() -> String {
|
||||
common::kill("steam.exe")
|
||||
}
|
||||
|
||||
// Steam
|
||||
#[tauri::command]
|
||||
pub fn get_steam_path() -> String {
|
||||
steam::path::get_steam_path().expect("获取Steam路径失败")
|
||||
}
|
||||
|
||||
// TODO get_cs_path
|
||||
// TODO get_powerplan
|
||||
// TODO set_powerplan
|
||||
// TODO watch_steam_users
|
||||
// TODO watch_video_settings
|
||||
// TODO watch + cancel
|
||||
// TODO fs_list_dir
|
||||
// TODO fs_watch_dir
|
||||
|
||||
#[tauri::command]
|
||||
pub fn set_auto_login_user(user: &str) -> String {
|
||||
#[cfg(target_os = "windows")]
|
||||
steam::reg::set_auto_login_user(user).expect("设置自动登录用户失败");
|
||||
|
||||
format!("Set auto login user to {}", user)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn check_file_exists(file: &str) -> bool {
|
||||
std::path::Path::new(&file).exists()
|
||||
}
|
||||
Reference in New Issue
Block a user