Trait ScriptBuilder

Source
pub trait ScriptBuilder: Debug {
Show 18 methods // Required methods fn default_encoding(&self) -> Encoding; fn build_script( &self, buf: Vec<u8>, filename: &str, encoding: Encoding, archive_encoding: Encoding, config: &ExtraConfig, archive: Option<&Box<dyn Script>>, ) -> Result<Box<dyn Script>>; fn extensions(&self) -> &'static [&'static str]; fn script_type(&self) -> &'static ScriptType; // Provided methods fn default_archive_encoding(&self) -> Option<Encoding> { ... } fn default_patched_encoding(&self) -> Encoding { ... } fn build_script_from_file( &self, filename: &str, encoding: Encoding, archive_encoding: Encoding, config: &ExtraConfig, archive: Option<&Box<dyn Script>>, ) -> Result<Box<dyn Script>> { ... } fn build_script_from_reader( &self, reader: Box<dyn ReadSeek>, filename: &str, encoding: Encoding, archive_encoding: Encoding, config: &ExtraConfig, archive: Option<&Box<dyn Script>>, ) -> Result<Box<dyn Script>> { ... } fn is_this_format( &self, _filename: &str, _buf: &[u8], _buf_len: usize, ) -> Option<u8> { ... } fn is_archive(&self) -> bool { ... } fn create_archive( &self, _filename: &str, _files: &[&str], _encoding: Encoding, _config: &ExtraConfig, ) -> Result<Box<dyn Archive>> { ... } fn can_create_file(&self) -> bool { ... } fn create_file<'a>( &'a self, _filename: &'a str, _writer: Box<dyn WriteSeek + 'a>, _encoding: Encoding, _file_encoding: Encoding, _config: &ExtraConfig, ) -> Result<()> { ... } fn create_file_filename( &self, filename: &str, output_filename: &str, encoding: Encoding, file_encoding: Encoding, config: &ExtraConfig, ) -> Result<()> { ... } fn is_image(&self) -> bool { ... } fn can_create_image_file(&self) -> bool { ... } fn create_image_file<'a>( &'a self, _data: ImageData, _writer: Box<dyn WriteSeek + 'a>, _options: &ExtraConfig, ) -> Result<()> { ... } fn create_image_file_filename( &self, data: ImageData, filename: &str, options: &ExtraConfig, ) -> Result<()> { ... }
}
Expand description

A trait for script builders.

Required Methods§

Source

fn default_encoding(&self) -> Encoding

Returns the default encoding for the script.

Source

fn build_script( &self, buf: Vec<u8>, filename: &str, encoding: Encoding, archive_encoding: Encoding, config: &ExtraConfig, archive: Option<&Box<dyn Script>>, ) -> Result<Box<dyn Script>>

Builds a script from the given buffer.

  • buf - The buffer containing the script data.
  • filename - The name of the file from which the script was read.
  • encoding - The encoding of the script data.
  • archive_encoding - The encoding of the archive, if applicable.
  • config - Additional configuration options.
  • archive - An optional archive to which the script belongs.
Source

fn extensions(&self) -> &'static [&'static str]

Returns the extensions supported by this script builder.

Source

fn script_type(&self) -> &'static ScriptType

Returns the script type associated with this builder.

Provided Methods§

Source

fn default_archive_encoding(&self) -> Option<Encoding>

Returns the default encoding for the archive. If None, the default encoding should be used.

Source

fn default_patched_encoding(&self) -> Encoding

Returns the default encoding for script files when patching scripts.

Source

fn build_script_from_file( &self, filename: &str, encoding: Encoding, archive_encoding: Encoding, config: &ExtraConfig, archive: Option<&Box<dyn Script>>, ) -> Result<Box<dyn Script>>

Builds a script from a file.

  • filename - The name of the file to read.
  • encoding - The encoding of the script data.
  • archive_encoding - The encoding of the archive, if applicable.
  • config - Additional configuration options.
  • archive - An optional archive to which the script belongs.
