refactor: upgrade crates and restructure project
This commit is contained in:
1 parent
ea093c044f
commit
47dad69321
80 files changed
+6094
-6125
No files matched your search
@@ -0,0 +1,47 @@
|
||||
use std::path::Path;
|
||||
|
||||
use async_trait::async_trait;
|
||||
|
||||
use super::{GameVersion, ModLoaderInstaller};
|
||||
use crate::instance::models::ModLoader;
|
||||
use crate::net::{mojang, HttpClient, NetError};
|
||||
|
||||
pub struct VanillaInstaller;
|
||||
|
||||
#[async_trait]
|
||||
impl ModLoaderInstaller for VanillaInstaller {
|
||||
fn loader_type(&self) -> ModLoader {
|
||||
ModLoader::Vanilla
|
||||
}
|
||||
|
||||
async fn get_game_versions(&self, client: &HttpClient) -> Result<Vec<GameVersion>, NetError> {
|
||||
let manifest = mojang::fetch_version_manifest(client).await?;
|
||||
Ok(manifest
|
||||
.versions
|
||||
.into_iter()
|
||||
.map(|v| GameVersion {
|
||||
id: v.id,
|
||||
stable: v.version_type == "release",
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
async fn get_versions(
|
||||
&self,
|
||||
_client: &HttpClient,
|
||||
_game_version: &str,
|
||||
) -> Result<Vec<String>, NetError> {
|
||||
Ok(vec!["vanilla".to_owned()])
|
||||
}
|
||||
|
||||
async fn install(
|
||||
&self,
|
||||
_client: &HttpClient,
|
||||
_game_version: &str,
|
||||
_loader_version: &str,
|
||||
_instance_dir: &Path,
|
||||
_meta_dir: &Path,
|
||||
) -> Result<(), NetError> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user