From c2c715c2887119953fd3f3206a4ff839643f6252 Mon Sep 17 00:00:00 2001 From: Ivandro Ismael Date: Sat, 29 Oct 2016 15:56:39 +0100 Subject: [PATCH] [TimeCode] - Add default constructor. The new default constructor will return new instance of TimeCode with all properties zeroed-out. --- libse/Paragraph.cs | 4 ++-- libse/SubtitleFormats/AribB36.cs | 4 ++-- libse/SubtitleFormats/CaptionsInc.cs | 2 +- libse/SubtitleFormats/DvdSubtitle.cs | 8 ++++---- libse/SubtitleFormats/ELRStudioClosedCaption.cs | 2 +- libse/SubtitleFormats/F4Text.cs | 2 +- libse/SubtitleFormats/FinalCutProXCM.cs | 2 +- libse/SubtitleFormats/FinalCutProXXml.cs | 2 +- libse/SubtitleFormats/FinalCutProXml13.cs | 2 +- libse/SubtitleFormats/FinalCutProXml14.cs | 2 +- libse/SubtitleFormats/FinalCutProXml14Text.cs | 2 +- libse/SubtitleFormats/FinalCutProXmlGap.cs | 2 +- libse/SubtitleFormats/ImageLogicAutocaption.cs | 4 ++-- libse/SubtitleFormats/Lrc.cs | 4 ++-- libse/SubtitleFormats/Pac.cs | 2 +- libse/SubtitleFormats/SubtitleFormat.cs | 6 +++--- libse/SubtitleFormats/Tmx14.cs | 2 +- libse/SubtitleFormats/UnknownSubtitle20.cs | 4 ++-- libse/SubtitleFormats/UnknownSubtitle21.cs | 4 ++-- libse/SubtitleFormats/UnknownSubtitle27.cs | 2 +- libse/SubtitleFormats/UnknownSubtitle44.cs | 2 +- libse/SubtitleFormats/UnknownSubtitle68.cs | 2 +- libse/SubtitleFormats/UnknownSubtitle78.cs | 4 ++-- libse/SubtitleFormats/Xif.cs | 2 +- libse/SubtitleFormats/YouTubeTranscript.cs | 2 +- libse/SubtitleFormats/YouTubeTranscriptOneLine.cs | 2 +- libse/TimeCode.cs | 4 ++++ libse/UknownFormatImporter.cs | 2 +- libse/Utilities.cs | 2 +- src/Forms/EbuSaveOptions.cs | 2 +- src/Forms/ExportPngXml.cs | 2 +- src/Forms/ExtractDateTimeInfo.cs | 2 +- src/Forms/Main.cs | 8 ++++---- src/Forms/SetVideoOffset.cs | 4 ++-- src/Test/Logic/ParagraphTest.cs | 2 +- 35 files changed, 54 insertions(+), 50 deletions(-) diff --git a/libse/Paragraph.cs b/libse/Paragraph.cs index fb097aca4..a1af0f600 100644 --- a/libse/Paragraph.cs +++ b/libse/Paragraph.cs @@ -94,8 +94,8 @@ namespace Nikse.SubtitleEdit.Core public Paragraph(int startFrame, int endFrame, string text) { - StartTime = new TimeCode(0, 0, 0, 0); - EndTime = new TimeCode(0, 0, 0, 0); + StartTime = new TimeCode(); + EndTime = new TimeCode(); StartFrame = startFrame; EndFrame = endFrame; Text = text; diff --git a/libse/SubtitleFormats/AribB36.cs b/libse/SubtitleFormats/AribB36.cs index 007d51e86..05fab07d2 100644 --- a/libse/SubtitleFormats/AribB36.cs +++ b/libse/SubtitleFormats/AribB36.cs @@ -121,7 +121,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats return new TimeCode(hours, minutes, seconds, FramesToMillisecondsMax999(frames)); } } - return new TimeCode(0); + return new TimeCode(); } public TimeCode GetStartTime() @@ -133,7 +133,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { string trimmed = EraseTiming.Trim(); if (trimmed == "F" || trimmed == "0" || trimmed.Length == 0) - return new TimeCode(0); + return new TimeCode(); return GetTime(EraseTiming, SpecifiedTimingUnit); } diff --git a/libse/SubtitleFormats/CaptionsInc.cs b/libse/SubtitleFormats/CaptionsInc.cs index d14f37d67..60d1cbdb6 100644 --- a/libse/SubtitleFormats/CaptionsInc.cs +++ b/libse/SubtitleFormats/CaptionsInc.cs @@ -127,7 +127,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats catch (Exception exception) { System.Diagnostics.Debug.WriteLine(exception.Message); - return new TimeCode(0, 0, 0, 0); + return new TimeCode(); } } diff --git a/libse/SubtitleFormats/DvdSubtitle.cs b/libse/SubtitleFormats/DvdSubtitle.cs index b23f803ad..ed389b0e6 100644 --- a/libse/SubtitleFormats/DvdSubtitle.cs +++ b/libse/SubtitleFormats/DvdSubtitle.cs @@ -73,8 +73,8 @@ LICENSE= _errorCount = 0; bool textOn = false; string text = string.Empty; - TimeCode start = new TimeCode(0); - TimeCode end = new TimeCode(0); + TimeCode start = new TimeCode(); + TimeCode end = new TimeCode(); foreach (string line in lines) { if (textOn) @@ -89,8 +89,8 @@ LICENSE= subtitle.Paragraphs.Add(p); text = string.Empty; - start = new TimeCode(0); - end = new TimeCode(0); + start = new TimeCode(); + end = new TimeCode(); textOn = false; } else diff --git a/libse/SubtitleFormats/ELRStudioClosedCaption.cs b/libse/SubtitleFormats/ELRStudioClosedCaption.cs index 4fc1df703..d0edf237a 100644 --- a/libse/SubtitleFormats/ELRStudioClosedCaption.cs +++ b/libse/SubtitleFormats/ELRStudioClosedCaption.cs @@ -141,7 +141,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats } catch { - return new TimeCode(0, 0, 0, 0); + return new TimeCode(); } } diff --git a/libse/SubtitleFormats/F4Text.cs b/libse/SubtitleFormats/F4Text.cs index 0edc0beba..c636fc602 100644 --- a/libse/SubtitleFormats/F4Text.cs +++ b/libse/SubtitleFormats/F4Text.cs @@ -136,7 +136,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats private TimeCode DecodeTimeCode(string[] parts) { - var tc = new TimeCode(0, 0, 0, 0); + var tc = new TimeCode(); try { int hour = int.Parse(parts[0]); diff --git a/libse/SubtitleFormats/FinalCutProXCM.cs b/libse/SubtitleFormats/FinalCutProXCM.cs index 6b21d2b52..d9c74f301 100644 --- a/libse/SubtitleFormats/FinalCutProXCM.cs +++ b/libse/SubtitleFormats/FinalCutProXCM.cs @@ -149,7 +149,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats return TimeCode.FromSeconds(float.Parse(arr[0])); } } - return new TimeCode(0, 0, 0, 0); + return new TimeCode(); } } diff --git a/libse/SubtitleFormats/FinalCutProXXml.cs b/libse/SubtitleFormats/FinalCutProXXml.cs index 6853394a1..a8ab8a97a 100644 --- a/libse/SubtitleFormats/FinalCutProXXml.cs +++ b/libse/SubtitleFormats/FinalCutProXXml.cs @@ -183,7 +183,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats return TimeCode.FromSeconds(float.Parse(arr[0])); } } - return new TimeCode(0, 0, 0, 0); + return new TimeCode(); } } diff --git a/libse/SubtitleFormats/FinalCutProXml13.cs b/libse/SubtitleFormats/FinalCutProXml13.cs index b47793283..817656dd7 100644 --- a/libse/SubtitleFormats/FinalCutProXml13.cs +++ b/libse/SubtitleFormats/FinalCutProXml13.cs @@ -203,7 +203,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats return TimeCode.FromSeconds(float.Parse(arr[0])); } } - return new TimeCode(0, 0, 0, 0); + return new TimeCode(); } } diff --git a/libse/SubtitleFormats/FinalCutProXml14.cs b/libse/SubtitleFormats/FinalCutProXml14.cs index 0cf48f57f..a9849f632 100644 --- a/libse/SubtitleFormats/FinalCutProXml14.cs +++ b/libse/SubtitleFormats/FinalCutProXml14.cs @@ -189,7 +189,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats return TimeCode.FromSeconds(float.Parse(arr[0])); } } - return new TimeCode(0, 0, 0, 0); + return new TimeCode(); } } diff --git a/libse/SubtitleFormats/FinalCutProXml14Text.cs b/libse/SubtitleFormats/FinalCutProXml14Text.cs index 7662625dd..9ba0aef2d 100644 --- a/libse/SubtitleFormats/FinalCutProXml14Text.cs +++ b/libse/SubtitleFormats/FinalCutProXml14Text.cs @@ -191,7 +191,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats return TimeCode.FromSeconds(float.Parse(arr[0])); } } - return new TimeCode(0, 0, 0, 0); + return new TimeCode(); } } diff --git a/libse/SubtitleFormats/FinalCutProXmlGap.cs b/libse/SubtitleFormats/FinalCutProXmlGap.cs index acf12d7be..ac982d24d 100644 --- a/libse/SubtitleFormats/FinalCutProXmlGap.cs +++ b/libse/SubtitleFormats/FinalCutProXmlGap.cs @@ -155,7 +155,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats return TimeCode.FromSeconds(float.Parse(arr[0])); } } - return new TimeCode(0, 0, 0, 0); + return new TimeCode(); } } diff --git a/libse/SubtitleFormats/ImageLogicAutocaption.cs b/libse/SubtitleFormats/ImageLogicAutocaption.cs index 7f73a065f..2b41648a4 100644 --- a/libse/SubtitleFormats/ImageLogicAutocaption.cs +++ b/libse/SubtitleFormats/ImageLogicAutocaption.cs @@ -87,9 +87,9 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats subtitle.Paragraphs.Add(p); string[] arr = s.Split('\t'); if (arr.Length > 2) - p = new Paragraph(DecodeTimeCodeFrames(arr[1], splitChars), new TimeCode(0, 0, 0, 0), arr[2].Trim()); + p = new Paragraph(DecodeTimeCodeFrames(arr[1], splitChars), new TimeCode(), arr[2].Trim()); else - p = new Paragraph(DecodeTimeCodeFrames(arr[1], splitChars), new TimeCode(0, 0, 0, 0), string.Empty); + p = new Paragraph(DecodeTimeCodeFrames(arr[1], splitChars), new TimeCode(), string.Empty); } catch { diff --git a/libse/SubtitleFormats/Lrc.cs b/libse/SubtitleFormats/Lrc.cs index 1097f8734..829f60fc6 100644 --- a/libse/SubtitleFormats/Lrc.cs +++ b/libse/SubtitleFormats/Lrc.cs @@ -101,7 +101,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats int milliseconds = int.Parse(parts[2]) * 10; string text = line.Remove(0, 9).Trim().TrimStart(']').Trim(); var start = new TimeCode(0, minutes, seconds, milliseconds); - var p = new Paragraph(start, new TimeCode(0, 0, 0, 0), text); + var p = new Paragraph(start, new TimeCode(), text); subtitle.Paragraphs.Add(p); } catch @@ -173,7 +173,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats int milliseconds = int.Parse(parts[2]) * 10; string text = GetTextAfterTimeCodes(p.Text); var start = new TimeCode(0, minutes, seconds, milliseconds); - var newParagraph = new Paragraph(start, new TimeCode(0, 0, 0, 0), text); + var newParagraph = new Paragraph(start, new TimeCode(), text); subtitle.Paragraphs.Add(newParagraph); } catch diff --git a/libse/SubtitleFormats/Pac.cs b/libse/SubtitleFormats/Pac.cs index 2a7c2b9de..74dab26b5 100644 --- a/libse/SubtitleFormats/Pac.cs +++ b/libse/SubtitleFormats/Pac.cs @@ -1796,7 +1796,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats return new TimeCode(hours, minutes, seconds, FramesToMillisecondsMax999(frames)); } - return new TimeCode(0, 0, 0, 0); + return new TimeCode(); } } diff --git a/libse/SubtitleFormats/SubtitleFormat.cs b/libse/SubtitleFormats/SubtitleFormat.cs index 58b85ed26..4bc641e8e 100644 --- a/libse/SubtitleFormats/SubtitleFormat.cs +++ b/libse/SubtitleFormats/SubtitleFormat.cs @@ -417,7 +417,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats protected TimeCode DecodeTimeCodeFramesTwoParts(string[] parts) { if (parts == null) - return new TimeCode(0); + return new TimeCode(); if (parts.Length != 2) throw new InvalidOperationException(); // 00:00 @@ -427,7 +427,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats protected TimeCode DecodeTimeCodeFramesThreeParts(string[] parts) { if (parts == null) - return new TimeCode(0); + return new TimeCode(); if (parts.Length != 3) throw new InvalidOperationException(); // 00:00:00 @@ -437,7 +437,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats protected TimeCode DecodeTimeCodeFramesFourParts(string[] parts) { if (parts == null) - return new TimeCode(0); + return new TimeCode(); if (parts.Length != 4) throw new InvalidOperationException(); // 00:00:00:00 diff --git a/libse/SubtitleFormats/Tmx14.cs b/libse/SubtitleFormats/Tmx14.cs index 9a7aefc91..1cbc3c6ee 100644 --- a/libse/SubtitleFormats/Tmx14.cs +++ b/libse/SubtitleFormats/Tmx14.cs @@ -140,7 +140,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats private static TimeCode DecodeTimeCode(XmlNode node) { - var tc = new TimeCode(0, 0, 0, 0); + var tc = new TimeCode(); if (node != null) { string[] arr = node.InnerText.Split(new[] { ':', '.', ',', ';' }, StringSplitOptions.RemoveEmptyEntries); diff --git a/libse/SubtitleFormats/UnknownSubtitle20.cs b/libse/SubtitleFormats/UnknownSubtitle20.cs index d57895f4e..5847b4056 100644 --- a/libse/SubtitleFormats/UnknownSubtitle20.cs +++ b/libse/SubtitleFormats/UnknownSubtitle20.cs @@ -93,7 +93,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { if (p != null) subtitle.Paragraphs.Add(p); - p = new Paragraph(DecodeTimeCodeFrames(s.Substring(5, 11), SplitCharColon), new TimeCode(0, 0, 0, 0), s.Remove(0, 37).Trim()); + p = new Paragraph(DecodeTimeCodeFrames(s.Substring(5, 11), SplitCharColon), new TimeCode(), s.Remove(0, 37).Trim()); } catch { @@ -107,7 +107,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { if (p != null) subtitle.Paragraphs.Add(p); - p = new Paragraph(DecodeTimeCodeFrames(s.Substring(5, 11), SplitCharColon), new TimeCode(0, 0, 0, 0), string.Empty); + p = new Paragraph(DecodeTimeCodeFrames(s.Substring(5, 11), SplitCharColon), new TimeCode(), string.Empty); } catch { diff --git a/libse/SubtitleFormats/UnknownSubtitle21.cs b/libse/SubtitleFormats/UnknownSubtitle21.cs index f49b6a48a..943e6932d 100644 --- a/libse/SubtitleFormats/UnknownSubtitle21.cs +++ b/libse/SubtitleFormats/UnknownSubtitle21.cs @@ -87,9 +87,9 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats subtitle.Paragraphs.Add(p); string[] arr = s.Split('\t'); if (arr.Length > 2) - p = new Paragraph(DecodeTimeCodeFrames(arr[1], splitChar), new TimeCode(0, 0, 0, 0), arr[2].Trim()); + p = new Paragraph(DecodeTimeCodeFrames(arr[1], splitChar), new TimeCode(), arr[2].Trim()); else - p = new Paragraph(DecodeTimeCodeFrames(arr[1], splitChar), new TimeCode(0, 0, 0, 0), string.Empty); + p = new Paragraph(DecodeTimeCodeFrames(arr[1], splitChar), new TimeCode(), string.Empty); } catch { diff --git a/libse/SubtitleFormats/UnknownSubtitle27.cs b/libse/SubtitleFormats/UnknownSubtitle27.cs index 5483a048b..97d723377 100644 --- a/libse/SubtitleFormats/UnknownSubtitle27.cs +++ b/libse/SubtitleFormats/UnknownSubtitle27.cs @@ -79,7 +79,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { string text = s.Remove(0, 10).Trim(); text = text.Replace(" ", Environment.NewLine); - p = new Paragraph(DecodeTimeCode(startParts), new TimeCode(0, 0, 0, 0), text); + p = new Paragraph(DecodeTimeCode(startParts), new TimeCode(), text); subtitle.Paragraphs.Add(p); } catch (Exception exception) diff --git a/libse/SubtitleFormats/UnknownSubtitle44.cs b/libse/SubtitleFormats/UnknownSubtitle44.cs index c3a3dc4d9..0ee4d980b 100644 --- a/libse/SubtitleFormats/UnknownSubtitle44.cs +++ b/libse/SubtitleFormats/UnknownSubtitle44.cs @@ -100,7 +100,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { try { - p = new Paragraph(DecodeTimeCodeFramesFourParts(startParts), new TimeCode(0, 0, 0, 0), text); + p = new Paragraph(DecodeTimeCodeFramesFourParts(startParts), new TimeCode(), text); subtitle.Paragraphs.Add(p); } catch (Exception exception) diff --git a/libse/SubtitleFormats/UnknownSubtitle68.cs b/libse/SubtitleFormats/UnknownSubtitle68.cs index b4be3f4cb..38c320f77 100644 --- a/libse/SubtitleFormats/UnknownSubtitle68.cs +++ b/libse/SubtitleFormats/UnknownSubtitle68.cs @@ -121,7 +121,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats TimeCode start = DecodeTimeCodeFrames(timeParts[0].Substring(0, 11), splitChars); if (p != null && Math.Abs(p.EndTime.TotalMilliseconds) < 0.001) p.EndTime.TotalMilliseconds = start.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines; - TimeCode end = new TimeCode(0, 0, 0, 0); + TimeCode end = new TimeCode(); p = MakeTextParagraph(text, p, start, end); subtitle.Paragraphs.Add(p); text = new StringBuilder(); diff --git a/libse/SubtitleFormats/UnknownSubtitle78.cs b/libse/SubtitleFormats/UnknownSubtitle78.cs index 5bd87917c..c2a0bc0e0 100644 --- a/libse/SubtitleFormats/UnknownSubtitle78.cs +++ b/libse/SubtitleFormats/UnknownSubtitle78.cs @@ -146,8 +146,8 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats 0 "; var xml = new XmlDocument(); - var firstTimeCode = new TimeCode(0); - var lastTimeCode = new TimeCode(0); + var firstTimeCode = new TimeCode(); + var lastTimeCode = new TimeCode(); if (subtitle.Paragraphs.Count > 0) { firstTimeCode = subtitle.Paragraphs[0].StartTime; diff --git a/libse/SubtitleFormats/Xif.cs b/libse/SubtitleFormats/Xif.cs index 47819f160..624c9d1af 100644 --- a/libse/SubtitleFormats/Xif.cs +++ b/libse/SubtitleFormats/Xif.cs @@ -105,7 +105,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats "; var xml = new XmlDocument(); - var lastTimeCode = new TimeCode(0); + var lastTimeCode = new TimeCode(); if (subtitle.Paragraphs.Count > 0) { lastTimeCode = subtitle.Paragraphs[subtitle.Paragraphs.Count - 1].StartTime; diff --git a/libse/SubtitleFormats/YouTubeTranscript.cs b/libse/SubtitleFormats/YouTubeTranscript.cs index 7074afd06..bf414fb1b 100644 --- a/libse/SubtitleFormats/YouTubeTranscript.cs +++ b/libse/SubtitleFormats/YouTubeTranscript.cs @@ -60,7 +60,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { if (RegexTimeCodes.IsMatch(line)) { - p = new Paragraph(DecodeTimeCode(line), new TimeCode(0, 0, 0, 0), string.Empty); + p = new Paragraph(DecodeTimeCode(line), new TimeCode(), string.Empty); subtitle.Paragraphs.Add(p); } else if (string.IsNullOrWhiteSpace(line)) diff --git a/libse/SubtitleFormats/YouTubeTranscriptOneLine.cs b/libse/SubtitleFormats/YouTubeTranscriptOneLine.cs index e4068c43e..d40a3b33c 100644 --- a/libse/SubtitleFormats/YouTubeTranscriptOneLine.cs +++ b/libse/SubtitleFormats/YouTubeTranscriptOneLine.cs @@ -63,7 +63,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats { int splitter = line.IndexOf(':') + 3; string text = line.Remove(0, splitter); - var p = new Paragraph(DecodeTimeCode(line.Substring(0, splitter)), new TimeCode(0, 0, 0, 0), text); + var p = new Paragraph(DecodeTimeCode(line.Substring(0, splitter)), new TimeCode(), text); subtitle.Paragraphs.Add(p); text = text.Trim().Trim(trimChars).Trim(); if (text.Length > 0 && char.IsDigit(text[0])) diff --git a/libse/TimeCode.cs b/libse/TimeCode.cs index c89a7823e..bf156ed23 100644 --- a/libse/TimeCode.cs +++ b/libse/TimeCode.cs @@ -58,6 +58,10 @@ namespace Nikse.SubtitleEdit.Core return 0; } + public TimeCode() : this(0) + { + } + public TimeCode(TimeSpan timeSpan) { _totalMilliseconds = timeSpan.TotalMilliseconds; diff --git a/libse/UknownFormatImporter.cs b/libse/UknownFormatImporter.cs index 43bcbe0cf..ae8963df9 100644 --- a/libse/UknownFormatImporter.cs +++ b/libse/UknownFormatImporter.cs @@ -705,7 +705,7 @@ namespace Nikse.SubtitleEdit.Core } catch { - return new TimeCode(0, 0, 0, 0); + return new TimeCode(); } } diff --git a/libse/Utilities.cs b/libse/Utilities.cs index dc62ac2f4..b9f7d9a3f 100644 --- a/libse/Utilities.cs +++ b/libse/Utilities.cs @@ -2158,7 +2158,7 @@ namespace Nikse.SubtitleEdit.Core if (int.TryParse(arr[0], out hour) && int.TryParse(arr[1], out min) && int.TryParse(arr[2], out sec) && int.TryParse(arr[3], out ms)) { - comments.Paragraphs.Add(new Paragraph(new TimeCode(hour, min, sec, ms * 10), new TimeCode(0, 0, 0, 0), line)); + comments.Paragraphs.Add(new Paragraph(new TimeCode(hour, min, sec, ms * 10), new TimeCode(), line)); } } } diff --git a/src/Forms/EbuSaveOptions.cs b/src/Forms/EbuSaveOptions.cs index 9d0ac1c30..ec6f01d41 100644 --- a/src/Forms/EbuSaveOptions.cs +++ b/src/Forms/EbuSaveOptions.cs @@ -203,7 +203,7 @@ namespace Nikse.SubtitleEdit.Forms } catch (Exception) { - timeUpDownStartTime.TimeCode = new TimeCode(0); + timeUpDownStartTime.TimeCode = new TimeCode(); } int number; diff --git a/src/Forms/ExportPngXml.cs b/src/Forms/ExportPngXml.cs index 1b8ab7698..c084c49ea 100644 --- a/src/Forms/ExportPngXml.cs +++ b/src/Forms/ExportPngXml.cs @@ -1536,7 +1536,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + fullSize.Save(fileName2, ImageFormat.Png); fullSize.Dispose(); - string line = string.Format("{0:000} {1} V C {2} {3} {4} {5}", i, fileName1, new TimeCode(0).ToHHMMSSFF(), param.P.Duration.ToHHMMSSFF(), param.P.StartTime.ToHHMMSSFF(), param.P.EndTime.ToHHMMSSFF()); + string line = string.Format("{0:000} {1} V C {2} {3} {4} {5}", i, fileName1, new TimeCode().ToHHMMSSFF(), param.P.Duration.ToHHMMSSFF(), param.P.StartTime.ToHHMMSSFF(), param.P.EndTime.ToHHMMSSFF()); sb.AppendLine(line); sb.AppendLine(); diff --git a/src/Forms/ExtractDateTimeInfo.cs b/src/Forms/ExtractDateTimeInfo.cs index 9c6ce4492..1e4f8626c 100644 --- a/src/Forms/ExtractDateTimeInfo.cs +++ b/src/Forms/ExtractDateTimeInfo.cs @@ -20,7 +20,7 @@ namespace Nikse.SubtitleEdit.Forms InitializeComponent(); comboBoxDateTimeFormats.SelectedIndex = 0; labelVideoFileName.Text = string.Empty; - timeUpDownStartTime.TimeCode = new TimeCode(0, 0, 0, 0); + timeUpDownStartTime.TimeCode = new TimeCode(); timeUpDownDuration.TimeCode = new TimeCode(1, 0, 0, 0); comboBoxDateTimeFormats.Items.Clear(); buttonCancel.Text = Configuration.Settings.Language.General.Cancel; diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs index 885c9250f..e58d52a06 100644 --- a/src/Forms/Main.cs +++ b/src/Forms/Main.cs @@ -333,7 +333,7 @@ namespace Nikse.SubtitleEdit.Forms labelVideoInfo.Text = string.Empty; labelSingleLine.Text = string.Empty; Text = Title; - timeUpDownStartTime.TimeCode = new TimeCode(0, 0, 0, 0); + timeUpDownStartTime.TimeCode = new TimeCode(); timeUpDownStartTime.UseVideoOffset = true; timeUpDownVideoPosition.UseVideoOffset = true; timeUpDownVideoPositionAdjust.UseVideoOffset = true; @@ -422,8 +422,8 @@ namespace Nikse.SubtitleEdit.Forms labelAutoDuration.Visible = false; mediaPlayer.SubtitleText = string.Empty; comboBoxAutoContinue.SelectedIndex = 2; - timeUpDownVideoPosition.TimeCode = new TimeCode(0, 0, 0, 0); - timeUpDownVideoPositionAdjust.TimeCode = new TimeCode(0, 0, 0, 0); + timeUpDownVideoPosition.TimeCode = new TimeCode(); + timeUpDownVideoPositionAdjust.TimeCode = new TimeCode(); timeUpDownVideoPosition.TimeCodeChanged += VideoPositionChanged; timeUpDownVideoPositionAdjust.TimeCodeChanged += VideoPositionChanged; timeUpDownVideoPosition.Enabled = false; @@ -8744,7 +8744,7 @@ namespace Nikse.SubtitleEdit.Forms { tc = tc.Substring(0, 13); var timeCode = tc.Split(new[] { ':', '.', ',' }, StringSplitOptions.RemoveEmptyEntries); - var realTC = new TimeCode(0, 0, 0, 0); + var realTC = new TimeCode(); try { realTC = new TimeCode(int.Parse(timeCode[1]), int.Parse(timeCode[2]), int.Parse(timeCode[3]), int.Parse(timeCode[4]) * 10); diff --git a/src/Forms/SetVideoOffset.cs b/src/Forms/SetVideoOffset.cs index 8d4d3edf8..5e3bc817e 100644 --- a/src/Forms/SetVideoOffset.cs +++ b/src/Forms/SetVideoOffset.cs @@ -29,7 +29,7 @@ namespace Nikse.SubtitleEdit.Forms public SetVideoOffset() { InitializeComponent(); - _videoOffset = new TimeCode(0); + _videoOffset = new TimeCode(); checkBoxKeepTimeCodes.Checked = Configuration.Settings.Tools.VideoOffsetKeepTimeCodes; Text = Configuration.Settings.Language.SetVideoOffset.Title; labelDescription.Text = Configuration.Settings.Language.SetVideoOffset.Description; @@ -56,7 +56,7 @@ namespace Nikse.SubtitleEdit.Forms private void buttonReset_Click(object sender, EventArgs e) { - VideoOffset = new TimeCode(0); + VideoOffset = new TimeCode(); DoNotaddVideoOffsetToTimeCodes = checkBoxKeepTimeCodes.Checked; Reset = true; DialogResult = DialogResult.OK; diff --git a/src/Test/Logic/ParagraphTest.cs b/src/Test/Logic/ParagraphTest.cs index 383f9694e..511e91f21 100644 --- a/src/Test/Logic/ParagraphTest.cs +++ b/src/Test/Logic/ParagraphTest.cs @@ -56,7 +56,7 @@ namespace Test.Logic [TestMethod] public void TestAdjust3() { - var p = new Paragraph { Text = string.Empty, StartTime = new TimeCode(0, 0, 0, 0) }; + var p = new Paragraph { Text = string.Empty, StartTime = new TimeCode() }; p.Adjust(1, 1); Assert.AreEqual(1, p.StartTime.TotalSeconds); }