public void RemoveStylingData(HTMLActiveModifiers modifiers) { foreach (Action <HTMLActiveModifiers> action in StylingDataRemovalActions) { action(modifiers); } }
public override void ApplyModifiers(ref string finalOutput, string nodeData, HTMLActiveModifiers modifiers) { Regex regex = new Regex("color=\"([#0123456789abcdef]*)\""); Match match = regex.Match(nodeData); if (match.Success) { modifiers.Color = match.Groups[1].Value; nodeData = nodeData.Replace(match.Value, ""); } ApplyStylingData(nodeData, modifiers); }
public void ApplyStylingData(string nodeData, HTMLActiveModifiers modifiers) { if (!string.IsNullOrEmpty(nodeData)) { Match match = null; if (MatchRegex(nodeData, "style=\"(.*?)\"", out match)) { nodeData = match.Groups[1].Value; match = null; foreach (string subpart in nodeData.Split(";")) { if (MatchRegex(subpart, @"color: rgb\(([0-9]*), ([0-9]*), ([0-9]*)\)", out match)) { string color = "#"; color += BitConverter.ToString(new byte[] { byte.Parse(match.Groups[1].Value), byte.Parse(match.Groups[2].Value), byte.Parse(match.Groups[3].Value) }).Replace("-", "").ToLower(); modifiers.Color = color; StylingDataRemovalActions.Add(m => m.Color = null); } } } } }
public override void ApplyModifiers(ref string finalOutput, string nodeData, HTMLActiveModifiers modifiers) { modifiers.Italic = true; ApplyStylingData(nodeData, modifiers); }
public override void RemoveModifiers(ref string finalOutput, HTMLActiveModifiers modifiers) { modifiers.Italic = false; }
public override void ApplyModifiers(ref string finalOutput, string nodeData, HTMLActiveModifiers modifiers) { finalOutput += "\\n"; ApplyStylingData(nodeData, modifiers); }
public override void RemoveModifiers(ref string finalOutput, HTMLActiveModifiers modifiers) { RemoveStylingData(modifiers); }
public abstract void RemoveModifiers(ref string finalOutput, HTMLActiveModifiers modifiers);
public abstract void ApplyModifiers(ref string finalOutput, string nodeData, HTMLActiveModifiers modifiers);
public override void RemoveModifiers(ref string finalOutput, HTMLActiveModifiers modifiers) { modifiers.Strikethrough = false; }
public override void RemoveModifiers(ref string finalOutput, HTMLActiveModifiers modifiers) { modifiers.Color = null; }