Framework_4_0 preprocessor is necessary for legacy compatibility.

This commit is contained in:
mark 2012-01-03 00:36:52 +00:00
parent 12fe97babd
commit 558fcf495a
15 changed files with 755 additions and 46 deletions

View file

@ -1137,7 +1137,7 @@ namespace Server
if ( s == null )
return false;
#if Framework_4_0
Type type = typeof(T);
T tempVal;
@ -1151,6 +1151,19 @@ namespace Server
Console.WriteLine( "Could not parse {0} enum attribute '{1}' in element '{2}'", type, attribute, xml.Name );
return false;
}
#else
try
{
value = (T)Enum.Parse(type, s, true);
}
catch
{
Console.WriteLine( "Could not parse {0} enum attribute '{1}' in element '{2}'", type, attribute, xml.Name );
return false;
}
return true;
#endif
}
public static bool ReadMap( XmlElement xml, string attribute, ref Map value )