class checkBuildVersion
{
public static void main()
{
const str latestFixVersion = '10.1.209.0';
boolean isLatest;
str appBuildVersion = Microsoft.Dynamics.BusinessPlatform.ProductInformation.Provider.ProductInfoProvider::get_Provider().ApplicationBuildVersion;
if( checkBuildVersion::compareVersion(appBuildVersion, latestFixVersion) >=1)
{
//if latest version
}
}
public static int compareVersion(str _versionStr1, str _versionStr2)
{
int subVersion1;
int subVersion2;
str versionSeperator = '.';
container con1 = str2con(_versionStr1, versionSeperator);
container con2 = str2con(_versionStr2, versionSeperator);
int maxLength = conLen(con1) > conLen(con2) ? conLen(con1) : conLen(con2);
int counter = 1;
for (counter = 1; counter <= maxLength; counter++)
{
subVersion1 = conPeek(con1, counter);
subVersion2 = conPeek(con2, counter);
if (subVersion1 > subVersion2)
{
return 1;
}
else if (subVersion1 < subVersion2)
{
return -1;
}
}
return 0;
}
}
No comments:
Post a Comment