stop failing when maps are corrupted while downloading textures
This commit is contained in:
parent
01524146c7
commit
de7b0bd5cc
26
src/main.rs
26
src/main.rs
@ -261,21 +261,23 @@ fn download_textures(paths: Vec<std::path::PathBuf>) -> BoxResult<()>{
|
|||||||
];
|
];
|
||||||
let mut texture_list=std::collections::HashSet::new();
|
let mut texture_list=std::collections::HashSet::new();
|
||||||
for path in paths {
|
for path in paths {
|
||||||
let input = std::io::BufReader::new(std::fs::File::open(path)?);
|
let input = std::io::BufReader::new(std::fs::File::open(path.clone())?);
|
||||||
|
|
||||||
let dom = rbx_binary::from_reader(input)?;
|
match rbx_binary::from_reader(input){
|
||||||
|
Ok(dom)=>{
|
||||||
let object_refs = get_texture_refs(&dom);
|
let object_refs = get_texture_refs(&dom);
|
||||||
|
for &object_ref in object_refs.iter() {
|
||||||
for &object_ref in object_refs.iter() {
|
if let Some(object)=dom.get_by_ref(object_ref){
|
||||||
if let Some(object)=dom.get_by_ref(object_ref){
|
if let Some(rbx_dom_weak::types::Variant::Content(content)) = object.properties.get("Texture") {
|
||||||
if let Some(rbx_dom_weak::types::Variant::Content(content)) = object.properties.get("Texture") {
|
println!("Texture content:{:?}",content);
|
||||||
println!("Texture content:{:?}",content);
|
if let Ok(asset_id)=content.clone().into_string().parse::<RobloxAssetId>(){
|
||||||
if let Ok(asset_id)=content.clone().into_string().parse::<RobloxAssetId>(){
|
texture_list.insert(asset_id.0);
|
||||||
texture_list.insert(asset_id.0);
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
Err(e)=>println!("error loading map {:?}: {:?}",path.file_name(),e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
println!("Texture list:{:?}",texture_list);
|
println!("Texture list:{:?}",texture_list);
|
||||||
|
Loading…
Reference in New Issue
Block a user