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


C# TimeCode.ToString方法代码示例

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


在下文中一共展示了TimeCode.ToString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetCurrentViaEndPositionAndGotoNext

        public void SetCurrentViaEndPositionAndGotoNext(int index)
        {
            Paragraph p = _subtitle.GetParagraphOrDefault(index);
            if (p == null)
                return;

            if (mediaPlayer.VideoPlayer == null || string.IsNullOrEmpty(_videoFileName))
            {
                MessageBox.Show(Configuration.Settings.Language.General.NoVideoLoaded);
                return;
            }

            //if (autoDuration)
            //{
            //    //TODO: auto duration
            //    //TODO: search for start via wave file (must only be minor adjustment)
            //}

            // current movie pos
            double durationTotalMilliseconds = p.Duration.TotalMilliseconds;
            double totalMillisecondsEnd = mediaPlayer.CurrentPosition * 1000.0;

            var tc = new TimeCode(TimeSpan.FromMilliseconds(totalMillisecondsEnd - durationTotalMilliseconds));
            MakeHistoryForUndo(_language.BeforeSetEndAndVideoPosition + "  " + tc.ToString());
            _makeHistoryPaused = true;

            if (p.StartTime.IsMaxTime)
            {
                p.EndTime.TotalSeconds = mediaPlayer.CurrentPosition;
                p.StartTime.TotalMilliseconds = p.EndTime.TotalMilliseconds - Utilities.GetOptimalDisplayMilliseconds(p.Text);
            }
            else
            {
                p.StartTime.TotalMilliseconds = totalMillisecondsEnd - durationTotalMilliseconds;
                p.EndTime.TotalMilliseconds = totalMillisecondsEnd;
            }

            timeUpDownStartTime.TimeCode = p.StartTime;
            var durationInSeconds = (decimal)(p.Duration.TotalSeconds);
            if (durationInSeconds >= numericUpDownDuration.Minimum && durationInSeconds <= numericUpDownDuration.Maximum)
                SetDurationInSeconds((double)durationInSeconds);

            SubtitleListview1.SelectIndexAndEnsureVisible(index+1);
            ShowStatus(string.Format(_language.VideoControls.AdjustedViaEndTime, p.StartTime.ToShortString()));
            audioVisualizer.Invalidate();
            _makeHistoryPaused = false;
        }
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:47,代码来源:Main.cs

