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


C# Logic.Subtitle类代码示例

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


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

示例1: GetHeaderOrFooter

 public static string GetHeaderOrFooter(string title, Subtitle subtitle, string template)
 {
     template = template.Replace("{title}", title);
     template = template.Replace("{#lines}", subtitle.Paragraphs.Count.ToString(CultureInfo.InvariantCulture));
     template = template.Replace("{tab}", "\t");
     return template;
 }
开发者ID:socialpercon,项目名称:subtitleedit,代码行数:7,代码来源:ExportCustomTextFormat.cs

示例2: Initialize

        public void Initialize(Subtitle subtitle)
        {
            _subtitle = subtitle;

            FindAllNames();
            GeneratePreview();
        }
开发者ID:nguansak,项目名称:subtitleedit,代码行数:7,代码来源:ChangeCasingNames.cs

示例3: Initialize

        public void Initialize(Subtitle subtitle)
        {
            if (subtitle.Paragraphs.Count > 0)
                subtitle.Renumber(subtitle.Paragraphs[0].Number);

            Text = Configuration.Settings.Language.MergeDoubleLines.Title;
            if (!string.IsNullOrEmpty(Configuration.Settings.Language.MergeDoubleLines.MaxMillisecondsBetweenLines)) //TODO: Remove in SE 3.3.4
            {
                labelMaxMillisecondsBetweenLines.Text = Configuration.Settings.Language.MergeDoubleLines.MaxMillisecondsBetweenLines;
                checkBoxIncludeIncrementing.Text = Configuration.Settings.Language.MergeDoubleLines.IncludeIncrementing;
                numericUpDownMaxMillisecondsBetweenLines.Left = labelMaxMillisecondsBetweenLines.Left + labelMaxMillisecondsBetweenLines.Width + 3;
                checkBoxIncludeIncrementing.Left = numericUpDownMaxMillisecondsBetweenLines.Left + numericUpDownMaxMillisecondsBetweenLines.Width + 10;
            }

            listViewFixes.Columns[0].Text = Configuration.Settings.Language.General.Apply;
            listViewFixes.Columns[1].Text = Configuration.Settings.Language.General.LineNumber;
            listViewFixes.Columns[2].Text = Configuration.Settings.Language.MergedShortLines.MergedText;

            buttonOK.Text = Configuration.Settings.Language.General.OK;
            buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
            SubtitleListview1.InitializeLanguage(Configuration.Settings.Language.General, Configuration.Settings);
            Utilities.InitializeSubtitleFont(SubtitleListview1);
            SubtitleListview1.AutoSizeAllColumns(this);
            NumberOfMerges = 0;
            _subtitle = subtitle;
            MergeDoubleLines_ResizeEnd(null, null);
        }
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:27,代码来源:MergeDoubleLines.cs

