set_FailOnInvalidSig Method

WRAPPER_API void set_FailOnInvalidSig(bool failOnInvalidSig) const

 

Description

The set_FailOnInvalidSig method allows the user to set whether we should throw an exception during the LoadFile call if the base data source file has been manually edited (i.e. with Notepad) since the last time it was saved. During the CommitToFile call the base data source is written out with a calculated signature value based on the current contents at the time it is saved. If the file is edited prior to being loaded again, the signature saved in the file will not match the signature calculated from the current (edited) contents of the file.

Setting this property to true will mean that during the LoadFile call the calculated signature will be compared to the signature from the data source file. If they do not match, a GeoCalcException will be thrown with an ErrorCode specifying FailedSignatureCheck.

Setting this property to false will mean that no such exceptions will be thrown, although the signature may still be retrieved and validated using get_IsSignatureValid

 

Example

void DataSource_setFailOnInvalidSig(GEOCALCPBW_NAMESPACE::DataSource & data)

{

data.setFailOnInvalidSig(true);

try

{

data.LoadFile("c:\\bmg\\GeoCalcPBW\\data\\geodata.xml",false,"c:\\bmg\\GeoCalcPBW\\data\\custom.xml");

}

catch(GEOCALCPBW_NAMESPACE::GeoCalcException & ex)

{

if(ex.get_ErrorCode() == GEOCALCPBW_NAMESPACE::GeoCalcException::Code::FailedSignatureCheck)

{

AfxMessageBox("Bad datasource signature!");

}

else

{

AfxMessageBox(_tochar(ex.get_FullMessage()).c_str());

}

}

}