當前位置: 首頁>>代碼示例>>C#>>正文


C# Paragraph.ToString方法代碼示例

本文整理匯總了C#中Nikse.SubtitleEdit.Logic.Paragraph.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# Paragraph.ToString方法的具體用法?C# Paragraph.ToString怎麽用?C# Paragraph.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Nikse.SubtitleEdit.Logic.Paragraph的用法示例。


在下文中一共展示了Paragraph.ToString方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TestToStringNewParagraph

 public void TestToStringNewParagraph()
 {
     string expectedOutput = "00:00:00,000 --> 00:00:00,000 ";
     var paragraph = new Paragraph();
     string actualOutput = paragraph.ToString();
     Assert.AreEqual(expectedOutput, actualOutput);
 }
開發者ID:AsenTahchiyski,項目名稱:SoftUni-Projects,代碼行數:7,代碼來源:ParagraphTest.cs

示例2: IsFixAllowed

 private bool IsFixAllowed(Paragraph p)
 {
     foreach (ListViewItem item in listViewFixes.Items)
     {
         if (item.Tag.ToString() == p.ToString())
             return item.Checked;
     }
     return false;
 }
開發者ID:paconaranjo,項目名稱:subtitleedit,代碼行數:9,代碼來源:RemoveTextFromHearImpaired.cs

示例3: MoveStartTime

        private int MoveStartTime(string fixAction, int noOfShortDisplayTimes, Paragraph p, Paragraph temp, Paragraph next)
        {
            if (AllowFix(p, fixAction))
            {
                string oldCurrent = p.ToString();
                if (next != null && next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines > p.EndTime.TotalMilliseconds)
                    p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MininumMillisecondsBetweenLines;
                p.StartTime.TotalMilliseconds = p.EndTime.TotalMilliseconds - temp.Duration.TotalMilliseconds;

                _totalFixes++;
                noOfShortDisplayTimes++;
                AddFixToListView(p, fixAction, oldCurrent, p.ToString());
            }
            return noOfShortDisplayTimes;
        }
開發者ID:nguansak,項目名稱:subtitleedit,代碼行數:15,代碼來源:FixCommonErrors.cs

示例4: FixOverlappingDisplayTimes

        public void FixOverlappingDisplayTimes()
        {
            // negative display time
            string fixAction = _language.FixOverlappingDisplayTime;
            int noOfOverlappingDisplayTimesFixed = 0;
            for (int i = 0; i < _subtitle.Paragraphs.Count; i++)
            {
                Paragraph p = _subtitle.Paragraphs[i];
                Paragraph oldP = new Paragraph(p);
                if (p.Duration.TotalMilliseconds < 0) // negative display time...
                {
                    bool isFixed = false;
                    string status = string.Format(_language.StartTimeLaterThanEndTime,
                                                    i + 1, p.StartTime, p.EndTime, p.Text, Environment.NewLine);

                    Paragraph prev = _subtitle.GetParagraphOrDefault(i - 1);
                    Paragraph next = _subtitle.GetParagraphOrDefault(i + 1);

                    double wantedDisplayTime = Utilities.GetOptimalDisplayMilliseconds(p.Text) * 0.9;

                    if (next == null || next.StartTime.TotalMilliseconds > p.StartTime.TotalMilliseconds + wantedDisplayTime)
                    {
                        if (AllowFix(p, fixAction))
                        {
                            p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + wantedDisplayTime;
                            isFixed = true;
                        }
                    }
                    else if (next.StartTime.TotalMilliseconds > p.StartTime.TotalMilliseconds + 500.0)
                    {
                        if (AllowFix(p, fixAction))
                        {
                            p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + 500.0;
                            isFixed = true;
                        }
                    }
                    else if (prev == null || next.StartTime.TotalMilliseconds - wantedDisplayTime > prev.EndTime.TotalMilliseconds)
                    {
                        if (AllowFix(p, fixAction))
                        {
                            p.StartTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - wantedDisplayTime;
                            p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - 1;
                            isFixed = true;
                        }
                    }
                    else
                    {
                        LogStatus(_language.FixOverlappingDisplayTimes, string.Format(_language.UnableToFixStartTimeLaterThanEndTime,
                                                    i + 1, p), true);
                        _totalErrors++;
                    }

                    if (isFixed)
                    {
                        _totalFixes++;
                        noOfOverlappingDisplayTimesFixed++;
                        status = string.Format(_language.XFixedToYZ, status, Environment.NewLine, p);
                        LogStatus(_language.FixOverlappingDisplayTimes, status);
                        AddFixToListView(p, fixAction, oldP.ToString(), p.ToString());
                    }
                }
            }

            // overlapping display time
            for (int i = 1; i < _subtitle.Paragraphs.Count; i++)
            {
                Paragraph p = _subtitle.Paragraphs[i];
                Paragraph prev = _subtitle.GetParagraphOrDefault(i - 1);
                Paragraph target = p; // subtitle to display when clicking on fix in top list view
                if (prev != null)
                    target = prev;
                string oldCurrent = p.ToString();
                string oldPrevious = prev.ToString();
                double prevWantedDisplayTime = Utilities.GetOptimalDisplayMilliseconds(prev.Text, Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds);
                double currentWantedDisplayTime = Utilities.GetOptimalDisplayMilliseconds(p.Text, Configuration.Settings.General.SubtitleMaximumCharactersPerSeconds);
                double prevOptimalDisplayTime = Utilities.GetOptimalDisplayMilliseconds(prev.Text);
                double currentOptimalDisplayTime = Utilities.GetOptimalDisplayMilliseconds(p.Text);
                bool canBeEqual = _format != null && (_format.GetType() == typeof(AdvancedSubStationAlpha) || _format.GetType() == typeof(SubStationAlpha));
                if (!canBeEqual)
                    canBeEqual = Configuration.Settings.Tools.FixCommonErrorsFixOverlapAllowEqualEndStart;

                double diff = prev.EndTime.TotalMilliseconds - p.StartTime.TotalMilliseconds;
                if (prev != null && !prev.StartTime.IsMaxTime && !p.StartTime.IsMaxTime && diff >= 0 && !(canBeEqual && diff == 0))
                {

                    int diffHalf = (int)(diff / 2);
                    if (!Configuration.Settings.Tools.FixCommonErrorsFixOverlapAllowEqualEndStart && p.StartTime.TotalMilliseconds == prev.EndTime.TotalMilliseconds &&
                        prev.Duration.TotalMilliseconds > 100)
                    {
                        if (AllowFix(target, fixAction))
                        {
                            if (!canBeEqual)
                            {
                                bool okEqual = true;
                                if (prev.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds)
                                    prev.EndTime.TotalMilliseconds--;
                                else if (p.Duration.TotalMilliseconds > Configuration.Settings.General.SubtitleMinimumDisplayMilliseconds)
                                    p.StartTime.TotalMilliseconds++;
                                else
                                    okEqual = false;
//.........這裏部分代碼省略.........
開發者ID:nguansak,項目名稱:subtitleedit,代碼行數:101,代碼來源:FixCommonErrors.cs


注:本文中的Nikse.SubtitleEdit.Logic.Paragraph.ToString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。