[feat] read video config is ok

This commit is contained in:
Purp1e
2025-03-27 13:32:30 +08:00
parent afa7355f4d
commit 93cda8dc85
9 changed files with 675 additions and 218 deletions

View File

@@ -1,6 +1,7 @@
use crate::steam;
use crate::tool::*;
use crate::vdf::preset;
use crate::vdf::preset::VideoConfig;
use crate::wrap_err;
use anyhow::Result;
@@ -81,6 +82,31 @@ pub fn set_auto_login_user(user: &str) -> Result<String, String> {
Ok(format!("Set auto login user to {}", user))
}
#[tauri::command]
pub fn get_cs2_video_config(steam_dir: &str, steam_id32: u32) -> Result<VideoConfig, String> {
let p = format!(
"{}/userdata/{}/730/local/cfg/cs2_video.txt",
steam_dir, steam_id32
);
let video = preset::get_cs2_video(p.as_str()).map_err(|e| e.to_string())?;
Ok(video)
}
#[tauri::command]
pub fn set_cs2_video_config(
steam_dir: &str,
steam_id32: u32,
video_config: VideoConfig,
) -> Result<(), String> {
let p = format!(
"{}/userdata/{}/730/local/cfg/cs2_video.txt",
steam_dir, steam_id32
);
preset::set_cs2_video(p.as_str(), video_config).map_err(|e| e.to_string())?;
Ok(())
}
#[tauri::command]
pub fn check_path(path: &str) -> Result<bool, String> {
Ok(std::path::Path::new(&path).exists())