public StyleSnippet Clone() { StyleSnippet s = new StyleSnippet() { Id = Id, TextStyle = TextStyle, Snippets = Snippets }; if (hasColor) { s.Color = Color; } return(s); }
// Applies snippets to the given settings public static void ApplySnippets(this TemplateSettings settings, params string[] ids) { StyleSnippets snippets = new StyleSnippets(); List <StyleSnippet> outSnippets = new List <StyleSnippet> (); for (int i = 0; i < ids.Length; i++) { string[] elementSnippet = ids[i].Split('|'); string snippetId; string[] elementIds = null; if (elementSnippet.Length > 1) { snippetId = elementSnippet[0]; elementIds = new string[elementSnippet.Length - 1]; for (int j = 1; j < elementSnippet.Length; j++) { elementIds[j - 1] = elementSnippet[j]; } } else { snippetId = ids[i]; } if (elementIds == null) { StyleSnippet outSnippet = snippets[snippetId]; outSnippets.Add(outSnippet); } else { for (int j = 0; j < elementIds.Length; j++) { StyleSnippet outSnippet = snippets[snippetId]; outSnippet.Id = elementIds[j]; outSnippets.Add(outSnippet); } } } settings.ApplySnippets(outSnippets.ToArray()); }
public static void ApplySnippets (this TemplateSettings settings, StyleSnippet[] snippets) { foreach (StyleSnippet snippet in snippets) snippet.Apply (settings); }
public StyleSnippet Clone () { StyleSnippet s = new StyleSnippet () { Id = Id, TextStyle = TextStyle, Snippets = Snippets }; if (hasColor) s.Color = Color; return s; }