OneLauncher-Cracked/onelauncher/src/game/clients/mod.rs
2024-03-30 19:40:59 +01:00

33 lines
No EOL
907 B
Rust

use std::path::PathBuf;
use serde::{Deserialize, Serialize};
use self::vanilla::VanillaClientProps;
use super::{client::{ClientTrait, Cluster, Manifest}, minecraft::MinecraftVersion};
pub mod vanilla;
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "type")]
pub enum ClientType {
Vanilla(VanillaClientProps),
}
#[derive(Debug)]
pub struct LaunchInfo {
// This is where things like account info, features etc will go
pub java: PathBuf
}
pub async fn get_versions(client: &ClientType, file: Option<&PathBuf>) -> crate::Result<Vec<MinecraftVersion>> {
match client {
ClientType::Vanilla(_) => vanilla::get_versions(file).await,
}
}
pub fn get_impl<'a>(client: &'a ClientType, cluster: &'a Cluster, manifest: &'a Manifest) -> Box<dyn ClientTrait<'a> + 'a> {
Box::new(match client {
ClientType::Vanilla(_) => vanilla::VanillaClient::new(cluster, manifest),
})
}