当前位置: 首页>>代码示例>>C#>>正文


C# SubtitleFormats.AdvancedSubStationAlpha类代码示例

本文整理汇总了C#中Nikse.SubtitleEdit.Logic.SubtitleFormats.AdvancedSubStationAlpha的典型用法代码示例。如果您正苦于以下问题:C# AdvancedSubStationAlpha类的具体用法?C# AdvancedSubStationAlpha怎么用?C# AdvancedSubStationAlpha使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AdvancedSubStationAlpha类属于Nikse.SubtitleEdit.Logic.SubtitleFormats命名空间,在下文中一共展示了AdvancedSubStationAlpha类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AssSimpleBold

 public void AssSimpleBold()
 {
     var target = new AdvancedSubStationAlpha();
     var subtitle = new Subtitle();
     target.LoadSubtitle(subtitle, GetAssLines(@"{\b1}Bold{\b0}"), null);
     string actual = subtitle.Paragraphs[0].Text;
     string expected = "<b>Bold</b>";
     Assert.AreEqual(expected, actual);
 }
开发者ID:socialpercon,项目名称:subtitleedit,代码行数:9,代码来源:SubtitleFormatsTest.cs

示例2: AssSimpleFontColor1

 public void AssSimpleFontColor1()
 {
     var target = new AdvancedSubStationAlpha();
     var subtitle = new Subtitle();
     target.LoadSubtitle(subtitle, GetAssLines(@"{\c&HFF&}Font"), null);
     string actual = subtitle.Paragraphs[0].Text;
     string expected = "<font color=\"#ff0000\">Font</font>";
     Assert.AreEqual(expected, actual);
 }
开发者ID:socialpercon,项目名称:subtitleedit,代码行数:9,代码来源:SubtitleFormatsTest.cs

示例3: AssFontNameAndSize

 public void AssFontNameAndSize()
 {
     var target = new AdvancedSubStationAlpha();
     var subtitle = new Subtitle();
     target.LoadSubtitle(subtitle, GetAssLines(@"{\fnViner Hand ITC\fs28}Testing"), null);
     string actual = subtitle.Paragraphs[0].Text;
     const string expected = "<font face=\"Viner Hand ITC\" size=\"28\">Testing</font>";
     Assert.AreEqual(expected, actual);
 }
开发者ID:socialpercon,项目名称:subtitleedit,代码行数:9,代码来源:SubtitleFormatsTest.cs

示例4: LoadMatroskaSubtitleForSync

        internal Subtitle LoadMatroskaSubtitleForSync(MatroskaSubtitleInfo matroskaSubtitleInfo, string fileName)
        {
            Subtitle subtitle = new Subtitle();
            bool isValid;
            bool isSsa = false;
            var matroska = new Matroska();
            SubtitleFormat format;

            if (matroskaSubtitleInfo.CodecId.ToUpper() == "S_VOBSUB")
            {
                return subtitle;
            }
            if (matroskaSubtitleInfo.CodecId.ToUpper() == "S_HDMV/PGS")
            {
                return subtitle;
            }

            List<SubtitleSequence> sub = matroska.GetMatroskaSubtitle(fileName, (int)matroskaSubtitleInfo.TrackNumber, out isValid, MatroskaProgress);
            if (isValid)
            {
                 if (matroskaSubtitleInfo.CodecPrivate.ToLower().Contains("[script info]"))
                {
                    if (matroskaSubtitleInfo.CodecPrivate.ToLower().Contains("[V4 Styles]".ToLower()))
                        format = new SubStationAlpha();
                    else
                        format = new AdvancedSubStationAlpha();
                    isSsa = true;
                }
                else
                {
                    format = new SubRip();
                }

                if (isSsa)
                {
                    foreach (Paragraph p in LoadMatroskaSSa(matroskaSubtitleInfo, fileName, format, sub).Paragraphs)
                    {
                        subtitle.Paragraphs.Add(p);
                    }
                }
                else
                {
                    foreach (SubtitleSequence p in sub)
                    {
                        subtitle.Paragraphs.Add(new Paragraph(p.Text, p.StartMilliseconds, p.EndMilliseconds));
                    }
                }

            }
            return subtitle;
        }
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:51,代码来源:Main.cs

