diff --git a/src/main.rs b/src/main.rs index f876ed6..b415b90 100644 --- a/src/main.rs +++ b/src/main.rs @@ -573,28 +573,28 @@ enum WriteStackInstruction<'a>{ #[derive(Default)] struct PropertiesOverride{ name:Option, - class_name:Option, + class:Option, } impl PropertiesOverride{ fn is_some(&self)->bool{ self.name.is_some() - ||self.class_name.is_some() + ||self.class.is_some() } } impl std::fmt::Display for PropertiesOverride{ fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{ if let Some(name)=self.name.as_deref(){ - writeln!(f,"--! Properties.Name=\"{}\"",name)?; + writeln!(f,"--!Properties.Name = \"{}\"",name)?; } - if let Some(class_name)=self.class_name.as_deref(){ - writeln!(f,"--! Properties.ClassName=\"{}\"",class_name)?; + if let Some(class)=self.class.as_deref(){ + writeln!(f,"--!Properties.ClassName = \"{}\"",class)?; } Ok(()) } } fn sanitize<'a>(s:&'a str)->std::borrow::Cow<'a,str>{ - lazy_regex::regex!(r"[^a-zA-Z0-9._-]").replace_all(s,"_") + lazy_regex::regex!(r"[^A-z0-9.-]").replace_all(s,"_") } fn write_item(dom:&rbx_dom_weak::WeakDom,mut file:std::path::PathBuf,node:&TreeNode,node_name_override:String,mut properties:PropertiesOverride,style:DecompileStyle,write_models:bool,write_scripts:bool)->AResult<()>{ @@ -610,18 +610,18 @@ fn write_item(dom:&rbx_dom_weak::WeakDom,mut file:std::path::PathBuf,node:&TreeN match style{ DecompileStyle::Rox=>assert!(file.set_extension("lua"),"could not set extension"), DecompileStyle::RoxRojo|DecompileStyle::Rojo=>{ - match properties.class_name.as_deref(){ + match properties.class.as_deref(){ Some("LocalScript")=>{ file.set_extension("client.lua"); - properties.class_name=None; + properties.class=None; }, Some("Script")=>{ file.set_extension("server.lua"); - properties.class_name=None; + properties.class=None; }, // Some("ModuleScript")=>{ // file.set_extension("module"); - // properties.class_name=None; + // properties.class=None; // }, None=>assert!(file.set_extension("lua"),"could not set extension"), Some(other)=>return Err(anyhow::Error::msg(format!("Attempt to write a {} as a script",other))), @@ -664,7 +664,7 @@ fn generate_decompiled_context(input:R)->AResult{ let mut tree_refs=std::collections::HashMap::new(); tree_refs.insert(dom.root_ref(),TreeNode::new( - "src".to_string(), + "src".to_owned(), dom.root_ref(), Ref::none(), Class::Folder @@ -783,8 +783,8 @@ async fn write_files(config:WriteConfig,mut context:DecompiledContext)->AResult< match node.class{ Class::Folder=>(), Class::ModuleScript=>(),//.lua files are ModuleScript by default - Class::LocalScript=>properties.class_name=Some("LocalScript".to_string()), - Class::Script=>properties.class_name=Some("Script".to_string()), + Class::LocalScript=>properties.class=Some("LocalScript".to_owned()), + Class::Script=>properties.class=Some("Script".to_owned()), Class::Model=>(), } let name_override=if 0