forked from StrafesNET/map-tool
print map script stats on completion
This commit is contained in:
parent
420dbaa022
commit
327d0a4992
19
src/main.rs
19
src/main.rs
@ -316,9 +316,12 @@ fn interactive() -> Result<(), Box<dyn std::error::Error>>{
|
||||
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<dyn std::error::Error>>{
|
||||
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<dyn std::error::Error>>{
|
||||
}
|
||||
}
|
||||
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)?;
|
||||
|
Loading…
Reference in New Issue
Block a user