OnCorruption
|
Previous Top Next |
:OnCorruption := {|Self| ... } --> nStatus
|
Self
|
Self contains a reference to the XbZLibZip object itself.
|
nStatus
|
nStatus is the new value of the Zip File's (Error) Status instance variable :Status, which will be set by the protected :AutoFix() method. Possible values are the following Define Constants from the XbZLib.ch file:
|
|
|
If any kind of Data Corruption is found by the :Open() method -- when XBZ_OPEN_TEST was specified as Open Mode -- the protected :AutoFix() method is automatically called. This method will by default call the :Fix() method, unless the :OnCorruption Callback Slot contains a CodeBlock, which would then be called instead of the :Fix() method. This CodeBlock must return a valid nStatus code (see above for possible values). This CodeBlock may either correct the corruption, or might do nothing but return the new nStatus value. Invalid (or missing) return values will default to the original value of the :Status instance variable, which will be updated accordingly by the :AutoFix() method.
|
· | Standard default behavior -- Call default :Fix() method automatically:
|
oZip:OnCorruption := NIL
|
· | Standard default behavior -- Call default :Fix() method automatically:
|
oZip:OnCorruption := {|oZ| oZ:Fix()}
|
· | Ignore Corruptions Do nothing:
|
oZip:OnCorruption := {|oZ| XBZ_FILE_OK}
|
· | Call a UDF (User-Defined Function) called "MyFix()" which should return an appropriate nStatus Code:
|
oZip:OnCorruption := {|oZ| MyFix(oZ)}
|