internal static IfcDerivedMeasureValue parseDerivedMeasureValue(string str)
{
try
{
int len = str.Length;
if (str.EndsWith(")"))
len--;
int icounter = 0;
char c = str[icounter];
while (!char.IsDigit(c) && icounter < str.Length)
c = str[icounter++];
if (icounter == str.Length)
return null;
icounter--;
if (icounter > 1)
{
string kw = str.Substring(0, icounter - 1).ToLower();
Dictionary<string, Type> dmvtypes = DerivedMeasureValueTypes;
if (dmvtypes.ContainsKey(kw))
{
Type type = dmvtypes[kw];
double val = 0;
if (double.TryParse(str.Substring(icounter, len - icounter), out val))
{
Type[] types = new Type[] { typeof(double) };
ConstructorInfo constructor = type.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
null, types, null);
if (constructor != null)
return constructor.Invoke(new object[] { val }) as IfcDerivedMeasureValue;
}
}
}
}
catch(Exception) { }
return null;
}