diff options
| author | Anthony Lavado <anthonylavado@users.noreply.github.com> | 2019-09-02 02:07:19 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-02 02:07:19 -0400 |
| commit | cb393c215a2ea75f61d0e3e798c6a4a596d720c2 (patch) | |
| tree | 1eb9586e139de7af8cc906ca4aa758e5106cb35d /Emby.Notifications/Notifications.cs | |
| parent | c4eac8b3c6257e4a2aab2fa93d877fbcff8fee51 (diff) | |
| parent | e4f893a0eb955d43e7ef4c99bef8d4bfeb61a771 (diff) | |
Merge pull request #1686 from Bond-009/warn7
More warning fixes
Diffstat (limited to 'Emby.Notifications/Notifications.cs')
| -rw-r--r-- | Emby.Notifications/Notifications.cs | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/Emby.Notifications/Notifications.cs b/Emby.Notifications/Notifications.cs index ec08fd193..7aa1e7ae8 100644 --- a/Emby.Notifications/Notifications.cs +++ b/Emby.Notifications/Notifications.cs @@ -209,47 +209,48 @@ namespace Emby.Notifications public static string GetItemName(BaseItem item) { var name = item.Name; - var episode = item as Episode; - if (episode != null) + if (item is Episode episode) { if (episode.IndexNumber.HasValue) { - name = string.Format("Ep{0} - {1}", episode.IndexNumber.Value.ToString(CultureInfo.InvariantCulture), name); + name = string.Format( + CultureInfo.InvariantCulture, + "Ep{0} - {1}", + episode.IndexNumber.Value, + name); } if (episode.ParentIndexNumber.HasValue) { - name = string.Format("S{0}, {1}", episode.ParentIndexNumber.Value.ToString(CultureInfo.InvariantCulture), name); + name = string.Format( + CultureInfo.InvariantCulture, + "S{0}, {1}", + episode.ParentIndexNumber.Value, + name); } } - var hasSeries = item as IHasSeries; - if (hasSeries != null) + if (item is IHasSeries hasSeries) { name = hasSeries.SeriesName + " - " + name; } - var hasAlbumArtist = item as IHasAlbumArtist; - if (hasAlbumArtist != null) + if (item is IHasAlbumArtist hasAlbumArtist) { var artists = hasAlbumArtist.AlbumArtists; - if (artists.Length > 0) + if (artists.Count > 0) { name = artists[0] + " - " + name; } } - else + else if (item is IHasArtist hasArtist) { - var hasArtist = item as IHasArtist; - if (hasArtist != null) - { - var artists = hasArtist.Artists; + var artists = hasArtist.Artists; - if (artists.Length > 0) - { - name = artists[0] + " - " + name; - } + if (artists.Count > 0) + { + name = artists[0] + " - " + name; } } |