Source

fn build_script_from_reader( &self, reader: Box<dyn ReadSeek>, filename: &str, encoding: Encoding, archive_encoding: Encoding, config: &ExtraConfig, archive: Option<&Box<dyn Script>>, ) -> Result<Box<dyn Script>>

Builds a script from a reader.

  • reader - A reader with seek capabilities.
  • filename - The name of the file from which the script was read.
  • encoding - The encoding of the script data.
  • archive_encoding - The encoding of the archive, if applicable.
  • config - Additional configuration options.
  • archive - An optional archive to which the script belongs.
Source

fn is_this_format( &self, _filename: &str, _buf: &[u8], _buf_len: usize, ) -> Option<u8>

Checks if the given filename and buffer match this script format.

  • filename - The name of the file to check.
  • buf - The buffer containing the script data.
  • buf_len - The length of the buffer.

Returns a score (0-255) indicating how well the format matches. A higher score means a better match.

Source

fn is_archive(&self) -> bool

Returns true if this script is an archive.

Source

fn create_archive( &self, _filename: &str, _files: &[&str], _encoding: Encoding, _config: &ExtraConfig, ) -> Result<Box<dyn Archive>>

Creates an archive with the given files.

  • filename - The path of the archive file to create.
  • files - A list of files to include in the archive.
  • encoding - The encoding to use for the archive.
  • config - Additional configuration options.
Source

fn can_create_file(&self) -> bool

Returns true if this script type can create from a file directly.

Source

fn create_file<'a>( &'a self, _filename: &'a str, _writer: Box<dyn WriteSeek + 'a>, _encoding: Encoding, _file_encoding: Encoding, _config: &ExtraConfig, ) -> Result<()>

Creates a new script file.

  • filename - The path to the input file.
  • writer - A writer with seek capabilities to write the script data.
  • encoding - The encoding to use for the script data.
  • file_encoding - The encoding of the file.
  • config - Additional configuration options.
Source

fn create_file_filename( &self, filename: &str, output_filename: &str, encoding: Encoding, file_encoding: Encoding, config: &ExtraConfig, ) -> Result<()>

Creates a new script file with the given filename.

  • filename - The path to the input file.
  • output_filename - The path to the output file.
  • encoding - The encoding to use for the script data.
  • file_encoding - The encoding of the file.
  • config - Additional configuration options.
Source

fn is_image(&self) -> bool

Available on crate feature image only.

Returns true if this script is an image.

Source

fn can_create_image_file(&self) -> bool

Available on crate feature image only.

Returns true if this script type can create from an image file directly.

Source

fn create_image_file<'a>( &'a self, _data: ImageData, _writer: Box<dyn WriteSeek + 'a>, _options: &ExtraConfig, ) -> Result<()>

Available on crate feature image only.

Creates an image file from the given data.

  • data - The image data to write.
  • writer - A writer with seek capabilities to write the image data.
  • options - Additional configuration options.
Source

fn create_image_file_filename( &self, data: ImageData, filename: &str, options: &ExtraConfig, ) -> Result<()>

Available on crate feature image only.

Creates an image file from the given data to the specified filename.

  • data - The image data to write.
  • filename - The path to the output file.
  • options - Additional configuration options.

Implementors§

Source§

impl ScriptBuilder for ArtemisArcBuilder

Available on crate features artemis-arc and artemis only.
Source§

impl ScriptBuilder for ArtemisAsbBuilder

Available on crate feature artemis only.
Source§

impl ScriptBuilder for AstScriptBuilder

Available on crate feature artemis only.
Source§

impl ScriptBuilder for TxtBuilder

Available on crate feature artemis only.
Source§

impl ScriptBuilder for DscBuilder

Available on crate features bgi-arc and bgi only.
Source§

impl ScriptBuilder for msg_tool::scripts::bgi::archive::v1::BgiArchiveBuilder

