match match lole
I disliked how if Some else None repeated twice looked, but I'm not sure if this is better
This commit is contained in:
parent
b3f7802046
commit
d7010956b3
34
src/main.rs
34
src/main.rs
@ -775,22 +775,24 @@ impl framework::Example for GraphicsData {
|
|||||||
if let (Ok(()),Ok(()))=(std::io::Read::read_exact(&mut input, &mut first_8),std::io::Seek::rewind(&mut input)){
|
if let (Ok(()),Ok(()))=(std::io::Read::read_exact(&mut input, &mut first_8),std::io::Seek::rewind(&mut input)){
|
||||||
//
|
//
|
||||||
if let Some(Ok((indexed_model_instances,spawn_point)))={
|
if let Some(Ok((indexed_model_instances,spawn_point)))={
|
||||||
if &first_8==b"<roblox!"{
|
match &first_8[0..4]{
|
||||||
if let Ok(dom) = rbx_binary::from_reader(input){
|
b"<rob"=>{
|
||||||
Some(load_roblox::generate_indexed_models_roblox(dom))
|
match match &first_8[4..8]{
|
||||||
}else{
|
b"lox!"=>rbx_binary::from_reader(input).map_err(|e|format!("{:?}",e)),
|
||||||
None
|
b"lox "=>rbx_xml::from_reader(input,rbx_xml::DecodeOptions::default()).map_err(|e|format!("{:?}",e)),
|
||||||
}
|
other=>Err(format!("Unknown Roblox file type {:?}",other)),
|
||||||
}else if &first_8==b"<roblox "{
|
}{
|
||||||
if let Ok(dom) = rbx_xml::from_reader(input,rbx_xml::DecodeOptions::default()){
|
Ok(dom)=>Some(load_roblox::generate_indexed_models_roblox(dom)),
|
||||||
Some(load_roblox::generate_indexed_models_roblox(dom))
|
Err(e)=>{
|
||||||
}else{
|
println!("Error loading roblox file:{:?}",e);
|
||||||
None
|
None
|
||||||
}
|
},
|
||||||
//}else if &first_8[0..4]==b"VBSP"{
|
}
|
||||||
// self.generate_indexed_models_valve(input)
|
},
|
||||||
}else{
|
//b"VBSP"=>load_valve::generate_indexed_models_valve(input),
|
||||||
None
|
//b"SNFM"=>sniffer::generate_indexed_models(input),
|
||||||
|
//b"SNFB"=>sniffer::load_bot(input),
|
||||||
|
_=>None,
|
||||||
}
|
}
|
||||||
}{
|
}{
|
||||||
//if generate_indexed_models succeeds, clear the previous ones
|
//if generate_indexed_models succeeds, clear the previous ones
|
||||||
|
Loading…
Reference in New Issue
Block a user