/* Private members */ private string FieldEvaluator(Match match) { Group fieldGroup = match.Groups["Field"]; string field = fieldGroup.Value; switch (field) { case "StartFrame": int startFrame = subtitle.Frames.Start; return(FormatedField(startFrame, match)); case "StartElapsedFrames": int previousFrames = (previousSubtitle == null ? 0 : previousSubtitle.Frames.End); int startElapsedFrames = subtitle.Frames.Start - previousFrames; return(FormatedField(startElapsedFrames, match)); case "EndFrame": int endFrame = subtitle.Frames.End; return(FormatedField(endFrame, match)); case "EndElapsedFrames": int endElapsedFrames = subtitle.Frames.Duration; return(FormatedField(endElapsedFrames, match)); case "StartHours": int startHours = subtitle.Times.Start.Hours; return(FormatedField(startHours, 2, match)); case "StartMinutes": int startMinutes = subtitle.Times.Start.Minutes; return(FormatedField(startMinutes, 2, match)); case "StartSeconds": int startSeconds = subtitle.Times.Start.Seconds; return(FormatedField(startSeconds, 2, match)); case "StartDeciseconds": int startDeciseconds = DivideAndRound(subtitle.Times.Start.Milliseconds, 100); return(FormatedField(startDeciseconds, 1, match)); case "StartTotalDeciseconds": int startTotalDeciseconds = DivideAndRound((int)subtitle.Times.Start.TotalMilliseconds, 100); return(startTotalDeciseconds.ToString()); case "StartCentiseconds": int startCentiseconds = DivideAndRound(subtitle.Times.Start.Milliseconds, 10); return(FormatedField(startCentiseconds, 2, match)); case "StartMilliseconds": int startMilliseconds = subtitle.Times.Start.Milliseconds; return(FormatedField(startMilliseconds, 3, match)); case "StartMillisecondsAsFrames": int startMillisecondsAsFrames = (int)TimingUtil.TimeMillisecondsToFrames(subtitle.Times.Start.Milliseconds, this.subtitleProperties.CurrentFrameRate); return(FormatedField(startMillisecondsAsFrames, 2, match)); case "StartMillisecondsAsFramesPAL": int startMillisecondsAsFramesPAL = (int)TimingUtil.TimeMillisecondsToFrames(subtitle.Times.Start.Milliseconds, 25); return(FormatedField(startMillisecondsAsFramesPAL, 2, match)); case "StartMillisecondsAsFramesNTSC": int startMillisecondsAsFramesNTSC = (int)TimingUtil.TimeMillisecondsToFrames(subtitle.Times.Start.Milliseconds, 29.97F); return(FormatedField(startMillisecondsAsFramesNTSC, 2, match)); case "EndMillisecondsAsFrames": int endMillisecondsAsFrames = (int)TimingUtil.TimeMillisecondsToFrames(subtitle.Times.End.Milliseconds, this.subtitleProperties.CurrentFrameRate); return(FormatedField(endMillisecondsAsFrames, 2, match)); case "EndMillisecondsAsFramesPAL": int endMillisecondsAsFramesPAL = (int)TimingUtil.TimeMillisecondsToFrames(subtitle.Times.End.Milliseconds, 25); return(FormatedField(endMillisecondsAsFramesPAL, 2, match)); case "EndMillisecondsAsFramesNTSC": int endMillisecondsAsFramesNTSC = (int)TimingUtil.TimeMillisecondsToFrames(subtitle.Times.End.Milliseconds, 29.97F); return(FormatedField(endMillisecondsAsFramesNTSC, 2, match)); case "StartElapsedTime": TimeSpan previousTime = (previousSubtitle == null ? TimeSpan.Zero : previousSubtitle.Times.End); TimeSpan startElapsedTime = subtitle.Times.Start - previousTime; return(FormatedField(startElapsedTime.TotalSeconds)); case "EndHours": int endHours = subtitle.Times.End.Hours; return(FormatedField(endHours, 2, match)); case "EndMinutes": int endMinutes = subtitle.Times.End.Minutes; return(FormatedField(endMinutes, 2, match)); case "EndSeconds": int endSeconds = subtitle.Times.End.Seconds; return(FormatedField(endSeconds, 2, match)); case "EndDeciseconds": int endDeciseconds = DivideAndRound(subtitle.Times.End.Milliseconds, 100); return(FormatedField(endDeciseconds, 1, match)); case "EndTotalDeciseconds": int endTotalDeciseconds = DivideAndRound((int)subtitle.Times.End.TotalMilliseconds, 100); return(endTotalDeciseconds.ToString()); case "EndCentiseconds": int endCentiseconds = DivideAndRound(subtitle.Times.End.Milliseconds, 10); return(FormatedField(endCentiseconds, 2, match)); case "EndMilliseconds": int endMilliseconds = subtitle.Times.End.Milliseconds; return(FormatedField(endMilliseconds, 3, match)); case "EndElapsedTime": TimeSpan endElapsedTime = subtitle.Times.Duration; return(FormatedField(endElapsedTime.TotalSeconds)); case "Text": SubtitleText subtitleText = (textType == SubtitleTextType.Text ? subtitle.Text : subtitle.Translation); string text = subtitleText.GetTrimLines(format.LineBreak); return(text.ToString()); case "Style": string style = format.StyleToString(subtitle.Style); return(style.ToString()); case "EndOfStyle": string endOfStyle = format.EndOfStyleToString(subtitle.Style); return(endOfStyle.ToString()); case "SubtitleNumber": return(FormatedField(subtitleNumber, match)); default: return(match.Value); } }