Ejemplo n.º 1
0
        private string Colorize(string input, ColorCode.ILanguage language, System.Func <string, string> htmlEncode)
        {
            System.Threading.Thread colorizeThread = new System.Threading.Thread(InvokeColorize)
            {
                IsBackground = true
            };
            ColorizeData data = new ColorizeData {
                Input = input, Language = language
            };

            colorizeThread.Start(data);
            if (!colorizeThread.Join(5000)) // wait 5 seconds before killing it
            {
                colorizeThread.Abort();
                data.Output = FormatSyntax(input, htmlEncode);
            }

            return(data.Output);
        }
Ejemplo n.º 2
0
        private void InvokeColorize(object data)
        {
            ColorizeData colorizeData = data as ColorizeData;

            colorizeData.Output = codeColorizer.Colorize(colorizeData.Input, colorizeData.Language);
        }