示例4: DCinemaPropertiesInterop

        public DCinemaPropertiesInterop(Subtitle _subtitle, string _videoFileName)
        {
            InitializeComponent();

            var l = Configuration.Settings.Language.DCinemaProperties;
            Text = l.Title;
            labelSubtitleID.Text = l.SubtitleId;
            labelMovieTitle.Text = l.MovieTitle;
            labelReelNumber.Text = l.ReelNumber;
            labelLanguage.Text = l.Language;
            groupBoxFont.Text = l.Font;
            labelFontId.Text = l.FontId;
            labelFontUri.Text = l.FontUri;
            labelFontColor.Text = l.FontColor;
            buttonFontColor.Text = l.ChooseColor;
            labelEffect.Text = l.FontEffect;
            labelEffectColor.Text = l.FontEffectColor;
            buttonFontEffectColor.Text = l.ChooseColor;
            labelFontSize.Text = l.FontSize;

            this._subtitle = _subtitle;
            this._videoFileName = _videoFileName;

            foreach (CultureInfo x in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
            {
                comboBoxLanguage.Items.Add(x.EnglishName);
            }
            comboBoxLanguage.Sorted = true;

            var ss = Configuration.Settings.SubtitleSettings;
            if (!string.IsNullOrEmpty(ss.CurrentDCinemaSubtitleId))
            {
                textBoxSubtitleID.Text = ss.CurrentDCinemaSubtitleId;
                textBoxMovieTitle.Text = ss.CurrentDCinemaMovieTitle;
                int number;
                if (int.TryParse(ss.CurrentDCinemaReelNumber, out number))
                {
                    if (numericUpDownReelNumber.Minimum <= number && numericUpDownReelNumber.Maximum >= number)
                        numericUpDownReelNumber.Value = number;
                }
                comboBoxLanguage.Text = ss.CurrentDCinemaLanguage;
                textBoxFontID.Text = ss.CurrentDCinemaFontId;
                textBoxFontUri.Text = ss.CurrentDCinemaFontUri;
                panelFontColor.BackColor = ss.CurrentDCinemaFontColor;
                if (ss.CurrentDCinemaFontEffect == "border")
                    comboBoxFontEffect.SelectedIndex = 1;
                else if (ss.CurrentDCinemaFontEffect == "shadow")
                    comboBoxFontEffect.SelectedIndex = 2;
                else
                    comboBoxFontEffect.SelectedIndex = 0;
                panelFontEffectColor.BackColor = ss.CurrentDCinemaFontEffectColor;
                numericUpDownFontSize.Value = ss.CurrentDCinemaFontSize;
                if (numericUpDownTopBottomMargin.Minimum <= Configuration.Settings.SubtitleSettings.DCinemaBottomMargin &&
                   numericUpDownTopBottomMargin.Maximum >= Configuration.Settings.SubtitleSettings.DCinemaBottomMargin)
                    numericUpDownTopBottomMargin.Value = Configuration.Settings.SubtitleSettings.DCinemaBottomMargin;
                else
                    numericUpDownTopBottomMargin.Value = 8;
            }
            FixLargeFonts();
        }
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:60,代码来源:DCinemaPropertiesInterop.cs

示例5: Initialize

        public void Initialize(Subtitle subtitle, bool autoBalance)
        {
            _modeAutoBalance = autoBalance;
            _paragraphs = new List<Paragraph>();

            foreach (Paragraph p in subtitle.Paragraphs)
                _paragraphs.Add(p);

            if (autoBalance)
            {
                labelCondition.Text = Configuration.Settings.Language.AutoBreakUnbreakLines.OnlyBreakLinesLongerThan;
                const int start = 10;
                const int max = 60;
                for (int i = start; i <= max; i++)
                    comboBoxConditions.Items.Add(i.ToString(CultureInfo.InvariantCulture));

                int index = Configuration.Settings.Tools.MergeLinesShorterThan - (start + 1);
                if (index > 0 && index < max)
                    comboBoxConditions.SelectedIndex = index;
                else
                    comboBoxConditions.SelectedIndex = 30;

                AutoBalance();
            }
            else
            {
                labelCondition.Text = Configuration.Settings.Language.AutoBreakUnbreakLines.OnlyUnbreakLinesLongerThan;
                for (int i = 5; i < 51; i++)
                    comboBoxConditions.Items.Add(i.ToString(CultureInfo.InvariantCulture));
                comboBoxConditions.SelectedIndex = 5;

                Unbreak();
            }
        }
开发者ID:athikan,项目名称:subtitleedit,代码行数:34,代码来源:AutoBreakUnbreakLines.cs

示例6: Initialize

        public void Initialize(Subtitle subtitle, string subtitleFileName, string videoFileName, int audioTrackNumber)
        {
            Text = Configuration.Settings.Language.PointSync.Title;
            labelSubtitleFileName.Text = subtitleFileName;
            _subtitle = new Subtitle(subtitle);
            _originalSubtitle = subtitle;
            _subtitleFileName = subtitleFileName;
            _videoFileName = videoFileName;
            _audioTrackNumber = audioTrackNumber;
            SubtitleListview1.Fill(subtitle);
            if (SubtitleListview1.Items.Count > 0)
                SubtitleListview1.Items[0].Selected = true;

            SubtitleListview1.Anchor = AnchorStyles.Left;
            buttonSetSyncPoint.Anchor = AnchorStyles.Left;
            buttonRemoveSyncPoint.Anchor = AnchorStyles.Left;
            labelNoOfSyncPoints.Anchor = AnchorStyles.Left;
            listBoxSyncPoints.Anchor = AnchorStyles.Left;
            groupBoxImportResult.Anchor = AnchorStyles.Left;
            labelOtherSubtitleFileName.Visible = false;
            subtitleListView2.Visible = false;
            buttonFindTextOther.Visible = false;
            groupBoxImportResult.Width = listBoxSyncPoints.Left + listBoxSyncPoints.Width + 20;
            Width = groupBoxImportResult.Left + groupBoxImportResult.Width + 15;
            SubtitleListview1.Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Right;
            buttonSetSyncPoint.Anchor = AnchorStyles.Right;
            buttonRemoveSyncPoint.Anchor = AnchorStyles.Right;
            labelNoOfSyncPoints.Anchor = AnchorStyles.Right;
            listBoxSyncPoints.Anchor = AnchorStyles.Right;
            groupBoxImportResult.Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Right;
            buttonFindText.Left = SubtitleListview1.Left + SubtitleListview1.Width - buttonFindText.Width;
            Width = 800;
            groupBoxImportResult.Width = Width - groupBoxImportResult.Left * 3;
            MinimumSize = new Size(Width - 50, MinimumSize.Height);
        }
开发者ID:KatyaMarincheva,项目名称:SubtitleEditOriginal,代码行数:35,代码来源:SyncPointsSync.cs

示例7: TimedTextStyles

        public TimedTextStyles(Subtitle subtitle)
        {
            InitializeComponent();

            _subtitle = subtitle;
            _xml = new XmlDocument();
            try
            {
                _xml.LoadXml(subtitle.Header);
                var xnsmgr = new XmlNamespaceManager(_xml.NameTable);
                xnsmgr.AddNamespace("ttml", "http://www.w3.org/ns/ttml");
                if (_xml.DocumentElement.SelectSingleNode("ttml:head", xnsmgr) == null)
                    _xml.LoadXml(new TimedText10().ToText(new Subtitle(), "tt")); // load default xml
            }
            catch
            {
                _xml.LoadXml(new TimedText10().ToText(new Subtitle(), "tt")); // load default xml
            }
            _nsmgr = new XmlNamespaceManager(_xml.NameTable);
            _nsmgr.AddNamespace("ttml", "http://www.w3.org/ns/ttml");
            _xmlHead = _xml.DocumentElement.SelectSingleNode("ttml:head", _nsmgr);

            foreach (FontFamily ff in FontFamily.Families)
                comboBoxFontName.Items.Add(ff.Name.Substring(0, 1).ToLower() + ff.Name.Substring(1));

            InitializeListView();

            _previewTimer.Interval = 200;
            _previewTimer.Tick += RefreshTimerTick;
        }
开发者ID:rragu,项目名称:subtitleedit,代码行数:30,代码来源:TimedTextStyles.cs

示例8: Initialize

        public void Initialize(Subtitle subtitle1, string subtitleFileName1, string title)
        {
            subtitleListView1.UseSyntaxColoring = false;
            subtitleListView2.UseSyntaxColoring = false;

            Compare_Resize(null, null);
            labelStatus.Text = string.Empty;
            _subtitle1 = subtitle1;
            labelSubtitle1.Text = subtitleFileName1;
            if (string.IsNullOrEmpty(subtitleFileName1))
                labelSubtitle1.Text = title;
            subtitleListView1.Fill(subtitle1);

            if (!string.IsNullOrEmpty(subtitleFileName1))
            {
                try
                {
                    openFileDialog1.InitialDirectory = Path.GetDirectoryName(subtitleFileName1);
                }
                catch
                {
                }
            }

            openFileDialog1.Filter = Utilities.GetOpenDialogFilter();
            subtitleListView1.SelectIndexAndEnsureVisible(0);
            subtitleListView2.SelectIndexAndEnsureVisible(0);
            _language1 = Utilities.AutoDetectGoogleLanguage(_subtitle1);
        }
开发者ID:nshayanfar,项目名称:subtitleedit,代码行数:29,代码来源:Compare.cs

示例9: InitializeFixCommonErrorsLine

 private static void InitializeFixCommonErrorsLine(Nikse.SubtitleEdit.Forms.FixCommonErrors target, string line, string line2)
 {
     var subtitle = new Subtitle();
     subtitle.Paragraphs.Add(new Paragraph(line, 100, 10000));
     subtitle.Paragraphs.Add(new Paragraph(line2, 10001, 30000));
     target.Initialize(subtitle, new Nikse.SubtitleEdit.Logic.SubtitleFormats.SubRip(), System.Text.Encoding.UTF8);
 }
开发者ID:athikan,项目名称:subtitleedit,代码行数:7,代码来源:FixCommonErrorsTest.cs

示例10: Initialize

        internal void Initialize(Logic.Subtitle subtitle, string fileName)
        {
            _subtitle = subtitle;
            _fileName = fileName;
            textBoxText.ReadOnly = true;
            comboBoxTimeCodeSeperator.SelectedIndex = 0;
            GeneratePreview();

            comboBoxEncoding.Items.Clear();
            int encodingSelectedIndex = 0;
            comboBoxEncoding.Items.Add(Encoding.UTF8.EncodingName);
            foreach (EncodingInfo ei in Encoding.GetEncodings())
            {
                if (ei.Name != Encoding.UTF8.BodyName)
                {
                    if (ei.Name != Encoding.UTF8.BodyName && ei.CodePage >= 949 && !ei.DisplayName.Contains("EBCDIC") && ei.CodePage != 1047)
                    {
                        comboBoxEncoding.Items.Add(ei.CodePage + ": " + ei.DisplayName);
                        if (ei.Name == Configuration.Settings.General.DefaultEncoding)
                            encodingSelectedIndex = comboBoxEncoding.Items.Count - 1;
                    }
                }
            }
            comboBoxEncoding.SelectedIndex = encodingSelectedIndex;
        }
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:25,代码来源:ExportText.cs

示例11: AddOrRemove

 internal void AddOrRemove(Subtitle subtitle)
 {
     if (groupBoxGenerate.Enabled)
         AddWaterMark(subtitle, textBoxWatermark.Text);
     else
         RemoveWaterMark(subtitle);
 }
开发者ID:nguansak,项目名称:subtitleedit,代码行数:7,代码来源:Watermark.cs

示例12: StylesForm

        protected StylesForm(Subtitle subtitle)
        {
            _subtitle = subtitle;

            _previewTimer.Interval = 200;
            _previewTimer.Tick += PreviewTimerTick;
        }
开发者ID:socialpercon,项目名称:subtitleedit,代码行数:7,代码来源:StylesForm.cs

示例13: Initialize

        internal void Initialize(Ebu.EbuGeneralSubtitleInformation header, byte justificationCode, string fileName, Subtitle subtitle)
        {
            _header = header;
            _subtitle = subtitle;

            FillFromHeader(header);
            if (!string.IsNullOrEmpty(fileName))
            {
                try
                {
                    FillHeaderFromFile(fileName);
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("EbuOptions unable to read existing file: " + fileName + "  - " + ex.Message);
                }
                string title = Path.GetFileNameWithoutExtension(fileName);
                if (title.Length > 32)
                    title = title.Substring(0, 32).Trim();
                textBoxOriginalProgramTitle.Text = title;
            }

            comboBoxJustificationCode.SelectedIndex = justificationCode;

            this.Text = Configuration.Settings.Language.EbuSaveOtpions.Title;
            buttonOK.Text = Configuration.Settings.Language.General.OK;
            buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
        }
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:28,代码来源:EbuSaveOptions.cs

示例14: GeneratePreview

 private void GeneratePreview()
 {
     Subtitle subtitle = new Subtitle();
     var p1 = new Paragraph("Line 1a." + Environment.NewLine + "Line 1b.", 1000, 3500);
     string start1 = GetTimeCode(p1.StartTime, comboBoxTimeCode.Text);
     string end1 = GetTimeCode(p1.EndTime, comboBoxTimeCode.Text);
     var p2 = new Paragraph("Line 2a." + Environment.NewLine + "Line 2b.", 1000, 3500);
     string start2 = GetTimeCode(p2.StartTime, comboBoxTimeCode.Text);
     string end2 = GetTimeCode(p2.EndTime, comboBoxTimeCode.Text);
     subtitle.Paragraphs.Add(p1);
     subtitle.Paragraphs.Add(p2);
     try
     {
         string newLine = comboBoxNewLine.Text.Replace(Configuration.Settings.Language.ExportCustomTextFormat.DoNotModify, EnglishDoNoModify);
         string template = GetParagraphTemplate(textBoxParagraph.Text);
         textBoxPreview.Text = GetHeaderOrFooter("Demo", subtitle, textBoxHeader.Text) +
                               GetParagraph(template, start1, end1, GetText(p1.Text, newLine), GetText("Linje 1a." + Environment.NewLine + "Line 1b.", newLine), 0, p1.Duration, comboBoxTimeCode.Text) +
                               GetParagraph(template, start2, end2, GetText(p2.Text, newLine), GetText("Linje 2a." + Environment.NewLine + "Line 2b.", newLine), 1, p2.Duration, comboBoxTimeCode.Text) +
                               GetHeaderOrFooter("Demo", subtitle, textBoxFooter.Text);
     }
     catch (Exception ex)
     {
         textBoxPreview.Text = ex.Message;
     }
 }
开发者ID:athikan,项目名称:subtitleedit,代码行数:25,代码来源:ExportCustomTextFormat.cs

示例15: StylesForm

        /// <summary>
        /// Initializes a new instance of the <see cref="StylesForm"/> class.
        /// </summary>
        /// <param name="subtitle">
        /// The subtitle.
        /// </param>
        protected StylesForm(Subtitle subtitle)
        {
            this._subtitle = subtitle;

            this._previewTimer.Interval = 200;
            this._previewTimer.Tick += this.PreviewTimerTick;
        }
开发者ID:KatyaMarincheva,项目名称:SubtitleEditOriginal,代码行数:13,代码来源:StylesForm.cs


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