public static void ProcessDisplayColumnProperty(C1DisplayColumn displayCol, string subLine, string value) { GroupCollection groups = RegularExpressions.PropertyRegex.Matches(subLine)[0].Groups; string property = groups[2].Value; string newSubLine = groups[8].Value; switch (property.ToUpper()) { case nameof(DisplayColumnProperties.COLUMNDIVIDER): GridLinesPropertyReader.ProcessGridLinesProperty(displayCol.ColumnDivider, newSubLine, value); break; case nameof(DisplayColumnProperties.DATACOLUMN): //ignore break; default: if (displayCol.Styles.ContainsKey(property)) { StylePropertyReader.ProcessStyleProperty(displayCol.Styles[property], newSubLine, value); } else { displayCol.Properties[property] = Utilities.CleanXMLProperty(value); } break; } }
public static Split ParseXML(XElement xElemSplit) { Split split = new Split(); split.TagName = Utilities.EnumValueToString(xElemSplit.Name.ToString()); IEnumerable <XElement> notStyles = xElemSplit.Elements().Where(x => x.Attribute("me") == null && x.Attribute("parent") == null && x.Name.ToString() != "internalCols"); IEnumerable <XElement> stylesXelements = xElemSplit.Elements().Where(x => x.Attribute("me") != null && x.Attribute("parent") != null && x.Name.ToString() != "internalCols"); foreach (XAttribute attribute in xElemSplit.Attributes()) { split.properties[attribute.Name.ToString()] = attribute.Value; } foreach (XElement style in stylesXelements) { split.Styles[style.Name.ToString()] = Style.ParseXML(style); } foreach (XElement property in notStyles) { split.Properties[property.Name.ToString()] = property.Value; } IEnumerable <XElement> displayCols = xElemSplit.Element("internalCols")?.Elements(); if (displayCols != null) { foreach (XElement dispCol in displayCols) { split.displayCols.Add(C1DisplayColumn.ParseXML(dispCol)); } } return(split); }
public static C1DisplayColumn ParseXML(XElement xElemDisplayColumn) { C1DisplayColumn displayColumn = new C1DisplayColumn(); IEnumerable <XElement> notStyles = xElemDisplayColumn.Elements().Where(x => x.Attribute("me") == null && x.Attribute("parent") == null && x.Name.ToString() != "ColumnDivider"); IEnumerable <XElement> stylesXelements = xElemDisplayColumn.Elements().Where(x => x.Attribute("me") != null && x.Attribute("parent") != null); foreach (XElement style in stylesXelements) { displayColumn.Styles[style.Name.ToString()] = Style.ParseXML(style); } foreach (XElement property in notStyles) { displayColumn.Properties[property.Name.ToString()] = property.Value; } displayColumn.ColumnDivider = GridLines.ParseXML(xElemDisplayColumn.Element("ColumnDivider")); return(displayColumn); }
public static void ProcessSplitProperty(Split split, string line, string value) { GroupCollection groups = RegularExpressions.PropertyRegex.Matches(line)[0].Groups; string property = groups[2].Value; string subLine = groups[8].Value; switch (property.ToUpper()) { case nameof(SplitProperties.ALTERNATINGROWS): split.Properties["AlternatingRowStyle"] = Utilities.FirstCharToUpper(value); break; case nameof(SplitProperties.DISPLAYCOLUMNS): int displayColumnIndex = Utilities.StringToIndex(groups[5].Value); C1DisplayColumn displayColumn = Utilities.GetCreateListElement <C1DisplayColumn>(split.DisplayCols, displayColumnIndex); DisplayColumnPropertyReader.ProcessDisplayColumnProperty(displayColumn, subLine, value); break; case nameof(SplitProperties.HSCROLLBAR): if (subLine.Equals("Style")) { split.Properties["HBarStyle"] = Utilities.EnumValueToString(value); } break; case nameof(SplitProperties.VSCROLLBAR): if (subLine.Equals("Style")) { split.Properties["VBarStyle"] = Utilities.EnumValueToString(value); } break; default: if (split.Styles.ContainsKey(property)) { StylePropertyReader.ProcessStyleProperty(split.Styles[property], subLine, value); } else { split.Properties[property] = Utilities.CleanXMLProperty(value); } break; } }