/// <summary>
        /// Set one extension color definition in the color definition
        /// </summary>
        /// <param name="extension"></param>
        /// <param name="fileColorDefinitionSet"></param>
        public ColorDefinition SetFileColorDefinitionSet(FileExtensionSupported extension, FileColorDefinitionSet fileColorDefinitionSet)
        {
            var json = fileColorDefinitionSet.ToJSON();

            this.JsonObject[extension.ToString()] = JObject.Parse(json);
            return(this);
        }
        /// <summary>
        /// Get a color definition for one extension
        /// </summary>
        /// <param name="extension"></param>
        /// <returns></returns>
        public FileColorDefinitionSet GetFileColorDefinitionSet(FileExtensionSupported extension)
        {
            var map           = GetKeywordColorMap(extension);
            var b             = new FileColorDefinitionSet();
            var mediaColorMap = GetMediaColorMap();

            b.Extension = extension.ToString();

            foreach (var e in map)
            {
                var colorDetail = new ColorDefinitionDetail()
                {
                    Bold      = e.Value.Contains("bold.") || e.Value.Contains("bolditalic."),
                    Italic    = e.Value.Contains("italic.") || e.Value.Contains("bolditalic."),
                    ColorName = e.Value.Replace("bolditalic.", "").Replace("bold.", "").Replace("italic.", "")
                };

                if (colorDetail.ColorName.In(mediaColorMap))
                {
                    colorDetail.Color = mediaColorMap[colorDetail.ColorName];
                }

                b.Add(e.Key, colorDetail);
            }
            return(b);
        }
        /// <summary>
        /// For one file extension return a dictionary, the key is the keyword type the value
        /// is the json string [bol, italic.]colorName
        ///  {
        ///     { "Variable" ,"bold.Peru"     },
        ///     { "Comment"  ,"SeaGreen"      },
        ///     { "Section"  ,"italic.Orange" },
        ///     { "Equal"    ,"Orange"        },
        ///     { "Value"    ,"LightCoral"    },
        ///     { "Default"  ,"White"         }
        ///  }
        /// </summary>
        /// <param name="fileExtension"></param>
        /// <returns></returns>
        public Dictionary <string, string> GetKeywordColorMap(FileExtensionSupported fileExtension)
        {
            var d = new Dictionary <string, string>();

            if (!fileExtension.ToString().In(GetFileExtensions()))
            {
                throw new ArgumentException("File extension:{0} in file:{1}not found".format(fileExtension, this.FileName));
            }

            var ext = this.JsonObject[fileExtension.ToString()] as JObject;

            foreach (var e in ext)
            {
                d.Add(e.Key, e.Value.ToString());
            }

            return(d);
        }
 public string GetColor(FileExtensionSupported fileExtension, string keyword, string defaultValue = null)
 {
     return(this.GetColor(fileExtension.ToString(), keyword, defaultValue));
 }