Class: Mspack::ChmDecompressor
- Inherits:
-
Object
- Object
- Mspack::ChmDecompressor
- Defined in:
- lib/mspack.rb,
ext/mspack/mspack.c
Defined Under Namespace
Instance Method Summary collapse
Instance Method Details
#close(header) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'ext/mspack/mspack.c', line 38
static VALUE chmd_close(VALUE self, VALUE header) {
struct mschm_decompressor *decom;
Data_Get_Struct(self, struct mschm_decompressor, decom);
struct mschmd_header *headerPtr;
Data_Get_Struct(header, struct mschmd_header, headerPtr);
decom->close(decom, headerPtr);
return Qnil;
}
|
#extract(file, outputPath) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 |
# File 'ext/mspack/mspack.c', line 49
static VALUE chmd_extract(VALUE self, VALUE file, VALUE outputPath) {
struct mschm_decompressor *decom;
Data_Get_Struct(self, struct mschm_decompressor, decom);
struct mschmd_file *filePtr;
Data_Get_Struct(file, struct mschmd_file, filePtr);
const char *pathStr = StringValueCStr(outputPath);
return decom->extract(decom, filePtr, pathStr) == MSPACK_ERR_OK ?
Qtrue : Qfalse;
}
|
#open(path) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'ext/mspack/mspack.c', line 24
static VALUE chmd_open(VALUE self, VALUE path) {
struct mschm_decompressor *decom;
Data_Get_Struct(self, struct mschm_decompressor, decom);
struct mschmd_header *header = decom->open(decom, StringValueCStr(path));
if (!header) {
return Qnil;
}
VALUE headerObj = rb_obj_alloc(ChmDHeader);
rb_obj_call_init(headerObj, 0, NULL);
return Data_Wrap_Struct(ChmDHeader, NULL, NULL, header);
}
|