forked from StrafesNET/asset-tool
34 lines
745 B
Rust
34 lines
745 B
Rust
#[derive(Clone,Copy,Debug)]
|
|
pub enum Style{
|
|
Rox,
|
|
Rojo,
|
|
RoxRojo,
|
|
}
|
|
|
|
#[derive(Default)]
|
|
pub(crate) struct PropertiesOverride{
|
|
pub name:Option<String>,
|
|
pub class:Option<String>,
|
|
}
|
|
impl PropertiesOverride{
|
|
pub fn is_some(&self)->bool{
|
|
self.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)?;
|
|
}
|
|
if let Some(class)=self.class.as_deref(){
|
|
writeln!(f,"-- Properties.ClassName = \"{}\"",class)?;
|
|
}
|
|
Ok(())
|
|
}
|
|
}
|
|
|
|
pub(crate) fn sanitize<'a>(s:&'a str)->std::borrow::Cow<'a,str>{
|
|
lazy_regex::regex!(r"[^A-Za-z0-9.-]").replace_all(s,"_")
|
|
}
|