示例5: LoadMatroskaSubtitleForSync

        private Subtitle LoadMatroskaSubtitleForSync(MatroskaTrackInfo matroskaSubtitleInfo, MatroskaFile matroska)
        {
            var subtitle = new Subtitle();
            bool isSsa = false;

            if (matroskaSubtitleInfo.CodecId.Equals("S_VOBSUB", StringComparison.OrdinalIgnoreCase))
            {
                return subtitle;
            }

            if (matroskaSubtitleInfo.CodecId.Equals("S_HDMV/PGS", StringComparison.OrdinalIgnoreCase))
            {
                return subtitle;
            }

            SubtitleFormat format;
            if (matroskaSubtitleInfo.CodecPrivate.Contains("[script info]", StringComparison.OrdinalIgnoreCase))
            {
                if (matroskaSubtitleInfo.CodecPrivate.Contains("[V4 Styles]", StringComparison.OrdinalIgnoreCase))
                {
                    format = new SubStationAlpha();
                }
                else
                {
                    format = new AdvancedSubStationAlpha();
                }

                isSsa = true;
            }
            else
            {
                format = new SubRip();
            }

            var sub = matroska.GetSubtitle(matroskaSubtitleInfo.TrackNumber, this.MatroskaProgress);
            TaskbarList.SetProgressState(this.Handle, TaskbarButtonProgressFlags.NoProgress);
            if (isSsa)
            {
                foreach (var p in Utilities.LoadMatroskaSSA(matroskaSubtitleInfo, matroska.Path, format, sub).Paragraphs)
                {
                    subtitle.Paragraphs.Add(p);
                }
            }
            else
            {
                foreach (var p in sub)
                {
                    subtitle.Paragraphs.Add(new Paragraph(p.Text, p.Start, p.End));
                }
            }

            return subtitle;
        }
开发者ID:AsenTahchiyski,项目名称:SoftUni-Projects,代码行数:53,代码来源:Main.cs

示例6: AssSimpleFontColorAndItalic

 public void AssSimpleFontColorAndItalic()
 {
     var target = new AdvancedSubStationAlpha();
     var subtitle = new Subtitle();
     target.LoadSubtitle(subtitle, GetAssLines(@"{\1c&HFFFF00&\i1}CYAN{\i0}"), null);
     string actual = subtitle.Paragraphs[0].Text;
     const string expected = "<font color=\"#00ffff\"><i>CYAN</i></font>";
     Assert.AreEqual(expected, actual);
 }
开发者ID:KatyaMarincheva,项目名称:SubtitleEditOriginal,代码行数:9,代码来源:SubtitleFormatsTest.cs

示例7: AssSimpleFontName

 public void AssSimpleFontName()
 {
     var target = new AdvancedSubStationAlpha();
     var subtitle = new Subtitle();
     target.LoadSubtitle(subtitle, GetAssLines(@"{\fnArial}Font"), null);
     string actual = subtitle.Paragraphs[0].Text;
     const string expected = "<font face=\"Arial\">Font</font>";
     Assert.AreEqual(expected, actual);
 }
开发者ID:KatyaMarincheva,项目名称:SubtitleEditOriginal,代码行数:9,代码来源:SubtitleFormatsTest.cs

示例8: AssSimpleUnderline

 public void AssSimpleUnderline()
 {
     var target = new AdvancedSubStationAlpha();
     var subtitle = new Subtitle();
     target.LoadSubtitle(subtitle, GetAssLines(@"{\u1}Underline{\u0}"), null);
     string actual = subtitle.Paragraphs[0].Text;
     const string expected = "<u>Underline</u>";
     Assert.AreEqual(expected, actual);
 }
