Struct Decrypter

Source
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>

Source

pub fn new() -> Self

Creates a new Decrypter with empty buffer, and force set to false.

Source

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.

Source

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.

Source

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 and force is false.
  • 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§

Source§

impl<'a> Default for Decrypter<'a>

Source§

fn default() -> Self

Returns a new Decrypter with default parameters.

Equivalent to calling Decrypter::new().

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.