19 lines
527 B
Rust
19 lines
527 B
Rust
use std::io::{Read, Seek};
|
|
|
|
use zip::ZipArchive;
|
|
|
|
use crate::error::{Error, Result};
|
|
use crate::model::ModPack;
|
|
|
|
pub mod model;
|
|
pub mod error;
|
|
pub(crate) mod tracking_reader;
|
|
pub mod ttmp_extractor;
|
|
|
|
pub fn from_reader<R: Read + Seek>(reader: R) -> Result<(ModPack, ZipArchive<R>)> {
|
|
let mut zip = ZipArchive::new(reader).map_err(Error::Zip)?;
|
|
let manifest = zip.by_name("TTMPL.mpl").map_err(Error::Zip)?;
|
|
let manifest = serde_json::from_reader(manifest).map_err(Error::InvalidManifest)?;
|
|
Ok((manifest, zip))
|
|
}
|