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§
Sourcefn default_encoding(&self) -> Encoding
fn default_encoding(&self) -> Encoding
Returns the default encoding for the script.
Sourcefn 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 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.
Sourcefn extensions(&self) -> &'static [&'static str]
fn extensions(&self) -> &'static [&'static str]
Returns the extensions supported by this script builder.
Sourcefn script_type(&self) -> &'static ScriptType
fn script_type(&self) -> &'static ScriptType
Returns the script type associated with this builder.
Provided Methods§
Sourcefn default_archive_encoding(&self) -> Option<Encoding>
fn default_archive_encoding(&self) -> Option<Encoding>
Returns the default encoding for the archive. If None, the default encoding should be used.
Sourcefn default_patched_encoding(&self) -> Encoding
fn default_patched_encoding(&self) -> Encoding
Returns the default encoding for script files when patching scripts.
Sourcefn 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_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.
Sourcefn 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 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.
Sourcefn is_this_format(
&self,
_filename: &str,
_buf: &[u8],
_buf_len: usize,
) -> Option<u8>
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.
Sourcefn is_archive(&self) -> bool
fn is_archive(&self) -> bool
Returns true if this script is an archive.
Sourcefn create_archive(
&self,
_filename: &str,
_files: &[&str],
_encoding: Encoding,
_config: &ExtraConfig,
) -> Result<Box<dyn Archive>>
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.
Sourcefn can_create_file(&self) -> bool
fn can_create_file(&self) -> bool
Returns true if this script type can create from a file directly.
Sourcefn create_file<'a>(
&'a self,
_filename: &'a str,
_writer: Box<dyn WriteSeek + 'a>,
_encoding: Encoding,
_file_encoding: Encoding,
_config: &ExtraConfig,
) -> Result<()>
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.
Sourcefn create_file_filename(
&self,
filename: &str,
output_filename: &str,
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<()>
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.
Sourcefn is_image(&self) -> bool
Available on crate feature image only.
fn is_image(&self) -> bool
image only.Returns true if this script is an image.
Sourcefn can_create_image_file(&self) -> bool
Available on crate feature image only.
fn can_create_image_file(&self) -> bool
image only.Returns true if this script type can create from an image file directly.
Sourcefn create_image_file<'a>(
&'a self,
_data: ImageData,
_writer: Box<dyn WriteSeek + 'a>,
_options: &ExtraConfig,
) -> Result<()>
Available on crate feature image only.
fn create_image_file<'a>( &'a self, _data: ImageData, _writer: Box<dyn WriteSeek + 'a>, _options: &ExtraConfig, ) -> Result<()>
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.
Sourcefn create_image_file_filename(
&self,
data: ImageData,
filename: &str,
options: &ExtraConfig,
) -> Result<()>
Available on crate feature image only.
fn create_image_file_filename( &self, data: ImageData, filename: &str, options: &ExtraConfig, ) -> Result<()>
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§
impl ScriptBuilder for ArtemisPf2Builder
artemis-arc and artemis only.impl ScriptBuilder for ArtemisArcBuilder
artemis-arc and artemis only.impl ScriptBuilder for ArtemisAsbBuilder
artemis only.impl ScriptBuilder for AstScriptBuilder
artemis only.impl ScriptBuilder for TxtBuilder
artemis-panmimisoft and artemis only.impl ScriptBuilder for ArtemisTxtBuilder
artemis only.impl ScriptBuilder for DscBuilder
bgi-arc and bgi only.impl ScriptBuilder for msg_tool::scripts::bgi::archive::v1::BgiArchiveBuilder
bgi-arc and bgi only.impl ScriptBuilder for msg_tool::scripts::bgi::archive::v2::BgiArchiveBuilder
bgi-arc and bgi only.impl ScriptBuilder for BgiAudioBuilder
bgi-audio and bgi only.impl ScriptBuilder for BGIBpScriptBuilder
bgi only.impl ScriptBuilder for BGIBsiScriptBuilder
bgi only.impl ScriptBuilder for BgiCBGBuilder
bgi-img and bgi only.impl ScriptBuilder for BgiImageBuilder
bgi-img and bgi only.impl ScriptBuilder for BGIScriptBuilder
bgi only.impl ScriptBuilder for CSIntArcBuilder
cat-system-arc and cat-system only.impl ScriptBuilder for CstScriptBuilder
cat-system only.impl ScriptBuilder for CstlScriptBuilder
cat-system only.impl ScriptBuilder for Hg3ImageBuilder
cat-system-img and cat-system only.impl ScriptBuilder for CrmArchiveBuilder
circus-arc and circus only.impl ScriptBuilder for DatArchiveBuilder
circus-arc and circus only.impl ScriptBuilder for PckArchiveBuilder
circus-arc and circus only.impl ScriptBuilder for PcmBuilder
circus-audio and circus only.impl ScriptBuilder for CrxImageBuilder
circus-img and circus only.impl ScriptBuilder for CrxdImageBuilder
circus-img and circus only.impl ScriptBuilder for CircusMesScriptBuilder
circus only.impl ScriptBuilder for DrefBuilder
emote-img only.impl ScriptBuilder for PImgBuilder
emote-img only.impl ScriptBuilder for PsbBuilder
emote-img only.impl ScriptBuilder for SrcXmlScriptBuilder
entis-gls only.impl ScriptBuilder for EscudeBinArchiveBuilder
escude-arc and escude only.impl ScriptBuilder for EscudeBinListBuilder
escude only.impl ScriptBuilder for EscudeBinScriptBuilder
escude only.impl ScriptBuilder for ExHibitGrpArchiveBuilder
ex-hibit-arc and ex-hibit only.impl ScriptBuilder for RldScriptBuilder
ex-hibit only.impl ScriptBuilder for HcbScriptBuilder
favorite only.impl ScriptBuilder for HexenHausArccArchiveBuilder
hexen-haus-arc and hexen-haus only.impl ScriptBuilder for HexenHausOdioArchiveBuilder
hexen-haus-arc and hexen-haus only.impl ScriptBuilder for HexenHausWagArchiveBuilder
hexen-haus-arc and hexen-haus only.impl ScriptBuilder for BinScriptBuilder
hexen-haus only.impl ScriptBuilder for PngImageBuilder
hexen-haus-img and hexen-haus only.impl ScriptBuilder for Xp3ArchiveBuilder
kirikiri-arc and kirikiri only.impl ScriptBuilder for TlgImageBuilder
kirikiri-img and kirikiri only.impl ScriptBuilder for KsBuilder
kirikiri only.impl ScriptBuilder for MdfBuilder
kirikiri only.impl ScriptBuilder for ScnScriptBuilder
kirikiri only.impl ScriptBuilder for SimpleCryptBuilder
kirikiri only.impl ScriptBuilder for Tjs2Builder
kirikiri only.impl ScriptBuilder for TjsNs0Builder
kirikiri only.impl ScriptBuilder for PazArcBuilder
musica-arc and musica only.impl ScriptBuilder for MusicaBuilder
musica only.impl ScriptBuilder for MapBuilder
silky only.impl ScriptBuilder for MesBuilder
silky only.impl ScriptBuilder for SoftpalPacBuilder
softpal-arc and softpal only.impl ScriptBuilder for PgdGeBuilder
softpal-img and softpal only.impl ScriptBuilder for Pgd3Builder
softpal-img and softpal only.impl ScriptBuilder for SoftpalScriptBuilder
softpal only.impl ScriptBuilder for WillPlusWipImageBuilder
will-plus-img and will-plus only.impl ScriptBuilder for Ws2ScriptBuilder
will-plus only.impl ScriptBuilder for ItufuruArchiveBuilder
yaneurao-itufuru and yaneurao only.impl ScriptBuilder for ItufuruScriptBuilder
yaneurao-itufuru and yaneurao only.