Fix material convertsion and units detection.

This commit is contained in:
Daniel Kraus
2015-08-10 06:55:57 +02:00
parent 6c9f003134
commit 947b53cf97
5 changed files with 44 additions and 12 deletions

View File

@ -69,16 +69,23 @@ namespace zaaReloaded2.Thesaurus
/// <param name="laurisName">Lauris item name to look up.</param>
/// <returns><see cref="zaaReloaded2.LabModel.Material"/> enum; if no material is
/// found in the dictionary, the default material "S" (serum) is returned.</returns>
public Material GetMaterial(string laurisName)
public Material GetMaterial(string laurisName, Material def)
{
string textValue = LookUpValue(laurisName, 2);
try
if (String.IsNullOrEmpty(textValue))
{
return MaterialFactory.FromAbbreviation(textValue);
return def;
}
catch
else
{
return Material.B;
try
{
return MaterialFactory.FromAbbreviation(textValue);
}
catch
{
return Material.B;
}
}
}