Available on crate features bgi-arc and bgi only.
Source§

impl ScriptBuilder for msg_tool::scripts::bgi::archive::v2::BgiArchiveBuilder

Available on crate features bgi-arc and bgi only.
Source§

impl ScriptBuilder for BgiAudioBuilder

Available on crate features bgi-audio and bgi only.
Source§

impl ScriptBuilder for BGIBpScriptBuilder

Available on crate feature bgi only.
Source§

impl ScriptBuilder for BGIBsiScriptBuilder

Available on crate feature bgi only.
Source§

impl ScriptBuilder for BgiCBGBuilder

Available on crate features bgi-img and bgi only.
Source§

impl ScriptBuilder for BgiImageBuilder

Available on crate features bgi-img and bgi only.
Source§

impl ScriptBuilder for BGIScriptBuilder

Available on crate feature bgi only.
Source§

impl ScriptBuilder for CSIntArcBuilder

Available on crate features cat-system-arc and cat-system only.
Source§

impl ScriptBuilder for CstScriptBuilder

Available on crate feature cat-system only.
Source§

impl ScriptBuilder for CstlScriptBuilder

Available on crate feature cat-system only.
Source§

impl ScriptBuilder for Hg3ImageBuilder

Available on crate features cat-system-img and cat-system only.
Source§

impl ScriptBuilder for CrmArchiveBuilder

Available on crate features circus-arc and circus only.
Source§

impl ScriptBuilder for DatArchiveBuilder

Available on crate features circus-arc and circus only.
Source§

impl ScriptBuilder for PckArchiveBuilder

Available on crate features circus-arc and circus only.
Source§

impl ScriptBuilder for PcmBuilder

Available on crate features circus-audio and circus only.
Source§

impl ScriptBuilder for CrxImageBuilder

Available on crate features circus-img and circus only.
Source§

impl ScriptBuilder for CrxdImageBuilder

Available on crate features circus-img and circus only.
Source§

impl ScriptBuilder for CircusMesScriptBuilder

Available on crate feature circus only.
Source§

impl ScriptBuilder for DrefBuilder

Available on crate feature emote-img only.
Source§

impl ScriptBuilder for PImgBuilder

Available on crate feature emote-img only.
Source§

impl ScriptBuilder for SrcXmlScriptBuilder

Available on crate feature entis-gls only.
Source§

impl ScriptBuilder for EscudeBinArchiveBuilder

Available on crate features escude-arc and escude only.
Source§

impl ScriptBuilder for EscudeBinListBuilder

Available on crate feature escude only.
Source§

impl ScriptBuilder for EscudeBinScriptBuilder

Available on crate feature escude only.
Source§

impl ScriptBuilder for RldScriptBuilder

Available on crate feature ex-hibit only.
Source§

impl ScriptBuilder for BinScriptBuilder

Available on crate feature hexen-haus only.
Source§

impl ScriptBuilder for TlgImageBuilder

Available on crate features kirikiri-img and kirikiri only.
Source§

impl ScriptBuilder for KsBuilder

Available on crate feature kirikiri only.
Source§

impl ScriptBuilder for MdfBuilder

Available on crate feature kirikiri only.
Source§

impl ScriptBuilder for ScnScriptBuilder

Available on crate feature kirikiri only.
Source§

impl ScriptBuilder for SimpleCryptBuilder

Available on crate feature kirikiri only.
Source§

impl ScriptBuilder for SoftpalScriptBuilder

Available on crate feature softpal only.
Source§

impl ScriptBuilder for Ws2ScriptBuilder

Available on crate feature will-plus only.
Source§

impl ScriptBuilder for ItufuruArchiveBuilder

Available on crate features yaneurao-itufuru and yaneurao only.
Source§

impl ScriptBuilder for ItufuruScriptBuilder

Available on crate features yaneurao-itufuru and yaneurao only.