/// <summary>
        /// Enumerates the file managers that encapsulates the
        /// updating logic required to set the specified highlighting color
        /// for the specified path.
        /// </summary>
        /// <param name="color">The color to set for class name highlighting.</param>
        /// <param name="path">
        /// The path of the SHFB installation to update.
        /// </param>
        /// <returns>
        /// The collection of file managers required for installation.
        /// </returns>
        static IEnumerable <FileManager> ClassNameColorSetter(string color, string path)
        {
            List <FileManager> managers = new List <FileManager>();

            #region HIGHLIGHT.CSS

            string colorHexCode = SupportedColors.GetColorHexCode(color);

            FileManager highlightCss = new HighlightCssEditor(
                Path.Combine(path,
                             "PresentationStyles",
                             "Colorizer",
                             "highlight.css"),
                colorHexCode);

            managers.Add(highlightCss);

            #endregion

            #region HIGHLIGHT.XSL

            FileManager highlightXsl = new HighlightXslEditor(
                Path.Combine(path,
                             "PresentationStyles",
                             "Colorizer",
                             "highlight.xsl"));

            managers.Add(highlightXsl);

            #endregion

            return(managers);
        }
Ejemplo n.º 2
0
        public bool ReplaceColor(SupportedColors styleType, string formatToReplace, ref string originalString)
        {
            //If the origin string or formatting is blank just return the orginal string
            if (string.IsNullOrWhiteSpace(originalString))
            {
                return(false);
            }

            //It's all blank anyways
            originalString = originalString.Replace(formatToReplace, string.Empty);

            return(true);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Engine for translating output text with color codes into proper output
        /// </summary>
        /// <param name="message">the text to translate</param>
        /// <returns>translated text</returns>
        public bool ReplaceColor(SupportedColors styleType, string formatToReplace, ref string originalString)
        {
            //If the origin string or formatting is blank just return the orginal string
            if (string.IsNullOrWhiteSpace(originalString) || string.IsNullOrWhiteSpace(formatToReplace))
            {
                return(false);
            }

            string styleElement = SupportedColorTranslations[styleType];

            //If the destination string is blank, just remove them all since they'd come back empty anyways
            if (string.IsNullOrWhiteSpace(styleElement))
            {
                originalString = originalString.Replace(formatToReplace, string.Empty);
            }
            else
            {
                int firstIndex = originalString.IndexOf(formatToReplace);

                if (firstIndex < 0)
                {
                    return(false);
                }
                else
                {
                    int secondIndex = originalString.IndexOf(formatToReplace, firstIndex + formatToReplace.Length);

                    //Yes 1st instance but no second instance? replace them all with empty string to scrub the string.
                    if (secondIndex < 0)
                    {
                        originalString = originalString.Replace(formatToReplace, string.Empty);
                    }
                    else
                    {
                        int lengthToSkip = formatToReplace.Length;

                        originalString = string.Format("{0}<span style=\"{3}\">{1}</span>{2}"
                                                       , firstIndex == 0 ? string.Empty : originalString.Substring(0, firstIndex)
                                                       , originalString.Substring(firstIndex + lengthToSkip, secondIndex - firstIndex - lengthToSkip)
                                                       , originalString.Substring(secondIndex + lengthToSkip)
                                                       , styleElement);
                    }
                }
            }

            return(true);
        }
Ejemplo n.º 4
0
        public bool ReplaceColor(SupportedColors styleType, string formatToReplace, ref string originalString)
        {
            //If the origin string or formatting is blank just return the orginal string
            if (string.IsNullOrWhiteSpace(originalString))
                return false;

            //It's all blank anyways
            originalString = originalString.Replace(formatToReplace, String.Empty);

            return true;
        }
Ejemplo n.º 5
0
 public bool ReplaceColor(SupportedColors styleType, string formatToReplace, ref string originalString)
 {
     throw new NotImplementedException();
 }