public void Set(XmlNode Node) { String Value = Node.InnerText; try { if (Typ.Name == "Double") { SetObject(Convert.ToDouble(Value)); } else if (Typ.Name == "Int32") { SetObject(Convert.ToInt32(Value)); } else if (Typ.Name == "Single") { SetObject(Convert.ToSingle(Value)); } else if (Typ.Name == "Boolean") { if (string.Equals(Value, "yes", StringComparison.CurrentCultureIgnoreCase)) { SetObject(true); } else if (string.Equals(Value, "no", StringComparison.CurrentCultureIgnoreCase)) { SetObject(false); } else { SetObject(Convert.ToBoolean(Value)); } } else if (Typ.Name == "String") { SetObject(Value); } else if (Typ.Name == "Double[]") { List <String> StringValues; if (XmlHelper.Find(Node, "double") != null) { StringValues = XmlHelper.Values(Node, "double"); } else { StringValues = XmlHelper.Values(Node.ParentNode, Node.Name); } double[] DoubleValues = null; if (StringValues.Count > 1) { DoubleValues = MathUtility.StringsToDoubles(StringValues); } else if (StringValues.Count == 1) { String Delimiters = " "; String[] Values = StringValues[0].Split(Delimiters.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); DoubleValues = MathUtility.StringsToDoubles(Values); } SetObject(DoubleValues); } else if (Typ.Name == "String[]") { List <String> StringValues; if (XmlHelper.Find(Node, "string") != null) { StringValues = XmlHelper.Values(Node, "string"); } else { StringValues = XmlHelper.Values(Node.ParentNode, Node.Name); } String[] Values = null; if (StringValues.Count > 1) { Values = new String[StringValues.Count]; StringValues.CopyTo(Values); } else if (StringValues.Count == 1) { String Delimiters = " "; Values = StringValues[0].Split(Delimiters.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); } SetObject(Values); } else if (Typ.Name == "DateTime") { SetObject(DateTime.Parse(Value)); } else { throw new Exception("Cannot set property. Unknown conversion target " + Typ.Name); } } catch (Exception err) { String Msg = "Error converting string to " + Typ.Name + ".\n" + err.Message + "\nParameter: " + Name + "\nValue: " + Value; throw new Exception(Msg); } }