From dec0ad58e535abd32c44bec76d04dd7a5c02937f Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sun, 31 Jul 2016 22:04:48 +0200 Subject: [PATCH] Minor refact (use simple types) --- libse/FileUtil.cs | 2 +- libse/RichTextToPlainText.cs | 22 +++++++++---------- .../AdvancedSubStationAlpha.cs | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libse/FileUtil.cs b/libse/FileUtil.cs index 8106eab3f..fae202f71 100644 --- a/libse/FileUtil.cs +++ b/libse/FileUtil.cs @@ -23,7 +23,7 @@ namespace Nikse.SubtitleEdit.Core { var index = 0; var fileLength = fs.Length; - if (fileLength > Int32.MaxValue) + if (fileLength > int.MaxValue) throw new IOException("File too long"); var count = (int)fileLength; var bytes = new byte[count]; diff --git a/libse/RichTextToPlainText.cs b/libse/RichTextToPlainText.cs index bd3a81506..80878b522 100644 --- a/libse/RichTextToPlainText.cs +++ b/libse/RichTextToPlainText.cs @@ -133,7 +133,7 @@ namespace Nikse.SubtitleEdit.Core string brace = match.Groups[5].Value; string tchar = match.Groups[6].Value; - if (!String.IsNullOrEmpty(brace)) + if (!string.IsNullOrEmpty(brace)) { curskip = 0; if (brace == "{") @@ -149,7 +149,7 @@ namespace Nikse.SubtitleEdit.Core ignorable = entry.Ignorable; } } - else if (!String.IsNullOrEmpty(character)) // \x (not a letter) + else if (!string.IsNullOrEmpty(character)) // \x (not a letter) { curskip = 0; if (character == "~") @@ -171,7 +171,7 @@ namespace Nikse.SubtitleEdit.Core ignorable = true; } } - else if (!String.IsNullOrEmpty(word)) // \foo + else if (!string.IsNullOrEmpty(word)) // \foo { curskip = 0; if (Destinations.Contains(word)) @@ -187,20 +187,20 @@ namespace Nikse.SubtitleEdit.Core } else if (word == "uc") { - ucskip = Int32.Parse(arg); + ucskip = int.Parse(arg); } else if (word == "u") { - int c = Int32.Parse(arg); + int c = int.Parse(arg); if (c < 0) { c += 0x10000; } - outList.Add(Char.ConvertFromUtf32(c)); + outList.Add(char.ConvertFromUtf32(c)); curskip = ucskip; } } - else if (!String.IsNullOrEmpty(hex)) // \'xx + else if (!string.IsNullOrEmpty(hex)) // \'xx { if (curskip > 0) { @@ -208,11 +208,11 @@ namespace Nikse.SubtitleEdit.Core } else if (!ignorable) { - int c = Int32.Parse(hex, System.Globalization.NumberStyles.HexNumber); - outList.Add(Char.ConvertFromUtf32(c)); + int c = int.Parse(hex, System.Globalization.NumberStyles.HexNumber); + outList.Add(char.ConvertFromUtf32(c)); } } - else if (!String.IsNullOrEmpty(tchar)) + else if (!string.IsNullOrEmpty(tchar)) { 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) diff --git a/libse/SubtitleFormats/AdvancedSubStationAlpha.cs b/libse/SubtitleFormats/AdvancedSubStationAlpha.cs index 4c3c71900..21e4b9404 100644 --- a/libse/SubtitleFormats/AdvancedSubStationAlpha.cs +++ b/libse/SubtitleFormats/AdvancedSubStationAlpha.cs @@ -1119,7 +1119,7 @@ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text if (s.StartsWith('h') && s.Length == 9) { 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) }