pub struct Project {
pub information: Information,
pub references: Vec<Reference>,
pub modules: Vec<Module>,
/* private fields */
}
Expand description
Represents a VBA project.
This type serves as the entry point into this crate’s functionality and exposes the public API surface.
Fields§
§information: Information
Specifies version-independent information for the VBA project.
references: Vec<Reference>
Specifies the external references of the VBA project.
modules: Vec<Module>
Specifies the modules in the project.
Implementations§
source§impl Project
impl Project
sourcepub fn decompress_stream_from<P>(
&self,
stream_path: P,
offset: usize
) -> Result<Vec<u8>>
pub fn decompress_stream_from<P>( &self, stream_path: P, offset: usize ) -> Result<Vec<u8>>
Returns a stream’s decompressed data.
This function reads a stream referenced by stream_path
and passes the data
starting at offset
into the RLE decompressor.
The primary use case for this function is to extract source code from VBA
Module
s. The respective offset
is reported by Module::text_offset
.
This is a low-level function that is useful for very specific use cases only.
Client code that needs to read source code should use Project::module_source
or Project::module_source_raw
instead.
sourcepub fn list(&self) -> Result<Vec<(String, String)>>
pub fn list(&self) -> Result<Vec<(String, String)>>
Returns a list of entries (storages and streams) in the raw binary data. Each
entry is represented as a tuple of two String
s, where the first element
contains the entry’s name and the second element the entry’s path inside the
CFB.
The raw binary data is encoded as a Compound File Binary
sourcepub fn module_source(&self, name: &str) -> Result<String>
pub fn module_source(&self, name: &str) -> Result<String>
Returns a module’s source code.
Similar to Project::module_source_raw
this function returns the source code
of a project’s module. After the raw source code has been decoded it is then
converted to a String
using the project’s code page.
sourcepub fn module_source_raw(&self, name: &str) -> Result<Vec<u8>>
pub fn module_source_raw(&self, name: &str) -> Result<Vec<u8>>
Returns the raw source code from a module.
The result contains a module’s source code as is. No character encoding conversion
is done. The data is encoded using the project’s code page available through
Information::code_page
.