开发者ID:KatyaMarincheva,项目名称:SubtitleEditOriginal,代码行数:9,代码来源:SubtitleFormatsTest.cs

示例9: AssSimpleItalic

 public void AssSimpleItalic()
 {
     var target = new AdvancedSubStationAlpha();
     var subtitle = new Subtitle();
     target.LoadSubtitle(subtitle, GetAssLines(@"{\i1}Italic{\i0}"), null);
     string actual = subtitle.Paragraphs[0].Text;
     const string expected = "<i>Italic</i>";
     Assert.AreEqual(expected, actual);
 }
开发者ID:KatyaMarincheva,项目名称:SubtitleEditOriginal,代码行数:9,代码来源:SubtitleFormatsTest.cs

示例10: ButtonStylesClick

 private void ButtonStylesClick(object sender, EventArgs e)
 {
     SubStationAlphaStyles form = null;
     try
     {
         var assa = new AdvancedSubStationAlpha();
         if (comboBoxSubtitleFormats.Text == assa.Name)
         {
             form = new SubStationAlphaStyles(new Subtitle(), assa);
             form.MakeOnlyOneStyle();
             if (form.ShowDialog(this) == DialogResult.OK)
             {
                 _assStyle = form.Header;
             }
         }
         else
         {
             var ssa = new SubStationAlpha();
             if (comboBoxSubtitleFormats.Text == ssa.Name)
             {
                 form = new SubStationAlphaStyles(new Subtitle(), ssa);
                 if (form.ShowDialog(this) == DialogResult.OK)
                 {
                     _ssaStyle = form.Header;
                 }
             }
         }
     }
     finally
     {
         if (form != null)
         {
             form.Dispose();
         }
     }
 }
开发者ID:KatyaMarincheva,项目名称:SubtitleEditOriginal,代码行数:36,代码来源:BatchConvert.cs

示例11: buttonRemoveAll_Click

 private void buttonRemoveAll_Click(object sender, EventArgs e)
 {
     listViewStyles.Items.Clear();
     var sub = new Subtitle();
     if (_isSubStationAlpha)
     {
         var ssa = new SubStationAlpha();
         string text = ssa.ToText(sub, string.Empty);
         string[] lineArray = text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
         var lines = new List<string>();
         foreach (string line in lineArray)
             lines.Add(line);
         ssa.LoadSubtitle(sub, lines, string.Empty);
         Header = Header.Remove(Header.IndexOf("[V4 Styles]")) + sub.Header.Substring(sub.Header.IndexOf("[V4 Styles]"));
     }
     else
     {
         var ass = new AdvancedSubStationAlpha();
         string text = ass.ToText(sub, string.Empty);
         string[] lineArray = text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
         var lines = new List<string>();
         foreach (string line in lineArray)
             lines.Add(line);
         ass.LoadSubtitle(sub, lines, string.Empty);
         Header = Header.Remove(Header.IndexOf("[V4+ Styles]")) + sub.Header.Substring(sub.Header.IndexOf("[V4+ Styles]"));
     }
     InitializeListView();
 }
开发者ID:rragu,项目名称:subtitleedit,代码行数:28,代码来源:SubStationAlphaStyles.cs

示例12: ResetHeader

 private void ResetHeader()
 {
     SubtitleFormat format;
     if (_isSubStationAlpha)
         format = new SubStationAlpha();
     else
         format = new AdvancedSubStationAlpha();
     var sub = new Subtitle();
     string text = format.ToText(sub, string.Empty);
     string[] lineArray = text.Replace(Environment.NewLine, "\n").Split('\n');
     var lines = new List<string>();
     foreach (string line in lineArray)
         lines.Add(line);
     format.LoadSubtitle(sub, lines, string.Empty);
     Header = sub.Header;
 }
开发者ID:rragu,项目名称:subtitleedit,代码行数:16,代码来源:SubStationAlphaStyles.cs

