private void MnuTestMarkLoad_Click(object sender, EventArgs e) { string fileName = @"C:\Program Files (x86)\Notepad++\themes\Black board.xml"; var markColors = MarkColors.FromFile(fileName); MessageBox.Show(markColors.SmartHighLightingForeground.ToString()); }
/// <summary> /// Creates a new instance of "this" class from a Notepad++ style definition XML file. /// </summary> /// <param name="fileName">Name of the XML file.</param> /// <returns>MarkColorsHelper.</returns> public static MarkColorsHelper FromFile(string fileName) { try { var markColors = MarkColors.FromFile(fileName); return(new MarkColorsHelper { SmartHighlight = markColors.SmartHighLightingBackground, Mark1Color = markColors.MarkOneBackground, Mark2Color = markColors.MarkTwoBackground, Mark3Color = markColors.MarkThreeBackground, Mark4Color = markColors.MarkFourBackground, Mark5Color = markColors.MarkFiveBackground, CurrentLineBackground = markColors.CurrentLineBackground }); } catch (Exception ex) { // log the exception.. ExceptionLogAction?.Invoke(ex); // ..and return default.. return(default);