示例2: LoadBluRaySubFromMatroska

        private void LoadBluRaySubFromMatroska(MatroskaSubtitleInfo matroskaSubtitleInfo, string fileName)
        {
            if (matroskaSubtitleInfo.ContentEncodingType == 1)
            {
                MessageBox.Show("Encrypted vobsub content not supported");
            }

            bool isValid;
            var matroska = new Matroska();

            ShowStatus(_language.ParsingMatroskaFile);
            Refresh();
            Cursor.Current = Cursors.WaitCursor;
            List<SubtitleSequence> sub = matroska.GetMatroskaSubtitle(fileName, (int)matroskaSubtitleInfo.TrackNumber, out isValid, MatroskaProgress);
            Cursor.Current = Cursors.Default;
            int noOfErrors = 0;
            string lastError = string.Empty;

            if (isValid)
            {
                MakeHistoryForUndo(_language.BeforeImportFromMatroskaFile);
                _subtitleListViewIndex = -1;
                _subtitle.Paragraphs.Clear();
                var subtitles = new List<Nikse.SubtitleEdit.Logic.BluRaySup.BluRaySupParser.PcsData>();
                StringBuilder log = new StringBuilder();
                foreach (SubtitleSequence p in sub)
                {
                    byte[] buffer = null;
                    if (matroskaSubtitleInfo.ContentEncodingType == 0) // compressed with zlib
                    {
                        MemoryStream outStream = new MemoryStream();
                        ComponentAce.Compression.Libs.zlib.ZOutputStream outZStream = new ComponentAce.Compression.Libs.zlib.ZOutputStream(outStream);
                        MemoryStream inStream = new MemoryStream(p.BinaryData);
                        try
                        {
                            CopyStream(inStream, outZStream);
                            buffer = new byte[outZStream.TotalOut];
                            outStream.Position = 0;
                            outStream.Read(buffer, 0, buffer.Length);
                        }
                        catch (Exception exception)
                        {
                            TimeCode tc = new TimeCode(TimeSpan.FromMilliseconds(p.StartMilliseconds));
                            lastError = tc.ToString() + ": " + exception.Message + ": " + exception.StackTrace;
                            noOfErrors++;
                        }
                        finally
                        {
                            outStream.Close();
                            outZStream.Close();
                            inStream.Close();
                        }
                    }
                    else
                    {
                        buffer = p.BinaryData;
                    }
                    if (buffer != null && buffer.Length > 100)
                    {
                        MemoryStream ms = new MemoryStream(buffer);
                        var list = BluRaySupParser.ParseBluRaySup(ms, log, true);
                        foreach (var sup in list)
                        {
                            sup.StartTime = (long)((p.StartMilliseconds - 45) * 90.0);
                            sup.EndTime = (long)((p.EndMilliseconds - 45) * 90.0);
                            subtitles.Add(sup);

                            // fix overlapping
                            if (subtitles.Count > 1 && sub[subtitles.Count - 2].EndMilliseconds > sub[subtitles.Count - 1].StartMilliseconds)
                                subtitles[subtitles.Count - 2].EndTime = subtitles[subtitles.Count - 1].StartTime - 1;
                        }
                        ms.Close();
                    }
                }

                if (noOfErrors > 0)
                {
                    MessageBox.Show(string.Format("{0} errror(s) occured during extraction of bdsup\r\n\r\n{1}", noOfErrors, lastError));
                }

                var formSubOcr = new VobSubOcr();
                _formPositionsAndSizes.SetPositionAndSize(formSubOcr);
                formSubOcr.Initialize(subtitles, Configuration.Settings.VobSubOcr, fileName);
                if (_loading)
                {
                    formSubOcr.Icon = (Icon)this.Icon.Clone();
                    formSubOcr.ShowInTaskbar = true;
                    formSubOcr.ShowIcon = true;
                }
                if (formSubOcr.ShowDialog(this) == DialogResult.OK)
                {
                    MakeHistoryForUndo(_language.BeforeImportingDvdSubtitle);

                    _subtitle.Paragraphs.Clear();
                    SetCurrentFormat(Configuration.Settings.General.DefaultSubtitleFormat);
                    _subtitle.WasLoadedWithFrameNumbers = false;
                    _subtitle.CalculateFrameNumbersFromTimeCodes(CurrentFrameRate);
                    foreach (Paragraph p in formSubOcr.SubtitleFromOcr.Paragraphs)
                    {
                        _subtitle.Paragraphs.Add(p);
//.........这里部分代码省略.........
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:101,代码来源:Main.cs

示例3: ShowEarlierOrLater

        public void ShowEarlierOrLater(double adjustMilliseconds, SelectionChoice selection)
        {
            TimeCode tc = new TimeCode(TimeSpan.FromMilliseconds(adjustMilliseconds));
            MakeHistoryForUndo(_language.BeforeShowSelectedLinesEarlierLater  + ": " + tc.ToString());
            if (adjustMilliseconds < 0)
            {
                if (selection == SelectionChoice.AllLines)
                    ShowStatus(string.Format(_language.ShowAllLinesXSecondsLinesEarlier, adjustMilliseconds / -1000.0));
                else if (selection == SelectionChoice.SelectionOnly)
                    ShowStatus(string.Format(_language.ShowSelectedLinesXSecondsLinesEarlier, adjustMilliseconds / -1000.0));
                else if (selection == SelectionChoice.SelectionAndForward)
                    ShowStatus(string.Format(_language.ShowSelectionAndForwardXSecondsLinesEarlier, adjustMilliseconds / -1000.0));
            }
            else
            {
                if (selection == SelectionChoice.AllLines)
                    ShowStatus(string.Format(_language.ShowAllLinesXSecondsLinesLater, adjustMilliseconds / 1000.0));
                else if (selection == SelectionChoice.SelectionOnly)
                    ShowStatus(string.Format(_language.ShowSelectedLinesXSecondsLinesLater, adjustMilliseconds / 1000.0));
                else if (selection == SelectionChoice.SelectionAndForward)
                    ShowStatus(string.Format(_language.ShowSelectionAndForwardXSecondsLinesLater, adjustMilliseconds / 1000.0));
            }

            double frameRate = CurrentFrameRate;
            SubtitleListview1.BeginUpdate();

            int startFrom = 0;
            if (selection == SelectionChoice.SelectionAndForward)
            {
                if (SubtitleListview1.SelectedItems.Count > 0)
                    startFrom = SubtitleListview1.SelectedItems[0].Index;
                else
                    startFrom = _subtitle.Paragraphs.Count;
            }

            for (int i = startFrom; i < _subtitle.Paragraphs.Count; i++)
            {
                switch (selection)
                {
                    case SelectionChoice.SelectionOnly:
                        if (SubtitleListview1.Items[i].Selected)
                            ShowEarlierOrLaterParagraph(adjustMilliseconds, i);
                        break;
                    case SelectionChoice.AllLines:
                        ShowEarlierOrLaterParagraph(adjustMilliseconds, i);
                        break;
                    case SelectionChoice.SelectionAndForward:
                        ShowEarlierOrLaterParagraph(adjustMilliseconds, i);
                        break;
                }
            }

            SubtitleListview1.EndUpdate();
            if (_subtitle.WasLoadedWithFrameNumbers)
                _subtitle.CalculateFrameNumbersFromTimeCodesNoCheck(frameRate);
            RefreshSelectedParagraph();
            UpdateSourceView();
            UpdateListSyntaxColoring();
        }
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:59,代码来源:Main.cs

示例4: ButtonSetStartAndOffsetRestClick

        private void ButtonSetStartAndOffsetRestClick(object sender, EventArgs e)
        {
            if (SubtitleListview1.SelectedItems.Count == 1)
            {
                bool oldSync = checkBoxSyncListViewWithVideoWhilePlaying.Checked;
                checkBoxSyncListViewWithVideoWhilePlaying.Checked = false;

                timeUpDownStartTime.MaskedTextBox.TextChanged -= MaskedTextBoxTextChanged;
                int index = SubtitleListview1.SelectedItems[0].Index;
                double videoPosition = mediaPlayer.CurrentPosition;
                if (!mediaPlayer.IsPaused)
                    videoPosition -= Configuration.Settings.General.SetStartEndHumanDelay / 1000.0;
                var tc = new TimeCode(TimeSpan.FromSeconds(videoPosition));
                timeUpDownStartTime.TimeCode = tc;

                MakeHistoryForUndo(_language.BeforeSetStartTimeAndOffsetTheRest + "  " +_subtitle.Paragraphs[index].Number.ToString() + " - " + tc.ToString());

                double offset = _subtitle.Paragraphs[index].StartTime.TotalMilliseconds - tc.TotalMilliseconds;

                if (_subtitle.Paragraphs[index].StartTime.IsMaxTime)
                {
                    _subtitle.Paragraphs[index].StartTime.TotalSeconds = videoPosition;
                    _subtitle.Paragraphs[index].EndTime.TotalMilliseconds = _subtitle.Paragraphs[index].StartTime.TotalMilliseconds + Utilities.GetOptimalDisplayMilliseconds(_subtitle.Paragraphs[index].Text);
                    SubtitleListview1.SetStartTime(index, _subtitle.Paragraphs[index]);
                    checkBoxSyncListViewWithVideoWhilePlaying.Checked = oldSync;
                    timeUpDownStartTime.MaskedTextBox.TextChanged += MaskedTextBoxTextChanged;
                    return;
                }

                _subtitle.Paragraphs[index].StartTime = new TimeCode(TimeSpan.FromMilliseconds(_subtitle.Paragraphs[index].StartTime.TotalMilliseconds - offset));
                _subtitle.Paragraphs[index].EndTime = new TimeCode(TimeSpan.FromMilliseconds(_subtitle.Paragraphs[index].EndTime.TotalMilliseconds - offset));
                SubtitleListview1.SetStartTime(index, _subtitle.Paragraphs[index]);

                for (int i = index+1; i < SubtitleListview1.Items.Count; i++)
                {
                    if (!_subtitle.Paragraphs[i].StartTime.IsMaxTime)
                    {
                        _subtitle.Paragraphs[i].StartTime = new TimeCode(TimeSpan.FromMilliseconds(_subtitle.Paragraphs[i].StartTime.TotalMilliseconds - offset));
                        _subtitle.Paragraphs[i].EndTime = new TimeCode(TimeSpan.FromMilliseconds(_subtitle.Paragraphs[i].EndTime.TotalMilliseconds - offset));
                        SubtitleListview1.SetStartTime(i, _subtitle.Paragraphs[i]);
                    }
                }

                if (Configuration.Settings.General.AllowEditOfOriginalSubtitle && _subtitleAlternate != null && _subtitleAlternate.Paragraphs.Count > 0)
                {
                    Paragraph original = Utilities.GetOriginalParagraph(index, _subtitle.Paragraphs[index], _subtitleAlternate.Paragraphs);
                    if (original != null)
                    {
                        index = _subtitleAlternate.GetIndex(original);
                        for (int i = index; i < _subtitleAlternate.Paragraphs.Count; i++)
                        {
                            if (!_subtitleAlternate.Paragraphs[i].StartTime.IsMaxTime)
                            {
                                _subtitleAlternate.Paragraphs[i].StartTime = new TimeCode(TimeSpan.FromMilliseconds(_subtitleAlternate.Paragraphs[i].StartTime.TotalMilliseconds - offset));
                                _subtitleAlternate.Paragraphs[i].EndTime = new TimeCode(TimeSpan.FromMilliseconds(_subtitleAlternate.Paragraphs[i].EndTime.TotalMilliseconds - offset));
                            }
                        }
                    }
                }
                if (IsFramesRelevant && CurrentFrameRate > 0)
                {
                    _subtitle.CalculateFrameNumbersFromTimeCodesNoCheck(CurrentFrameRate);
                    if (tabControlSubtitle.SelectedIndex == TabControlSourceView)
                        ShowSource();
                }

                checkBoxSyncListViewWithVideoWhilePlaying.Checked = oldSync;
                timeUpDownStartTime.MaskedTextBox.TextChanged += MaskedTextBoxTextChanged;
            }
        }
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:70,代码来源:Main.cs

示例5: InsertNewTextAtVideoPosition

        private Paragraph InsertNewTextAtVideoPosition()
        {
            // current movie pos
            double videoPositionInMilliseconds = mediaPlayer.CurrentPosition * 1000.0;
            if (!mediaPlayer.IsPaused)
                videoPositionInMilliseconds -= Configuration.Settings.General.SetStartEndHumanDelay;

            var tc = new TimeCode(TimeSpan.FromMilliseconds(videoPositionInMilliseconds));
            MakeHistoryForUndo(_language.BeforeInsertSubtitleAtVideoPosition + "  " + tc.ToString());

            // find index where to insert
            int index = 0;
            foreach (Paragraph p in _subtitle.Paragraphs)
            {
                if (p.StartTime.TotalMilliseconds > videoPositionInMilliseconds)
                    break;
                index++;
            }

            // create and insert
            var newParagraph = new Paragraph("", videoPositionInMilliseconds, videoPositionInMilliseconds + Configuration.Settings.General.NewEmptyDefaultMs);
            if (GetCurrentSubtitleFormat().IsFrameBased)
            {
                newParagraph.CalculateFrameNumbersFromTimeCodes(CurrentFrameRate);
                newParagraph.CalculateTimeCodesFromFrameNumbers(CurrentFrameRate);
            }

            if (_networkSession != null)
            {
                _networkSession.TimerStop();
                NetworkGetSendUpdates(new List<int>(), index, newParagraph);
            }
            else
            {
                _subtitle.Paragraphs.Insert(index, newParagraph);

                // check if original is available - and insert new paragraph in the original too
                if (Configuration.Settings.General.AllowEditOfOriginalSubtitle && _subtitleAlternate != null && _subtitleAlternate.Paragraphs.Count > 0)
                {
                    _subtitleAlternate.InsertParagraphInCorrectTimeOrder(new Paragraph(newParagraph));
                    _subtitleAlternate.Renumber(1);
                }

                _subtitleListViewIndex = -1;
                _subtitle.Renumber(1);
                SubtitleListview1.Fill(_subtitle, _subtitleAlternate);
            }
            SubtitleListview1.SelectIndexAndEnsureVisible(index);
            return newParagraph;
        }
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:50,代码来源:Main.cs

示例6: SetEndAndOffsetTheRest

        private void SetEndAndOffsetTheRest(bool goToNext)
        {
            if (SubtitleListview1.SelectedItems.Count == 1)
            {
                bool oldSync = checkBoxSyncListViewWithVideoWhilePlaying.Checked;
                checkBoxSyncListViewWithVideoWhilePlaying.Checked = false;

                int index = SubtitleListview1.SelectedItems[0].Index;
                double videoPosition = mediaPlayer.CurrentPosition;
                if (!mediaPlayer.IsPaused)
                    videoPosition -= Configuration.Settings.General.SetStartEndHumanDelay / 1000.0;

                var tc = new TimeCode(TimeSpan.FromSeconds(videoPosition));

                double offset = tc.TotalMilliseconds - _subtitle.Paragraphs[index].EndTime.TotalMilliseconds;
                if (_subtitle.Paragraphs[index].StartTime.TotalMilliseconds + 100 > tc.TotalMilliseconds || offset > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds)
                    return;

                MakeHistoryForUndo(_language.BeforeSetEndTimeAndOffsetTheRest + "  " + _subtitle.Paragraphs[index].Number.ToString() + " - " + tc.ToString());

                numericUpDownDuration.ValueChanged -= NumericUpDownDurationValueChanged;
                _subtitle.Paragraphs[index].EndTime.TotalSeconds = videoPosition;
                SubtitleListview1.SetDuration(index, _subtitle.Paragraphs[index]);
                checkBoxSyncListViewWithVideoWhilePlaying.Checked = oldSync;
                numericUpDownDuration.Value = (decimal)_subtitle.Paragraphs[index].Duration.TotalSeconds;
                numericUpDownDuration.ValueChanged += NumericUpDownDurationValueChanged;

                for (int i = index + 1; i < SubtitleListview1.Items.Count; i++)
                {
                    if (!_subtitle.Paragraphs[i].StartTime.IsMaxTime)
                    {
                        _subtitle.Paragraphs[i].StartTime = new TimeCode(TimeSpan.FromMilliseconds(_subtitle.Paragraphs[i].StartTime.TotalMilliseconds + offset));
                        _subtitle.Paragraphs[i].EndTime = new TimeCode(TimeSpan.FromMilliseconds(_subtitle.Paragraphs[i].EndTime.TotalMilliseconds + offset));
                        SubtitleListview1.SetDuration(i, _subtitle.Paragraphs[i]);
                    }
                }

                if (Configuration.Settings.General.AllowEditOfOriginalSubtitle && _subtitleAlternate != null && _subtitleAlternate.Paragraphs.Count > 0)
                {
                    Paragraph original = Utilities.GetOriginalParagraph(index, _subtitle.Paragraphs[index], _subtitleAlternate.Paragraphs);
                    if (original != null)
                    {
                        index = _subtitleAlternate.GetIndex(original);
                        for (int i = index; i < _subtitleAlternate.Paragraphs.Count; i++)
                        {
                            if (!_subtitleAlternate.Paragraphs[i].StartTime.IsMaxTime)
                            {
                                _subtitleAlternate.Paragraphs[i].StartTime = new TimeCode(TimeSpan.FromMilliseconds(_subtitleAlternate.Paragraphs[i].StartTime.TotalMilliseconds + offset));
                                _subtitleAlternate.Paragraphs[i].EndTime = new TimeCode(TimeSpan.FromMilliseconds(_subtitleAlternate.Paragraphs[i].EndTime.TotalMilliseconds + offset));
                            }
                        }
                    }
                }
                if (IsFramesRelevant && CurrentFrameRate > 0)
                {
                    _subtitle.CalculateFrameNumbersFromTimeCodesNoCheck(CurrentFrameRate);
                    if (tabControlSubtitle.SelectedIndex == TabControlSourceView)
                        ShowSource();
                }

                checkBoxSyncListViewWithVideoWhilePlaying.Checked = oldSync;
                numericUpDownDuration.ValueChanged += NumericUpDownDurationValueChanged;

                if (goToNext)
                {
                    SubtitleListview1.SelectIndexAndEnsureVisible(index + 1);
                }
            }
        }
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:69,代码来源:Main.cs

示例7: SetTotalMilliseconds

 public void SetTotalMilliseconds(double milliseconds)
 {
     if (Mode == TimeMode.HHMMSSMS)
     {
         if (Mode == TimeMode.HHMMSSMS && milliseconds < 0)
             maskedTextBox1.Mask = "-00:00:00.000";
         else
             maskedTextBox1.Mask = "00:00:00.000";
         maskedTextBox1.Text = new TimeCode(milliseconds).ToString();
     }
     else
     {
         var tc = new TimeCode(milliseconds);
         maskedTextBox1.Text = tc.ToString().Substring(0, 9) + string.Format("{0:00}", Logic.SubtitleFormats.SubtitleFormat.MillisecondsToFrames(tc.Milliseconds));
     }
 }
开发者ID:athikan,项目名称:subtitleedit,代码行数:16,代码来源:TimeUpDown.cs

示例8: GetParagraph

        internal static string GetParagraph(string template, string start, string end, string text, string translation, int number, TimeCode duration, string timeCodeTemplate)
        {
            string d = duration.ToString();
            if (timeCodeTemplate == "ff" || timeCodeTemplate == "f")
                d = SubtitleFormat.MillisecondsToFrames(duration.TotalMilliseconds).ToString();
            if (timeCodeTemplate == "zzz" || timeCodeTemplate == "zz" || timeCodeTemplate == "z")
                d = duration.TotalMilliseconds.ToString();
            if (timeCodeTemplate == "sss" || timeCodeTemplate == "ss" || timeCodeTemplate == "s")
                d = duration.Seconds.ToString();
            else if (timeCodeTemplate.EndsWith("ss.ff"))
                d = string.Format("{0:00}.{1:00}", duration.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds));
            else if (timeCodeTemplate.EndsWith("ss:ff"))
                d = string.Format("{0:00}:{1:00}", duration.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds));
            else if (timeCodeTemplate.EndsWith("ss,ff"))
                d = string.Format("{0:00},{1:00}", duration.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds));
            else if (timeCodeTemplate.EndsWith("ss;ff"))
                d = string.Format("{0:00};{1:00}", duration.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds));
            else if (timeCodeTemplate.EndsWith("ss;ff"))
                d = string.Format("{0:00};{1:00}", duration.Seconds, SubtitleFormat.MillisecondsToFramesMaxFrameRate(duration.Milliseconds));
            else if (timeCodeTemplate.EndsWith("ss.zzz"))
                d = string.Format("{0:00}.{1:000}", duration.Seconds, duration.Milliseconds);
            else if (timeCodeTemplate.EndsWith("ss:zzz"))
                d = string.Format("{0:00}:{1:000}", duration.Seconds, duration.Milliseconds);
            else if (timeCodeTemplate.EndsWith("ss,zzz"))
                d = string.Format("{0:00},{1:000}", duration.Seconds, duration.Milliseconds);
            else if (timeCodeTemplate.EndsWith("ss;zzz"))
                d = string.Format("{0:00};{1:000}", duration.Seconds, duration.Milliseconds);
            else if (timeCodeTemplate.EndsWith("ss;zzz"))
                d = string.Format("{0:00};{1:000}", duration.Seconds, duration.Milliseconds);
            else if (timeCodeTemplate.EndsWith("ss.zz"))
                d = string.Format("{0:00}.{1:00}", duration.Seconds, Math.Round(duration.Milliseconds / 10.0));
            else if (timeCodeTemplate.EndsWith("ss:zz"))
                d = string.Format("{0:00}:{1:00}", duration.Seconds, Math.Round(duration.Milliseconds / 10.0));
            else if (timeCodeTemplate.EndsWith("ss,zz"))
                d = string.Format("{0:00},{1:00}", duration.Seconds, Math.Round(duration.Milliseconds / 10.0));
            else if (timeCodeTemplate.EndsWith("ss;zz"))
                d = string.Format("{0:00};{1:00}", duration.Seconds, Math.Round(duration.Milliseconds / 10.0));

            string s = template;
            s = s.Replace("{{", "@@@@[email protected]@@{");
            s = s.Replace("}}", "}@@@[email protected]@@@");
            s = string.Format(s, start, end, text, translation, number + 1, number, d);
            s = s.Replace("@@@@[email protected]@@", "{");
            s = s.Replace("@@@[email protected]@@@", "}");
            return s;
        }