示例13: LoadMatroskaTextSubtitle

        internal static SubtitleFormat LoadMatroskaTextSubtitle(MatroskaTrackInfo matroskaSubtitleInfo, MatroskaFile matroska, List<MatroskaSubtitle> sub, Subtitle subtitle)
        {
            if (subtitle == null)
                throw new ArgumentNullException("subtitle");
            subtitle.Paragraphs.Clear();

            var isSsa = false;
            SubtitleFormat format = new SubRip();
            if (matroskaSubtitleInfo.CodecPrivate.Contains("[script info]", StringComparison.OrdinalIgnoreCase))
            {
                if (matroskaSubtitleInfo.CodecPrivate.Contains("[V4 Styles]", StringComparison.OrdinalIgnoreCase))
                    format = new SubStationAlpha();
                else
                    format = new AdvancedSubStationAlpha();
                isSsa = true;
            }

            if (isSsa)
            {
                foreach (var p in LoadMatroskaSSA(matroskaSubtitleInfo, matroska.Path, format, sub).Paragraphs)
                {
                    subtitle.Paragraphs.Add(p);
                }

                if (!string.IsNullOrEmpty(matroskaSubtitleInfo.CodecPrivate))
                {
                    bool eventsStarted = false;
                    bool fontsStarted = false;
                    bool graphicsStarted = false;
                    var header = new StringBuilder();
                    foreach (string line in matroskaSubtitleInfo.CodecPrivate.Replace(Environment.NewLine, "\n").Split('\n'))
                    {
                        if (!eventsStarted && !fontsStarted && !graphicsStarted)
                        {
                            header.AppendLine(line);
                        }

                        if (line.TrimStart().StartsWith("dialog:", StringComparison.OrdinalIgnoreCase))
                        {
                            eventsStarted = true;
                            fontsStarted = false;
                            graphicsStarted = false;
                        }
                        else if (line.Trim().Equals("[events]", StringComparison.OrdinalIgnoreCase))
                        {
                            eventsStarted = true;
                            fontsStarted = false;
                            graphicsStarted = false;
                        }
                        else if (line.Trim().Equals("[fonts]", StringComparison.OrdinalIgnoreCase))
                        {
                            eventsStarted = false;
                            fontsStarted = true;
                            graphicsStarted = false;
                        }
                        else if (line.Trim().Equals("[graphics]", StringComparison.OrdinalIgnoreCase))
                        {
                            eventsStarted = false;
                            fontsStarted = false;
                            graphicsStarted = true;
                        }
                    }
                    subtitle.Header = header.ToString().TrimEnd();
                    if (!subtitle.Header.Contains("[events]", StringComparison.OrdinalIgnoreCase))
                    {
                        subtitle.Header += Environment.NewLine + Environment.NewLine + "[Events]" + Environment.NewLine;
                    }
                }
            }
            else
            {
                foreach (var p in sub)
                {
                    subtitle.Paragraphs.Add(new Paragraph(p.Text, p.Start, p.End));
                }
            }
            subtitle.Renumber();
            return format;
        }
开发者ID:aisam97,项目名称:subtitleedit,代码行数:79,代码来源:Utilities.cs

示例14: ResetHeader

 private void ResetHeader()
 {
     SubtitleFormat format;
     if (_isSubStationAlpha)
         format = new SubStationAlpha();
     else
         format = new AdvancedSubStationAlpha();
     var sub = new Subtitle();
     string text = format.ToText(sub, string.Empty);
     var lines = new List<string>();
     foreach (string line in text.SplitToLines())
         lines.Add(line);
     format.LoadSubtitle(sub, lines, string.Empty);
     _header = sub.Header;
 }
开发者ID:socialpercon,项目名称:subtitleedit,代码行数:15,代码来源:SubStationAlphaStyles.cs

