From: Charles Date: Mon, 12 Apr 2010 01:36:42 +0000 (+0000) Subject: map constants should be case-insensitive X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=7fa101e60a4bc35dfd5dabf8f66811e3f8cfa673;p=chaz%2Fcarfire map constants should be case-insensitive git-svn-id: https://bd85.net/svn/cs3505_group@64 92bb83a3-7c8f-8a45-bc97-515c4e399668 --- diff --git a/CarFire/CarFire/CarFire/Content/Maps/sandbox.cfmap b/CarFire/CarFire/CarFire/Content/Maps/sandbox.cfmap index f537127..48338b3 100644 --- a/CarFire/CarFire/CarFire/Content/Maps/sandbox.cfmap +++ b/CarFire/CarFire/CarFire/Content/Maps/sandbox.cfmap @@ -6,7 +6,7 @@ [metadata] author = Chaz McGarvey levelname = Sandbox - type = Campaign + type = campaign dimensions = [80,21] tileset = FuturisticBuilding numplayers = <1,4> diff --git a/CarFire/CarFire/CarFire/Parse.cs b/CarFire/CarFire/CarFire/Parse.cs index e1a482e..169cf30 100644 --- a/CarFire/CarFire/CarFire/Parse.cs +++ b/CarFire/CarFire/CarFire/Parse.cs @@ -101,21 +101,19 @@ namespace CarFire /// /// An enumeration. /// Text. - /// The constant, or null if parsing failed. + /// The constant, or default(T) if parsing failed. public static T Constant(string atom) { - string constant = String(atom); - if (constant != null) + try { - foreach (string enumConstant in System.Enum.GetNames(typeof(T))) - { - if (constant == enumConstant) - { - return (T)System.Enum.Parse(typeof(T), constant); - } - } + return (T)System.Enum.Parse(typeof(T), String(atom), true); + } +#pragma warning disable 0168 + catch (System.Exception ex) +#pragma warning restore 0168 + { + return default(T); } - return default(T); } /// @@ -171,17 +169,6 @@ namespace CarFire return null; } - /// - /// Parses a comma-separated list of atoms. - /// - /// Text. - /// An array of strings containing the atoms, or null - /// if parsing failed. - public static string[] ParameterList(string text) - { - return null; - } - /// /// Parses a whitespace-separated list of atoms. ///