示例#1
0
        private static string EncodeText(string text)
        {
            text = HtmlUtil.FixUpperTags(text);
            bool allItalic = text.StartsWith("<i>") && text.EndsWith("</i>") && Utilities.CountTagInText(text, "<i>") == 1;

            text = text.Replace("<b>", Bold);
            text = text.Replace("</b>", Bold);
            text = text.Replace("<i>", Italic);
            text = text.Replace("</i>", Italic);
            text = text.Replace("<u>", Underline);
            text = text.Replace("</u>", Underline);
            if (allItalic)
            {
                return(text.Replace(Environment.NewLine, "|^I"));
            }
            return(text.Replace(Environment.NewLine, "|"));
        }
示例#2
0
        private static string EncodeText(string input)
        {
            var  text      = HtmlUtil.FixUpperTags(input);
            bool allItalic = text.StartsWith("<i>", StringComparison.Ordinal) && text.EndsWith("</i>", StringComparison.Ordinal) && Utilities.CountTagInText(text, "<i>") == 1;

            text = text.Replace("<b>", Bold);
            text = text.Replace("</b>", Bold);
            text = text.Replace("<i>", Italic);
            text = text.Replace("</i>", Italic);
            text = text.Replace("<u>", Underline);
            text = text.Replace("</u>", Underline);
            text = HtmlUtil.RemoveHtmlTags(text, true);
            if (allItalic)
            {
                return(text.Replace(Environment.NewLine, "^I|^I"));
            }

            return(text.Replace(Environment.NewLine, "|"));
        }
示例#3
0
        private string FixCasing(string text, string lastLine, List <string> namesEtc)
        {
            string original = text;

            if (radioButtonNormal.Checked)
            {
                if (checkBoxOnlyAllUpper.Checked && text != text.ToUpper())
                {
                    return(text);
                }

                if (text.Length > 1)
                {
                    // first all to lower
                    text = text.ToLower().Trim();
                    while (text.Contains("  "))
                    {
                        text = text.Replace("  ", " ");
                    }
                    text = text.Replace(" " + Environment.NewLine, Environment.NewLine);
                    text = text.Replace(Environment.NewLine + " ", Environment.NewLine);

                    var st = new StripableText(text);
                    st.FixCasing(namesEtc, false, true, true, lastLine); // fix all casing but names (that's a seperate option)
                    text = st.MergedString;
                }
            }
            else if (radioButtonUppercase.Checked)
            {
                var st = new StripableText(text);
                text = st.Pre + st.StrippedText.ToUpper() + st.Post;
                text = HtmlUtil.FixUpperTags(text); // tags inside text
            }
            else if (radioButtonLowercase.Checked)
            {
                text = text.ToLower();
            }
            if (original != text)
            {
                _noOfLinesChanged++;
            }
            return(text);
        }
        internal void Initialize(Paragraph paragraph)
        {
            _paragraph = new Paragraph(paragraph);
            if (_paragraph.Text.Length > 3)
            {
                _paragraph.Text = HtmlUtil.FixUpperTags(_paragraph.Text);
            }
            _animation = new List <Paragraph>();

            colorDialog1.Color   = Color.Red;
            labelColor.Text      = Utilities.ColorToHex(colorDialog1.Color);
            panelColor.BackColor = colorDialog1.Color;

            AddToPreview(richTextBoxPreview, paragraph.Text);
            RefreshPreview();
            labelTotalMilliseconds.Text = string.Format("{0:#,##0.000}", paragraph.Duration.TotalMilliseconds / TimeCode.BaseUnit);
            numericUpDownDelay.Maximum  = (decimal)((paragraph.Duration.TotalMilliseconds - 500) / TimeCode.BaseUnit);
            numericUpDownDelay.Minimum  = 0;

            numericUpDownDelay.Left = labelEndDelay.Left + labelEndDelay.Width + 5;
        }
示例#5
0
        private string FixCasing(string text, string lastLine, List <string> nameList, CultureInfo subtitleCulture)
        {
            string original = text;

            if (radioButtonNormal.Checked)
            {
                if (checkBoxOnlyAllUpper.Checked && text != text.ToUpper(subtitleCulture))
                {
                    return(text);
                }

                if (text.Length > 1)
                {
                    // first all to lower
                    text = text.ToLower(subtitleCulture).Trim();
                    text = text.FixExtraSpaces();
                    var st = new StrippableText(text);
                    st.FixCasing(nameList, false, true, true, lastLine); // fix all casing but names (that's a seperate option)
                    text = st.MergedString;
                }
            }
            else if (radioButtonUppercase.Checked)
            {
                var st = new StrippableText(text);
                text = st.Pre + st.StrippedText.ToUpper(subtitleCulture) + st.Post;
                text = HtmlUtil.FixUpperTags(text); // tags inside text
            }
            else if (radioButtonLowercase.Checked)
            {
                text = text.ToLower(subtitleCulture);
            }
            if (original != text)
            {
                _noOfLinesChanged++;
            }
            return(text);
        }