开发者ID:athikan,项目名称:subtitleedit,代码行数:46,代码来源:ExportCustomTextFormat.cs

示例9: listBoxTracks_SelectedIndexChanged

        private void listBoxTracks_SelectedIndexChanged(object sender, EventArgs e)
        {
            int idx = listBoxTracks.SelectedIndex;
            if (idx < 0)
                return;

            listBoxSubtitles.Items.Clear();
            int pid = _tsParser.SubtitlePacketIds[idx];
            var list = _tsParser.GetDvbSubtitles(pid);
            int i = 0;
            foreach (var sub in list)
            {
                i++;
                var start = new TimeCode(TimeSpan.FromMilliseconds(sub.StartMilliseconds));
                var end = new TimeCode(TimeSpan.FromMilliseconds(sub.EndMilliseconds));
                if (string.IsNullOrEmpty(Configuration.Settings.Language.TransportStreamSubtitleChooser.SubLine))
                    listBoxSubtitles.Items.Add(string.Format("{0}:  {1} --> {2},  {3} image(s)", i, start.ToString(), end.ToString(), sub.NumberOfImages));
                else
                    listBoxSubtitles.Items.Add(string.Format(Configuration.Settings.Language.TransportStreamSubtitleChooser.SubLine, i, start.ToString(), end.ToString(), sub.NumberOfImages));
            }
            if (list.Count > 0)
                listBoxSubtitles.SelectedIndex = 0;
        }
开发者ID:IlgnerBri,项目名称:subtitleedit,代码行数:23,代码来源:TransportStreamSubtitleChooser.cs


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