/// <summary> /// deserializes the <see cref="Columnizer"/> instance from the spezified <paramref name="node"/>. /// </summary> /// <param name="node">The <see cref="XmlNode"/> that may contain <see cref="LogColumn"/> data to deserialize.</param> /// <returns><c>True</c> if the deserialialzation was successfull; otherwise <c>false</c>.</returns> public bool DeserializeFromXml(XmlNode node) { if (node != null && Equals(node.Name, "Columnizer") && node.Attributes != null) { Name = node.Attributes["Name"] != null ? node.Attributes["Name"].Value ?? Resources.strColumnizerDefaultName : Resources.strColumnizerDefaultName; DateTimeFormat = node.Attributes["DateTimeFormat"] != null ? node.Attributes["DateTimeFormat"].Value ?? DefaultDateTimeFormat : DefaultDateTimeFormat; // Initialize an empty column list. Columns = new List <LogColumn>(); XmlNode columnNode = node.SelectSingleNode("LogColumns"); if (columnNode.HasChildNodes) { foreach (XmlNode childNode in columnNode.ChildNodes) { LogColumn deserializedColumn = new LogColumn(); if (deserializedColumn.DeserializeFromXml(childNode)) { Columns.Add(deserializedColumn); } } } XmlNode logLevelNode = node.SelectSingleNode("LogLevels"); if (logLevelNode.HasChildNodes) { foreach (XmlNode childNode in logLevelNode.ChildNodes) { LogLevel parsedLevel = (LogLevel)int.Parse( childNode.Attributes["Level"].Value); LogLevelMapping[parsedLevel] = childNode.Attributes["Value"].Value; } } return(true); } return(false); }
/// <summary> /// Gets a <see cref="DataGridViewRow"/> that tags the spezified <paramref name="column."/> /// </summary> /// <param name="column">The <see cref="LogColumn"/> that is tagged in a <see cref="DataGridViewRow"/>.</param> /// <returns>The <see cref="DataGridViewRow"/> that tags the spezified <paramref name="column."/>; or <c>null</c> if none is found.</returns> private DataGridViewRow GetRowWithTag(LogColumn column) { foreach (DataGridViewRow dgvRow in dgvResult.Rows) { if (Equals(dgvRow.Tag, column)) { return dgvRow; } } return null; }
/// <summary> /// deserializes the <see cref="Columnizer"/> instance from the spezified <paramref name="node"/>. /// </summary> /// <param name="node">The <see cref="XmlNode"/> that may contain <see cref="LogColumn"/> data to deserialize.</param> /// <returns><c>True</c> if the deserialialzation was successfull; otherwise <c>false</c>.</returns> public bool DeserializeFromXml(XmlNode node) { if (node != null && Equals(node.Name, "Columnizer") && node.Attributes != null) { Name = node.Attributes["Name"] != null ? node.Attributes["Name"].Value ?? Resources.strColumnizerDefaultName : Resources.strColumnizerDefaultName; // Initialize an empty column list. Columns = new List<LogColumn>(); if (node.HasChildNodes) { foreach (XmlNode childNode in node.ChildNodes) { LogColumn deserializedColumn = new LogColumn(); if (deserializedColumn.DeserializeFromXml(childNode)) { Columns.Add(deserializedColumn); } } } return true; } return false; }