private static void Dump(List <ColorRange> ranges, string text, string line) { Main.Log(text + "CCCR Ranges:" + ranges.Count); foreach (var range in ranges) { Main.Log("CCCR range:" + range + " colorset:" + range.ColorSet + " startIndex:" + range.StartIndex + " length:" + range.Length); Main.Log("CCCR text:'" + line.Substring(range.StartIndex, range.Length) + "'"); } }
internal static void ComputeQuickColorizersColorRanges(List <ColorRange> ranges, Settings settings, string line) { var colorizers = settings.QuickColorizers; if (colorizers == null || colorizers.Length == 0) { return; } Main.Log("QCCR colorizers:" + colorizers.Length); foreach (var colorizer in colorizers) { if (!colorizer.Active || string.IsNullOrEmpty(colorizer.Text)) { continue; } var sc = colorizer.IgnoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal; int index = line.IndexOf(colorizer.Text, sc); Main.Log("QCCR test qc:" + colorizer + " sc:" + sc + " index:" + index); if (index < 0) { continue; } if (colorizer.WholeText) { // start if (index > 0) { Main.Log("QCCR IsWholeTextCompatible('" + line[index - 1] + "'):" + IsWholeTextCompatible(line[index - 1])); if (!IsWholeTextCompatible(line[index - 1])) { continue; } } // end if ((index + colorizer.Text.Length) < (line.Length - 1)) { Main.Log("QCCR IsWholeTextCompatible('" + line[index + colorizer.Text.Length] + "'):" + IsWholeTextCompatible(line[index + colorizer.Text.Length])); if (!IsWholeTextCompatible(line[index + colorizer.Text.Length])) { continue; } } } Main.Log("QCCR match '" + line + "'"); var range = CreateColorRange(colorizer.ColorSet, index, colorizer.Text.Length, line); ranges.Add(range); } ranges.Sort(); }
internal static Color ConvertColor(string color, Color defaultValue) { try { return((Color)(new ColorConverter().ConvertFromInvariantString(color))); } #if DEBUG catch (Exception e) { Main.Log("ConvertColor e:" + e); return(defaultValue); } #else catch { return(defaultValue); } #endif }