From f95aa772c1ede02fd173424b390d7ea9575be022 Mon Sep 17 00:00:00 2001 From: mxgmn Date: Wed, 5 Oct 2016 04:00:01 +0400 Subject: [PATCH] added license file, culture invariant string conversion --- LICENSE.md | 1 + SynTex.cs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..33a0c60 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1 @@ +SynTex software is mostly under the MIT license. Check individual source files for license text. Provided image samples are not part of SynTex software. diff --git a/SynTex.cs b/SynTex.cs index 9281dfd..1ad2d4f 100644 --- a/SynTex.cs +++ b/SynTex.cs @@ -26,7 +26,7 @@ static void Main() xdoc.Load("samples.xml"); int pass = 1; - for (var xnode = xdoc.FirstChild.FirstChild; xnode != null; xnode = xnode.NextSibling) + foreach (XmlNode xnode in xdoc.FirstChild.ChildNodes) { string name = xnode.Get("name", ""), method = xnode.Name; int K = xnode.Get("K", 1), N = xnode.Get("N", 1), M = xnode.Get("M", 20), polish = xnode.Get("polish", 3), OW = xnode.Get("width", 32), OH = xnode.Get("height", 32); @@ -404,7 +404,7 @@ static class Stuff { string s = ((XmlElement)node).GetAttribute(attribute); var converter = TypeDescriptor.GetConverter(typeof(T)); - return s == "" ? defaultT : (T)converter.ConvertFromString(s); + return s == "" ? defaultT : (T)converter.ConvertFromInvariantString(s); } public static int Random(this double[] array, double r)