aboutsummaryrefslogtreecommitdiff
path: root/Emby.Naming
diff options
context:
space:
mode:
authorErwin de Haan <EraYaN@users.noreply.github.com>2019-01-06 21:50:43 +0100
committerErwin de Haan <EraYaN@users.noreply.github.com>2019-01-10 20:38:53 +0100
commitec1f5dc317182582ebff843c9e8a4d5277405469 (patch)
tree6514de336cc9aa94becb3fbd767285dfa61d0b1b /Emby.Naming
parent3d867c2c46cec39b669bb8647efef677f32b8a8d (diff)
Mayor code cleanup
Add Argument*Exceptions now use proper nameof operators. Added exception messages to quite a few Argument*Exceptions. Fixed rethorwing to be proper syntax. Added a ton of null checkes. (This is only a start, there are about 500 places that need proper null handling) Added some TODOs to log certain exceptions. Fix sln again. Fixed all AssemblyInfo's and added proper copyright (where I could find them) We live in *current year*. Fixed the use of braces. Fixed a ton of properties, and made a fair amount of functions static that should be and can be static. Made more Methods that should be static static. You can now use static to find bad functions! Removed unused variable. And added one more proper XML comment.
Diffstat (limited to 'Emby.Naming')
-rw-r--r--Emby.Naming/AudioBook/AudioBookResolver.cs2
-rw-r--r--Emby.Naming/Emby.Naming.csproj4
-rw-r--r--Emby.Naming/Properties/AssemblyInfo.cs21
-rw-r--r--Emby.Naming/Subtitles/SubtitleParser.cs4
-rw-r--r--Emby.Naming/TV/EpisodePathParser.cs4
-rw-r--r--Emby.Naming/TV/EpisodeResolver.cs2
-rw-r--r--Emby.Naming/Video/CleanDateTimeParser.cs4
-rw-r--r--Emby.Naming/Video/CleanStringParser.cs4
-rw-r--r--Emby.Naming/Video/FlagParser.cs2
-rw-r--r--Emby.Naming/Video/Format3DParser.cs4
-rw-r--r--Emby.Naming/Video/VideoListResolver.cs2
-rw-r--r--Emby.Naming/Video/VideoResolver.cs2
12 files changed, 40 insertions, 15 deletions
diff --git a/Emby.Naming/AudioBook/AudioBookResolver.cs b/Emby.Naming/AudioBook/AudioBookResolver.cs
index a206ee30b..226d016d9 100644
--- a/Emby.Naming/AudioBook/AudioBookResolver.cs
+++ b/Emby.Naming/AudioBook/AudioBookResolver.cs
@@ -30,7 +30,7 @@ namespace Emby.Naming.AudioBook
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
if (IsDirectory)
return null;
diff --git a/Emby.Naming/Emby.Naming.csproj b/Emby.Naming/Emby.Naming.csproj
index f1a736ecc..360ffaabe 100644
--- a/Emby.Naming/Emby.Naming.csproj
+++ b/Emby.Naming/Emby.Naming.csproj
@@ -4,6 +4,10 @@
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
+
+ <ItemGroup>
+ <Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" />
+ </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
diff --git a/Emby.Naming/Properties/AssemblyInfo.cs b/Emby.Naming/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..15311570b
--- /dev/null
+++ b/Emby.Naming/Properties/AssemblyInfo.cs
@@ -0,0 +1,21 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Emby.Naming")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
diff --git a/Emby.Naming/Subtitles/SubtitleParser.cs b/Emby.Naming/Subtitles/SubtitleParser.cs
index fbf0f60cb..9c279cc09 100644
--- a/Emby.Naming/Subtitles/SubtitleParser.cs
+++ b/Emby.Naming/Subtitles/SubtitleParser.cs
@@ -18,7 +18,7 @@ namespace Emby.Naming.Subtitles
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
var extension = Path.GetExtension(path);
@@ -52,7 +52,7 @@ namespace Emby.Naming.Subtitles
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
// Note: the tags need be be surrounded be either a space ( ), hyphen -, dot . or underscore _.
diff --git a/Emby.Naming/TV/EpisodePathParser.cs b/Emby.Naming/TV/EpisodePathParser.cs
index 7f8a6a70e..813be3f7a 100644
--- a/Emby.Naming/TV/EpisodePathParser.cs
+++ b/Emby.Naming/TV/EpisodePathParser.cs
@@ -1,4 +1,4 @@
-using Emby.Naming.Common;
+using Emby.Naming.Common;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -74,7 +74,7 @@ namespace Emby.Naming.TV
return result ?? new EpisodePathParserResult();
}
- private EpisodePathParserResult Parse(string name, EpisodeExpression expression)
+ private static EpisodePathParserResult Parse(string name, EpisodeExpression expression)
{
var result = new EpisodePathParserResult();
diff --git a/Emby.Naming/TV/EpisodeResolver.cs b/Emby.Naming/TV/EpisodeResolver.cs
index 2007d1307..4548b4c35 100644
--- a/Emby.Naming/TV/EpisodeResolver.cs
+++ b/Emby.Naming/TV/EpisodeResolver.cs
@@ -19,7 +19,7 @@ namespace Emby.Naming.TV
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
var isStub = false;
diff --git a/Emby.Naming/Video/CleanDateTimeParser.cs b/Emby.Naming/Video/CleanDateTimeParser.cs
index 572dd1c60..c8eb9abf8 100644
--- a/Emby.Naming/Video/CleanDateTimeParser.cs
+++ b/Emby.Naming/Video/CleanDateTimeParser.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using Emby.Naming.Common;
using System.Globalization;
using System.IO;
@@ -63,7 +63,7 @@ namespace Emby.Naming.Video
result;
}
- private CleanDateTimeResult Clean(string name, Regex expression)
+ private static CleanDateTimeResult Clean(string name, Regex expression)
{
var result = new CleanDateTimeResult();
diff --git a/Emby.Naming/Video/CleanStringParser.cs b/Emby.Naming/Video/CleanStringParser.cs
index bddf9589b..02b90310d 100644
--- a/Emby.Naming/Video/CleanStringParser.cs
+++ b/Emby.Naming/Video/CleanStringParser.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace Emby.Naming.Video
@@ -30,7 +30,7 @@ namespace Emby.Naming.Video
};
}
- private CleanStringResult Clean(string name, Regex expression)
+ private static CleanStringResult Clean(string name, Regex expression)
{
var result = new CleanStringResult();
diff --git a/Emby.Naming/Video/FlagParser.cs b/Emby.Naming/Video/FlagParser.cs
index a2c541eeb..ef785ebf9 100644
--- a/Emby.Naming/Video/FlagParser.cs
+++ b/Emby.Naming/Video/FlagParser.cs
@@ -22,7 +22,7 @@ namespace Emby.Naming.Video
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
// Note: the tags need be be surrounded be either a space ( ), hyphen -, dot . or underscore _.
diff --git a/Emby.Naming/Video/Format3DParser.cs b/Emby.Naming/Video/Format3DParser.cs
index 42737b483..e335d1055 100644
--- a/Emby.Naming/Video/Format3DParser.cs
+++ b/Emby.Naming/Video/Format3DParser.cs
@@ -1,4 +1,4 @@
-using Emby.Naming.Common;
+using Emby.Naming.Common;
using System;
using System.Linq;
@@ -36,7 +36,7 @@ namespace Emby.Naming.Video
return new Format3DResult();
}
- private Format3DResult Parse(string[] videoFlags, Format3DRule rule)
+ private static Format3DResult Parse(string[] videoFlags, Format3DRule rule)
{
var result = new Format3DResult();
diff --git a/Emby.Naming/Video/VideoListResolver.cs b/Emby.Naming/Video/VideoListResolver.cs
index 47be28104..23e012c30 100644
--- a/Emby.Naming/Video/VideoListResolver.cs
+++ b/Emby.Naming/Video/VideoListResolver.cs
@@ -236,7 +236,7 @@ namespace Emby.Naming.Video
if (testFilename.StartsWith(folderName, StringComparison.OrdinalIgnoreCase))
{
testFilename = testFilename.Substring(folderName.Length).Trim();
- return testFilename.StartsWith("-", StringComparison.OrdinalIgnoreCase)||Regex.Replace(testFilename, @"\[([^]]*)\]", "").Trim() == String.Empty;
+ return testFilename.StartsWith("-", StringComparison.OrdinalIgnoreCase)||Regex.Replace(testFilename, @"\[([^]]*)\]", "").Trim() == string.Empty;
}
return false;
diff --git a/Emby.Naming/Video/VideoResolver.cs b/Emby.Naming/Video/VideoResolver.cs
index c4951c728..f6ab8cb87 100644
--- a/Emby.Naming/Video/VideoResolver.cs
+++ b/Emby.Naming/Video/VideoResolver.cs
@@ -45,7 +45,7 @@ namespace Emby.Naming.Video
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
var isStub = false;