From 327d0a49924ad48da7d3af4713af8d76d6b26fc6 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 12 Sep 2023 16:56:43 -0700 Subject: [PATCH] print map script stats on completion --- src/main.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index be9e4f6..7826eb4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -316,9 +316,12 @@ fn interactive() -> Result<(), Box>{ let scripts = get_scripts(dom); //check scribb + let mut script_count=0; + let mut block_count=0; let mut fail_type=Interactive::Passed; for script in scripts.iter() { if let Some(rbx_dom_weak::types::Variant::String(source)) = script.properties.get("Source") { + script_count+=1; let source_action=if check_source_illegal_keywords(source) { ScriptAction::Flag//script triggers flagging -> Flag } else if blocked.contains(source) { @@ -402,6 +405,7 @@ fn interactive() -> Result<(), Box>{ fail_type=Interactive::Flagged; }, ScriptAction::Block => { + block_count+=1; println!("blocked source location={}",get_full_name(&write_dom, script)); match fail_type{ Interactive::Passed => fail_type=Interactive::Blocked, @@ -414,9 +418,18 @@ fn interactive() -> Result<(), Box>{ } } let mut dest=match fail_type{ - Interactive::Passed => std::path::PathBuf::from("maps/processed"),//write map into maps/processed - Interactive::Blocked => std::path::PathBuf::from("maps/blocked"),//write map into maps/blocked - Interactive::Flagged => std::path::PathBuf::from("maps/flagged"),//write map into maps/flagged + Interactive::Passed => { + println!("map={:?} passed with {} {}",file_thing.file_name(),script_count,if script_count==1 {"script"}else{"scripts"}); + std::path::PathBuf::from("maps/processed") + },//write map into maps/processed + Interactive::Blocked => { + println!("map={:?} blocked with {}/{} {} blocked",file_thing.file_name(),block_count,script_count,if script_count==1 {"script"}else{"scripts"}); + std::path::PathBuf::from("maps/blocked") + },//write map into maps/blocked + Interactive::Flagged => { + println!("map={:?} flagged",file_thing.file_name()); + std::path::PathBuf::from("maps/flagged") + },//write map into maps/flagged }; dest.push(file_thing.file_name()); std::fs::rename(file_thing.path(), dest)?;