revert forced 4.0 migration -- many users are still dependent on 2.0

This commit is contained in:
mark 2012-03-07 13:47:33 +00:00
parent 7b48ebb7e6
commit 4bcde77cc2
13 changed files with 531 additions and 46 deletions

View file

@ -1139,7 +1139,7 @@ namespace Server
return false;
Type type = typeof(T);
#if Framework_4_0
T tempVal;
if( type.IsEnum && Enum.TryParse( s, true, out tempVal ) )
@ -1152,6 +1152,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 )