Ejemplo n.º 1
0
        private static JObject ToJObject(ClassificationSettings classification)
        {
            var jClassification = new JObject();

            jClassification.Add(nameof(classification.Name), new JValue(classification.Name));
            if (classification.Background.HasValue)
            {
                jClassification.Add(nameof(classification.Background), new JValue(classification.Background.Value.ToString()));
            }
            if (classification.Foreground.HasValue)
            {
                jClassification.Add(nameof(classification.Foreground), new JValue(classification.Foreground.Value.ToString()));
            }
            if (!string.IsNullOrWhiteSpace(classification.FontFamily))
            {
                jClassification.Add(nameof(classification.FontFamily), new JValue(classification.FontFamily));
            }
            if (!string.IsNullOrWhiteSpace(classification.FontStyle))
            {
                jClassification.Add(nameof(classification.FontStyle), new JValue(classification.FontStyle));
            }

            jClassification
            .AppendProperty(nameof(classification.IsBold), classification.IsBold)
            .AppendProperty(nameof(classification.FontStretch), classification.FontStretch)
            .AppendProperty(nameof(classification.IsOverline), classification.IsOverline)
            .AppendProperty(nameof(classification.IsUnderline), classification.IsUnderline)
            .AppendProperty(nameof(classification.IsStrikethrough), classification.IsStrikethrough)
            .AppendProperty(nameof(classification.IsBaseline), classification.IsBaseline)
            .AppendProperty(nameof(classification.FontRenderingSize), classification.FontRenderingSize)
            .AppendProperty(nameof(classification.IsDisabled), classification.IsDisabled)
            .AppendProperty(nameof(classification.IsDisabledInEditor), classification.IsDisabledInEditor)
            .AppendProperty(nameof(classification.IsDisabledInQuickInfo), classification.IsDisabledInQuickInfo)
            .AppendProperty(nameof(classification.IsDisabledInXml), classification.IsDisabledInXml);

            return(jClassification);
        }