Minor refact (use simple types)

This commit is contained in:
Nikolaj Olsson 2016-07-31 22:04:48 +02:00
parent adfa76b4b3
commit dec0ad58e5
3 changed files with 13 additions and 13 deletions

View File

@ -23,7 +23,7 @@ namespace Nikse.SubtitleEdit.Core
{ {
var index = 0; var index = 0;
var fileLength = fs.Length; var fileLength = fs.Length;
if (fileLength > Int32.MaxValue) if (fileLength > int.MaxValue)
throw new IOException("File too long"); throw new IOException("File too long");
var count = (int)fileLength; var count = (int)fileLength;
var bytes = new byte[count]; var bytes = new byte[count];

View File

@ -133,7 +133,7 @@ namespace Nikse.SubtitleEdit.Core
string brace = match.Groups[5].Value; string brace = match.Groups[5].Value;
string tchar = match.Groups[6].Value; string tchar = match.Groups[6].Value;
if (!String.IsNullOrEmpty(brace)) if (!string.IsNullOrEmpty(brace))
{ {
curskip = 0; curskip = 0;
if (brace == "{") if (brace == "{")
@ -149,7 +149,7 @@ namespace Nikse.SubtitleEdit.Core
ignorable = entry.Ignorable; ignorable = entry.Ignorable;
} }
} }
else if (!String.IsNullOrEmpty(character)) // \x (not a letter) else if (!string.IsNullOrEmpty(character)) // \x (not a letter)
{ {
curskip = 0; curskip = 0;
if (character == "~") if (character == "~")
@ -171,7 +171,7 @@ namespace Nikse.SubtitleEdit.Core
ignorable = true; ignorable = true;
} }
} }
else if (!String.IsNullOrEmpty(word)) // \foo else if (!string.IsNullOrEmpty(word)) // \foo
{ {
curskip = 0; curskip = 0;
if (Destinations.Contains(word)) if (Destinations.Contains(word))
@ -187,20 +187,20 @@ namespace Nikse.SubtitleEdit.Core
} }
else if (word == "uc") else if (word == "uc")
{ {
ucskip = Int32.Parse(arg); ucskip = int.Parse(arg);
} }
else if (word == "u") else if (word == "u")
{ {
int c = Int32.Parse(arg); int c = int.Parse(arg);
if (c < 0) if (c < 0)
{ {
c += 0x10000; c += 0x10000;
} }
outList.Add(Char.ConvertFromUtf32(c)); outList.Add(char.ConvertFromUtf32(c));
curskip = ucskip; curskip = ucskip;
} }
} }
else if (!String.IsNullOrEmpty(hex)) // \'xx else if (!string.IsNullOrEmpty(hex)) // \'xx
{ {
if (curskip > 0) if (curskip > 0)
{ {
@ -208,11 +208,11 @@ namespace Nikse.SubtitleEdit.Core
} }
else if (!ignorable) else if (!ignorable)
{ {
int c = Int32.Parse(hex, System.Globalization.NumberStyles.HexNumber); int c = int.Parse(hex, System.Globalization.NumberStyles.HexNumber);
outList.Add(Char.ConvertFromUtf32(c)); outList.Add(char.ConvertFromUtf32(c));
} }
} }
else if (!String.IsNullOrEmpty(tchar)) else if (!string.IsNullOrEmpty(tchar))
{ {
if (curskip > 0) if (curskip > 0)
{ {
@ -225,7 +225,7 @@ namespace Nikse.SubtitleEdit.Core
} }
} }
} }
return String.Join(String.Empty, outList.ToArray()); return string.Join(string.Empty, outList.ToArray());
} }
internal static string ConvertToRtf(string value) internal static string ConvertToRtf(string value)

View File

@ -1119,7 +1119,7 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
if (s.StartsWith('h') && s.Length == 9) if (s.StartsWith('h') && s.Length == 9)
{ {
int alpha; int alpha;
if (Int32.TryParse(s.Substring(1, 2), NumberStyles.HexNumber, null, out alpha)) if (int.TryParse(s.Substring(1, 2), NumberStyles.HexNumber, null, out alpha))
{ {
alpha = 255 - alpha; // ASS stores alpha in reverse (0=full itentity and 255=fully transparent) alpha = 255 - alpha; // ASS stores alpha in reverse (0=full itentity and 255=fully transparent)
} }