コード例 #1
0
    public StyleSnippet Clone()
    {
        StyleSnippet s = new StyleSnippet()
        {
            Id        = Id,
            TextStyle = TextStyle,
            Snippets  = Snippets
        };

        if (hasColor)
        {
            s.Color = Color;
        }
        return(s);
    }
コード例 #2
0
    // 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());
    }
コード例 #3
0
	public static void ApplySnippets (this TemplateSettings settings, StyleSnippet[] snippets) {

		foreach (StyleSnippet snippet in snippets)
			snippet.Apply (settings);
	}
コード例 #4
0
	public StyleSnippet Clone () {
		StyleSnippet s = new StyleSnippet () {
			Id = Id,
			TextStyle = TextStyle,
			Snippets = Snippets
		};
		if (hasColor)
			s.Color = Color;
		return s;
	}