You've already forked AstralRinth
Update validators again (#925)
* Update validators again * fix tests + clippy
This commit is contained in:
34
src/validate/rift.rs
Normal file
34
src/validate/rift.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
use crate::validate::{filter_out_packs, SupportedGameVersions, ValidationError, ValidationResult};
|
||||
use std::io::Cursor;
|
||||
use zip::ZipArchive;
|
||||
|
||||
pub struct RiftValidator;
|
||||
|
||||
impl super::Validator for RiftValidator {
|
||||
fn get_file_extensions(&self) -> &[&str] {
|
||||
&["jar"]
|
||||
}
|
||||
|
||||
fn get_supported_loaders(&self) -> &[&str] {
|
||||
&["rift"]
|
||||
}
|
||||
|
||||
fn get_supported_game_versions(&self) -> SupportedGameVersions {
|
||||
SupportedGameVersions::All
|
||||
}
|
||||
|
||||
fn validate(
|
||||
&self,
|
||||
archive: &mut ZipArchive<Cursor<bytes::Bytes>>,
|
||||
) -> Result<ValidationResult, ValidationError> {
|
||||
if archive.by_name("riftmod.json").is_err() {
|
||||
return Ok(ValidationResult::Warning(
|
||||
"No riftmod.json present for Rift file.",
|
||||
));
|
||||
}
|
||||
|
||||
filter_out_packs(archive)?;
|
||||
|
||||
Ok(ValidationResult::Pass)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user