/// <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> /// 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); }