pub struct Decrypter<'a> { /* private fields */ }Expand description
A struct responsible for decrypting and extracting files from encrypted game archives.
Implementations§
Source§impl<'a> Decrypter<'a>
impl<'a> Decrypter<'a>
Sourcepub fn force(self, enabled: bool) -> Self
pub fn force(self, enabled: bool) -> Self
Enables or disables forced overwrite during extraction.
When enabled is true, extracted files will overwrite existing files on disk.
Returns self.
Sourcepub fn set_force(&mut self, enabled: bool)
pub fn set_force(&mut self, enabled: bool)
Enables or disables forced overwrite during extraction.
When enabled is true, extracted files will overwrite existing files on disk.
Sourcepub fn extract<P: AsRef<Path>>(
&mut self,
data: &[u8],
output_path: P,
) -> Result<ExtractOutcome, ExtractError>
pub fn extract<P: AsRef<Path>>( &mut self, data: &[u8], output_path: P, ) -> Result<ExtractOutcome, ExtractError>
Extracts files from the archive data into the specified output path.
§Parameters
data: The content of the archive file.output_path: The output path for extracted files.
§Returns
Ok(ExtractOutcome::Extracted)if files were successfully extracted.Ok(ExtractOutcome::FilesExist)if files already exist andforceisfalse.Err(ExtractError::InvalidHeader)for invalid header.Err(ExtractError::InvalidEngine)for invalid header engine type byte.
§Example
use rpgmad_lib::Decrypter;
let archive_data: Vec<u8> = std::fs::read("Game.rgss3a").unwrap();
let mut decrypter = Decrypter::new();
decrypter.extract(&archive_data, "output").unwrap();Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Decrypter<'a>
impl<'a> RefUnwindSafe for Decrypter<'a>
impl<'a> Send for Decrypter<'a>
impl<'a> Sync for Decrypter<'a>
impl<'a> Unpin for Decrypter<'a>
impl<'a> UnwindSafe for Decrypter<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more