mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
Minor refact
This commit is contained in:
parent
f6d8e76d6a
commit
a00f3c347c
@ -409,7 +409,7 @@ namespace Nikse.SubtitleEdit.Core.ContainerFormats
|
||||
|
||||
public static string FromFourCC(int FourCC)
|
||||
{
|
||||
char[] chars = new char[4];
|
||||
var chars = new char[4];
|
||||
chars[0] = (char)(FourCC & 0xFF);
|
||||
chars[1] = (char)((FourCC >> 8) & 0xFF);
|
||||
chars[2] = (char)((FourCC >> 16) & 0xFF);
|
||||
|
@ -30,7 +30,7 @@ namespace Nikse.SubtitleEdit.Core.Forms
|
||||
ColonSeparateLine = Configuration.Settings.RemoveTextForHearingImpaired.RemoveTextBeforeColonOnlyOnSeparateLine;
|
||||
RemoveWhereContains = Configuration.Settings.RemoveTextForHearingImpaired.RemoveIfContains;
|
||||
RemoveIfTextContains = new List<string>();
|
||||
foreach (string item in Configuration.Settings.RemoveTextForHearingImpaired.RemoveIfContainsText.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
foreach (string item in Configuration.Settings.RemoveTextForHearingImpaired.RemoveIfContainsText.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
RemoveIfTextContains.Add(item.Trim());
|
||||
}
|
||||
|
@ -666,7 +666,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
|
||||
private static TimeCode GetTimeCode(string s)
|
||||
{
|
||||
string[] parts = s.Split(new char[] { ':', '.', ',' });
|
||||
var parts = s.Split(new[] { ':', '.', ',' });
|
||||
|
||||
int milliseconds = (int)(int.Parse(parts[3]) * 4); // 000 to 249
|
||||
if (s.Contains('.'))
|
||||
|
@ -713,7 +713,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
|
||||
private TimeCode GetTimeCode(string s)
|
||||
{
|
||||
string[] parts = s.Split(new char[] { ':', '.', ',' });
|
||||
var parts = s.Split(new[] { ':', '.', ',' });
|
||||
|
||||
int milliseconds = (int)Math.Round(int.Parse(parts[3]) * (TimeCode.BaseUnit / _frameRate));
|
||||
if (milliseconds > 999)
|
||||
|
@ -713,7 +713,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
|
||||
private TimeCode GetTimeCode(string s)
|
||||
{
|
||||
string[] parts = s.Split(new char[] { ':', '.', ',' });
|
||||
var parts = s.Split(new[] { ':', '.', ',' });
|
||||
|
||||
int milliseconds = (int)Math.Round(int.Parse(parts[3]) * (TimeCode.BaseUnit / _frameRate));
|
||||
if (milliseconds > 999)
|
||||
|
@ -179,7 +179,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
s = s.TrimEnd('s');
|
||||
return TimeCode.FromSeconds(double.Parse(s));
|
||||
}
|
||||
string[] parts = s.Split(new char[] { ':', '.', ',' });
|
||||
var parts = s.Split(new[] { ':', '.', ',' });
|
||||
return new TimeCode(int.Parse(parts[0]), int.Parse(parts[1]), int.Parse(parts[2]), int.Parse(parts[3]));
|
||||
}
|
||||
|
||||
|
@ -55,13 +55,13 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
{
|
||||
var s = line.Replace(">", ">").Substring(0, idx);
|
||||
s = s.Remove(0, s.IndexOf(':') + 1);
|
||||
var arr = s.Split(new char[] { '-', '>' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var arr = s.Split(new[] { '-', '>' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var p = new Paragraph();
|
||||
p.StartTime = DecodeTimeCode(arr[0]);
|
||||
p.EndTime = DecodeTimeCode(arr[1]);
|
||||
int start = line.IndexOf("<img src=") + 9;
|
||||
int end = line.IndexOf(".png") + 4;
|
||||
p.Text = (line.Substring(start, end - start)).Trim(new char[] { '"', '\'' });
|
||||
p.Text = line.Substring(start, end - start).Trim(new[] { '"', '\'' });
|
||||
|
||||
subtitle.Paragraphs.Add(p);
|
||||
}
|
||||
@ -77,7 +77,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
|
||||
private TimeCode DecodeTimeCode(string timeCode)
|
||||
{
|
||||
var parts = timeCode.Split(new char[] { ':', '-', '>', ',', '.' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var parts = timeCode.Split(new[] { ':', '-', '>', ',', '.' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
int milliseconds = int.Parse(parts[parts.Length - 1]);
|
||||
int seconds = int.Parse(parts[parts.Length - 2]);
|
||||
int minutes = 0;
|
||||
|
@ -821,8 +821,8 @@ namespace Nikse.SubtitleEdit.Forms.Styles
|
||||
if (_isSubStationAlpha)
|
||||
{
|
||||
var ssa = new SubStationAlpha();
|
||||
string text = ssa.ToText(sub, string.Empty);
|
||||
string[] lineArray = text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
|
||||
var text = ssa.ToText(sub, string.Empty);
|
||||
var lineArray = text.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
|
||||
var lines = new List<string>();
|
||||
foreach (string line in lineArray)
|
||||
lines.Add(line);
|
||||
@ -832,8 +832,8 @@ namespace Nikse.SubtitleEdit.Forms.Styles
|
||||
else
|
||||
{
|
||||
var ass = new AdvancedSubStationAlpha();
|
||||
string text = ass.ToText(sub, string.Empty);
|
||||
string[] lineArray = text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
|
||||
var text = ass.ToText(sub, string.Empty);
|
||||
var lineArray = text.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
|
||||
var lines = new List<string>();
|
||||
foreach (string line in lineArray)
|
||||
lines.Add(line);
|
||||
|
Loading…
Reference in New Issue
Block a user