pub struct Cache { /* private fields */ }
Expand description
A complete virtual representation of the RuneScape cache file system.
Implementations§
source§impl Cache
impl Cache
sourcepub fn new<P: AsRef<Path>>(path: P) -> Result<Self, Error>
pub fn new<P: AsRef<Path>>(path: P) -> Result<Self, Error>
Creates a high level virtual memory map over the cache directory.
All files are isolated on allocation by keeping them as in-memory files.
Errors
The bulk of the errors which might occur are mostely I/O related due to acquiring file handles.
Other errors might include protocol changes in newer caches. Any error unrelated to I/O at this stage should be considered a bug.
sourcepub fn checksum(&self) -> Result<Checksum, Error>
pub fn checksum(&self) -> Result<Checksum, Error>
Generate a checksum based on the current cache.
The Checksum
acts as a validator for individual cache files. Any
RuneScape client will request a list of crc’s to check the validity of
all of the file data that was transferred.
sourcepub fn checksum_with<'a>(
&self,
keys: RsaKeys<'a>
) -> Result<RsaChecksum<'a>, Error>
Available on crate feature rs3
only.
pub fn checksum_with<'a>( &self, keys: RsaKeys<'a> ) -> Result<RsaChecksum<'a>, Error>
rs3
only.Generate a checksum based on the current cache with RSA encryption.
RsaChecksum
wraps a regular Checksum
with the added benefit of
encrypting the whirlpool hash into the checksum buffer.
sourcepub fn read(
&self,
index_id: u8,
archive_id: u32
) -> Result<Buffer<Encoded>, Error>
pub fn read( &self, index_id: u8, archive_id: u32 ) -> Result<Buffer<Encoded>, Error>
Retrieves and constructs data corresponding to the given index and archive.
Errors
When trying to retrieve data from an index or an archive that does not
exist the IndexNotFound
or ArchiveNotFound
errors are returned,
respectively.
Any other errors such as sector validation failures or failed parsers should be considered a bug.