Skip to main content

conduit_cli/core/io/modpack/
mod.rs

1pub mod conduit;
2pub mod metadata;
3pub mod mrpack;
4
5use crate::core::{error::CoreResult, events::CoreCallbacks, paths::CorePaths};
6use std::path::Path;
7
8pub enum PackFormat {
9    Conduit,
10    // MrPack,
11}
12
13pub struct PackAnalysis {
14    pub files: Vec<String>,
15    pub extensions: Vec<String>,
16    pub dangerous_count: usize,
17    pub local_jars_count: usize,
18    pub suspicious_files: Vec<String>,
19}
20
21pub trait ModpackProvider {
22    fn export(&self, paths: &CorePaths, output_path: &Path, include_config: bool) -> CoreResult<()>;
23    fn analyze(&self, input_path: &Path) -> CoreResult<PackAnalysis>;
24    
25    fn import(&self, paths: &CorePaths, input_path: &Path, callbacks: &mut dyn CoreCallbacks) -> CoreResult<()>;
26}
27
28pub fn get_provider(format: &PackFormat) -> Box<dyn ModpackProvider> {
29    match format {
30        PackFormat::Conduit => Box::new(conduit::ConduitProvider),
31        // PackFormat::MrPack => Box::new(mrpack::MrPackProvider),
32    }
33}