示例15: LoadMatroskaSubtitle

        internal void LoadMatroskaSubtitle(MatroskaSubtitleInfo matroskaSubtitleInfo, string fileName, bool batchMode)
        {
            bool isValid;
            bool isSsa = false;
            var matroska = new Matroska();
            SubtitleFormat format;

            if (matroskaSubtitleInfo.CodecId.ToUpper() == "S_VOBSUB")
            {
                if (batchMode)
                    return;
                LoadVobSubFromMatroska(matroskaSubtitleInfo, fileName);
                return;
            }
            if (matroskaSubtitleInfo.CodecId.ToUpper() == "S_HDMV/PGS")
            {
                if (batchMode)
                    return;
                LoadBluRaySubFromMatroska(matroskaSubtitleInfo, fileName);
                return;
            }

            ShowStatus(_language.ParsingMatroskaFile);
            Refresh();
            Cursor.Current = Cursors.WaitCursor;
            List<SubtitleSequence> sub = matroska.GetMatroskaSubtitle(fileName, (int)matroskaSubtitleInfo.TrackNumber, out isValid, MatroskaProgress);
            Cursor.Current = Cursors.Default;
            if (isValid)
            {
                MakeHistoryForUndo(_language.BeforeImportFromMatroskaFile);
                _subtitleListViewIndex = -1;
                if (!batchMode)
                    ResetSubtitle();
                _subtitle.Paragraphs.Clear();

                if (matroskaSubtitleInfo.CodecPrivate.ToLower().Contains("[script info]"))
                {
                    if (matroskaSubtitleInfo.CodecPrivate.ToLower().Contains("[V4 Styles]".ToLower()))
                        format = new SubStationAlpha();
                    else
                        format = new AdvancedSubStationAlpha();
                    isSsa = true;
                    if (_networkSession == null)
                    {
                        SubtitleListview1.ShowExtraColumn(Configuration.Settings.Language.General.Style);
                        SubtitleListview1.DisplayExtraFromExtra = true;
                    }
                }
                else
                {
                    format = new SubRip();
                    if (_networkSession == null && SubtitleListview1.IsExtraColumnVisible)
                        SubtitleListview1.HideExtraColumn();
                }

                comboBoxSubtitleFormats.SelectedIndexChanged -= ComboBoxSubtitleFormatsSelectedIndexChanged;
                SetCurrentFormat(format);
                comboBoxSubtitleFormats.SelectedIndexChanged += ComboBoxSubtitleFormatsSelectedIndexChanged;

                if (isSsa)
                {
                    foreach (Paragraph p in LoadMatroskaSSa(matroskaSubtitleInfo, fileName, format, sub).Paragraphs)
                    {
                        _subtitle.Paragraphs.Add(p);
                    }

                    if (!string.IsNullOrEmpty(matroskaSubtitleInfo.CodecPrivate))
                    {
                        bool eventsStarted = false;
                        bool fontsStarted = false;
                        bool graphicsStarted = false;
                        var header = new StringBuilder();
                        foreach (string line in matroskaSubtitleInfo.CodecPrivate.Replace(Environment.NewLine, "\n").Split('\n'))
                        {
                            if (!eventsStarted && !fontsStarted && !graphicsStarted)
                            {
                                header.AppendLine(line);
                            }
                            else if (line.Trim().ToLower().StartsWith("dialogue:"))
                            {
                                eventsStarted = true;
                                fontsStarted = false;
                                graphicsStarted = false;
                            }
                            else if (line.Trim().ToLower() == "[events]")
                            {
                                eventsStarted = true;
                                fontsStarted = false;
                                graphicsStarted = false;
                            }
                            else if (line.Trim().ToLower() == "[fonts]")
                            {
                                eventsStarted = false;
                                fontsStarted = true;
                                graphicsStarted = false;
                            }
                            else if (line.Trim().ToLower() == "[graphics]")
                            {
                                eventsStarted = false;
                                fontsStarted = false;
//.........这里部分代码省略.........
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:101,代码来源:Main.cs


注:本文中的Nikse.SubtitleEdit.Logic.SubtitleFormats.AdvancedSubStationAlpha类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。