get_FailOnInvalidSig Method

WRAPPER_API bool get_FailOnInvalidSig() const

 

Description

The get_FailOnInvalidSig method indicates 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.

If get_FailOnInvalidSig returns true, then 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.

If get_FailOnInvalidSig returns false, no exceptions will be thrown, although the signature may still be retrieved and validated using get_IsSignatureValid

 

Example

void DataSource_getFailOnInvalidSig(GEOCALCPBW_NAMESPACE::DataSource & data)

{
     if (data.getFailOnInvalidSig() )
     {

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());

}

}

        }

}