private void Deserialize(XmlReader reader, IDictionary <string, object> properties) { reader.ReadStartElement(); reader.MoveToContent(); while (reader.NodeType == XmlNodeType.Element) { if (reader.IsEmptyElement == false) { var name = reader.GetAttribute("name"); var type = reader.GetAttribute("type"); try { var runtimeType = Type.GetType(type); reader.ReadStartElement(); var value = XmlSerializerUtility.Read(reader, runtimeType); reader.ReadEndElement(); properties.Add(name, value); } catch { reader.Skip(); } } else { reader.Skip(); } reader.MoveToContent(); } }
public static ResXInfo GetSettings(this Solution solution) { var fullName = solution.GetFullName(); var xmlPath = fullName + ".cremaresx"; if (File.Exists(xmlPath) == true) { if (XmlSerializerUtility.Read(xmlPath, typeof(ResXInfo)) is ResXInfo obj) { return(obj); } } throw new InvalidOperationException(); }
void IXmlSerializable.ReadXml(XmlReader reader) { var dataSet = new CremaDataSet(); var name = reader.GetAttribute("Name"); var categoryPath = reader.GetAttribute(nameof(CategoryPath)); var baseNamespace = reader.GetAttribute("BaseNamespace"); dataSet.Namespace = baseNamespace; reader.ReadStartElement(); reader.MoveToContent(); this.template.TargetTable = null; this.template.OmitSignatureDate = true; this.template.ReadXml(reader); this.template.OmitSignatureDate = false; reader.MoveToContent(); dataSet.ReadXmlSchema(reader); reader.MoveToContent(); dataSet.ReadXml(reader); reader.MoveToContent(); this.template.InternalTypes = XmlSerializerUtility.Read <string[]>(reader); reader.MoveToContent(); reader.ReadEndElement(); this.template.InternalTargetTable = (InternalDataTable)dataSet.Tables[name, categoryPath]; foreach (var item in this.template.Rows) { if (item is InternalTemplateColumn rowItem) { if (rowItem.RowState == DataRowState.Deleted) { continue; } rowItem.TargetColumn = (InternalDataColumn)this.template.InternalTargetTable.Columns[rowItem.ColumnName]; } } }