public void ConvertFromStringTest() { var converter = new EnumConverter(typeof(TestEnum)); var propertyMapData = new CsvPropertyMapData(null); propertyMapData.TypeConverterOptions.CultureInfo = CultureInfo.CurrentCulture; Assert.AreEqual(TestEnum.One, converter.ConvertFromString("One", null, propertyMapData)); Assert.AreEqual(TestEnum.One, converter.ConvertFromString("one", null, propertyMapData)); Assert.AreEqual(TestEnum.One, converter.ConvertFromString("1", null, propertyMapData)); try { Assert.AreEqual(TestEnum.One, converter.ConvertFromString("", null, propertyMapData)); Assert.Fail(); } catch (CsvTypeConverterException) { } try { Assert.AreEqual(TestEnum.One, converter.ConvertFromString(null, null, propertyMapData)); Assert.Fail(); } catch (CsvTypeConverterException) { } }
public void ConvertFromStringTest() { var converter = new EnumConverter(typeof(TestEnum)); var typeConverterOptions = new TypeConverterOptions { CultureInfo = CultureInfo.CurrentCulture }; Assert.AreEqual(TestEnum.One, converter.ConvertFromString(typeConverterOptions, "One")); Assert.AreEqual(TestEnum.One, converter.ConvertFromString(typeConverterOptions, "one")); Assert.AreEqual(TestEnum.One, converter.ConvertFromString(typeConverterOptions, "1")); try { Assert.AreEqual(TestEnum.One, converter.ConvertFromString(typeConverterOptions, "")); Assert.Fail(); } catch (CsvTypeConverterException) { } try { Assert.AreEqual(TestEnum.One, converter.ConvertFromString(typeConverterOptions, null)); Assert.Fail(); } catch (CsvTypeConverterException) { } }
public void ConvertFromStringTest() { var converter = new EnumConverter(typeof(TestEnum)); var propertyMapData = new MemberMapData(null); propertyMapData.TypeConverterOptions.CultureInfo = CultureInfo.CurrentCulture; var mockRow = new Mock <IReaderRow>(); Assert.AreEqual(TestEnum.One, converter.ConvertFromString("One", null, propertyMapData)); Assert.AreEqual(TestEnum.One, converter.ConvertFromString("one", null, propertyMapData)); Assert.AreEqual(TestEnum.One, converter.ConvertFromString("1", null, propertyMapData)); try { Assert.AreEqual(TestEnum.One, converter.ConvertFromString("", mockRow.Object, propertyMapData)); Assert.Fail(); } catch (TypeConverterException) { } try { Assert.AreEqual(TestEnum.One, converter.ConvertFromString(null, mockRow.Object, propertyMapData)); Assert.Fail(); } catch (TypeConverterException) { } }
public void ConvertFromStringTest() { var converter = new EnumConverter(typeof(TestEnum)); var propertyMapData = new MemberMapData(null); propertyMapData.TypeConverterOptions.CultureInfo = CultureInfo.CurrentCulture; var row = new CsvReader(new ParserMock()); Assert.AreEqual(TestEnum.One, converter.ConvertFromString("One", null, propertyMapData)); Assert.AreEqual(TestEnum.One, converter.ConvertFromString("one", null, propertyMapData)); Assert.AreEqual(TestEnum.One, converter.ConvertFromString("1", null, propertyMapData)); Assert.ThrowsException <TypeConverterException>(() => converter.ConvertFromString("", row, propertyMapData)); Assert.ThrowsException <TypeConverterException>(() => Assert.AreEqual(TestEnum.One, converter.ConvertFromString(null, row, propertyMapData))); }
private static object CoerceTypeSafetyMode(DependencyObject d, object value) { if (value != null) { Type vType = value.GetType(); if (vType == typeof(string)) { EnumConverter enumConverter = new EnumConverter(typeof(PropBagTypeSafetyMode)); object test = enumConverter.ConvertFromString((string)value); if (test is PropBagTypeSafetyMode pbtsm) { return(pbtsm); } } else { if (vType == typeof(PropBagTypeSafetyMode)) { return(value); } } } return(PropBagTypeSafetyMode.None); }
public static string GetTag(string tagName, string param = "", string attr = "") { var enumConverter = new EnumConverter(typeof(Tags)); var tag = (Tags)enumConverter.ConvertFromString(tagName); return(GetTag(tag, param, attr)); }
public void ConvertFromStringTest() { var converter = new EnumConverter(typeof(TestEnum)); var propertyMapData = new MemberMapData(null) { TypeConverterOptions = { EnumIgnoreCase = true }, }; var row = new CsvReader(new ParserMock()); Assert.Equal(TestEnum.One, converter.ConvertFromString("One", null, propertyMapData)); Assert.Equal(TestEnum.One, converter.ConvertFromString("one", null, propertyMapData)); Assert.Equal(TestEnum.One, converter.ConvertFromString("1", null, propertyMapData)); Assert.Throws <TypeConverterException>(() => converter.ConvertFromString("", row, propertyMapData)); Assert.Throws <TypeConverterException>(() => Assert.Equal(TestEnum.One, converter.ConvertFromString(null, row, propertyMapData))); }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { char[] separator = new char[] { '\n' }; string[] strArray = ((string)value).Split(separator); Keyframe[] keys = new Keyframe[strArray.Length - 2]; for (int i = 0; i < keys.Length; i++) { char[] chArray2 = new char[] { ',' }; string[] keyvals = strArray[i + 2].Split(chArray2); keys[i] = new Keyframe(ParseKeyVal(keyvals, Val.Time), ParseKeyVal(keyvals, Val.Value), ParseKeyVal(keyvals, Val.InTangent), ParseKeyVal(keyvals, Val.OutTangent)); } AnimationCurve curve = new AnimationCurve(keys); EnumConverter converter = new EnumConverter(typeof(WrapMode)); curve.postWrapMode = (WrapMode)converter.ConvertFromString(strArray[0]); curve.preWrapMode = (WrapMode)converter.ConvertFromString(strArray[1]); return(curve); }
public static TEnum ToEnum <TEnum>(this string data) { EnumConverter convert = new EnumConverter(typeof(TEnum)); if (convert == null) { throw new ApplicationException("找不到枚举转换器"); } return((TEnum)convert.ConvertFromString(data)); }
public void ConvertFromString_NameAttribute_ReturnsValueFromNameAttribute() { var converter = new EnumConverter(typeof(NameAttributeEnum)); var propertyMapData = new MemberMapData(null) { }; var value = converter.ConvertFromString("Bar", null, propertyMapData); Assert.Equal(NameAttributeEnum.Foo, value); }
public void ConvertFromString_UsingValue_DuplicateAttributeNamesAndValues_ReturnsNameThatAppearsFirst() { var converter = new EnumConverter(typeof(DuplicateNamesAndValuesAttributeEnum)); var memberMapData = new MemberMapData(null) { }; var value = converter.ConvertFromString("1", null, memberMapData); Assert.Equal(DuplicateNamesAndValuesAttributeEnum.One, value); }
public void ConvertFromString_DuplicateValues_ReturnsNameThatAppearsFirst() { var converter = new EnumConverter(typeof(DuplicateValues)); var memberMapData = new MemberMapData(null) { }; var value = converter.ConvertFromString("1", null, memberMapData); Assert.AreEqual(DuplicateValues.One, value); }
public void ConvertFromString_UsingName_DuplicateAttributeNamesAndValues_ReturnsNameThatAppearsFirst() { var converter = new EnumConverter(typeof(DuplicateNamesAndValuesAttributeEnum)); var memberMapData = new MemberMapData(null) { TypeConverterOptions = { EnumIgnoreCase = true }, }; var value = converter.ConvertFromString("oNe", null, memberMapData); Assert.Equal(DuplicateNamesAndValuesAttributeEnum.One, value); }
public void ConvertFromString_DuplicateAttributeNames_IgnoreCase_ReturnsNameWithLowestValue() { var converter = new EnumConverter(typeof(DuplicateNamesAttributeEnum)); var memberMapData = new MemberMapData(null) { TypeConverterOptions = { EnumIgnoreCase = true }, }; var value = converter.ConvertFromString("oNe", null, memberMapData); Assert.Equal(DuplicateNamesAttributeEnum.One, value); }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { string[] array = ((string)value).Split(new char[] { '\n' }); Keyframe[] array2 = new Keyframe[array.Length - 2]; for (int i = 0; i < array2.Length; i++) { string[] keyvals = array[i + 2].Split(new char[] { ',' }); array2[i] = new Keyframe(AnimationCurveTypeConverter.ParseKeyVal(keyvals, AnimationCurveTypeConverter.Val.Time), AnimationCurveTypeConverter.ParseKeyVal(keyvals, AnimationCurveTypeConverter.Val.Value), AnimationCurveTypeConverter.ParseKeyVal(keyvals, AnimationCurveTypeConverter.Val.InTangent), AnimationCurveTypeConverter.ParseKeyVal(keyvals, AnimationCurveTypeConverter.Val.OutTangent)); } AnimationCurve animationCurve = new AnimationCurve(array2); EnumConverter enumConverter = new EnumConverter(typeof(WrapMode)); animationCurve.postWrapMode = (WrapMode)((int)enumConverter.ConvertFromString(array[0])); animationCurve.preWrapMode = (WrapMode)((int)enumConverter.ConvertFromString(array[1])); return(animationCurve); }
public void ConvertFromString_NameAttribute_ReturnsValueFromNameAttribute() { var converter = new EnumConverter(typeof(NameAttributeEnum)); var propertyMapData = new MemberMapData(null) { TypeConverter = converter, TypeConverterOptions = { CultureInfo = CultureInfo.CurrentCulture } }; var value = converter.ConvertFromString("Bar", null, propertyMapData); Assert.AreEqual(NameAttributeEnum.Foo, value); }
public void ConvertFromString_Int16Enum_ReturnsEnumValue() { var converter = new EnumConverter(typeof(Int16Enum)); var propertyMapData = new MemberMapData(null) { TypeConverter = converter, TypeConverterOptions = { CultureInfo = CultureInfo.CurrentCulture } }; var value = converter.ConvertFromString("1", null, propertyMapData); Assert.AreEqual(Int16Enum.One, value); }
public void ConvertFromStringTest() { var converter = new EnumConverter(typeof(TestEnum)); Assert.AreEqual(TestEnum.One, converter.ConvertFromString("One")); Assert.AreEqual(TestEnum.One, converter.ConvertFromString("one")); Assert.AreEqual(TestEnum.One, converter.ConvertFromString("1")); try { Assert.AreEqual(TestEnum.One, converter.ConvertFromString("")); Assert.Fail(); } catch (NotSupportedException) { } try { Assert.AreEqual(TestEnum.One, converter.ConvertFromString(null)); Assert.Fail(); } catch (NotSupportedException) { } }
private static GridColumnInfo ReadColumnInfoAndSetWidth(XmlNode node, GridView gridView, float scaleCorrection) { if (!node.Name.Equals("Column")) { return(null); } var fieldName = node.Attributes["FieldName"].Value; var col = gridView.Columns[fieldName]; var ci = new GridColumnInfo(fieldName); var conv = new EnumConverter(typeof(ColumnSortOrder)); for (XmlNode item = node.FirstChild; item != null; item = item.NextSibling) { if (item.Name.Equals("Width")) { ci.Width = Convert.ToInt32(item.InnerText); if (col != null) { col.Width = (int)Math.Round(ci.Width * scaleCorrection, 0); } } else if (item.Name.Equals("VisibleIndex")) { ci.VisibleIndex = Convert.ToInt32(item.InnerText); } else if (item.Name == "InvisibleIndex") { ci.InvisibleIndex = Convert.ToInt32(item.InnerText); } else if (item.Name.Equals("SortIndex")) { ci.SortIndex = Convert.ToInt32(item.InnerText); } else if (item.Name.Equals("SortOrder")) { ci.SortOrder = (ColumnSortOrder)conv.ConvertFromString(item.InnerText); } else if (item.Name.Equals("GroupIndex")) { ci.GroupIndex = int.Parse(item.InnerText); } } return(ci); }
/// <summary> /// 解析成枚举 /// </summary> /// <param name="type"></param> /// <param name="jsonObject">Json对象</param> /// <returns></returns> private object ConvertToEnum(Type type, IJsonObject jsonObject) { if (jsonObject.Type == JsonType.String) { EnumConverter converter = new EnumConverter(type); return(converter.ConvertFromString((string)jsonObject.Value)); } else if (jsonObject.Type == JsonType.Number && ((JsonNumber)jsonObject).NumberType == NumberType.Long) { int value = int.Parse((string)jsonObject.Value); if (!System.Enum.IsDefined(type, value)) { throw new JsonDeserializationException(jsonObject, type, "当前Number数字,在枚举中未定义"); } return(System.Enum.ToObject(type, value)); } else { throw new JsonDeserializationException(jsonObject, type, "Json对象的" + jsonObject.Type.ToString() + "类型不能解析成Enum类型"); } }
static void Main(string[] args) { Console.WriteLine("使用 EnumConverter "); { EnumConverter converter = new EnumConverter(typeof(ProgrammingLanguage)); // 将字符串转换为枚举. string langStr = "CS, Cpp, XAML"; Console.WriteLine("将字符串 \"{0}\" 转换为枚举...", langStr); ProgrammingLanguage lang = (ProgrammingLanguage)converter.ConvertFromString(langStr); Console.WriteLine("完成!"); // 将枚举转换为字符串. Console.WriteLine("将枚举结果转换为字符串..."); langStr = converter.ConvertToString(lang); Console.WriteLine("完成! \"{0}\"", langStr); } Console.WriteLine("\n使用 EnumDescriptionConverter "); { EnumDescriptionConverter converter = new EnumDescriptionConverter( typeof(ProgrammingLanguage)); // 将枚举转换为字符串. string langStr = "Visual C#, Visual C++, XAML"; Console.WriteLine("将字符串 \"{0}\" 转换为枚举...", langStr); ProgrammingLanguage lang = (ProgrammingLanguage)converter.ConvertFromString(langStr); Console.WriteLine("完成!"); // 将枚举转换为字符串. Console.WriteLine("将枚举结果转换为字符串..."); langStr = converter.ConvertToString(lang); Console.WriteLine("完成! \"{0}\"", langStr); } Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("Using EnumConverter to"); { EnumConverter converter = new EnumConverter(typeof(ProgrammingLanguage)); // Convert string to enum. string langStr = "CS, Cpp, XAML"; Console.WriteLine("Convert the string \"{0}\" to enum...", langStr); ProgrammingLanguage lang = (ProgrammingLanguage)converter.ConvertFromString(langStr); Console.WriteLine("Done!"); // Convert enum to string. Console.WriteLine("Convert the resulting enum to string..."); langStr = converter.ConvertToString(lang); Console.WriteLine("Done! \"{0}\"", langStr); } Console.WriteLine("\nUsing EnumDescriptionConverter to"); { EnumDescriptionConverter converter = new EnumDescriptionConverter( typeof(ProgrammingLanguage)); // Convert string to enum. string langStr = "Visual C#, Visual C++, XAML"; Console.WriteLine("Convert the string \"{0}\" to enum...", langStr); ProgrammingLanguage lang = (ProgrammingLanguage)converter.ConvertFromString(langStr); Console.WriteLine("Done!"); // Convert enum to string. Console.WriteLine("Convert the resulting enum to string..."); langStr = converter.ConvertToString(lang); Console.WriteLine("Done! \"{0}\"", langStr); } Console.ReadLine(); }
protected XObject XConvertFromString(string value, XType xtype) { object result = null; Type t = typeof(bool); if (xtype.XName == t.Name) { bool v = false; if (bool.TryParse(value, out v)) { result = v; } return(x.XNew(result)); } /*t = typeof(Color); * if (xtype.XName == t.Name) * { * ColorConverter converter = new ColorConverter(); * result = converter.ConvertFromString(value); * return x.XNew(result); * }*/ t = typeof(DateTime); if (xtype.XName == t.Name) { DateTimeConverter converter = new DateTimeConverter(); result = converter.ConvertFromString(value); return(x.XNew(result)); } t = typeof(float); if (xtype.XName == t.Name) { float v = 0; if (float.TryParse(value, out v)) { result = v; } return(x.XNew(result)); } t = typeof(int); if (xtype.XName == t.Name) { int v = 0; if (int.TryParse(value, out v)) { result = v; } return(x.XNew(result)); } t = typeof(string); if (xtype.XName == t.Name) { result = value; return(x.XNew(result)); } t = typeof(Uri); if (xtype.XName == t.Name) { result = new Uri(value); return(x.XNew(result)); } if (xtype.XIsEnum) { EnumConverter converter = new EnumConverter(xtype.X); result = converter.ConvertFromString(value); return(x.XNew(result)); } return(null); }
private void DeserializeBoxSettings(AnnotationBox boxSettings, XmlElement boxSettingsNode) { string font = boxSettingsNode.GetAttribute("font"); string color = boxSettingsNode.GetAttribute("color"); string italics = boxSettingsNode.GetAttribute("italics"); string bold = boxSettingsNode.GetAttribute("bold"); string numberOfLines = boxSettingsNode.GetAttribute("number-of-lines"); string truncation = boxSettingsNode.GetAttribute("truncation"); string justification = boxSettingsNode.GetAttribute("justification"); string verticalAlignment = boxSettingsNode.GetAttribute("vertical-alignment"); string fitWidth = boxSettingsNode.GetAttribute("fit-width"); string alwaysVisible = boxSettingsNode.GetAttribute("always-visible"); if (!String.IsNullOrEmpty(font)) { boxSettings.Font = font; } if (!String.IsNullOrEmpty(color)) { boxSettings.Color = color; } if (!String.IsNullOrEmpty(italics)) { boxSettings.Italics = (String.Compare("true", italics, true) == 0); } if (!String.IsNullOrEmpty(bold)) { boxSettings.Bold = (String.Compare("true", bold, true) == 0); } if (!String.IsNullOrEmpty(numberOfLines)) { byte result; if (!byte.TryParse(numberOfLines, System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.InvariantCulture, out result)) { result = 1; } boxSettings.NumberOfLines = result; } if (!String.IsNullOrEmpty(fitWidth)) { boxSettings.FitWidth = (String.Compare("true", fitWidth) == 0); } if (!String.IsNullOrEmpty(alwaysVisible)) { boxSettings.AlwaysVisible = (String.Compare("true", alwaysVisible, true) == 0); } if (!String.IsNullOrEmpty(truncation)) { AnnotationBox.TruncationBehaviour fromString = boxSettings.Truncation; EnumConverter converter = new EnumConverter(typeof(AnnotationBox.TruncationBehaviour)); if (converter.IsValid(truncation)) { boxSettings.Truncation = (AnnotationBox.TruncationBehaviour)converter.ConvertFromString(truncation); } } if (!String.IsNullOrEmpty(justification)) { AnnotationBox.JustificationBehaviour fromString = boxSettings.Justification; EnumConverter converter = new EnumConverter(typeof(AnnotationBox.JustificationBehaviour)); if (converter.IsValid(justification)) { boxSettings.Justification = (AnnotationBox.JustificationBehaviour)converter.ConvertFromString(justification); } } if (!String.IsNullOrEmpty(verticalAlignment)) { AnnotationBox.VerticalAlignmentBehaviour fromString = boxSettings.VerticalAlignment; EnumConverter converter = new EnumConverter(typeof(AnnotationBox.VerticalAlignmentBehaviour)); if (converter.IsValid(verticalAlignment)) { boxSettings.VerticalAlignment = (AnnotationBox.VerticalAlignmentBehaviour)converter.ConvertFromString(verticalAlignment); } } XmlElement configurationSettings = (XmlElement)boxSettingsNode.SelectSingleNode("configuration-settings"); if (configurationSettings != null) { string showLabel = configurationSettings.GetAttribute("show-label"); string showLabelIfEmpty = configurationSettings.GetAttribute("show-label-if-empty"); if (!String.IsNullOrEmpty(showLabel)) { boxSettings.ConfigurationOptions.ShowLabel = (String.Compare("true", showLabel, true) == 0); } if (!String.IsNullOrEmpty(showLabelIfEmpty)) { boxSettings.ConfigurationOptions.ShowLabelIfValueEmpty = (String.Compare("true", showLabelIfEmpty, true) == 0); } } }
/// <summary> /// Creates Data Sources in Reporting Services. /// </summary> /// <param name="datasourceXMLFilePath">XML file path holds Data Sources information.</param> private static void CreateDataSources(string datasourceXMLFilePath) { ReportingService reportingServicesClient = new ReportingService(); reportingServicesClient.Credentials = System.Net.CredentialCache.DefaultCredentials; DataSourceDefinition tempDataSource; XDocument xmlDoc = XDocument.Load(datasourceXMLFilePath); try { var result = from c in xmlDoc.Descendants("DataSource") select new { name = (string)c.Element("Name").Value, folder = (string)c.Element("Folder").Value, description = (string)c.Element("Description").Value, hideInListView = (string)c.Element("HideInListView").Value, enabled = (string)c.Element("Enabled").Value, connectionString = (string)c.Element("ConnectionString").Value, extension = (string)c.Element("Extension").Value, credentialRetrieval = (string)c.Element("CredentialRetrieval").Value, windowsCredentials = (string)c.Element("WindowsCredentials").Value, impersonateUser = (string)c.Element("ImpersonateUser").Value, impersonateUserSpecified = (string)c.Element("ImpersonateUserSpecified").Value, prompt = (string)c.Element("Prompt").Value, userName = (string)c.Element("UserName").Value, password = (string)c.Element("Password").Value, enabledSpecified = (string)c.Element("EnabledSpecified").Value }; foreach (var row in result) { CredentialRetrievalEnum credentialRetrieval; EnumConverter ec = new EnumConverter(typeof(CredentialRetrievalEnum)); credentialRetrieval = (CredentialRetrievalEnum)ec.ConvertFromString(row.credentialRetrieval); tempDataSource = new DataSourceDefinition(); tempDataSource.CredentialRetrieval = credentialRetrieval; tempDataSource.ConnectString = row.connectionString; tempDataSource.Enabled = bool.Parse(row.enabled); tempDataSource.EnabledSpecified = bool.Parse(row.enabledSpecified); tempDataSource.Extension = row.extension; tempDataSource.ImpersonateUserSpecified = bool.Parse(row.impersonateUserSpecified); tempDataSource.ImpersonateUser = bool.Parse(row.impersonateUser); tempDataSource.Prompt = row.prompt; tempDataSource.WindowsCredentials = bool.Parse(row.windowsCredentials); //tempDataSource.UserName = row.userName; //tempDataSource.Password = row.password; try { reportingServicesClient.CreateDataSource(row.name, row.folder, true, tempDataSource, null); Logging.Log(string.Format("Data Source {0} has created successfully", row.name)); } catch (SoapException e) { Logging.Log(e.Detail.InnerXml.ToString()); } } } catch (Exception er) { Logging.Log(er.Message); } }
private static int ResolveTokenId(string tokenName) { EnumConverter converter = new EnumConverter(typeof(Tokens)); return((int)converter.ConvertFromString(tokenName)); }
/// <summary> /// Used by Deserialize method for setting properties of /// TreeNode from xml node attributes /// </summary> private void vSetAttributeValue(TreeNode _node, string _propertyName, string _value) { tNodeTagInfo nti; if (_node.Tag == null) { nti = new tNodeTagInfo(); nti.type = eMenueElementType.normal; nti.info = ""; nti.ID = -1; _node.Tag = nti; } if (_propertyName == XmlNodeTextAtt) { _node.Text = _value; } else if (_propertyName == XmlNodeImageIndexAtt) { _node.ImageIndex = int.Parse(_value); _node.SelectedImageIndex = int.Parse(_value); } else if (_propertyName == XmlNodeTagIDAtt) { nti = (tNodeTagInfo)_node.Tag; nti.ID = -1;//int.Parse(value); // fixme _node.Tag = nti; } else if (_propertyName == XmlNodeTagTypeAtt) { nti = (tNodeTagInfo)_node.Tag; EnumConverter ec = new EnumConverter(typeof(eMenueElementType)); nti.type = (eMenueElementType)ec.ConvertFromString(_value); _node.Tag = nti; } else if (_propertyName == XmlNodeTagInfoAtt) { nti = (tNodeTagInfo)_node.Tag; nti.info = _value; _node.Tag = nti; } else if (_propertyName == XmlNodeTagParUpper) { nti = (tNodeTagInfo)_node.Tag; nti.ParUpper = int.Parse(_value); _node.Tag = nti; } else if (_propertyName == XmlNodeTagParLower) { nti = (tNodeTagInfo)_node.Tag; nti.ParLower = int.Parse(_value); _node.Tag = nti; } else if (_propertyName == XmlNodeTagParStepSize) { nti = (tNodeTagInfo)_node.Tag; nti.ParStepSize = int.Parse(_value); _node.Tag = nti; } else if (_propertyName == XmlNodeTagParType) { nti = (tNodeTagInfo)_node.Tag; nti.ParType = _value; _node.Tag = nti; _node.ImageIndex = (int)((tNodeTagInfo)_node.Tag).type; // this is duplicated somehow..., but if node info is missing in XML, it is restored here. _node.SelectedImageIndex = (int)((tNodeTagInfo)_node.Tag).type; } else if (_propertyName == XmlNodeTagParDesc) { nti = (tNodeTagInfo)_node.Tag; nti.ParDesc = _value; _node.Tag = nti; } }