From 106d1d18ed5781043312194590aa37dc8a3072d0 Mon Sep 17 00:00:00 2001 From: Erwin de Haan Date: Sun, 13 Jan 2019 20:25:11 +0100 Subject: Visual Studio Reformat: MediaBrowser.Common --- MediaBrowser.Common/Plugins/BasePlugin.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'MediaBrowser.Common/Plugins/BasePlugin.cs') diff --git a/MediaBrowser.Common/Plugins/BasePlugin.cs b/MediaBrowser.Common/Plugins/BasePlugin.cs index 2fdee381d..cd52803c6 100644 --- a/MediaBrowser.Common/Plugins/BasePlugin.cs +++ b/MediaBrowser.Common/Plugins/BasePlugin.cs @@ -1,8 +1,8 @@ +using System; +using System.IO; using MediaBrowser.Common.Configuration; using MediaBrowser.Model.Plugins; using MediaBrowser.Model.Serialization; -using System; -using System.IO; namespace MediaBrowser.Common.Plugins { -- cgit v1.2.3 From a36658f6f0ed342d8b55dbf7c9ff95fe3abfa818 Mon Sep 17 00:00:00 2001 From: Erwin de Haan Date: Sun, 13 Jan 2019 21:31:14 +0100 Subject: ReSharper Reformat: Properties to expression bodied form. --- BDInfo/BDInfoSettings.cs | 96 ++-------- BDInfo/TSStream.cs | 31 +--- BDInfo/TSStreamBuffer.cs | 16 +- BDInfo/TSStreamClip.cs | 8 +- Emby.Dlna/Api/DlnaServerService.cs | 24 +-- Emby.Dlna/Didl/StringWriterWithEncoding.cs | 5 +- Emby.Dlna/DlnaManager.cs | 16 +- Emby.Dlna/Eventing/EventSubscription.cs | 8 +- Emby.Dlna/PlayTo/Device.cs | 39 +---- Emby.Dlna/PlayTo/DeviceInfo.cs | 18 +- Emby.Dlna/PlayTo/PlayToController.cs | 21 +-- Emby.Dlna/PlayTo/TransportCommands.cs | 20 +-- Emby.Drawing.Skia/SkiaEncoder.cs | 79 +++------ Emby.Drawing/ImageProcessor.cs | 101 +++++------ Emby.Drawing/NullImageEncoder.cs | 40 ++--- Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs | 23 +-- Emby.IsoMounting/IsoMounter/Plugin.cs | 18 +- Emby.Naming/Common/EpisodeExpression.cs | 11 +- Emby.Naming/Video/VideoFileInfo.cs | 5 +- Emby.Photos/PhotoProvider.cs | 5 +- .../Data/SqliteItemRepository.cs | 24 +-- Jellyfin.Server/CoreAppHost.cs | 17 +- Jellyfin.Server/SocketSharp/RequestMono.cs | 75 ++------ Jellyfin.Server/SocketSharp/SharpWebSocket.cs | 8 +- .../SocketSharp/WebSocketSharpRequest.cs | 170 ++++-------------- .../SocketSharp/WebSocketSharpResponse.cs | 34 ++-- MediaBrowser.Api/BaseApiService.cs | 16 +- MediaBrowser.Api/LiveTv/ProgressiveFileCopier.cs | 8 +- MediaBrowser.Api/Playback/BaseStreamingService.cs | 5 +- MediaBrowser.Api/Playback/Hls/BaseHlsService.cs | 5 +- .../Progressive/BaseProgressiveStreamingService.cs | 5 +- .../Progressive/ProgressiveStreamWriter.cs | 8 +- .../Playback/StaticRemoteStreamWriter.cs | 5 +- MediaBrowser.Api/Playback/StreamRequest.cs | 8 +- MediaBrowser.Api/Playback/StreamState.cs | 20 +-- .../ScheduledTasksWebSocketListener.cs | 5 +- .../Session/SessionInfoWebSocketListener.cs | 5 +- .../System/ActivityLogWebSocketListener.cs | 5 +- MediaBrowser.Common/Net/HttpRequestOptions.cs | 14 +- MediaBrowser.Common/Plugins/BasePlugin.cs | 41 +---- MediaBrowser.Controller/Channels/Channel.cs | 13 +- .../Entities/AggregateFolder.cs | 26 +-- MediaBrowser.Controller/Entities/Audio/Audio.cs | 52 +----- .../Entities/Audio/MusicAlbum.cs | 49 +----- .../Entities/Audio/MusicArtist.cs | 66 +------ .../Entities/Audio/MusicGenre.cs | 37 +--- MediaBrowser.Controller/Entities/AudioBook.cs | 16 +- MediaBrowser.Controller/Entities/BaseItem.cs | 195 ++++----------------- .../Entities/BasePluginFolder.cs | 21 +-- MediaBrowser.Controller/Entities/Book.cs | 8 +- .../Entities/CollectionFolder.cs | 45 +---- MediaBrowser.Controller/Entities/Folder.cs | 97 ++-------- MediaBrowser.Controller/Entities/Game.cs | 15 +- MediaBrowser.Controller/Entities/GameGenre.cs | 24 +-- MediaBrowser.Controller/Entities/GameSystem.cs | 32 +--- MediaBrowser.Controller/Entities/Genre.cs | 32 +--- MediaBrowser.Controller/Entities/Movies/BoxSet.cs | 29 +-- MediaBrowser.Controller/Entities/Movies/Movie.cs | 13 +- MediaBrowser.Controller/Entities/MusicVideo.cs | 8 +- MediaBrowser.Controller/Entities/Person.cs | 32 +--- MediaBrowser.Controller/Entities/Photo.cs | 24 +-- MediaBrowser.Controller/Entities/PhotoAlbum.cs | 24 +-- MediaBrowser.Controller/Entities/Studio.cs | 32 +--- MediaBrowser.Controller/Entities/TV/Episode.cs | 66 +------ MediaBrowser.Controller/Entities/TV/Season.cs | 36 +--- MediaBrowser.Controller/Entities/TV/Series.cs | 43 +---- MediaBrowser.Controller/Entities/Trailer.cs | 9 +- MediaBrowser.Controller/Entities/User.cs | 62 ++----- MediaBrowser.Controller/Entities/UserItemData.cs | 5 +- MediaBrowser.Controller/Entities/UserRootFolder.cs | 32 +--- MediaBrowser.Controller/Entities/UserView.cs | 32 +--- MediaBrowser.Controller/Entities/Video.cs | 62 ++----- MediaBrowser.Controller/Entities/Year.cs | 24 +-- MediaBrowser.Controller/Library/ItemResolveArgs.cs | 16 +- MediaBrowser.Controller/LiveTv/LiveTvChannel.cs | 46 +---- MediaBrowser.Controller/LiveTv/LiveTvProgram.cs | 61 +------ MediaBrowser.Controller/LiveTv/TimerInfo.cs | 42 +---- .../MediaEncoding/EncodingJobInfo.cs | 74 ++------ .../MediaEncoding/EncodingJobOptions.cs | 8 +- .../Net/AuthenticatedAttribute.cs | 5 +- MediaBrowser.Controller/Net/AuthorizationInfo.cs | 8 +- .../Net/BasePeriodicWebSocketListener.cs | 8 +- MediaBrowser.Controller/Playlists/Playlist.cs | 64 +------ .../Resolvers/BaseItemResolver.cs | 8 +- MediaBrowser.LocalMetadata/BaseXmlProvider.cs | 25 +-- .../Images/CollectionFolderImageProvider.cs | 14 +- .../Images/EpisodeLocalImageProvider.cs | 10 +- .../Images/InternalMetadataFolderImageProvider.cs | 14 +- .../Images/LocalImageProvider.cs | 10 +- MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs | 16 +- MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs | 6 +- MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs | 4 +- MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 5 +- MediaBrowser.MediaEncoding/Encoder/VideoEncoder.cs | 6 +- .../Subtitles/OpenSubtitleDownloader.cs | 5 +- .../Subtitles/SubtitleEncoder.cs | 8 +- MediaBrowser.Model/Dlna/SortCriteria.cs | 5 +- MediaBrowser.Model/Dlna/StreamInfo.cs | 27 +-- MediaBrowser.Model/Drawing/ImageSize.cs | 14 +- MediaBrowser.Model/Dto/BaseItemPerson.cs | 8 +- MediaBrowser.Model/Entities/LibraryUpdateInfo.cs | 8 +- .../Services/QueryParamCollection.cs | 36 +--- MediaBrowser.Model/Updates/CheckForUpdateResult.cs | 2 +- MediaBrowser.Model/Updates/PackageVersionInfo.cs | 5 +- .../BoxSets/BoxSetMetadataService.cs | 32 +--- .../BoxSets/MovieDbBoxSetImageProvider.cs | 15 +- .../BoxSets/MovieDbBoxSetProvider.cs | 5 +- .../Folders/FolderMetadataService.cs | 9 +- .../Manager/GenericPriorityQueue.cs | 16 +- MediaBrowser.Providers/Manager/MetadataService.cs | 43 +---- .../MediaInfo/AudioImageProvider.cs | 13 +- .../MediaInfo/FFProbeProvider.cs | 14 +- .../MediaInfo/SubtitleScheduledTask.cs | 20 +-- .../MediaInfo/VideoImageProvider.cs | 14 +- .../Movies/FanartMovieImageProvider.cs | 15 +- .../Movies/MovieDbImageProvider.cs | 15 +- MediaBrowser.Providers/Movies/MovieDbProvider.cs | 13 +- .../Movies/MovieDbTrailerProvider.cs | 13 +- MediaBrowser.Providers/Movies/MovieExternalIds.cs | 105 +++-------- .../Music/AlbumMetadataService.cs | 24 +-- .../Music/ArtistMetadataService.cs | 8 +- .../Music/AudioDbAlbumImageProvider.cs | 14 +- .../Music/AudioDbAlbumProvider.cs | 14 +- .../Music/AudioDbArtistImageProvider.cs | 14 +- .../Music/AudioDbArtistProvider.cs | 14 +- MediaBrowser.Providers/Music/AudioDbExternalIds.cs | 60 ++----- .../Music/FanArtAlbumProvider.cs | 19 +- .../Music/FanArtArtistProvider.cs | 15 +- .../Music/MovieDbMusicVideoProvider.cs | 5 +- .../Music/MusicBrainzAlbumProvider.cs | 10 +- .../Music/MusicBrainzArtistProvider.cs | 5 +- MediaBrowser.Providers/Music/MusicExternalIds.cs | 105 +++-------- MediaBrowser.Providers/Omdb/OmdbImageProvider.cs | 15 +- MediaBrowser.Providers/Omdb/OmdbItemProvider.cs | 14 +- .../People/MovieDbPersonImageProvider.cs | 15 +- .../People/MovieDbPersonProvider.cs | 5 +- .../People/TvdbPersonImageProvider.cs | 15 +- .../Playlists/PlaylistItemsProvider.cs | 14 +- .../Playlists/PlaylistMetadataService.cs | 24 +-- .../Studios/StudiosImageProvider.cs | 10 +- .../TV/FanArt/FanArtSeasonProvider.cs | 15 +- .../TV/FanArt/FanartSeriesProvider.cs | 15 +- .../TV/Omdb/OmdbEpisodeProvider.cs | 14 +- MediaBrowser.Providers/TV/SeasonMetadataService.cs | 8 +- .../TV/TheMovieDb/MovieDbEpisodeImageProvider.cs | 14 +- .../TV/TheMovieDb/MovieDbEpisodeProvider.cs | 14 +- .../TV/TheMovieDb/MovieDbProviderBase.cs | 5 +- .../TV/TheMovieDb/MovieDbSeasonProvider.cs | 5 +- .../TV/TheMovieDb/MovieDbSeriesImageProvider.cs | 19 +- .../TV/TheMovieDb/MovieDbSeriesProvider.cs | 14 +- .../TV/TheTVDB/TvdbEpisodeImageProvider.cs | 10 +- .../TV/TheTVDB/TvdbEpisodeProvider.cs | 7 +- .../TV/TheTVDB/TvdbSeasonImageProvider.cs | 15 +- .../TV/TheTVDB/TvdbSeriesImageProvider.cs | 15 +- .../TV/TheTVDB/TvdbSeriesProvider.cs | 13 +- MediaBrowser.Providers/TV/TvExternalIds.cs | 60 ++----- .../Videos/VideoMetadataService.cs | 9 +- MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs | 10 +- .../Parsers/MovieNfoParser.cs | 8 +- .../Parsers/SeriesNfoParser.cs | 13 +- .../Providers/BaseNfoProvider.cs | 8 +- MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs | 16 +- SocketHttpListener/CloseEventArgs.cs | 26 +-- SocketHttpListener/ErrorEventArgs.cs | 8 +- SocketHttpListener/HttpBase.cs | 16 +- SocketHttpListener/HttpResponse.cs | 40 +---- SocketHttpListener/MessageEventArgs.cs | 24 +-- SocketHttpListener/Net/ChunkStream.cs | 15 +- SocketHttpListener/Net/ChunkedInputStream.cs | 4 +- SocketHttpListener/Net/HttpConnection.cs | 32 +--- SocketHttpListener/Net/HttpEndPointListener.cs | 8 +- SocketHttpListener/Net/HttpListener.cs | 23 +-- .../Net/HttpListenerBasicIdentity.cs | 29 +-- SocketHttpListener/Net/HttpListenerContext.cs | 16 +- .../Net/HttpListenerPrefixCollection.cs | 15 +- .../Net/HttpListenerResponse.Managed.cs | 4 +- SocketHttpListener/Net/HttpListenerResponse.cs | 27 ++- SocketHttpListener/Net/HttpRequestStream.cs | 18 +- SocketHttpListener/Net/HttpResponseStream.cs | 18 +- SocketHttpListener/Net/HttpStreamAsyncResult.cs | 5 +- SocketHttpListener/Net/ListenerPrefix.cs | 24 +-- SocketHttpListener/PayloadData.cs | 43 +---- SocketHttpListener/SocketStream.cs | 28 ++- SocketHttpListener/WebSocket.cs | 14 +- SocketHttpListener/WebSocketFrame.cs | 192 +++----------------- 185 files changed, 792 insertions(+), 3796 deletions(-) (limited to 'MediaBrowser.Common/Plugins/BasePlugin.cs') diff --git a/BDInfo/BDInfoSettings.cs b/BDInfo/BDInfoSettings.cs index d127710f4..f4cb30016 100644 --- a/BDInfo/BDInfoSettings.cs +++ b/BDInfo/BDInfoSettings.cs @@ -3,103 +3,31 @@ namespace BDInfo { class BDInfoSettings { - public static bool GenerateStreamDiagnostics - { - get - { - return true; - } - } + public static bool GenerateStreamDiagnostics => true; - public static bool EnableSSIF - { - get - { - return true; - } - } + public static bool EnableSSIF => true; - public static bool AutosaveReport - { - get - { - return false; - } - } + public static bool AutosaveReport => false; - public static bool GenerateFrameDataFile - { - get - { - return false; - } - } + public static bool GenerateFrameDataFile => false; - public static bool FilterLoopingPlaylists - { - get - { - return true; - } - } + public static bool FilterLoopingPlaylists => true; - public static bool FilterShortPlaylists - { - get - { - return false; - } - } + public static bool FilterShortPlaylists => false; - public static int FilterShortPlaylistsValue - { - get - { - return 0; - } - } + public static int FilterShortPlaylistsValue => 0; - public static bool UseImagePrefix - { - get - { - return false; - } - } + public static bool UseImagePrefix => false; - public static string UseImagePrefixValue - { - get - { - return null; - } - } + public static string UseImagePrefixValue => null; /// /// Setting this to false throws an IComparer error on some discs. /// - public static bool KeepStreamOrder - { - get - { - return true; - } - } + public static bool KeepStreamOrder => true; - public static bool GenerateTextSummary - { - get - { - return false; - } - } + public static bool GenerateTextSummary => false; - public static string LastPath - { - get - { - return string.Empty; - } - } + public static string LastPath => string.Empty; } } diff --git a/BDInfo/TSStream.cs b/BDInfo/TSStream.cs index 98269a362..fad3f1acb 100644 --- a/BDInfo/TSStream.cs +++ b/BDInfo/TSStream.cs @@ -142,21 +142,12 @@ namespace BDInfo public double PacketSeconds = 0; public int AngleIndex = 0; - public ulong PacketSize - { - get - { - return PacketCount * 192; - } - } + public ulong PacketSize => PacketCount * 192; private string _LanguageCode; public string LanguageCode { - get - { - return _LanguageCode; - } + get => _LanguageCode; set { _LanguageCode = value; @@ -398,13 +389,7 @@ namespace BDInfo } } - public virtual string Description - { - get - { - return ""; - } - } + public virtual string Description => ""; public abstract TSStream Clone(); @@ -444,10 +429,7 @@ namespace BDInfo private TSVideoFormat _VideoFormat; public TSVideoFormat VideoFormat { - get - { - return _VideoFormat; - } + get => _VideoFormat; set { _VideoFormat = value; @@ -488,10 +470,7 @@ namespace BDInfo private TSFrameRate _FrameRate; public TSFrameRate FrameRate { - get - { - return _FrameRate; - } + get => _FrameRate; set { _FrameRate = value; diff --git a/BDInfo/TSStreamBuffer.cs b/BDInfo/TSStreamBuffer.cs index 36f3149fa..17025c2e3 100644 --- a/BDInfo/TSStreamBuffer.cs +++ b/BDInfo/TSStreamBuffer.cs @@ -37,21 +37,9 @@ namespace BDInfo Stream = new MemoryStream(Buffer); } - public long Length - { - get - { - return (long)BufferLength; - } - } + public long Length => (long)BufferLength; - public long Position - { - get - { - return Stream.Position; - } - } + public long Position => Stream.Position; public void Add( byte[] buffer, diff --git a/BDInfo/TSStreamClip.cs b/BDInfo/TSStreamClip.cs index 23408859d..20f795e53 100644 --- a/BDInfo/TSStreamClip.cs +++ b/BDInfo/TSStreamClip.cs @@ -74,13 +74,7 @@ namespace BDInfo } } - public ulong PacketSize - { - get - { - return PacketCount * 192; - } - } + public ulong PacketSize => PacketCount * 192; public ulong PacketBitRate { diff --git a/Emby.Dlna/Api/DlnaServerService.cs b/Emby.Dlna/Api/DlnaServerService.cs index 44c9ebc71..f4009ee93 100644 --- a/Emby.Dlna/Api/DlnaServerService.cs +++ b/Emby.Dlna/Api/DlnaServerService.cs @@ -115,29 +115,11 @@ namespace Emby.Dlna.Api public IRequest Request { get; set; } private IHttpResultFactory _resultFactory; - private IContentDirectory ContentDirectory - { - get - { - return DlnaEntryPoint.Current.ContentDirectory; - } - } + private IContentDirectory ContentDirectory => DlnaEntryPoint.Current.ContentDirectory; - private IConnectionManager ConnectionManager - { - get - { - return DlnaEntryPoint.Current.ConnectionManager; - } - } + private IConnectionManager ConnectionManager => DlnaEntryPoint.Current.ConnectionManager; - private IMediaReceiverRegistrar MediaReceiverRegistrar - { - get - { - return DlnaEntryPoint.Current.MediaReceiverRegistrar; - } - } + private IMediaReceiverRegistrar MediaReceiverRegistrar => DlnaEntryPoint.Current.MediaReceiverRegistrar; public DlnaServerService(IDlnaManager dlnaManager, IHttpResultFactory httpResultFactory) { diff --git a/Emby.Dlna/Didl/StringWriterWithEncoding.cs b/Emby.Dlna/Didl/StringWriterWithEncoding.cs index 93ed323d0..c3c4bd393 100644 --- a/Emby.Dlna/Didl/StringWriterWithEncoding.cs +++ b/Emby.Dlna/Didl/StringWriterWithEncoding.cs @@ -51,9 +51,6 @@ namespace Emby.Dlna.Didl _encoding = encoding; } - public override Encoding Encoding - { - get { return (null == _encoding) ? base.Encoding : _encoding; } - } + public override Encoding Encoding => (null == _encoding) ? base.Encoding : _encoding; } } diff --git a/Emby.Dlna/DlnaManager.cs b/Emby.Dlna/DlnaManager.cs index 2a65ce40a..62b261908 100644 --- a/Emby.Dlna/DlnaManager.cs +++ b/Emby.Dlna/DlnaManager.cs @@ -261,21 +261,9 @@ namespace Emby.Dlna return false; } - private string UserProfilesPath - { - get - { - return Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "user"); - } - } + private string UserProfilesPath => Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "user"); - private string SystemProfilesPath - { - get - { - return Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "system"); - } - } + private string SystemProfilesPath => Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "system"); private IEnumerable GetProfiles(string path, DeviceProfileType type) { diff --git a/Emby.Dlna/Eventing/EventSubscription.cs b/Emby.Dlna/Eventing/EventSubscription.cs index 4c72c4211..eb8781e0c 100644 --- a/Emby.Dlna/Eventing/EventSubscription.cs +++ b/Emby.Dlna/Eventing/EventSubscription.cs @@ -23,12 +23,6 @@ namespace Emby.Dlna.Eventing TriggerCount++; } - public bool IsExpired - { - get - { - return SubscriptionTime.AddSeconds(TimeoutSeconds) >= DateTime.UtcNow; - } - } + public bool IsExpired => SubscriptionTime.AddSeconds(TimeoutSeconds) >= DateTime.UtcNow; } } diff --git a/Emby.Dlna/PlayTo/Device.cs b/Emby.Dlna/PlayTo/Device.cs index 117646108..a85720b5f 100644 --- a/Emby.Dlna/PlayTo/Device.cs +++ b/Emby.Dlna/PlayTo/Device.cs @@ -35,10 +35,7 @@ namespace Emby.Dlna.PlayTo RefreshVolumeIfNeeded(); return _volume; } - set - { - _volume = value; - } + set => _volume = value; } public TimeSpan? Duration { get; set; } @@ -46,41 +43,17 @@ namespace Emby.Dlna.PlayTo private TimeSpan _position = TimeSpan.FromSeconds(0); public TimeSpan Position { - get - { - return _position; - } - set - { - _position = value; - } + get => _position; + set => _position = value; } public TRANSPORTSTATE TransportState { get; private set; } - public bool IsPlaying - { - get - { - return TransportState == TRANSPORTSTATE.PLAYING; - } - } + public bool IsPlaying => TransportState == TRANSPORTSTATE.PLAYING; - public bool IsPaused - { - get - { - return TransportState == TRANSPORTSTATE.PAUSED || TransportState == TRANSPORTSTATE.PAUSED_PLAYBACK; - } - } + public bool IsPaused => TransportState == TRANSPORTSTATE.PAUSED || TransportState == TRANSPORTSTATE.PAUSED_PLAYBACK; - public bool IsStopped - { - get - { - return TransportState == TRANSPORTSTATE.STOPPED; - } - } + public bool IsStopped => TransportState == TRANSPORTSTATE.STOPPED; #endregion diff --git a/Emby.Dlna/PlayTo/DeviceInfo.cs b/Emby.Dlna/PlayTo/DeviceInfo.cs index d81ce584b..9e7c04bdb 100644 --- a/Emby.Dlna/PlayTo/DeviceInfo.cs +++ b/Emby.Dlna/PlayTo/DeviceInfo.cs @@ -34,26 +34,14 @@ namespace Emby.Dlna.PlayTo private string _baseUrl = string.Empty; public string BaseUrl { - get - { - return _baseUrl; - } - set - { - _baseUrl = value; - } + get => _baseUrl; + set => _baseUrl = value; } public DeviceIcon Icon { get; set; } private readonly List _services = new List(); - public List Services - { - get - { - return _services; - } - } + public List Services => _services; public DeviceIdentification ToDeviceIdentification() { diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs index 49c944790..95be02ff4 100644 --- a/Emby.Dlna/PlayTo/PlayToController.cs +++ b/Emby.Dlna/PlayTo/PlayToController.cs @@ -44,18 +44,9 @@ namespace Emby.Dlna.PlayTo private readonly string _accessToken; private readonly DateTime _creationTime; - public bool IsSessionActive - { - get - { - return !_disposed && _device != null; - } - } + public bool IsSessionActive => !_disposed && _device != null; - public bool SupportsMediaControl - { - get { return IsSessionActive; } - } + public bool SupportsMediaControl => IsSessionActive; public PlayToController(SessionInfo session, ISessionManager sessionManager, ILibraryManager libraryManager, ILogger logger, IDlnaManager dlnaManager, IUserManager userManager, IImageProcessor imageProcessor, string serverAddress, string accessToken, IDeviceDiscovery deviceDiscovery, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, IConfigurationManager config, IMediaEncoder mediaEncoder) { @@ -436,13 +427,7 @@ namespace Emby.Dlna.PlayTo private int _currentPlaylistIndex; private readonly List _playlist = new List(); - private List Playlist - { - get - { - return _playlist; - } - } + private List Playlist => _playlist; private void AddItemFromId(Guid id, List list) { diff --git a/Emby.Dlna/PlayTo/TransportCommands.cs b/Emby.Dlna/PlayTo/TransportCommands.cs index bb6d69115..b96fa43e5 100644 --- a/Emby.Dlna/PlayTo/TransportCommands.cs +++ b/Emby.Dlna/PlayTo/TransportCommands.cs @@ -12,27 +12,15 @@ namespace Emby.Dlna.PlayTo private List _stateVariables = new List(); public List StateVariables { - get - { - return _stateVariables; - } - set - { - _stateVariables = value; - } + get => _stateVariables; + set => _stateVariables = value; } private List _serviceActions = new List(); public List ServiceActions { - get - { - return _serviceActions; - } - set - { - _serviceActions = value; - } + get => _serviceActions; + set => _serviceActions = value; } public static TransportCommands Create(XDocument document) diff --git a/Emby.Drawing.Skia/SkiaEncoder.cs b/Emby.Drawing.Skia/SkiaEncoder.cs index 3f82fd4b7..8f517681e 100644 --- a/Emby.Drawing.Skia/SkiaEncoder.cs +++ b/Emby.Drawing.Skia/SkiaEncoder.cs @@ -34,46 +34,34 @@ namespace Emby.Drawing.Skia LogVersion(); } - public string[] SupportedInputFormats - { - get + public string[] SupportedInputFormats => + new[] { - // Some common file name extensions for RAW picture files include: .cr2, .crw, .dng, .nef, .orf, .rw2, .pef, .arw, .sr2, .srf, and .tif. - return new[] - { - "jpeg", - "jpg", - "png", - - "dng", - - "webp", - "gif", - "bmp", - "ico", - "astc", - "ktx", - "pkm", - "wbmp", - - // TODO - // Are all of these supported? https://github.com/google/skia/blob/master/infra/bots/recipes/test.py#L454 - - // working on windows at least - "cr2", - "nef", - "arw" - }; - } - } + "jpeg", + "jpg", + "png", - public ImageFormat[] SupportedOutputFormats - { - get - { - return new[] { ImageFormat.Webp, ImageFormat.Jpg, ImageFormat.Png }; - } - } + "dng", + + "webp", + "gif", + "bmp", + "ico", + "astc", + "ktx", + "pkm", + "wbmp", + + // TODO + // Are all of these supported? https://github.com/google/skia/blob/master/infra/bots/recipes/test.py#L454 + + // working on windows at least + "cr2", + "nef", + "arw" + }; + + public ImageFormat[] SupportedOutputFormats => new[] { ImageFormat.Webp, ImageFormat.Jpg, ImageFormat.Png }; private void LogVersion() { @@ -666,19 +654,10 @@ namespace Emby.Drawing.Skia } } - public string Name - { - get { return "Skia"; } - } + public string Name => "Skia"; - public bool SupportsImageCollageCreation - { - get { return true; } - } + public bool SupportsImageCollageCreation => true; - public bool SupportsImageEncoding - { - get { return true; } - } + public bool SupportsImageEncoding => true; } } diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index 5b9b15857..57a6eb148 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -74,7 +74,7 @@ namespace Emby.Drawing public IImageEncoder ImageEncoder { - get { return _imageEncoder; } + get => _imageEncoder; set { if (value == null) @@ -86,67 +86,44 @@ namespace Emby.Drawing } } - public string[] SupportedInputFormats - { - get - { - return new string[] - { - "tiff", - "tif", - "jpeg", - "jpg", - "png", - "aiff", - "cr2", - "crw", - - // Remove until supported - //"nef", - "orf", - "pef", - "arw", - "webp", - "gif", - "bmp", - "erf", - "raf", - "rw2", - "nrw", - "dng", - "ico", - "astc", - "ktx", - "pkm", - "wbmp" - }; - } - } - - - public bool SupportsImageCollageCreation - { - get - { - return _imageEncoder.SupportsImageCollageCreation; - } - } - - private string ResizedImageCachePath - { - get - { - return Path.Combine(_appPaths.ImageCachePath, "resized-images"); - } - } - - private string EnhancedImageCachePath - { - get - { - return Path.Combine(_appPaths.ImageCachePath, "enhanced-images"); - } - } + public string[] SupportedInputFormats => + new string[] + { + "tiff", + "tif", + "jpeg", + "jpg", + "png", + "aiff", + "cr2", + "crw", + + // Remove until supported + //"nef", + "orf", + "pef", + "arw", + "webp", + "gif", + "bmp", + "erf", + "raf", + "rw2", + "nrw", + "dng", + "ico", + "astc", + "ktx", + "pkm", + "wbmp" + }; + + + public bool SupportsImageCollageCreation => _imageEncoder.SupportsImageCollageCreation; + + private string ResizedImageCachePath => Path.Combine(_appPaths.ImageCachePath, "resized-images"); + + private string EnhancedImageCachePath => Path.Combine(_appPaths.ImageCachePath, "enhanced-images"); public void AddParts(IEnumerable enhancers) { diff --git a/Emby.Drawing/NullImageEncoder.cs b/Emby.Drawing/NullImageEncoder.cs index 748ae6f2c..e6f205a1f 100644 --- a/Emby.Drawing/NullImageEncoder.cs +++ b/Emby.Drawing/NullImageEncoder.cs @@ -6,26 +6,15 @@ namespace Emby.Drawing { public class NullImageEncoder : IImageEncoder { - public string[] SupportedInputFormats - { - get + public string[] SupportedInputFormats => + new[] { - return new[] - { - "png", - "jpeg", - "jpg" - }; - } - } + "png", + "jpeg", + "jpg" + }; - public ImageFormat[] SupportedOutputFormats - { - get - { - return new[] { ImageFormat.Jpg, ImageFormat.Png }; - } - } + public ImageFormat[] SupportedOutputFormats => new[] { ImageFormat.Jpg, ImageFormat.Png }; public void CropWhiteSpace(string inputPath, string outputPath) { @@ -42,20 +31,11 @@ namespace Emby.Drawing throw new NotImplementedException(); } - public string Name - { - get { return "Null Image Encoder"; } - } + public string Name => "Null Image Encoder"; - public bool SupportsImageCollageCreation - { - get { return false; } - } + public bool SupportsImageCollageCreation => false; - public bool SupportsImageEncoding - { - get { return false; } - } + public bool SupportsImageEncoding => false; public ImageSize GetImageSize(string path) { diff --git a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs index 846f3b2ce..ac486f167 100644 --- a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs +++ b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs @@ -13,7 +13,7 @@ namespace IsoMounter public class LinuxIsoManager : IIsoMounter { [DllImport("libc", SetLastError = true)] - public static extern uint getuid(); + static extern uint getuid(); #region Private Fields @@ -102,26 +102,11 @@ namespace IsoMounter #region Interface Implementation for IIsoMounter - public bool IsInstalled - { - get - { - return true; - } - } + public bool IsInstalled => true; - public string Name - { - get { return "LinuxMount"; } - } + public string Name => "LinuxMount"; - public bool RequiresInstallation - { - get - { - return false; - } - } + public bool RequiresInstallation => false; public bool CanMount(string path) { diff --git a/Emby.IsoMounting/IsoMounter/Plugin.cs b/Emby.IsoMounting/IsoMounter/Plugin.cs index bcacab906..f45b39d3e 100644 --- a/Emby.IsoMounting/IsoMounter/Plugin.cs +++ b/Emby.IsoMounting/IsoMounter/Plugin.cs @@ -13,30 +13,18 @@ namespace IsoMounter } private Guid _id = new Guid("4682DD4C-A675-4F1B-8E7C-79ADF137A8F8"); - public override Guid Id - { - get { return _id; } - } + public override Guid Id => _id; /// /// Gets the name of the plugin /// /// The name. - public override string Name - { - get { return "Iso Mounter"; } - } + public override string Name => "Iso Mounter"; /// /// Gets the description. /// /// The description. - public override string Description - { - get - { - return "Mount and stream ISO contents"; - } - } + public override string Description => "Mount and stream ISO contents"; } } diff --git a/Emby.Naming/Common/EpisodeExpression.cs b/Emby.Naming/Common/EpisodeExpression.cs index ebaacd3a1..fd85bf76a 100644 --- a/Emby.Naming/Common/EpisodeExpression.cs +++ b/Emby.Naming/Common/EpisodeExpression.cs @@ -6,7 +6,8 @@ namespace Emby.Naming.Common public class EpisodeExpression { private string _expression; - public string Expression { get { return _expression; } set { _expression = value; _regex = null; } } + public string Expression { get => _expression; + set { _expression = value; _regex = null; } } public bool IsByDate { get; set; } public bool IsOptimistic { get; set; } @@ -16,13 +17,7 @@ namespace Emby.Naming.Common public string[] DateTimeFormats { get; set; } private Regex _regex; - public Regex Regex - { - get - { - return _regex ?? (_regex = new Regex(Expression, RegexOptions.IgnoreCase | RegexOptions.Compiled)); - } - } + public Regex Regex => _regex ?? (_regex = new Regex(Expression, RegexOptions.IgnoreCase | RegexOptions.Compiled)); public EpisodeExpression(string expression, bool byDate) { diff --git a/Emby.Naming/Video/VideoFileInfo.cs b/Emby.Naming/Video/VideoFileInfo.cs index d14d04b20..6a29ada7e 100644 --- a/Emby.Naming/Video/VideoFileInfo.cs +++ b/Emby.Naming/Video/VideoFileInfo.cs @@ -65,10 +65,7 @@ namespace Emby.Naming.Video /// Gets the file name without extension. /// /// The file name without extension. - public string FileNameWithoutExtension - { - get { return !IsDirectory ? System.IO.Path.GetFileNameWithoutExtension(Path) : System.IO.Path.GetFileName(Path); } - } + public string FileNameWithoutExtension => !IsDirectory ? System.IO.Path.GetFileNameWithoutExtension(Path) : System.IO.Path.GetFileName(Path); public override string ToString() { diff --git a/Emby.Photos/PhotoProvider.cs b/Emby.Photos/PhotoProvider.cs index 40480b2ae..99d0ed7ab 100644 --- a/Emby.Photos/PhotoProvider.cs +++ b/Emby.Photos/PhotoProvider.cs @@ -199,9 +199,6 @@ namespace Emby.Photos return Task.FromResult(result); } - public string Name - { - get { return "Embedded Information"; } - } + public string Name => "Embedded Information"; } } diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 8621de563..325bad501 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -45,13 +45,7 @@ namespace Emby.Server.Implementations.Data /// Gets the name of the repository /// /// The name. - public string Name - { - get - { - return "SQLite"; - } - } + public string Name => "SQLite"; /// /// Gets the json serializer. @@ -97,21 +91,9 @@ namespace Emby.Server.Implementations.Data private const string ChaptersTableName = "Chapters2"; - protected override int? CacheSize - { - get - { - return 20000; - } - } + protected override int? CacheSize => 20000; - protected override bool EnableTempStoreMemory - { - get - { - return true; - } - } + protected override bool EnableTempStoreMemory => true; /// /// Opens the connection to the database diff --git a/Jellyfin.Server/CoreAppHost.cs b/Jellyfin.Server/CoreAppHost.cs index 50e24a0c2..b18562a69 100644 --- a/Jellyfin.Server/CoreAppHost.cs +++ b/Jellyfin.Server/CoreAppHost.cs @@ -16,14 +16,7 @@ namespace Jellyfin.Server { } - public override bool CanSelfRestart - { - get - { - // A restart script must be provided - return StartupOptions.ContainsOption("-restartpath"); - } - } + public override bool CanSelfRestart => StartupOptions.ContainsOption("-restartpath"); protected override void RestartInternal() => Program.Restart(); @@ -32,13 +25,7 @@ namespace Jellyfin.Server protected override void ShutdownInternal() => Program.Shutdown(); - protected override bool SupportsDualModeSockets - { - get - { - return true; - } - } + protected override bool SupportsDualModeSockets => true; protected override IHttpListener CreateHttpListener() => new WebSocketSharpListener( diff --git a/Jellyfin.Server/SocketSharp/RequestMono.cs b/Jellyfin.Server/SocketSharp/RequestMono.cs index ffa57758a..6e5a4e75a 100644 --- a/Jellyfin.Server/SocketSharp/RequestMono.cs +++ b/Jellyfin.Server/SocketSharp/RequestMono.cs @@ -113,21 +113,9 @@ namespace Jellyfin.SocketSharp return form; } - public string Accept - { - get - { - return string.IsNullOrEmpty(request.Headers["Accept"]) ? null : request.Headers["Accept"]; - } - } + public string Accept => string.IsNullOrEmpty(request.Headers["Accept"]) ? null : request.Headers["Accept"]; - public string Authorization - { - get - { - return string.IsNullOrEmpty(request.Headers["Authorization"]) ? null : request.Headers["Authorization"]; - } - } + public string Authorization => string.IsNullOrEmpty(request.Headers["Authorization"]) ? null : request.Headers["Authorization"]; protected bool validate_cookies, validate_query_string, validate_form; protected bool checked_cookies, checked_query_string, checked_form; @@ -410,30 +398,17 @@ namespace Jellyfin.SocketSharp throw new NotSupportedException(); } - public override bool CanRead - { - get { return true; } - } - public override bool CanSeek - { - get { return true; } - } - public override bool CanWrite - { - get { return false; } - } + public override bool CanRead => true; - public override long Length - { - get { return end - offset; } - } + public override bool CanSeek => true; + + public override bool CanWrite => false; + + public override long Length => end - offset; public override long Position { - get - { - return position - offset; - } + get => position - offset; set { if (value > Length) @@ -451,37 +426,13 @@ namespace Jellyfin.SocketSharp this.stream = new ReadSubStream(base_stream, offset, length); } - public string ContentType - { - get - { - return content_type; - } - } + public string ContentType => content_type; - public int ContentLength - { - get - { - return (int)stream.Length; - } - } + public int ContentLength => (int)stream.Length; - public string FileName - { - get - { - return name; - } - } + public string FileName => name; - public Stream InputStream - { - get - { - return stream; - } - } + public Stream InputStream => stream; } class Helpers diff --git a/Jellyfin.Server/SocketSharp/SharpWebSocket.cs b/Jellyfin.Server/SocketSharp/SharpWebSocket.cs index cb346cac5..d0dcd86eb 100644 --- a/Jellyfin.Server/SocketSharp/SharpWebSocket.cs +++ b/Jellyfin.Server/SocketSharp/SharpWebSocket.cs @@ -85,13 +85,7 @@ namespace Jellyfin.SocketSharp /// Gets or sets the state. /// /// The state. - public WebSocketState State - { - get - { - return WebSocket.ReadyState; - } - } + public WebSocketState State => WebSocket.ReadyState; /// /// Sends the async. diff --git a/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs b/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs index c6c87cdea..e38468388 100644 --- a/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs +++ b/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs @@ -39,88 +39,38 @@ namespace Jellyfin.SocketSharp return string.IsNullOrEmpty(endHostUrl) ? null : endHostUrl.TrimEnd('/'); } - public HttpListenerRequest HttpRequest - { - get { return request; } - } + public HttpListenerRequest HttpRequest => request; - public object OriginalRequest - { - get { return request; } - } + public object OriginalRequest => request; - public IResponse Response - { - get { return response; } - } + public IResponse Response => response; - public IHttpResponse HttpResponse - { - get { return response; } - } + public IHttpResponse HttpResponse => response; public string OperationName { get; set; } public object Dto { get; set; } - public string RawUrl - { - get { return request.RawUrl; } - } + public string RawUrl => request.RawUrl; - public string AbsoluteUri - { - get { return request.Url.AbsoluteUri.TrimEnd('/'); } - } + public string AbsoluteUri => request.Url.AbsoluteUri.TrimEnd('/'); - public string UserHostAddress - { - get { return request.UserHostAddress; } - } + public string UserHostAddress => request.UserHostAddress; - public string XForwardedFor - { - get - { - return string.IsNullOrEmpty(request.Headers["X-Forwarded-For"]) ? null : request.Headers["X-Forwarded-For"]; - } - } + public string XForwardedFor => string.IsNullOrEmpty(request.Headers["X-Forwarded-For"]) ? null : request.Headers["X-Forwarded-For"]; - public int? XForwardedPort - { - get - { - return string.IsNullOrEmpty(request.Headers["X-Forwarded-Port"]) ? (int?)null : int.Parse(request.Headers["X-Forwarded-Port"]); - } - } + public int? XForwardedPort => string.IsNullOrEmpty(request.Headers["X-Forwarded-Port"]) ? (int?)null : int.Parse(request.Headers["X-Forwarded-Port"]); - public string XForwardedProtocol - { - get - { - return string.IsNullOrEmpty(request.Headers["X-Forwarded-Proto"]) ? null : request.Headers["X-Forwarded-Proto"]; - } - } + public string XForwardedProtocol => string.IsNullOrEmpty(request.Headers["X-Forwarded-Proto"]) ? null : request.Headers["X-Forwarded-Proto"]; - public string XRealIp - { - get - { - return string.IsNullOrEmpty(request.Headers["X-Real-IP"]) ? null : request.Headers["X-Real-IP"]; - } - } + public string XRealIp => string.IsNullOrEmpty(request.Headers["X-Real-IP"]) ? null : request.Headers["X-Real-IP"]; private string remoteIp; - public string RemoteIp - { - get - { - return remoteIp ?? - (remoteIp = (CheckBadChars(XForwardedFor)) ?? - (NormalizeIp(CheckBadChars(XRealIp)) ?? - (request.RemoteEndPoint != null ? NormalizeIp(request.RemoteEndPoint.Address.ToString()) : null))); - } - } + public string RemoteIp => + remoteIp ?? + (remoteIp = (CheckBadChars(XForwardedFor)) ?? + (NormalizeIp(CheckBadChars(XRealIp)) ?? + (request.RemoteEndPoint != null ? NormalizeIp(request.RemoteEndPoint.Address.ToString()) : null))); private static readonly char[] HttpTrimCharacters = new char[] { (char)0x09, (char)0xA, (char)0xB, (char)0xC, (char)0xD, (char)0x20 }; @@ -215,34 +165,20 @@ namespace Jellyfin.SocketSharp return ip; } - public bool IsSecureConnection - { - get { return request.IsSecureConnection || XForwardedProtocol == "https"; } - } + public bool IsSecureConnection => request.IsSecureConnection || XForwardedProtocol == "https"; - public string[] AcceptTypes - { - get { return request.AcceptTypes; } - } + public string[] AcceptTypes => request.AcceptTypes; private Dictionary items; - public Dictionary Items - { - get { return items ?? (items = new Dictionary()); } - } + public Dictionary Items => items ?? (items = new Dictionary()); private string responseContentType; public string ResponseContentType { - get - { - return responseContentType - ?? (responseContentType = GetResponseContentType(this)); - } - set - { - this.responseContentType = value; - } + get => + responseContentType + ?? (responseContentType = GetResponseContentType(this)); + set => this.responseContentType = value; } public const string FormUrlEncoded = "application/x-www-form-urlencoded"; @@ -434,58 +370,32 @@ namespace Jellyfin.SocketSharp } } - public string UserAgent - { - get { return request.UserAgent; } - } + public string UserAgent => request.UserAgent; - public QueryParamCollection Headers - { - get { return request.Headers; } - } + public QueryParamCollection Headers => request.Headers; private QueryParamCollection queryString; - public QueryParamCollection QueryString - { - get { return queryString ?? (queryString = MyHttpUtility.ParseQueryString(request.Url.Query)); } - } + public QueryParamCollection QueryString => queryString ?? (queryString = MyHttpUtility.ParseQueryString(request.Url.Query)); - public bool IsLocal - { - get { return request.IsLocal; } - } + public bool IsLocal => request.IsLocal; private string httpMethod; - public string HttpMethod - { - get - { - return httpMethod - ?? (httpMethod = request.HttpMethod); - } - } + public string HttpMethod => + httpMethod + ?? (httpMethod = request.HttpMethod); - public string Verb - { - get { return HttpMethod; } - } + public string Verb => HttpMethod; - public string ContentType - { - get { return request.ContentType; } - } + public string ContentType => request.ContentType; public Encoding contentEncoding; public Encoding ContentEncoding { - get { return contentEncoding ?? request.ContentEncoding; } - set { contentEncoding = value; } + get => contentEncoding ?? request.ContentEncoding; + set => contentEncoding = value; } - public Uri UrlReferrer - { - get { return request.UrlReferrer; } - } + public Uri UrlReferrer => request.UrlReferrer; public static Encoding GetEncoding(string contentTypeHeader) { @@ -501,15 +411,9 @@ namespace Jellyfin.SocketSharp } } - public Stream InputStream - { - get { return request.InputStream; } - } + public Stream InputStream => request.InputStream; - public long ContentLength - { - get { return request.ContentLength64; } - } + public long ContentLength => request.ContentLength64; private IHttpFile[] httpFiles; public IHttpFile[] Files diff --git a/Jellyfin.Server/SocketSharp/WebSocketSharpResponse.cs b/Jellyfin.Server/SocketSharp/WebSocketSharpResponse.cs index 8b1e8bbb7..21bfac55d 100644 --- a/Jellyfin.Server/SocketSharp/WebSocketSharpResponse.cs +++ b/Jellyfin.Server/SocketSharp/WebSocketSharpResponse.cs @@ -31,27 +31,24 @@ namespace Jellyfin.SocketSharp public IRequest Request { get; private set; } public Dictionary Items { get; private set; } - public object OriginalResponse - { - get { return _response; } - } + public object OriginalResponse => _response; public int StatusCode { - get { return this._response.StatusCode; } - set { this._response.StatusCode = value; } + get => this._response.StatusCode; + set => this._response.StatusCode = value; } public string StatusDescription { - get { return this._response.StatusDescription; } - set { this._response.StatusDescription = value; } + get => this._response.StatusDescription; + set => this._response.StatusDescription = value; } public string ContentType { - get { return _response.ContentType; } - set { _response.ContentType = value; } + get => _response.ContentType; + set => _response.ContentType = value; } //public ICookies Cookies { get; set; } @@ -67,13 +64,7 @@ namespace Jellyfin.SocketSharp _response.AddHeader(name, value); } - public QueryParamCollection Headers - { - get - { - return _response.Headers; - } - } + public QueryParamCollection Headers => _response.Headers; public string GetHeader(string name) { @@ -85,10 +76,7 @@ namespace Jellyfin.SocketSharp _response.Redirect(url); } - public Stream OutputStream - { - get { return _response.OutputStream; } - } + public Stream OutputStream => _response.OutputStream; public void Close() { @@ -179,8 +167,8 @@ namespace Jellyfin.SocketSharp public bool SendChunked { - get { return _response.SendChunked; } - set { _response.SendChunked = value; } + get => _response.SendChunked; + set => _response.SendChunked = value; } public bool KeepAlive { get; set; } diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs index ff0d23fcd..8decea5a2 100644 --- a/MediaBrowser.Api/BaseApiService.cs +++ b/MediaBrowser.Api/BaseApiService.cs @@ -22,25 +22,13 @@ namespace MediaBrowser.Api /// Gets or sets the logger. /// /// The logger. - public ILogger Logger - { - get - { - return ApiEntryPoint.Instance.Logger; - } - } + public ILogger Logger => ApiEntryPoint.Instance.Logger; /// /// Gets or sets the HTTP result factory. /// /// The HTTP result factory. - public IHttpResultFactory ResultFactory - { - get - { - return ApiEntryPoint.Instance.ResultFactory; - } - } + public IHttpResultFactory ResultFactory => ApiEntryPoint.Instance.ResultFactory; /// /// Gets or sets the request context. diff --git a/MediaBrowser.Api/LiveTv/ProgressiveFileCopier.cs b/MediaBrowser.Api/LiveTv/ProgressiveFileCopier.cs index 28590444e..8412bf66b 100644 --- a/MediaBrowser.Api/LiveTv/ProgressiveFileCopier.cs +++ b/MediaBrowser.Api/LiveTv/ProgressiveFileCopier.cs @@ -45,13 +45,7 @@ namespace MediaBrowser.Api.LiveTv _streamHelper = streamHelper; } - public IDictionary Headers - { - get - { - return _outputHeaders; - } - } + public IDictionary Headers => _outputHeaders; private Stream GetInputStream(bool allowAsyncFileRead) { diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index c6781cad9..cdf9c7d0b 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -141,10 +141,7 @@ namespace MediaBrowser.Api.Playback return Path.Combine(folder, dataHash + (outputFileExtension ?? string.Empty).ToLower()); } - protected virtual bool EnableOutputInSubFolder - { - get { return false; } - } + protected virtual bool EnableOutputInSubFolder => false; protected readonly CultureInfo UsCulture = new CultureInfo("en-US"); diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs index 969ab9c3b..1e90d03b0 100644 --- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs @@ -52,10 +52,7 @@ namespace MediaBrowser.Api.Playback.Hls /// Gets the type of the transcoding job. /// /// The type of the transcoding job. - protected override TranscodingJobType TranscodingJobType - { - get { return TranscodingJobType.Hls; } - } + protected override TranscodingJobType TranscodingJobType => TranscodingJobType.Hls; /// /// Processes the request. diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs index e3fb0ad52..bb21fe5ae 100644 --- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs +++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs @@ -102,10 +102,7 @@ namespace MediaBrowser.Api.Playback.Progressive /// Gets the type of the transcoding job. /// /// The type of the transcoding job. - protected override TranscodingJobType TranscodingJobType - { - get { return TranscodingJobType.Progressive; } - } + protected override TranscodingJobType TranscodingJobType => TranscodingJobType.Progressive; /// /// Processes the request. diff --git a/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs b/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs index cad08ea24..3dd9de2a1 100644 --- a/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs +++ b/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs @@ -50,13 +50,7 @@ namespace MediaBrowser.Api.Playback.Progressive _environment = environment; } - public IDictionary Headers - { - get - { - return _outputHeaders; - } - } + public IDictionary Headers => _outputHeaders; private Stream GetInputStream(bool allowAsyncFileRead) { diff --git a/MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs b/MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs index 5a309ba09..3b8b29995 100644 --- a/MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs +++ b/MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs @@ -31,10 +31,7 @@ namespace MediaBrowser.Api.Playback /// Gets the options. /// /// The options. - public IDictionary Headers - { - get { return _options; } - } + public IDictionary Headers => _options; public async Task WriteToAsync(Stream responseStream, CancellationToken cancellationToken) { diff --git a/MediaBrowser.Api/Playback/StreamRequest.cs b/MediaBrowser.Api/Playback/StreamRequest.cs index 4771e188f..da1f00c3e 100644 --- a/MediaBrowser.Api/Playback/StreamRequest.cs +++ b/MediaBrowser.Api/Playback/StreamRequest.cs @@ -50,13 +50,7 @@ namespace MediaBrowser.Api.Playback /// Gets a value indicating whether this instance has fixed resolution. /// /// true if this instance has fixed resolution; otherwise, false. - public bool HasFixedResolution - { - get - { - return Width.HasValue || Height.HasValue; - } - } + public bool HasFixedResolution => Width.HasValue || Height.HasValue; public bool EnableSubtitlesInManifest { get; set; } } diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs index fc2310683..400ad47cc 100644 --- a/MediaBrowser.Api/Playback/StreamState.cs +++ b/MediaBrowser.Api/Playback/StreamState.cs @@ -17,7 +17,7 @@ namespace MediaBrowser.Api.Playback public StreamRequest Request { - get { return (StreamRequest)BaseRequest; } + get => (StreamRequest)BaseRequest; set { BaseRequest = value; @@ -28,10 +28,7 @@ namespace MediaBrowser.Api.Playback public TranscodingThrottler TranscodingThrottler { get; set; } - public VideoStreamRequest VideoRequest - { - get { return Request as VideoStreamRequest; } - } + public VideoStreamRequest VideoRequest => Request as VideoStreamRequest; /// /// Gets or sets the log file stream. @@ -42,10 +39,7 @@ namespace MediaBrowser.Api.Playback public string WaitForPath { get; set; } - public bool IsOutputVideo - { - get { return Request is VideoStreamRequest; } - } + public bool IsOutputVideo => Request is VideoStreamRequest; public int SegmentLength { @@ -98,13 +92,7 @@ namespace MediaBrowser.Api.Playback } } - public int HlsListSize - { - get - { - return 0; - } - } + public int HlsListSize => 0; public string UserAgent { get; set; } diff --git a/MediaBrowser.Api/ScheduledTasks/ScheduledTasksWebSocketListener.cs b/MediaBrowser.Api/ScheduledTasks/ScheduledTasksWebSocketListener.cs index f1edc5a22..b0c4b29c1 100644 --- a/MediaBrowser.Api/ScheduledTasks/ScheduledTasksWebSocketListener.cs +++ b/MediaBrowser.Api/ScheduledTasks/ScheduledTasksWebSocketListener.cs @@ -24,10 +24,7 @@ namespace MediaBrowser.Api.ScheduledTasks /// Gets the name. /// /// The name. - protected override string Name - { - get { return "ScheduledTasksInfo"; } - } + protected override string Name => "ScheduledTasksInfo"; /// /// Initializes a new instance of the class. diff --git a/MediaBrowser.Api/Session/SessionInfoWebSocketListener.cs b/MediaBrowser.Api/Session/SessionInfoWebSocketListener.cs index f2cb1d485..387ccad25 100644 --- a/MediaBrowser.Api/Session/SessionInfoWebSocketListener.cs +++ b/MediaBrowser.Api/Session/SessionInfoWebSocketListener.cs @@ -17,10 +17,7 @@ namespace MediaBrowser.Api.Session /// Gets the name. /// /// The name. - protected override string Name - { - get { return "Sessions"; } - } + protected override string Name => "Sessions"; /// /// The _kernel diff --git a/MediaBrowser.Api/System/ActivityLogWebSocketListener.cs b/MediaBrowser.Api/System/ActivityLogWebSocketListener.cs index 1b1fc8ff8..0df46c399 100644 --- a/MediaBrowser.Api/System/ActivityLogWebSocketListener.cs +++ b/MediaBrowser.Api/System/ActivityLogWebSocketListener.cs @@ -17,10 +17,7 @@ namespace MediaBrowser.Api.System /// Gets the name. /// /// The name. - protected override string Name - { - get { return "ActivityLogEntry"; } - } + protected override string Name => "ActivityLogEntry"; /// /// The _kernel diff --git a/MediaBrowser.Common/Net/HttpRequestOptions.cs b/MediaBrowser.Common/Net/HttpRequestOptions.cs index 938b56285..0b21472f0 100644 --- a/MediaBrowser.Common/Net/HttpRequestOptions.cs +++ b/MediaBrowser.Common/Net/HttpRequestOptions.cs @@ -24,11 +24,8 @@ namespace MediaBrowser.Common.Net /// The accept header. public string AcceptHeader { - get { return GetHeaderValue("Accept"); } - set - { - RequestHeaders["Accept"] = value; - } + get => GetHeaderValue("Accept"); + set => RequestHeaders["Accept"] = value; } /// /// Gets or sets the cancellation token. @@ -48,11 +45,8 @@ namespace MediaBrowser.Common.Net /// The user agent. public string UserAgent { - get { return GetHeaderValue("User-Agent"); } - set - { - RequestHeaders["User-Agent"] = value; - } + get => GetHeaderValue("User-Agent"); + set => RequestHeaders["User-Agent"] = value; } /// diff --git a/MediaBrowser.Common/Plugins/BasePlugin.cs b/MediaBrowser.Common/Plugins/BasePlugin.cs index cd52803c6..a14c9fb34 100644 --- a/MediaBrowser.Common/Plugins/BasePlugin.cs +++ b/MediaBrowser.Common/Plugins/BasePlugin.cs @@ -18,10 +18,7 @@ namespace MediaBrowser.Common.Plugins /// Gets the description. /// /// The description. - public virtual string Description - { - get { return string.Empty; } - } + public virtual string Description => string.Empty; /// /// Gets the unique id. @@ -108,10 +105,7 @@ namespace MediaBrowser.Common.Plugins /// Gets the type of configuration this plugin uses /// /// The type of the configuration. - public Type ConfigurationType - { - get { return typeof(TConfigurationType); } - } + public Type ConfigurationType => typeof(TConfigurationType); private Action _directoryCreateFn; public void SetStartupInfo(Action directoryCreateFn) @@ -124,13 +118,7 @@ namespace MediaBrowser.Common.Plugins /// Gets the name the assembly file /// /// The name of the assembly file. - protected string AssemblyFileName - { - get - { - return Path.GetFileName(AssemblyFilePath); - } - } + protected string AssemblyFileName => Path.GetFileName(AssemblyFilePath); /// /// The _configuration sync lock @@ -161,10 +149,7 @@ namespace MediaBrowser.Common.Plugins } return _configuration; } - protected set - { - _configuration = value; - } + protected set => _configuration = value; } private TConfigurationType LoadConfiguration() @@ -185,22 +170,13 @@ namespace MediaBrowser.Common.Plugins /// Gets the name of the configuration file. Subclasses should override /// /// The name of the configuration file. - public virtual string ConfigurationFileName - { - get { return Path.ChangeExtension(AssemblyFileName, ".xml"); } - } + public virtual string ConfigurationFileName => Path.ChangeExtension(AssemblyFileName, ".xml"); /// /// Gets the full path to the configuration file /// /// The configuration file path. - public string ConfigurationFilePath - { - get - { - return Path.Combine(ApplicationPaths.PluginConfigurationsPath, ConfigurationFileName); - } - } + public string ConfigurationFilePath => Path.Combine(ApplicationPaths.PluginConfigurationsPath, ConfigurationFileName); /// /// Initializes a new instance of the class. @@ -253,10 +229,7 @@ namespace MediaBrowser.Common.Plugins /// Gets the plugin's configuration /// /// The configuration. - BasePluginConfiguration IHasPluginConfiguration.Configuration - { - get { return Configuration; } - } + BasePluginConfiguration IHasPluginConfiguration.Configuration => Configuration; public override PluginInfo GetPluginInfo() { diff --git a/MediaBrowser.Controller/Channels/Channel.cs b/MediaBrowser.Controller/Channels/Channel.cs index 022d4aa82..adf03fb66 100644 --- a/MediaBrowser.Controller/Channels/Channel.cs +++ b/MediaBrowser.Controller/Channels/Channel.cs @@ -31,19 +31,10 @@ namespace MediaBrowser.Controller.Channels } [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; [IgnoreDataMember] - public override SourceType SourceType - { - get { return SourceType.Channel; } - } + public override SourceType SourceType => SourceType.Channel; protected override QueryResult GetItemsInternal(InternalItemsQuery query) { diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs index a484f31f1..522b3e33e 100644 --- a/MediaBrowser.Controller/Entities/AggregateFolder.cs +++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs @@ -24,10 +24,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool IsPhysicalRoot - { - get { return true; } - } + public override bool IsPhysicalRoot => true; public override bool CanDelete() { @@ -35,13 +32,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return false; - } - } + public override bool SupportsPlayedStatus => false; /// /// The _virtual children @@ -52,19 +43,10 @@ namespace MediaBrowser.Controller.Entities /// Gets the virtual children. /// /// The virtual children. - public ConcurrentBag VirtualChildren - { - get { return _virtualChildren; } - } + public ConcurrentBag VirtualChildren => _virtualChildren; [IgnoreDataMember] - public override string[] PhysicalLocations - { - get - { - return PhysicalLocationsList; - } - } + public override string[] PhysicalLocations => PhysicalLocationsList; public string[] PhysicalLocationsList { get; set; } diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index e9eb1e907..13a6fe44a 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -41,49 +41,22 @@ namespace MediaBrowser.Controller.Entities.Audio } [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return true; - } - } + public override bool SupportsPlayedStatus => true; [IgnoreDataMember] - public override bool SupportsPeople - { - get { return false; } - } + public override bool SupportsPeople => false; [IgnoreDataMember] - public override bool SupportsAddingToPlaylist - { - get { return true; } - } + public override bool SupportsAddingToPlaylist => true; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get { return true; } - } + public override bool SupportsInheritedParentImages => true; [IgnoreDataMember] - protected override bool SupportsOwnedItems - { - get - { - return false; - } - } + protected override bool SupportsOwnedItems => false; [IgnoreDataMember] - public override Folder LatestItemsIndexContainer - { - get - { - return AlbumEntity; - } - } + public override Folder LatestItemsIndexContainer => AlbumEntity; public override bool CanDownload() { @@ -115,23 +88,14 @@ namespace MediaBrowser.Controller.Entities.Audio } [IgnoreDataMember] - public MusicAlbum AlbumEntity - { - get { return FindParent(); } - } + public MusicAlbum AlbumEntity => FindParent(); /// /// Gets the type of the media. /// /// The type of the media. [IgnoreDataMember] - public override string MediaType - { - get - { - return Model.Entities.MediaType.Audio; - } - } + public override string MediaType => Model.Entities.MediaType.Audio; /// /// Creates the name of the sort. diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs index b91aa4d0b..a3e05f0d2 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -28,22 +28,13 @@ namespace MediaBrowser.Controller.Entities.Audio } [IgnoreDataMember] - public override bool SupportsAddingToPlaylist - { - get { return true; } - } + public override bool SupportsAddingToPlaylist => true; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get { return true; } - } + public override bool SupportsInheritedParentImages => true; [IgnoreDataMember] - public MusicArtist MusicArtist - { - get { return GetMusicArtist(new DtoOptions(true)); } - } + public MusicArtist MusicArtist => GetMusicArtist(new DtoOptions(true)); public MusicArtist GetMusicArtist(DtoOptions options) { @@ -66,22 +57,10 @@ namespace MediaBrowser.Controller.Entities.Audio } [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return false; - } - } + public override bool SupportsPlayedStatus => false; [IgnoreDataMember] - public override bool SupportsCumulativeRunTimeTicks - { - get - { - return true; - } - } + public override bool SupportsCumulativeRunTimeTicks => true; [IgnoreDataMember] public string[] AllArtists @@ -107,29 +86,17 @@ namespace MediaBrowser.Controller.Entities.Audio } [IgnoreDataMember] - public string AlbumArtist - { - get { return AlbumArtists.Length == 0 ? null : AlbumArtists[0]; } - } + public string AlbumArtist => AlbumArtists.Length == 0 ? null : AlbumArtists[0]; [IgnoreDataMember] - public override bool SupportsPeople - { - get { return false; } - } + public override bool SupportsPeople => false; /// /// Gets the tracks. /// /// The tracks. [IgnoreDataMember] - public IEnumerable Tracks - { - get - { - return GetRecursiveChildren(i => i is Audio); - } - } + public IEnumerable Tracks => GetRecursiveChildren(i => i is Audio); protected override IEnumerable GetEligibleChildrenForRecursiveChildren(User user) { diff --git a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs index d1e047c5d..2d464bd32 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs @@ -19,61 +19,25 @@ namespace MediaBrowser.Controller.Entities.Audio public class MusicArtist : Folder, IItemByName, IHasMusicGenres, IHasDualAccess, IHasLookupInfo { [IgnoreDataMember] - public bool IsAccessedByName - { - get { return ParentId.Equals(Guid.Empty); } - } + public bool IsAccessedByName => ParentId.Equals(Guid.Empty); [IgnoreDataMember] - public override bool IsFolder - { - get - { - return !IsAccessedByName; - } - } + public override bool IsFolder => !IsAccessedByName; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; [IgnoreDataMember] - public override bool SupportsCumulativeRunTimeTicks - { - get - { - return true; - } - } + public override bool SupportsCumulativeRunTimeTicks => true; [IgnoreDataMember] - public override bool IsDisplayedAsFolder - { - get - { - return true; - } - } + public override bool IsDisplayedAsFolder => true; [IgnoreDataMember] - public override bool SupportsAddingToPlaylist - { - get { return true; } - } + public override bool SupportsAddingToPlaylist => true; [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return false; - } - } + public override bool SupportsPlayedStatus => false; public override double GetDefaultPrimaryImageAspectRatio() { @@ -154,13 +118,7 @@ namespace MediaBrowser.Controller.Entities.Audio /// /// The containing folder path. [IgnoreDataMember] - public override string ContainingFolderPath - { - get - { - return Path; - } - } + public override string ContainingFolderPath => Path; /// /// Gets the user data key. @@ -207,13 +165,7 @@ namespace MediaBrowser.Controller.Entities.Audio } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; public static string GetPath(string name) { diff --git a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs index 5525ddcc5..d26aaf2bb 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs @@ -24,28 +24,13 @@ namespace MediaBrowser.Controller.Entities.Audio } [IgnoreDataMember] - public override bool SupportsAddingToPlaylist - { - get { return true; } - } + public override bool SupportsAddingToPlaylist => true; [IgnoreDataMember] - public override bool SupportsAncestors - { - get - { - return false; - } - } + public override bool SupportsAncestors => false; [IgnoreDataMember] - public override bool IsDisplayedAsFolder - { - get - { - return true; - } - } + public override bool IsDisplayedAsFolder => true; /// /// Returns the folder containing the item. @@ -53,13 +38,7 @@ namespace MediaBrowser.Controller.Entities.Audio /// /// The containing folder path. [IgnoreDataMember] - public override string ContainingFolderPath - { - get - { - return Path; - } - } + public override string ContainingFolderPath => Path; public override double GetDefaultPrimaryImageAspectRatio() { @@ -77,13 +56,7 @@ namespace MediaBrowser.Controller.Entities.Audio } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; public IList GetTaggedItems(InternalItemsQuery query) { diff --git a/MediaBrowser.Controller/Entities/AudioBook.cs b/MediaBrowser.Controller/Entities/AudioBook.cs index 95d1690d5..65c8a5fdd 100644 --- a/MediaBrowser.Controller/Entities/AudioBook.cs +++ b/MediaBrowser.Controller/Entities/AudioBook.cs @@ -8,22 +8,10 @@ namespace MediaBrowser.Controller.Entities public class AudioBook : Audio.Audio, IHasSeries, IHasLookupInfo { [IgnoreDataMember] - public override bool SupportsPositionTicksResume - { - get - { - return true; - } - } + public override bool SupportsPositionTicksResume => true; [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return true; - } - } + public override bool SupportsPlayedStatus => true; [IgnoreDataMember] public string SeriesPresentationUniqueKey { get; set; } diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 65f2ad992..995f39483 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -108,19 +108,10 @@ namespace MediaBrowser.Controller.Entities public Guid ChannelId { get; set; } [IgnoreDataMember] - public virtual bool SupportsAddingToPlaylist - { - get - { - return false; - } - } + public virtual bool SupportsAddingToPlaylist => false; [IgnoreDataMember] - public virtual bool AlwaysScanInternalMetadataPath - { - get { return false; } - } + public virtual bool AlwaysScanInternalMetadataPath => false; /// /// Gets a value indicating whether this instance is in mixed folder. @@ -130,31 +121,13 @@ namespace MediaBrowser.Controller.Entities public bool IsInMixedFolder { get; set; } [IgnoreDataMember] - public virtual bool SupportsPlayedStatus - { - get - { - return false; - } - } + public virtual bool SupportsPlayedStatus => false; [IgnoreDataMember] - public virtual bool SupportsPositionTicksResume - { - get - { - return false; - } - } + public virtual bool SupportsPositionTicksResume => false; [IgnoreDataMember] - public virtual bool SupportsRemoteImageDownloading - { - get - { - return true; - } - } + public virtual bool SupportsRemoteImageDownloading => true; private string _name; /// @@ -164,10 +137,7 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] public virtual string Name { - get - { - return _name; - } + get => _name; set { _name = value; @@ -178,10 +148,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public bool IsUnaired - { - get { return PremiereDate.HasValue && PremiereDate.Value.ToLocalTime().Date >= DateTime.Now.Date; } - } + public bool IsUnaired => PremiereDate.HasValue && PremiereDate.Value.ToLocalTime().Date >= DateTime.Now.Date; [IgnoreDataMember] public int? TotalBitrate { get; set; } @@ -189,13 +156,7 @@ namespace MediaBrowser.Controller.Entities public ExtraType? ExtraType { get; set; } [IgnoreDataMember] - public bool IsThemeMedia - { - get - { - return ExtraType.HasValue && (ExtraType.Value == Model.Entities.ExtraType.ThemeSong || ExtraType.Value == Model.Entities.ExtraType.ThemeVideo); - } - } + public bool IsThemeMedia => ExtraType.HasValue && (ExtraType.Value == Model.Entities.ExtraType.ThemeSong || ExtraType.Value == Model.Entities.ExtraType.ThemeVideo); [IgnoreDataMember] public string OriginalTitle { get; set; } @@ -295,13 +256,7 @@ namespace MediaBrowser.Controller.Entities public string ExternalEtag { get; set; } [IgnoreDataMember] - public virtual bool IsHidden - { - get - { - return false; - } - } + public virtual bool IsHidden => false; public BaseItem GetOwner() { @@ -362,22 +317,10 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public bool IsFileProtocol - { - get - { - return IsPathProtocol(MediaProtocol.File); - } - } + public bool IsFileProtocol => IsPathProtocol(MediaProtocol.File); [IgnoreDataMember] - public bool HasPathProtocol - { - get - { - return PathProtocol.HasValue; - } - } + public bool HasPathProtocol => PathProtocol.HasValue; [IgnoreDataMember] public virtual bool SupportsLocalMetadata @@ -408,13 +351,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public virtual bool EnableAlphaNumericSorting - { - get - { - return true; - } - } + public virtual bool EnableAlphaNumericSorting => true; private List> GetSortChunks(string s1) { @@ -455,10 +392,7 @@ namespace MediaBrowser.Controller.Entities /// /// The primary image path. [IgnoreDataMember] - public string PrimaryImagePath - { - get { return this.GetImagePath(ImageType.Primary); } - } + public string PrimaryImagePath => this.GetImagePath(ImageType.Primary); public bool IsMetadataFetcherEnabled(LibraryOptions libraryOptions, string name) { @@ -637,13 +571,7 @@ namespace MediaBrowser.Controller.Entities /// /// The type of the media. [IgnoreDataMember] - public virtual string MediaType - { - get - { - return null; - } - } + public virtual string MediaType => null; [IgnoreDataMember] public virtual string[] PhysicalLocations @@ -667,7 +595,7 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] public string ForcedSortName { - get { return _forcedSortName; } + get => _forcedSortName; set { _forcedSortName = value; _sortName = null; } } @@ -695,10 +623,7 @@ namespace MediaBrowser.Controller.Entities } return _sortName; } - set - { - _sortName = value; - } + set => _sortName = value; } public string GetInternalMetadataPath() @@ -816,7 +741,7 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] public Folder Parent { - get { return GetParent() as Folder; } + get => GetParent() as Folder; set { @@ -1007,10 +932,7 @@ namespace MediaBrowser.Controller.Entities public int? ParentIndexNumber { get; set; } [IgnoreDataMember] - public virtual bool HasLocalAlternateVersions - { - get { return false; } - } + public virtual bool HasLocalAlternateVersions => false; [IgnoreDataMember] public string OfficialRatingForComparison @@ -1426,22 +1348,13 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - protected virtual bool SupportsOwnedItems - { - get { return !ParentId.Equals(Guid.Empty) && IsFileProtocol; } - } + protected virtual bool SupportsOwnedItems => !ParentId.Equals(Guid.Empty) && IsFileProtocol; [IgnoreDataMember] - public virtual bool SupportsPeople - { - get { return false; } - } + public virtual bool SupportsPeople => false; [IgnoreDataMember] - public virtual bool SupportsThemeMedia - { - get { return false; } - } + public virtual bool SupportsThemeMedia => false; /// /// Refreshes owned items such as trailers, theme videos, special features, etc. @@ -1602,10 +1515,7 @@ namespace MediaBrowser.Controller.Entities public Dictionary ProviderIds { get; set; } [IgnoreDataMember] - public virtual Folder LatestItemsIndexContainer - { - get { return null; } - } + public virtual Folder LatestItemsIndexContainer => null; public virtual double GetDefaultPrimaryImageAspectRatio() { @@ -1923,10 +1833,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public virtual bool SupportsInheritedParentImages - { - get { return false; } - } + public virtual bool SupportsInheritedParentImages => false; protected bool IsVisibleStandaloneInternal(User user, bool checkFolders) { @@ -1969,22 +1876,10 @@ namespace MediaBrowser.Controller.Entities /// /// true if this instance is folder; otherwise, false. [IgnoreDataMember] - public virtual bool IsFolder - { - get - { - return false; - } - } + public virtual bool IsFolder => false; [IgnoreDataMember] - public virtual bool IsDisplayedAsFolder - { - get - { - return false; - } - } + public virtual bool IsDisplayedAsFolder => false; public virtual string GetClientTypeName() { @@ -2070,13 +1965,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public virtual bool EnableRememberingTrackSelections - { - get - { - return true; - } - } + public virtual bool EnableRememberingTrackSelections => true; /// /// Adds a studio to the item @@ -2813,22 +2702,10 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public virtual bool SupportsAncestors - { - get - { - return true; - } - } + public virtual bool SupportsAncestors => true; [IgnoreDataMember] - public virtual bool StopRefreshIfLocalMetadataFound - { - get - { - return true; - } - } + public virtual bool StopRefreshIfLocalMetadataFound => true; public virtual IEnumerable GetIdsForAncestorQuery() { @@ -2915,13 +2792,7 @@ namespace MediaBrowser.Controller.Entities return GetExtras(); } - public virtual bool IsHD - { - get - { - return Height >= 720; - } - } + public virtual bool IsHD => Height >= 720; public bool IsShortcut { get; set; } public string ShortcutPath { get; set; } public int Width { get; set; } @@ -2933,12 +2804,6 @@ namespace MediaBrowser.Controller.Entities } // what does this do? public static ExtraType[] DisplayExtraTypes = new[] { Model.Entities.ExtraType.ThemeSong, Model.Entities.ExtraType.ThemeVideo }; - public virtual bool SupportsExternalTransfer - { - get - { - return false; - } - } + public virtual bool SupportsExternalTransfer => false; } } diff --git a/MediaBrowser.Controller/Entities/BasePluginFolder.cs b/MediaBrowser.Controller/Entities/BasePluginFolder.cs index 218515995..c15ba1a1e 100644 --- a/MediaBrowser.Controller/Entities/BasePluginFolder.cs +++ b/MediaBrowser.Controller/Entities/BasePluginFolder.cs @@ -10,10 +10,7 @@ namespace MediaBrowser.Controller.Entities public abstract class BasePluginFolder : Folder, ICollectionFolder { [IgnoreDataMember] - public virtual string CollectionType - { - get { return null; } - } + public virtual string CollectionType => null; public override bool CanDelete() { @@ -26,22 +23,10 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; //public override double? GetDefaultPrimaryImageAspectRatio() //{ diff --git a/MediaBrowser.Controller/Entities/Book.cs b/MediaBrowser.Controller/Entities/Book.cs index febd0cc20..7a23d9a66 100644 --- a/MediaBrowser.Controller/Entities/Book.cs +++ b/MediaBrowser.Controller/Entities/Book.cs @@ -9,13 +9,7 @@ namespace MediaBrowser.Controller.Entities public class Book : BaseItem, IHasLookupInfo, IHasSeries { [IgnoreDataMember] - public override string MediaType - { - get - { - return Model.Entities.MediaType.Book; - } - } + public override string MediaType => Model.Entities.MediaType.Book; [IgnoreDataMember] public string SeriesPresentationUniqueKey { get; set; } diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index f0713a74b..c56dc04ec 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -34,22 +34,10 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return false; - } - } + public override bool SupportsPlayedStatus => false; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; public override bool CanDelete() { @@ -158,22 +146,10 @@ namespace MediaBrowser.Controller.Entities /// /// The display prefs id. [IgnoreDataMember] - public override Guid DisplayPreferencesId - { - get - { - return Id; - } - } + public override Guid DisplayPreferencesId => Id; [IgnoreDataMember] - public override string[] PhysicalLocations - { - get - { - return PhysicalLocationsList; - } - } + public override string[] PhysicalLocations => PhysicalLocationsList; public override bool IsSaveLocalMetadataEnabled() { @@ -337,10 +313,7 @@ namespace MediaBrowser.Controller.Entities /// /// The actual children. [IgnoreDataMember] - public override IEnumerable Children - { - get { return GetActualChildren(); } - } + public override IEnumerable Children => GetActualChildren(); public IEnumerable GetActualChildren() { @@ -386,12 +359,6 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; } } diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 5573bbf31..fe53d2f05 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -47,80 +47,35 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsThemeMedia - { - get { return true; } - } + public override bool SupportsThemeMedia => true; [IgnoreDataMember] - public virtual bool IsPreSorted - { - get { return false; } - } + public virtual bool IsPreSorted => false; [IgnoreDataMember] - public virtual bool IsPhysicalRoot - { - get { return false; } - } + public virtual bool IsPhysicalRoot => false; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return true; - } - } + public override bool SupportsInheritedParentImages => true; [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return true; - } - } + public override bool SupportsPlayedStatus => true; /// /// Gets a value indicating whether this instance is folder. /// /// true if this instance is folder; otherwise, false. [IgnoreDataMember] - public override bool IsFolder - { - get - { - return true; - } - } + public override bool IsFolder => true; [IgnoreDataMember] - public override bool IsDisplayedAsFolder - { - get - { - return true; - } - } + public override bool IsDisplayedAsFolder => true; [IgnoreDataMember] - public virtual bool SupportsCumulativeRunTimeTicks - { - get - { - return false; - } - } + public virtual bool SupportsCumulativeRunTimeTicks => false; [IgnoreDataMember] - public virtual bool SupportsDateLastMediaAdded - { - get - { - return false; - } - } + public virtual bool SupportsDateLastMediaAdded => false; public override bool CanDelete() { @@ -172,10 +127,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - protected virtual bool SupportsShortcutChildren - { - get { return false; } - } + protected virtual bool SupportsShortcutChildren => false; /// /// Adds the child. @@ -210,23 +162,14 @@ namespace MediaBrowser.Controller.Entities /// /// The actual children. [IgnoreDataMember] - public virtual IEnumerable Children - { - get - { - return LoadChildren(); - } - } + public virtual IEnumerable Children => LoadChildren(); /// /// thread-safe access to all recursive children of this folder - without regard to user /// /// The recursive children. [IgnoreDataMember] - public IEnumerable RecursiveChildren - { - get { return GetRecursiveChildren(); } - } + public IEnumerable RecursiveChildren => GetRecursiveChildren(); public override bool IsVisible(User user) { @@ -1421,13 +1364,7 @@ namespace MediaBrowser.Controller.Entities return list; } - protected virtual bool FilterLinkedChildrenPerUser - { - get - { - return false; - } - } + protected virtual bool FilterLinkedChildrenPerUser => false; public bool ContainsLinkedChildByItemId(Guid itemId) { @@ -1524,13 +1461,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - protected override bool SupportsOwnedItems - { - get - { - return base.SupportsOwnedItems || SupportsShortcutChildren; - } - } + protected override bool SupportsOwnedItems => base.SupportsOwnedItems || SupportsShortcutChildren; protected override async Task RefreshedOwnedItems(MetadataRefreshOptions options, List fileSystemChildren, CancellationToken cancellationToken) { diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs index 46cdfcf15..82a4531ff 100644 --- a/MediaBrowser.Controller/Entities/Game.cs +++ b/MediaBrowser.Controller/Entities/Game.cs @@ -27,26 +27,17 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsThemeMedia - { - get { return true; } - } + public override bool SupportsThemeMedia => true; [IgnoreDataMember] - public override bool SupportsPeople - { - get { return false; } - } + public override bool SupportsPeople => false; /// /// Gets the type of the media. /// /// The type of the media. [IgnoreDataMember] - public override string MediaType - { - get { return Model.Entities.MediaType.Game; } - } + public override string MediaType => Model.Entities.MediaType.Game; /// /// Gets or sets the players supported. diff --git a/MediaBrowser.Controller/Entities/GameGenre.cs b/MediaBrowser.Controller/Entities/GameGenre.cs index e55273904..c0fd4ae89 100644 --- a/MediaBrowser.Controller/Entities/GameGenre.cs +++ b/MediaBrowser.Controller/Entities/GameGenre.cs @@ -32,22 +32,10 @@ namespace MediaBrowser.Controller.Entities /// /// The containing folder path. [IgnoreDataMember] - public override string ContainingFolderPath - { - get - { - return Path; - } - } + public override string ContainingFolderPath => Path; [IgnoreDataMember] - public override bool SupportsAncestors - { - get - { - return false; - } - } + public override bool SupportsAncestors => false; public override bool IsSaveLocalMetadataEnabled() { @@ -68,13 +56,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; public static string GetPath(string name) { diff --git a/MediaBrowser.Controller/Entities/GameSystem.cs b/MediaBrowser.Controller/Entities/GameSystem.cs index e9c915ead..63f830d25 100644 --- a/MediaBrowser.Controller/Entities/GameSystem.cs +++ b/MediaBrowser.Controller/Entities/GameSystem.cs @@ -18,31 +18,13 @@ namespace MediaBrowser.Controller.Entities /// /// The display prefs id. [IgnoreDataMember] - public override Guid DisplayPreferencesId - { - get - { - return Id; - } - } + public override Guid DisplayPreferencesId => Id; [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return false; - } - } + public override bool SupportsPlayedStatus => false; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; public override double GetDefaultPrimaryImageAspectRatio() { @@ -90,12 +72,6 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; } } diff --git a/MediaBrowser.Controller/Entities/Genre.cs b/MediaBrowser.Controller/Entities/Genre.cs index 9380deb33..3f3ab3551 100644 --- a/MediaBrowser.Controller/Entities/Genre.cs +++ b/MediaBrowser.Controller/Entities/Genre.cs @@ -35,31 +35,13 @@ namespace MediaBrowser.Controller.Entities /// /// The containing folder path. [IgnoreDataMember] - public override string ContainingFolderPath - { - get - { - return Path; - } - } + public override string ContainingFolderPath => Path; [IgnoreDataMember] - public override bool IsDisplayedAsFolder - { - get - { - return true; - } - } + public override bool IsDisplayedAsFolder => true; [IgnoreDataMember] - public override bool SupportsAncestors - { - get - { - return false; - } - } + public override bool SupportsAncestors => false; public override bool IsSaveLocalMetadataEnabled() { @@ -80,13 +62,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; public static string GetPath(string name) { diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs index c2384ca72..124a943ef 100644 --- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs +++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs @@ -25,28 +25,13 @@ namespace MediaBrowser.Controller.Entities.Movies } [IgnoreDataMember] - protected override bool FilterLinkedChildrenPerUser - { - get - { - return true; - } - } + protected override bool FilterLinkedChildrenPerUser => true; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; [IgnoreDataMember] - public override bool SupportsPeople - { - get { return true; } - } + public override bool SupportsPeople => true; public Guid[] LocalTrailerIds { get; set; } public Guid[] RemoteTrailerIds { get; set; } @@ -110,13 +95,7 @@ namespace MediaBrowser.Controller.Entities.Movies } [IgnoreDataMember] - public override bool IsPreSorted - { - get - { - return true; - } - } + public override bool IsPreSorted => true; public override bool IsAuthorizedToDelete(User user, List allCollectionFolders) { diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs index 0da021558..232d11624 100644 --- a/MediaBrowser.Controller/Entities/Movies/Movie.cs +++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs @@ -39,8 +39,8 @@ namespace MediaBrowser.Controller.Entities.Movies [IgnoreDataMember] public string CollectionName { - get { return TmdbCollectionName; } - set { TmdbCollectionName = value; } + get => TmdbCollectionName; + set => TmdbCollectionName = value; } public override double GetDefaultPrimaryImageAspectRatio() @@ -184,13 +184,6 @@ namespace MediaBrowser.Controller.Entities.Movies } [IgnoreDataMember] - public override bool StopRefreshIfLocalMetadataFound - { - get - { - // Need people id's from internet metadata - return false; - } - } + public override bool StopRefreshIfLocalMetadataFound => false; } } diff --git a/MediaBrowser.Controller/Entities/MusicVideo.cs b/MediaBrowser.Controller/Entities/MusicVideo.cs index e990b9374..5bf082b7e 100644 --- a/MediaBrowser.Controller/Entities/MusicVideo.cs +++ b/MediaBrowser.Controller/Entities/MusicVideo.cs @@ -17,13 +17,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public string[] AllArtists - { - get - { - return Artists; - } - } + public string[] AllArtists => Artists; public override UnratedItem GetBlockUnratedType() { diff --git a/MediaBrowser.Controller/Entities/Person.cs b/MediaBrowser.Controller/Entities/Person.cs index 061541447..0ba8b3b48 100644 --- a/MediaBrowser.Controller/Entities/Person.cs +++ b/MediaBrowser.Controller/Entities/Person.cs @@ -51,13 +51,7 @@ namespace MediaBrowser.Controller.Entities /// /// The containing folder path. [IgnoreDataMember] - public override string ContainingFolderPath - { - get - { - return Path; - } - } + public override string ContainingFolderPath => Path; public override bool CanDelete() { @@ -70,31 +64,13 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool EnableAlphaNumericSorting - { - get - { - return false; - } - } + public override bool EnableAlphaNumericSorting => false; [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; [IgnoreDataMember] - public override bool SupportsAncestors - { - get - { - return false; - } - } + public override bool SupportsAncestors => false; public static string GetPath(string name) { diff --git a/MediaBrowser.Controller/Entities/Photo.cs b/MediaBrowser.Controller/Entities/Photo.cs index 2e6830e78..686bb643b 100644 --- a/MediaBrowser.Controller/Entities/Photo.cs +++ b/MediaBrowser.Controller/Entities/Photo.cs @@ -6,31 +6,13 @@ namespace MediaBrowser.Controller.Entities public class Photo : BaseItem { [IgnoreDataMember] - public override bool SupportsLocalMetadata - { - get - { - return false; - } - } + public override bool SupportsLocalMetadata => false; [IgnoreDataMember] - public override string MediaType - { - get - { - return Model.Entities.MediaType.Photo; - } - } + public override string MediaType => Model.Entities.MediaType.Photo; [IgnoreDataMember] - public override Folder LatestItemsIndexContainer - { - get - { - return AlbumEntity; - } - } + public override Folder LatestItemsIndexContainer => AlbumEntity; [IgnoreDataMember] diff --git a/MediaBrowser.Controller/Entities/PhotoAlbum.cs b/MediaBrowser.Controller/Entities/PhotoAlbum.cs index 42992bbd5..4cd0c8b66 100644 --- a/MediaBrowser.Controller/Entities/PhotoAlbum.cs +++ b/MediaBrowser.Controller/Entities/PhotoAlbum.cs @@ -5,30 +5,12 @@ namespace MediaBrowser.Controller.Entities public class PhotoAlbum : Folder { [IgnoreDataMember] - public override bool AlwaysScanInternalMetadataPath - { - get - { - return true; - } - } + public override bool AlwaysScanInternalMetadataPath => true; [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return false; - } - } + public override bool SupportsPlayedStatus => false; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; } } diff --git a/MediaBrowser.Controller/Entities/Studio.cs b/MediaBrowser.Controller/Entities/Studio.cs index b95199f7e..d6da0d48c 100644 --- a/MediaBrowser.Controller/Entities/Studio.cs +++ b/MediaBrowser.Controller/Entities/Studio.cs @@ -29,31 +29,13 @@ namespace MediaBrowser.Controller.Entities /// /// The containing folder path. [IgnoreDataMember] - public override string ContainingFolderPath - { - get - { - return Path; - } - } + public override string ContainingFolderPath => Path; [IgnoreDataMember] - public override bool IsDisplayedAsFolder - { - get - { - return true; - } - } + public override bool IsDisplayedAsFolder => true; [IgnoreDataMember] - public override bool SupportsAncestors - { - get - { - return false; - } - } + public override bool SupportsAncestors => false; public override double GetDefaultPrimaryImageAspectRatio() { @@ -81,13 +63,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; public static string GetPath(string name) { diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index 8a04d7a8d..072b1d89a 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -47,61 +47,25 @@ namespace MediaBrowser.Controller.Entities.TV } [IgnoreDataMember] - protected override bool SupportsOwnedItems - { - get - { - return IsStacked || MediaSourceCount > 1; - } - } + protected override bool SupportsOwnedItems => IsStacked || MediaSourceCount > 1; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get { return true; } - } + public override bool SupportsInheritedParentImages => true; [IgnoreDataMember] - public override bool SupportsPeople - { - get { return true; } - } + public override bool SupportsPeople => true; [IgnoreDataMember] - public int? AiredSeasonNumber - { - get - { - return AirsAfterSeasonNumber ?? AirsBeforeSeasonNumber ?? ParentIndexNumber; - } - } + public int? AiredSeasonNumber => AirsAfterSeasonNumber ?? AirsBeforeSeasonNumber ?? ParentIndexNumber; [IgnoreDataMember] - public override Folder LatestItemsIndexContainer - { - get - { - return Series; - } - } + public override Folder LatestItemsIndexContainer => Series; [IgnoreDataMember] - public override Guid DisplayParentId - { - get - { - return SeasonId; - } - } + public override Guid DisplayParentId => SeasonId; [IgnoreDataMember] - protected override bool EnableDefaultVideoUserDataKeys - { - get - { - return false; - } - } + protected override bool EnableDefaultVideoUserDataKeys => false; public override double GetDefaultPrimaryImageAspectRatio() { @@ -166,13 +130,7 @@ namespace MediaBrowser.Controller.Entities.TV } [IgnoreDataMember] - public bool IsInSeasonFolder - { - get - { - return FindParent() != null; - } - } + public bool IsInSeasonFolder => FindParent() != null; [IgnoreDataMember] public string SeriesPresentationUniqueKey { get; set; } @@ -278,13 +236,7 @@ namespace MediaBrowser.Controller.Entities.TV } [IgnoreDataMember] - public bool IsMissingEpisode - { - get - { - return LocationType == LocationType.Virtual; - } - } + public bool IsMissingEpisode => LocationType == LocationType.Virtual; [IgnoreDataMember] public Guid SeasonId { get; set; } diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs index 4c8c9b590..b40009e0c 100644 --- a/MediaBrowser.Controller/Entities/TV/Season.cs +++ b/MediaBrowser.Controller/Entities/TV/Season.cs @@ -16,46 +16,22 @@ namespace MediaBrowser.Controller.Entities.TV public class Season : Folder, IHasSeries, IHasLookupInfo { [IgnoreDataMember] - public override bool SupportsAddingToPlaylist - { - get { return true; } - } + public override bool SupportsAddingToPlaylist => true; [IgnoreDataMember] - public override bool IsPreSorted - { - get - { - return true; - } - } + public override bool IsPreSorted => true; [IgnoreDataMember] - public override bool SupportsDateLastMediaAdded - { - get - { - return false; - } - } + public override bool SupportsDateLastMediaAdded => false; [IgnoreDataMember] - public override bool SupportsPeople - { - get { return true; } - } + public override bool SupportsPeople => true; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get { return true; } - } + public override bool SupportsInheritedParentImages => true; [IgnoreDataMember] - public override Guid DisplayParentId - { - get { return SeriesId; } - } + public override Guid DisplayParentId => SeriesId; public override double GetDefaultPrimaryImageAspectRatio() { diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index e48c8dd29..5ba4613c0 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -32,43 +32,19 @@ namespace MediaBrowser.Controller.Entities.TV public string AirTime { get; set; } [IgnoreDataMember] - public override bool SupportsAddingToPlaylist - { - get { return true; } - } + public override bool SupportsAddingToPlaylist => true; [IgnoreDataMember] - public override bool IsPreSorted - { - get - { - return true; - } - } + public override bool IsPreSorted => true; [IgnoreDataMember] - public override bool SupportsDateLastMediaAdded - { - get - { - return true; - } - } + public override bool SupportsDateLastMediaAdded => true; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; [IgnoreDataMember] - public override bool SupportsPeople - { - get { return true; } - } + public override bool SupportsPeople => true; public Guid[] LocalTrailerIds { get; set; } public Guid[] RemoteTrailerIds { get; set; } @@ -526,13 +502,6 @@ namespace MediaBrowser.Controller.Entities.TV } [IgnoreDataMember] - public override bool StopRefreshIfLocalMetadataFound - { - get - { - // Need people id's from internet metadata - return false; - } - } + public override bool StopRefreshIfLocalMetadataFound => false; } } diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs index 2ce776103..5bf22d7bc 100644 --- a/MediaBrowser.Controller/Entities/Trailer.cs +++ b/MediaBrowser.Controller/Entities/Trailer.cs @@ -94,13 +94,6 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool StopRefreshIfLocalMetadataFound - { - get - { - // Need people id's from internet metadata - return false; - } - } + public override bool StopRefreshIfLocalMetadataFound => false; } } diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs index 03facf107..16fef9a82 100644 --- a/MediaBrowser.Controller/Entities/User.cs +++ b/MediaBrowser.Controller/Entities/User.cs @@ -40,14 +40,8 @@ namespace MediaBrowser.Controller.Entities // Strictly to remove IgnoreDataMember public override ItemImageInfo[] ImageInfos { - get - { - return base.ImageInfos; - } - set - { - base.ImageInfos = value; - } + get => base.ImageInfos; + set => base.ImageInfos = value; } /// @@ -57,15 +51,8 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] public override string Path { - get - { - // Return this so that metadata providers will look in here - return ConfigurationDirectoryPath; - } - set - { - base.Path = value; - } + get => ConfigurationDirectoryPath; + set => base.Path = value; } private string _name; @@ -75,10 +62,7 @@ namespace MediaBrowser.Controller.Entities /// The name. public override string Name { - get - { - return _name; - } + get => _name; set { _name = value; @@ -94,26 +78,14 @@ namespace MediaBrowser.Controller.Entities /// /// The containing folder path. [IgnoreDataMember] - public override string ContainingFolderPath - { - get - { - return Path; - } - } + public override string ContainingFolderPath => Path; /// /// Gets the root folder. /// /// The root folder. [IgnoreDataMember] - public Folder RootFolder - { - get - { - return LibraryManager.GetUserRootFolder(); - } - } + public Folder RootFolder => LibraryManager.GetUserRootFolder(); /// /// Gets or sets the last login date. @@ -146,7 +118,7 @@ namespace MediaBrowser.Controller.Entities return _config; } - set { _config = value; } + set => _config = value; } private volatile UserPolicy _policy; @@ -169,7 +141,7 @@ namespace MediaBrowser.Controller.Entities return _policy; } - set { _policy = value; } + set => _policy = value; } /// @@ -232,13 +204,7 @@ namespace MediaBrowser.Controller.Entities /// /// The configuration directory path. [IgnoreDataMember] - public string ConfigurationDirectoryPath - { - get - { - return GetConfigurationDirectoryPath(Name); - } - } + public string ConfigurationDirectoryPath => GetConfigurationDirectoryPath(Name); public override double GetDefaultPrimaryImageAspectRatio() { @@ -327,13 +293,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; public long InternalId { get; set; } diff --git a/MediaBrowser.Controller/Entities/UserItemData.cs b/MediaBrowser.Controller/Entities/UserItemData.cs index 0739d5f57..8a87aff5f 100644 --- a/MediaBrowser.Controller/Entities/UserItemData.cs +++ b/MediaBrowser.Controller/Entities/UserItemData.cs @@ -31,10 +31,7 @@ namespace MediaBrowser.Controller.Entities /// Rating;A 0 to 10 rating is required for UserItemData. public double? Rating { - get - { - return _rating; - } + get => _rating; set { if (value.HasValue) diff --git a/MediaBrowser.Controller/Entities/UserRootFolder.cs b/MediaBrowser.Controller/Entities/UserRootFolder.cs index 7b55d8bb9..7fe8df8af 100644 --- a/MediaBrowser.Controller/Entities/UserRootFolder.cs +++ b/MediaBrowser.Controller/Entities/UserRootFolder.cs @@ -34,22 +34,10 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return false; - } - } + public override bool SupportsPlayedStatus => false; private void ClearCache() { @@ -88,22 +76,10 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - protected override bool SupportsShortcutChildren - { - get - { - return true; - } - } + protected override bool SupportsShortcutChildren => true; [IgnoreDataMember] - public override bool IsPreSorted - { - get - { - return true; - } - } + public override bool IsPreSorted => true; protected override IEnumerable GetEligibleChildrenForRecursiveChildren(User user) { diff --git a/MediaBrowser.Controller/Entities/UserView.cs b/MediaBrowser.Controller/Entities/UserView.cs index 9c45a803b..de4105df9 100644 --- a/MediaBrowser.Controller/Entities/UserView.cs +++ b/MediaBrowser.Controller/Entities/UserView.cs @@ -20,13 +20,7 @@ namespace MediaBrowser.Controller.Entities public static IPlaylistManager PlaylistManager; [IgnoreDataMember] - public string CollectionType - { - get - { - return ViewType; - } - } + public string CollectionType => ViewType; public override IEnumerable GetIdsForAncestorQuery() { @@ -48,22 +42,10 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return false; - } - } + public override bool SupportsPlayedStatus => false; public override int GetChildCount(User user) { @@ -188,12 +170,6 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; } } diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index cc236cbba..dd4440c3b 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -33,28 +33,13 @@ namespace MediaBrowser.Controller.Entities public LinkedChild[] LinkedAlternateVersions { get; set; } [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return true; - } - } + public override bool SupportsPlayedStatus => true; [IgnoreDataMember] - public override bool SupportsPeople - { - get { return true; } - } + public override bool SupportsPeople => true; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return true; - } - } + public override bool SupportsInheritedParentImages => true; [IgnoreDataMember] public override bool SupportsPositionTicksResume @@ -106,10 +91,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsThemeMedia - { - get { return true; } - } + public override bool SupportsThemeMedia => true; /// /// Gets or sets the timestamp. @@ -199,10 +181,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsAddingToPlaylist - { - get { return true; } - } + public override bool SupportsAddingToPlaylist => true; [IgnoreDataMember] public int MediaSourceCount @@ -222,16 +201,10 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public bool IsStacked - { - get { return AdditionalParts.Length > 0; } - } + public bool IsStacked => AdditionalParts.Length > 0; [IgnoreDataMember] - public override bool HasLocalAlternateVersions - { - get { return LocalAlternateVersions.Length > 0; } - } + public override bool HasLocalAlternateVersions => LocalAlternateVersions.Length > 0; public IEnumerable GetAdditionalPartIds() { @@ -289,13 +262,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - protected virtual bool EnableDefaultVideoUserDataKeys - { - get - { - return true; - } - } + protected virtual bool EnableDefaultVideoUserDataKeys => true; public override List GetUserDataKeys() { @@ -466,23 +433,14 @@ namespace MediaBrowser.Controller.Entities /// /// true if [is3 D]; otherwise, false. [IgnoreDataMember] - public bool Is3D - { - get { return Video3DFormat.HasValue; } - } + public bool Is3D => Video3DFormat.HasValue; /// /// Gets the type of the media. /// /// The type of the media. [IgnoreDataMember] - public override string MediaType - { - get - { - return Model.Entities.MediaType.Video; - } - } + public override string MediaType => Model.Entities.MediaType.Video; protected override async Task RefreshedOwnedItems(MetadataRefreshOptions options, List fileSystemChildren, CancellationToken cancellationToken) { diff --git a/MediaBrowser.Controller/Entities/Year.cs b/MediaBrowser.Controller/Entities/Year.cs index 054724b21..643c0ddcf 100644 --- a/MediaBrowser.Controller/Entities/Year.cs +++ b/MediaBrowser.Controller/Entities/Year.cs @@ -25,13 +25,7 @@ namespace MediaBrowser.Controller.Entities /// /// The containing folder path. [IgnoreDataMember] - public override string ContainingFolderPath - { - get - { - return Path; - } - } + public override string ContainingFolderPath => Path; public override double GetDefaultPrimaryImageAspectRatio() { @@ -42,13 +36,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsAncestors - { - get - { - return false; - } - } + public override bool SupportsAncestors => false; public override bool CanDelete() { @@ -89,13 +77,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override bool SupportsPeople - { - get - { - return false; - } - } + public override bool SupportsPeople => false; public static string GetPath(string name) { diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.cs index dfe23f193..eb459e890 100644 --- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs +++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs @@ -67,13 +67,7 @@ namespace MediaBrowser.Controller.Library /// Gets a value indicating whether this instance is directory. /// /// true if this instance is directory; otherwise, false. - public bool IsDirectory - { - get - { - return FileInfo.IsDirectory; - } - } + public bool IsDirectory => FileInfo.IsDirectory; /// /// Gets a value indicating whether this instance is vf. @@ -103,13 +97,7 @@ namespace MediaBrowser.Controller.Library /// Gets a value indicating whether this instance is physical root. /// /// true if this instance is physical root; otherwise, false. - public bool IsPhysicalRoot - { - get - { - return IsDirectory && BaseItem.FileSystem.AreEqual(Path, _appPaths.RootFolderPath); - } - } + public bool IsPhysicalRoot => IsDirectory && BaseItem.FileSystem.AreEqual(Path, _appPaths.RootFolderPath); /// /// Gets or sets the additional locations. diff --git a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs index 93300243b..55f47aae9 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs @@ -32,28 +32,13 @@ namespace MediaBrowser.Controller.LiveTv } [IgnoreDataMember] - public override bool SupportsPositionTicksResume - { - get - { - return false; - } - } + public override bool SupportsPositionTicksResume => false; [IgnoreDataMember] - public override SourceType SourceType - { - get { return SourceType.LiveTV; } - } + public override SourceType SourceType => SourceType.LiveTV; [IgnoreDataMember] - public override bool EnableRememberingTrackSelections - { - get - { - return false; - } - } + public override bool EnableRememberingTrackSelections => false; /// /// Gets or sets the number. @@ -68,14 +53,7 @@ namespace MediaBrowser.Controller.LiveTv public ChannelType ChannelType { get; set; } [IgnoreDataMember] - public override LocationType LocationType - { - get - { - // TODO: This should be removed - return LocationType.Remote; - } - } + public override LocationType LocationType => LocationType.Remote; protected override string CreateSortName() { @@ -93,13 +71,7 @@ namespace MediaBrowser.Controller.LiveTv } [IgnoreDataMember] - public override string MediaType - { - get - { - return ChannelType == ChannelType.Radio ? Model.Entities.MediaType.Audio : Model.Entities.MediaType.Video; - } - } + public override string MediaType => ChannelType == ChannelType.Radio ? Model.Entities.MediaType.Audio : Model.Entities.MediaType.Video; public override string GetClientTypeName() { @@ -176,13 +148,7 @@ namespace MediaBrowser.Controller.LiveTv /// /// true if this instance is kids; otherwise, false. [IgnoreDataMember] - public bool IsKids - { - get - { - return Tags.Contains("Kids", StringComparer.OrdinalIgnoreCase); - } - } + public bool IsKids => Tags.Contains("Kids", StringComparer.OrdinalIgnoreCase); [IgnoreDataMember] public bool IsRepeat { get; set; } diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs index 15394cc20..8bde6a5da 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs @@ -63,10 +63,7 @@ namespace MediaBrowser.Controller.LiveTv } [IgnoreDataMember] - public override SourceType SourceType - { - get { return SourceType.LiveTV; } - } + public override SourceType SourceType => SourceType.LiveTV; /// /// The start date of the program, in UTC. @@ -103,13 +100,7 @@ namespace MediaBrowser.Controller.LiveTv /// /// true if this instance is sports; otherwise, false. [IgnoreDataMember] - public bool IsSports - { - get - { - return Tags.Contains("Sports", StringComparer.OrdinalIgnoreCase); - } - } + public bool IsSports => Tags.Contains("Sports", StringComparer.OrdinalIgnoreCase); /// /// Gets or sets a value indicating whether this instance is series. @@ -123,52 +114,28 @@ namespace MediaBrowser.Controller.LiveTv /// /// true if this instance is live; otherwise, false. [IgnoreDataMember] - public bool IsLive - { - get - { - return Tags.Contains("Live", StringComparer.OrdinalIgnoreCase); - } - } + public bool IsLive => Tags.Contains("Live", StringComparer.OrdinalIgnoreCase); /// /// Gets or sets a value indicating whether this instance is news. /// /// true if this instance is news; otherwise, false. [IgnoreDataMember] - public bool IsNews - { - get - { - return Tags.Contains("News", StringComparer.OrdinalIgnoreCase); - } - } + public bool IsNews => Tags.Contains("News", StringComparer.OrdinalIgnoreCase); /// /// Gets or sets a value indicating whether this instance is kids. /// /// true if this instance is kids; otherwise, false. [IgnoreDataMember] - public bool IsKids - { - get - { - return Tags.Contains("Kids", StringComparer.OrdinalIgnoreCase); - } - } + public bool IsKids => Tags.Contains("Kids", StringComparer.OrdinalIgnoreCase); /// /// Gets or sets a value indicating whether this instance is premiere. /// /// true if this instance is premiere; otherwise, false. [IgnoreDataMember] - public bool IsPremiere - { - get - { - return Tags.Contains("Premiere", StringComparer.OrdinalIgnoreCase); - } - } + public bool IsPremiere => Tags.Contains("Premiere", StringComparer.OrdinalIgnoreCase); /// /// Returns the folder containing the item. @@ -176,13 +143,7 @@ namespace MediaBrowser.Controller.LiveTv /// /// The containing folder path. [IgnoreDataMember] - public override string ContainingFolderPath - { - get - { - return Path; - } - } + public override string ContainingFolderPath => Path; //[IgnoreDataMember] //public override string MediaType @@ -251,13 +212,7 @@ namespace MediaBrowser.Controller.LiveTv } [IgnoreDataMember] - public override bool SupportsAncestors - { - get - { - return false; - } - } + public override bool SupportsAncestors => false; private LiveTvOptions GetConfiguration() { diff --git a/MediaBrowser.Controller/LiveTv/TimerInfo.cs b/MediaBrowser.Controller/LiveTv/TimerInfo.cs index 8088e7332..d89ec4fbf 100644 --- a/MediaBrowser.Controller/LiveTv/TimerInfo.cs +++ b/MediaBrowser.Controller/LiveTv/TimerInfo.cs @@ -115,27 +115,11 @@ namespace MediaBrowser.Controller.LiveTv /// The episode number. public int? EpisodeNumber { get; set; } public bool IsMovie { get; set; } - public bool IsKids - { - get - { - return Tags.Contains("Kids", StringComparer.OrdinalIgnoreCase); - } - } - public bool IsSports - { - get - { - return Tags.Contains("Sports", StringComparer.OrdinalIgnoreCase); - } - } - public bool IsNews - { - get - { - return Tags.Contains("News", StringComparer.OrdinalIgnoreCase); - } - } + public bool IsKids => Tags.Contains("Kids", StringComparer.OrdinalIgnoreCase); + + public bool IsSports => Tags.Contains("Sports", StringComparer.OrdinalIgnoreCase); + + public bool IsNews => Tags.Contains("News", StringComparer.OrdinalIgnoreCase); public bool IsSeries { get; set; } /// @@ -143,22 +127,10 @@ namespace MediaBrowser.Controller.LiveTv /// /// true if this instance is live; otherwise, false. [IgnoreDataMember] - public bool IsLive - { - get - { - return Tags.Contains("Live", StringComparer.OrdinalIgnoreCase); - } - } + public bool IsLive => Tags.Contains("Live", StringComparer.OrdinalIgnoreCase); [IgnoreDataMember] - public bool IsPremiere - { - get - { - return Tags.Contains("Premiere", StringComparer.OrdinalIgnoreCase); - } - } + public bool IsPremiere => Tags.Contains("Premiere", StringComparer.OrdinalIgnoreCase); public int? ProductionYear { get; set; } public string EpisodeTitle { get; set; } diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs index dd846fafe..bb09d365e 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs @@ -61,53 +61,17 @@ namespace MediaBrowser.Controller.MediaEncoding } } - public bool IgnoreInputDts - { - get - { - return MediaSource.IgnoreDts; - } - } + public bool IgnoreInputDts => MediaSource.IgnoreDts; - public bool IgnoreInputIndex - { - get - { - return MediaSource.IgnoreIndex; - } - } + public bool IgnoreInputIndex => MediaSource.IgnoreIndex; - public bool GenPtsInput - { - get - { - return MediaSource.GenPtsInput; - } - } + public bool GenPtsInput => MediaSource.GenPtsInput; - public bool DiscardCorruptFramesInput - { - get - { - return false; - } - } + public bool DiscardCorruptFramesInput => false; - public bool EnableFastSeekInput - { - get - { - return false; - } - } + public bool EnableFastSeekInput => false; - public bool GenPtsOutput - { - get - { - return false; - } - } + public bool GenPtsOutput => false; public string OutputContainer { get; set; } @@ -142,15 +106,9 @@ namespace MediaBrowser.Controller.MediaEncoding public BaseEncodingJobOptions BaseRequest { get; set; } - public long? StartTimeTicks - { - get { return BaseRequest.StartTimeTicks; } - } + public long? StartTimeTicks => BaseRequest.StartTimeTicks; - public bool CopyTimestamps - { - get { return BaseRequest.CopyTimestamps; } - } + public bool CopyTimestamps => BaseRequest.CopyTimestamps; public int? OutputAudioBitrate; public int? OutputAudioChannels; @@ -323,13 +281,7 @@ namespace MediaBrowser.Controller.MediaEncoding SupportedSubtitleCodecs = Array.Empty(); } - public bool IsSegmentedLiveStream - { - get - { - return TranscodingType != TranscodingJobType.Progressive && !RunTimeTicks.HasValue; - } - } + public bool IsSegmentedLiveStream => TranscodingType != TranscodingJobType.Progressive && !RunTimeTicks.HasValue; public bool EnableBreakOnNonKeyFrames(string videoCodec) { @@ -346,13 +298,7 @@ namespace MediaBrowser.Controller.MediaEncoding return false; } - public int? TotalOutputBitrate - { - get - { - return (OutputAudioBitrate ?? 0) + (OutputVideoBitrate ?? 0); - } - } + public int? TotalOutputBitrate => (OutputAudioBitrate ?? 0) + (OutputVideoBitrate ?? 0); public int? OutputWidth { diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs index 48d2b65ad..625f0b389 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs @@ -20,13 +20,7 @@ namespace MediaBrowser.Controller.MediaEncoding /// Gets a value indicating whether this instance has fixed resolution. /// /// true if this instance has fixed resolution; otherwise, false. - public bool HasFixedResolution - { - get - { - return Width.HasValue || Height.HasValue; - } - } + public bool HasFixedResolution => Width.HasValue || Height.HasValue; private readonly CultureInfo _usCulture = new CultureInfo("en-US"); public EncodingJobOptions(StreamInfo info, DeviceProfile deviceProfile) diff --git a/MediaBrowser.Controller/Net/AuthenticatedAttribute.cs b/MediaBrowser.Controller/Net/AuthenticatedAttribute.cs index 9ef0eb80f..64c2294e3 100644 --- a/MediaBrowser.Controller/Net/AuthenticatedAttribute.cs +++ b/MediaBrowser.Controller/Net/AuthenticatedAttribute.cs @@ -44,10 +44,7 @@ namespace MediaBrowser.Controller.Net /// >0 Executed after global request filters /// /// The priority. - public int Priority - { - get { return 0; } - } + public int Priority => 0; public string[] GetRoles() { diff --git a/MediaBrowser.Controller/Net/AuthorizationInfo.cs b/MediaBrowser.Controller/Net/AuthorizationInfo.cs index 2471989a0..3e004763d 100644 --- a/MediaBrowser.Controller/Net/AuthorizationInfo.cs +++ b/MediaBrowser.Controller/Net/AuthorizationInfo.cs @@ -9,13 +9,7 @@ namespace MediaBrowser.Controller.Net /// Gets or sets the user identifier. /// /// The user identifier. - public Guid UserId - { - get - { - return User == null ? Guid.Empty : User.Id; - } - } + public Guid UserId => User == null ? Guid.Empty : User.Id; /// /// Gets or sets the device identifier. diff --git a/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs b/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs index bee53b4c5..4e7e1c8ed 100644 --- a/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs +++ b/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs @@ -83,13 +83,7 @@ namespace MediaBrowser.Controller.Net protected readonly CultureInfo UsCulture = new CultureInfo("en-US"); - protected virtual bool SendOnTimer - { - get - { - return false; - } - } + protected virtual bool SendOnTimer => false; protected virtual void ParseMessageParams(string[] values) { diff --git a/MediaBrowser.Controller/Playlists/Playlist.cs b/MediaBrowser.Controller/Playlists/Playlist.cs index af8d6cb11..969643660 100644 --- a/MediaBrowser.Controller/Playlists/Playlist.cs +++ b/MediaBrowser.Controller/Playlists/Playlist.cs @@ -34,13 +34,7 @@ namespace MediaBrowser.Controller.Playlists } [IgnoreDataMember] - public bool IsFile - { - get - { - return IsPlaylistFile(Path); - } - } + public bool IsFile => IsPlaylistFile(Path); public static bool IsPlaylistFile(string path) { @@ -64,49 +58,19 @@ namespace MediaBrowser.Controller.Playlists } [IgnoreDataMember] - protected override bool FilterLinkedChildrenPerUser - { - get - { - return true; - } - } + protected override bool FilterLinkedChildrenPerUser => true; [IgnoreDataMember] - public override bool SupportsInheritedParentImages - { - get - { - return false; - } - } + public override bool SupportsInheritedParentImages => false; [IgnoreDataMember] - public override bool SupportsPlayedStatus - { - get - { - return string.Equals(MediaType, "Video", StringComparison.OrdinalIgnoreCase); - } - } + public override bool SupportsPlayedStatus => string.Equals(MediaType, "Video", StringComparison.OrdinalIgnoreCase); [IgnoreDataMember] - public override bool AlwaysScanInternalMetadataPath - { - get - { - return true; - } - } + public override bool AlwaysScanInternalMetadataPath => true; [IgnoreDataMember] - public override bool SupportsCumulativeRunTimeTicks - { - get - { - return true; - } - } + public override bool SupportsCumulativeRunTimeTicks => true; public override double GetDefaultPrimaryImageAspectRatio() { @@ -229,24 +193,12 @@ namespace MediaBrowser.Controller.Playlists } [IgnoreDataMember] - public override bool IsPreSorted - { - get - { - return true; - } - } + public override bool IsPreSorted => true; public string PlaylistMediaType { get; set; } [IgnoreDataMember] - public override string MediaType - { - get - { - return PlaylistMediaType; - } - } + public override string MediaType => PlaylistMediaType; public void SetMediaType(string value) { diff --git a/MediaBrowser.Controller/Resolvers/BaseItemResolver.cs b/MediaBrowser.Controller/Resolvers/BaseItemResolver.cs index 1016535e1..637a7e3f0 100644 --- a/MediaBrowser.Controller/Resolvers/BaseItemResolver.cs +++ b/MediaBrowser.Controller/Resolvers/BaseItemResolver.cs @@ -24,13 +24,7 @@ namespace MediaBrowser.Controller.Resolvers /// Gets the priority. /// /// The priority. - public virtual ResolverPriority Priority - { - get - { - return ResolverPriority.First; - } - } + public virtual ResolverPriority Priority => ResolverPriority.First; /// /// Sets initial values on the newly resolved item diff --git a/MediaBrowser.LocalMetadata/BaseXmlProvider.cs b/MediaBrowser.LocalMetadata/BaseXmlProvider.cs index 2e4de4d93..e67b3ebac 100644 --- a/MediaBrowser.LocalMetadata/BaseXmlProvider.cs +++ b/MediaBrowser.LocalMetadata/BaseXmlProvider.cs @@ -67,32 +67,13 @@ namespace MediaBrowser.LocalMetadata return file.Exists && FileSystem.GetLastWriteTimeUtc(file) > item.DateLastSaved; } - public string Name - { - get - { - return XmlProviderUtils.Name; - } - } + public string Name => XmlProviderUtils.Name; - public virtual int Order - { - get - { - // After Nfo - return 1; - } - } + public virtual int Order => 1; } static class XmlProviderUtils { - public static string Name - { - get - { - return "Emby Xml"; - } - } + public static string Name => "Emby Xml"; } } diff --git a/MediaBrowser.LocalMetadata/Images/CollectionFolderImageProvider.cs b/MediaBrowser.LocalMetadata/Images/CollectionFolderImageProvider.cs index 73f9b69c8..f5e028ab8 100644 --- a/MediaBrowser.LocalMetadata/Images/CollectionFolderImageProvider.cs +++ b/MediaBrowser.LocalMetadata/Images/CollectionFolderImageProvider.cs @@ -14,24 +14,14 @@ namespace MediaBrowser.LocalMetadata.Images _fileSystem = fileSystem; } - public string Name - { - get { return "Collection Folder Images"; } - } + public string Name => "Collection Folder Images"; public bool Supports(BaseItem item) { return item is CollectionFolder && item.SupportsLocalMetadata; } - public int Order - { - get - { - // Run after LocalImageProvider - return 1; - } - } + public int Order => 1; public List GetImages(BaseItem item, IDirectoryService directoryService) { diff --git a/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs index 589cbf4df..894f46129 100644 --- a/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs +++ b/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs @@ -18,15 +18,9 @@ namespace MediaBrowser.LocalMetadata.Images _fileSystem = fileSystem; } - public string Name - { - get { return "Local Images"; } - } + public string Name => "Local Images"; - public int Order - { - get { return 0; } - } + public int Order => 0; public bool Supports(BaseItem item) { diff --git a/MediaBrowser.LocalMetadata/Images/InternalMetadataFolderImageProvider.cs b/MediaBrowser.LocalMetadata/Images/InternalMetadataFolderImageProvider.cs index 23d65e5ac..2a2f36fbd 100644 --- a/MediaBrowser.LocalMetadata/Images/InternalMetadataFolderImageProvider.cs +++ b/MediaBrowser.LocalMetadata/Images/InternalMetadataFolderImageProvider.cs @@ -19,10 +19,7 @@ namespace MediaBrowser.LocalMetadata.Images _fileSystem = fileSystem; } - public string Name - { - get { return "Internal Images"; } - } + public string Name => "Internal Images"; public bool Supports(BaseItem item) { @@ -50,14 +47,7 @@ namespace MediaBrowser.LocalMetadata.Images return true; } - public int Order - { - get - { - // Make sure this is last so that all other locations are scanned first - return 1000; - } - } + public int Order => 1000; public List GetImages(BaseItem item, IDirectoryService directoryService) { diff --git a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs index 479e13da4..0a4928ed7 100644 --- a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs +++ b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs @@ -21,15 +21,9 @@ namespace MediaBrowser.LocalMetadata.Images _fileSystem = fileSystem; } - public string Name - { - get { return "Local Images"; } - } + public string Name => "Local Images"; - public int Order - { - get { return 0; } - } + public int Order => 0; public bool Supports(BaseItem item) { diff --git a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs index 4fef3055b..2ddf922f9 100644 --- a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs +++ b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs @@ -42,21 +42,9 @@ namespace MediaBrowser.LocalMetadata.Savers protected ILogger Logger { get; private set; } protected IXmlReaderSettingsFactory XmlReaderSettingsFactory { get; private set; } - protected ItemUpdateType MinimumUpdateType - { - get - { - return ItemUpdateType.MetadataDownload; - } - } + protected ItemUpdateType MinimumUpdateType => ItemUpdateType.MetadataDownload; - public string Name - { - get - { - return XmlProviderUtils.Name; - } - } + public string Name => XmlProviderUtils.Name; public string GetSavePath(BaseItem item) { diff --git a/MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs index 05a2d84e9..d5773fe31 100644 --- a/MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/AudioEncoder.cs @@ -53,10 +53,6 @@ namespace MediaBrowser.MediaEncoding.Encoder return null; } - protected override bool IsVideoEncoder - { - get { return false; } - } - + protected override bool IsVideoEncoder => false; } } diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs index a3a6506bc..df78d117a 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs @@ -20,8 +20,8 @@ namespace MediaBrowser.MediaEncoding.Encoder public EncodingJobOptions Options { - get { return (EncodingJobOptions)BaseRequest; } - set { BaseRequest = value; } + get => (EncodingJobOptions)BaseRequest; + set => BaseRequest = value; } public string Id { get; set; } diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index 7b368923c..8489cc9b1 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -415,10 +415,7 @@ namespace MediaBrowser.MediaEncoding.Encoder /// Gets the encoder path. /// /// The encoder path. - public string EncoderPath - { - get { return FFMpegPath; } - } + public string EncoderPath => FFMpegPath; /// /// Gets the media info. diff --git a/MediaBrowser.MediaEncoding/Encoder/VideoEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/VideoEncoder.cs index fe315d83c..bf23a73bd 100644 --- a/MediaBrowser.MediaEncoding/Encoder/VideoEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/VideoEncoder.cs @@ -54,10 +54,6 @@ namespace MediaBrowser.MediaEncoding.Encoder return null; } - protected override bool IsVideoEncoder - { - get { return true; } - } - + protected override bool IsVideoEncoder => true; } } diff --git a/MediaBrowser.MediaEncoding/Subtitles/OpenSubtitleDownloader.cs b/MediaBrowser.MediaEncoding/Subtitles/OpenSubtitleDownloader.cs index 0e418ecf7..a1d925881 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/OpenSubtitleDownloader.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/OpenSubtitleDownloader.cs @@ -83,10 +83,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles return _encryption.DecryptString(password.Substring(2)); } - public string Name - { - get { return "Open Subtitles"; } - } + public string Name => "Open Subtitles"; private SubtitleOptions GetOptions() { diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs index 58a05e2f3..3b7514613 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs @@ -60,13 +60,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles _textEncoding = textEncoding; } - private string SubtitleCachePath - { - get - { - return Path.Combine(_appPaths.DataPath, "subtitles"); - } - } + private string SubtitleCachePath => Path.Combine(_appPaths.DataPath, "subtitles"); private Stream ConvertSubtitles(Stream stream, string inputFormat, diff --git a/MediaBrowser.Model/Dlna/SortCriteria.cs b/MediaBrowser.Model/Dlna/SortCriteria.cs index 7465e05f8..b5c1ac408 100644 --- a/MediaBrowser.Model/Dlna/SortCriteria.cs +++ b/MediaBrowser.Model/Dlna/SortCriteria.cs @@ -4,10 +4,7 @@ namespace MediaBrowser.Model.Dlna { public class SortCriteria { - public SortOrder SortOrder - { - get { return SortOrder.Ascending; } - } + public SortOrder SortOrder => SortOrder.Ascending; public SortCriteria(string value) { diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs index 2bc6908db..86d7c9d62 100644 --- a/MediaBrowser.Model/Dlna/StreamInfo.cs +++ b/MediaBrowser.Model/Dlna/StreamInfo.cs @@ -127,22 +127,11 @@ namespace MediaBrowser.Model.Dlna public Dictionary StreamOptions { get; private set; } - public string MediaSourceId - { - get - { - return MediaSource == null ? null : MediaSource.Id; - } - } + public string MediaSourceId => MediaSource == null ? null : MediaSource.Id; - public bool IsDirectStream - { - get - { - return PlayMethod == PlayMethod.DirectStream || - PlayMethod == PlayMethod.DirectPlay; - } - } + public bool IsDirectStream => + PlayMethod == PlayMethod.DirectStream || + PlayMethod == PlayMethod.DirectPlay; public string ToUrl(string baseUrl, string accessToken) { @@ -911,13 +900,7 @@ namespace MediaBrowser.Model.Dlna } } - public int? TargetTotalBitrate - { - get - { - return (TargetAudioBitrate ?? 0) + (TargetVideoBitrate ?? 0); - } - } + public int? TargetTotalBitrate => (TargetAudioBitrate ?? 0) + (TargetVideoBitrate ?? 0); public bool? IsTargetAnamorphic { diff --git a/MediaBrowser.Model/Drawing/ImageSize.cs b/MediaBrowser.Model/Drawing/ImageSize.cs index b6866d38e..b27df346c 100644 --- a/MediaBrowser.Model/Drawing/ImageSize.cs +++ b/MediaBrowser.Model/Drawing/ImageSize.cs @@ -16,14 +16,8 @@ namespace MediaBrowser.Model.Drawing /// The height. public double Height { - get - { - return _height; - } - set - { - _height = value; - } + get => _height; + set => _height = value; } /// @@ -32,8 +26,8 @@ namespace MediaBrowser.Model.Drawing /// The width. public double Width { - get { return _width; } - set { _width = value; } + get => _width; + set => _width = value; } public bool Equals(ImageSize size) diff --git a/MediaBrowser.Model/Dto/BaseItemPerson.cs b/MediaBrowser.Model/Dto/BaseItemPerson.cs index f42ef4c91..7011ff8ea 100644 --- a/MediaBrowser.Model/Dto/BaseItemPerson.cs +++ b/MediaBrowser.Model/Dto/BaseItemPerson.cs @@ -42,12 +42,6 @@ namespace MediaBrowser.Model.Dto /// /// true if this instance has primary image; otherwise, false. [IgnoreDataMember] - public bool HasPrimaryImage - { - get - { - return PrimaryImageTag != null; - } - } + public bool HasPrimaryImage => PrimaryImageTag != null; } } diff --git a/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs b/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs index 9c9b3ef67..b83df87e2 100644 --- a/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs +++ b/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs @@ -38,13 +38,7 @@ namespace MediaBrowser.Model.Entities public string[] CollectionFolders { get; set; } - public bool IsEmpty - { - get - { - return FoldersAddedTo.Length == 0 && FoldersRemovedFrom.Length == 0 && ItemsAdded.Length == 0 && ItemsRemoved.Length == 0 && ItemsUpdated.Length == 0 && CollectionFolders.Length == 0; - } - } + public bool IsEmpty => FoldersAddedTo.Length == 0 && FoldersRemovedFrom.Length == 0 && ItemsAdded.Length == 0 && ItemsRemoved.Length == 0 && ItemsUpdated.Length == 0 && CollectionFolders.Length == 0; /// /// Initializes a new instance of the class. diff --git a/MediaBrowser.Model/Services/QueryParamCollection.cs b/MediaBrowser.Model/Services/QueryParamCollection.cs index 05ba6f18d..4297b97c6 100644 --- a/MediaBrowser.Model/Services/QueryParamCollection.cs +++ b/MediaBrowser.Model/Services/QueryParamCollection.cs @@ -177,40 +177,8 @@ namespace MediaBrowser.Model.Services /// The query parameter value or array of values public string this[string name] { - get { return Get(name); } - set - { - Set(name, value); - //var parameters = this.Where(p => p.Name == name).ToArray(); - //var values = new[] { value }; - - //for (int i = 0; ; i++) - //{ - // if (i < parameters.Length && i < values.Length) - // { - // if (values[i] == null) - // Remove(parameters[i]); - // else if (values[i] is NameValuePair) - // this[IndexOf(parameters[i])] = (NameValuePair)values[i]; - // else - // parameters[i].Value = values[i]; - // } - // else if (i < parameters.Length) - // Remove(parameters[i]); - // else if (i < values.Length) - // { - // if (values[i] != null) - // { - // if (values[i] is NameValuePair) - // Add((NameValuePair)values[i]); - // else - // Add(name, values[i]); - // } - // } - // else - // break; - //} - } + get => Get(name); + set => Set(name, value); } private string GetQueryStringValue(NameValuePair pair) diff --git a/MediaBrowser.Model/Updates/CheckForUpdateResult.cs b/MediaBrowser.Model/Updates/CheckForUpdateResult.cs index 79558b0cf..ed6ed22a0 100644 --- a/MediaBrowser.Model/Updates/CheckForUpdateResult.cs +++ b/MediaBrowser.Model/Updates/CheckForUpdateResult.cs @@ -18,7 +18,7 @@ namespace MediaBrowser.Model.Updates /// The available version. public string AvailableVersion { - get { return Package != null ? Package.versionStr : "0.0.0.1"; } + get => Package != null ? Package.versionStr : "0.0.0.1"; set { } // need this for the serializer } diff --git a/MediaBrowser.Model/Updates/PackageVersionInfo.cs b/MediaBrowser.Model/Updates/PackageVersionInfo.cs index 570fb3e02..be531770d 100644 --- a/MediaBrowser.Model/Updates/PackageVersionInfo.cs +++ b/MediaBrowser.Model/Updates/PackageVersionInfo.cs @@ -36,10 +36,7 @@ namespace MediaBrowser.Model.Updates /// /// The version. [IgnoreDataMember] - public Version version - { - get { return _version ?? (_version = new Version(ValueOrDefault(versionStr, "0.0.0.1"))); } - } + public Version version => _version ?? (_version = new Version(ValueOrDefault(versionStr, "0.0.0.1"))); /// /// Values the or default. diff --git a/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs b/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs index 99fbddf09..693edb143 100644 --- a/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs +++ b/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs @@ -52,36 +52,12 @@ namespace MediaBrowser.Providers.BoxSets { } - protected override bool EnableUpdatingGenresFromChildren - { - get - { - return true; - } - } + protected override bool EnableUpdatingGenresFromChildren => true; - protected override bool EnableUpdatingOfficialRatingFromChildren - { - get - { - return true; - } - } + protected override bool EnableUpdatingOfficialRatingFromChildren => true; - protected override bool EnableUpdatingStudiosFromChildren - { - get - { - return true; - } - } + protected override bool EnableUpdatingStudiosFromChildren => true; - protected override bool EnableUpdatingPremiereDateFromChildren - { - get - { - return true; - } - } + protected override bool EnableUpdatingPremiereDateFromChildren => true; } } diff --git a/MediaBrowser.Providers/BoxSets/MovieDbBoxSetImageProvider.cs b/MediaBrowser.Providers/BoxSets/MovieDbBoxSetImageProvider.cs index 6619ea980..c6c1a2a94 100644 --- a/MediaBrowser.Providers/BoxSets/MovieDbBoxSetImageProvider.cs +++ b/MediaBrowser.Providers/BoxSets/MovieDbBoxSetImageProvider.cs @@ -23,15 +23,9 @@ namespace MediaBrowser.Providers.BoxSets _httpClient = httpClient; } - public string Name - { - get { return ProviderName; } - } + public string Name => ProviderName; - public static string ProviderName - { - get { return "TheMovieDb"; } - } + public static string ProviderName => "TheMovieDb"; public bool Supports(BaseItem item) { @@ -150,10 +144,7 @@ namespace MediaBrowser.Providers.BoxSets .ThenByDescending(i => i.vote_count); } - public int Order - { - get { return 0; } - } + public int Order => 0; public Task GetImageResponse(string url, CancellationToken cancellationToken) { diff --git a/MediaBrowser.Providers/BoxSets/MovieDbBoxSetProvider.cs b/MediaBrowser.Providers/BoxSets/MovieDbBoxSetProvider.cs index a832606a9..e06d93520 100644 --- a/MediaBrowser.Providers/BoxSets/MovieDbBoxSetProvider.cs +++ b/MediaBrowser.Providers/BoxSets/MovieDbBoxSetProvider.cs @@ -241,10 +241,7 @@ namespace MediaBrowser.Providers.BoxSets return DownloadInfo(tmdbId, preferredMetadataLanguage, cancellationToken); } - public string Name - { - get { return "TheMovieDb"; } - } + public string Name => "TheMovieDb"; private static string GetDataFilePath(IApplicationPaths appPaths, string tmdbId, string preferredLanguage) { diff --git a/MediaBrowser.Providers/Folders/FolderMetadataService.cs b/MediaBrowser.Providers/Folders/FolderMetadataService.cs index 39f6e04a5..c839befff 100644 --- a/MediaBrowser.Providers/Folders/FolderMetadataService.cs +++ b/MediaBrowser.Providers/Folders/FolderMetadataService.cs @@ -11,14 +11,7 @@ namespace MediaBrowser.Providers.Folders { public class FolderMetadataService : MetadataService { - public override int Order - { - get - { - // Make sure the type-specific services get picked first - return 10; - } - } + public override int Order => 10; protected override void MergeData(MetadataResult source, MetadataResult target, MetadataFields[] lockedFields, bool replaceData, bool mergeMetadataSettings) { diff --git a/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs b/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs index 7d921d864..2b73fdcd3 100644 --- a/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs +++ b/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs @@ -41,25 +41,13 @@ namespace Priority_Queue /// Returns the number of nodes in the queue. /// O(1) /// - public int Count - { - get - { - return _numNodes; - } - } + public int Count => _numNodes; /// /// Returns the maximum number of items that can be enqueued at once in this queue. Once you hit this number (ie. once Count == MaxSize), /// attempting to enqueue another item will cause undefined behavior. O(1) /// - public int MaxSize - { - get - { - return _nodes.Length - 1; - } - } + public int MaxSize => _nodes.Length - 1; /// /// Removes every node from the queue. diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index 7a713b4e5..3322582cc 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -441,34 +441,13 @@ namespace MediaBrowser.Providers.Manager return updateType; } - protected virtual bool EnableUpdatingPremiereDateFromChildren - { - get - { - return false; - } - } - protected virtual bool EnableUpdatingGenresFromChildren - { - get - { - return false; - } - } - protected virtual bool EnableUpdatingStudiosFromChildren - { - get - { - return false; - } - } - protected virtual bool EnableUpdatingOfficialRatingFromChildren - { - get - { - return false; - } - } + protected virtual bool EnableUpdatingPremiereDateFromChildren => false; + + protected virtual bool EnableUpdatingGenresFromChildren => false; + + protected virtual bool EnableUpdatingStudiosFromChildren => false; + + protected virtual bool EnableUpdatingOfficialRatingFromChildren => false; private ItemUpdateType UpdatePremiereDate(TItemType item, IList children) { @@ -926,13 +905,7 @@ namespace MediaBrowser.Providers.Manager bool replaceData, bool mergeMetadataSettings); - public virtual int Order - { - get - { - return 0; - } - } + public virtual int Order => 0; private bool HasChanged(BaseItem item, IHasItemChangeMonitor changeMonitor, IDirectoryService directoryService) { diff --git a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs index ffbb2d7c1..0b902ccec 100644 --- a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs @@ -119,18 +119,9 @@ namespace MediaBrowser.Providers.MediaInfo return Path.Combine(AudioImagesPath, prefix, filename); } - public string AudioImagesPath - { - get - { - return Path.Combine(_config.ApplicationPaths.CachePath, "extracted-audio-images"); - } - } + public string AudioImagesPath => Path.Combine(_config.ApplicationPaths.CachePath, "extracted-audio-images"); - public string Name - { - get { return "Image Extractor"; } - } + public string Name => "Image Extractor"; public bool Supports(BaseItem item) { diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs index 31be4d6d3..70bf862fb 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeProvider.cs @@ -53,10 +53,7 @@ namespace MediaBrowser.Providers.MediaInfo private readonly IChannelManager _channelManager; private readonly IMediaSourceManager _mediaSourceManager; - public string Name - { - get { return "ffprobe"; } - } + public string Name => "ffprobe"; public bool HasChanged(BaseItem item, IDirectoryService directoryService) { @@ -227,13 +224,6 @@ namespace MediaBrowser.Providers.MediaInfo return prober.Probe(item, options, cancellationToken); } - public int Order - { - get - { - // Run last - return 100; - } - } + public int Order => 100; } } diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs b/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs index c5a47836f..b7598ef22 100644 --- a/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs +++ b/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs @@ -36,20 +36,11 @@ namespace MediaBrowser.Providers.MediaInfo _json = json; } - public string Name - { - get { return "Download missing subtitles"; } - } + public string Name => "Download missing subtitles"; - public string Description - { - get { return "Searches the internet for missing subtitles based on metadata configuration."; } - } + public string Description => "Searches the internet for missing subtitles based on metadata configuration."; - public string Category - { - get { return "Library"; } - } + public string Category => "Library"; private SubtitleOptions GetOptions() { @@ -213,9 +204,6 @@ namespace MediaBrowser.Providers.MediaInfo }; } - public string Key - { - get { return "DownloadSubtitles"; } - } + public string Key => "DownloadSubtitles"; } } diff --git a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs index e0b6d97ce..6aaad41f7 100644 --- a/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/VideoImageProvider.cs @@ -120,10 +120,7 @@ namespace MediaBrowser.Providers.MediaInfo }; } - public string Name - { - get { return "Screen Grabber"; } - } + public string Name => "Screen Grabber"; public bool Supports(BaseItem item) { @@ -146,13 +143,6 @@ namespace MediaBrowser.Providers.MediaInfo return false; } - public int Order - { - get - { - // Make sure this comes after internet image providers - return 100; - } - } + public int Order => 100; } } diff --git a/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs b/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs index d495ffed1..79e61f6a7 100644 --- a/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs +++ b/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs @@ -45,15 +45,9 @@ namespace MediaBrowser.Providers.Movies Current = this; } - public string Name - { - get { return ProviderName; } - } + public string Name => ProviderName; - public static string ProviderName - { - get { return "FanArt"; } - } + public static string ProviderName => "FanArt"; public bool Supports(BaseItem item) { @@ -199,10 +193,7 @@ namespace MediaBrowser.Providers.Movies }).Where(i => i != null)); } - public int Order - { - get { return 1; } - } + public int Order => 1; public Task GetImageResponse(string url, CancellationToken cancellationToken) { diff --git a/MediaBrowser.Providers/Movies/MovieDbImageProvider.cs b/MediaBrowser.Providers/Movies/MovieDbImageProvider.cs index 0c7c5cecf..b9c5d7ce5 100644 --- a/MediaBrowser.Providers/Movies/MovieDbImageProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbImageProvider.cs @@ -29,15 +29,9 @@ namespace MediaBrowser.Providers.Movies _fileSystem = fileSystem; } - public string Name - { - get { return ProviderName; } - } + public string Name => ProviderName; - public static string ProviderName - { - get { return "TheMovieDb"; } - } + public static string ProviderName => "TheMovieDb"; public bool Supports(BaseItem item) { @@ -199,10 +193,7 @@ namespace MediaBrowser.Providers.Movies return null; } - public int Order - { - get { return 0; } - } + public int Order => 0; public Task GetImageResponse(string url, CancellationToken cancellationToken) { diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs index d85d77701..ef5c781dc 100644 --- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs @@ -122,10 +122,7 @@ namespace MediaBrowser.Providers.Movies return movieDb.GetMetadata(id, cancellationToken); } - public string Name - { - get { return "TheMovieDb"; } - } + public string Name => "TheMovieDb"; /// /// The _TMDB settings task @@ -633,13 +630,7 @@ namespace MediaBrowser.Providers.Movies } } - public int Order - { - get - { - return 1; - } - } + public int Order => 1; public Task GetImageResponse(string url, CancellationToken cancellationToken) { diff --git a/MediaBrowser.Providers/Movies/MovieDbTrailerProvider.cs b/MediaBrowser.Providers/Movies/MovieDbTrailerProvider.cs index 485e6a2f9..2a3cdf097 100644 --- a/MediaBrowser.Providers/Movies/MovieDbTrailerProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbTrailerProvider.cs @@ -27,18 +27,9 @@ namespace MediaBrowser.Providers.Movies return MovieDbProvider.Current.GetItemMetadata(info, cancellationToken); } - public string Name - { - get { return MovieDbProvider.Current.Name; } - } + public string Name => MovieDbProvider.Current.Name; - public int Order - { - get - { - return 0; - } - } + public int Order => 0; public Task GetImageResponse(string url, CancellationToken cancellationToken) { diff --git a/MediaBrowser.Providers/Movies/MovieExternalIds.cs b/MediaBrowser.Providers/Movies/MovieExternalIds.cs index 63bcd9e2d..3783c5032 100644 --- a/MediaBrowser.Providers/Movies/MovieExternalIds.cs +++ b/MediaBrowser.Providers/Movies/MovieExternalIds.cs @@ -11,20 +11,11 @@ namespace MediaBrowser.Providers.Movies { public const string BaseMovieDbUrl = "https://www.themoviedb.org/"; - public string Name - { - get { return "TheMovieDb"; } - } + public string Name => "TheMovieDb"; - public string Key - { - get { return MetadataProviders.Tmdb.ToString(); } - } + public string Key => MetadataProviders.Tmdb.ToString(); - public string UrlFormatString - { - get { return BaseMovieDbUrl + "movie/{0}"; } - } + public string UrlFormatString => BaseMovieDbUrl + "movie/{0}"; public bool Supports(IHasProviderIds item) { @@ -41,20 +32,11 @@ namespace MediaBrowser.Providers.Movies public class MovieDbSeriesExternalId : IExternalId { - public string Name - { - get { return "TheMovieDb"; } - } + public string Name => "TheMovieDb"; - public string Key - { - get { return MetadataProviders.Tmdb.ToString(); } - } + public string Key => MetadataProviders.Tmdb.ToString(); - public string UrlFormatString - { - get { return MovieDbMovieExternalId.BaseMovieDbUrl + "tv/{0}"; } - } + public string UrlFormatString => MovieDbMovieExternalId.BaseMovieDbUrl + "tv/{0}"; public bool Supports(IHasProviderIds item) { @@ -64,20 +46,11 @@ namespace MediaBrowser.Providers.Movies public class MovieDbMovieCollectionExternalId : IExternalId { - public string Name - { - get { return "TheMovieDb Collection"; } - } + public string Name => "TheMovieDb Collection"; - public string Key - { - get { return MetadataProviders.TmdbCollection.ToString(); } - } + public string Key => MetadataProviders.TmdbCollection.ToString(); - public string UrlFormatString - { - get { return MovieDbMovieExternalId.BaseMovieDbUrl + "collection/{0}"; } - } + public string UrlFormatString => MovieDbMovieExternalId.BaseMovieDbUrl + "collection/{0}"; public bool Supports(IHasProviderIds item) { @@ -87,20 +60,11 @@ namespace MediaBrowser.Providers.Movies public class MovieDbPersonExternalId : IExternalId { - public string Name - { - get { return "TheMovieDb"; } - } + public string Name => "TheMovieDb"; - public string Key - { - get { return MetadataProviders.Tmdb.ToString(); } - } + public string Key => MetadataProviders.Tmdb.ToString(); - public string UrlFormatString - { - get { return MovieDbMovieExternalId.BaseMovieDbUrl + "person/{0}"; } - } + public string UrlFormatString => MovieDbMovieExternalId.BaseMovieDbUrl + "person/{0}"; public bool Supports(IHasProviderIds item) { @@ -110,20 +74,11 @@ namespace MediaBrowser.Providers.Movies public class MovieDbCollectionExternalId : IExternalId { - public string Name - { - get { return "TheMovieDb"; } - } + public string Name => "TheMovieDb"; - public string Key - { - get { return MetadataProviders.Tmdb.ToString(); } - } + public string Key => MetadataProviders.Tmdb.ToString(); - public string UrlFormatString - { - get { return MovieDbMovieExternalId.BaseMovieDbUrl + "collection/{0}"; } - } + public string UrlFormatString => MovieDbMovieExternalId.BaseMovieDbUrl + "collection/{0}"; public bool Supports(IHasProviderIds item) { @@ -133,20 +88,11 @@ namespace MediaBrowser.Providers.Movies public class ImdbExternalId : IExternalId { - public string Name - { - get { return "IMDb"; } - } + public string Name => "IMDb"; - public string Key - { - get { return MetadataProviders.Imdb.ToString(); } - } + public string Key => MetadataProviders.Imdb.ToString(); - public string UrlFormatString - { - get { return "https://www.imdb.com/title/{0}"; } - } + public string UrlFormatString => "https://www.imdb.com/title/{0}"; public bool Supports(IHasProviderIds item) { @@ -164,20 +110,11 @@ namespace MediaBrowser.Providers.Movies public class ImdbPersonExternalId : IExternalId { - public string Name - { - get { return "IMDb"; } - } + public string Name => "IMDb"; - public string Key - { - get { return MetadataProviders.Imdb.ToString(); } - } + public string Key => MetadataProviders.Imdb.ToString(); - public string UrlFormatString - { - get { return "https://www.imdb.com/name/{0}"; } - } + public string UrlFormatString => "https://www.imdb.com/name/{0}"; public bool Supports(IHasProviderIds item) { diff --git a/MediaBrowser.Providers/Music/AlbumMetadataService.cs b/MediaBrowser.Providers/Music/AlbumMetadataService.cs index d4ade5686..33a6c2fa3 100644 --- a/MediaBrowser.Providers/Music/AlbumMetadataService.cs +++ b/MediaBrowser.Providers/Music/AlbumMetadataService.cs @@ -50,29 +50,11 @@ namespace MediaBrowser.Providers.Music return updateType; } - protected override bool EnableUpdatingPremiereDateFromChildren - { - get - { - return true; - } - } + protected override bool EnableUpdatingPremiereDateFromChildren => true; - protected override bool EnableUpdatingGenresFromChildren - { - get - { - return true; - } - } + protected override bool EnableUpdatingGenresFromChildren => true; - protected override bool EnableUpdatingStudiosFromChildren - { - get - { - return true; - } - } + protected override bool EnableUpdatingStudiosFromChildren => true; private ItemUpdateType SetAlbumArtistFromSongs(MusicAlbum item, IEnumerable /// The user id. /// Task{DisplayPreferences}. - /// item + /// item public IEnumerable GetAllDisplayPreferences(Guid userId) { var list = new List(); diff --git a/Emby.Server.Implementations/Data/SqliteExtensions.cs b/Emby.Server.Implementations/Data/SqliteExtensions.cs index 5ff61d37c..edb73d2a1 100644 --- a/Emby.Server.Implementations/Data/SqliteExtensions.cs +++ b/Emby.Server.Implementations/Data/SqliteExtensions.cs @@ -128,7 +128,7 @@ namespace Emby.Server.Implementations.Data /// Serializes to bytes. /// /// System.Byte[][]. - /// obj + /// obj public static byte[] SerializeToBytes(this IJsonSerializer json, object obj) { if (obj == null) diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 325bad501..7e7271371 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -531,7 +531,7 @@ namespace Emby.Server.Implementations.Data /// /// The item. /// The cancellation token. - /// item + /// item public void SaveItem(BaseItem item, CancellationToken cancellationToken) { if (item == null) @@ -574,7 +574,7 @@ namespace Emby.Server.Implementations.Data /// /// The items. /// The cancellation token. - /// + /// /// items /// or /// cancellationToken @@ -1198,8 +1198,8 @@ namespace Emby.Server.Implementations.Data /// /// The id. /// BaseItem. - /// id - /// + /// id + /// public BaseItem RetrieveItem(Guid id) { if (id.Equals(Guid.Empty)) @@ -1945,7 +1945,7 @@ namespace Emby.Server.Implementations.Data /// /// The item. /// IEnumerable{ChapterInfo}. - /// id + /// id public List GetChapters(BaseItem item) { CheckDisposed(); @@ -1977,7 +1977,7 @@ namespace Emby.Server.Implementations.Data /// The item. /// The index. /// ChapterInfo. - /// id + /// id public ChapterInfo GetChapter(BaseItem item, int index) { CheckDisposed(); diff --git a/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs b/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs index 469927f63..48ff9ded8 100644 --- a/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs @@ -110,7 +110,7 @@ namespace Emby.Server.Implementations.Data private List GetAllUserIdsWithUserData(IDatabaseConnection db) { - List list = new List(); + var list = new List(); using (var statement = PrepareStatement(db, "select DISTINCT UserId from UserData where UserId not null")) { @@ -271,7 +271,7 @@ namespace Emby.Server.Implementations.Data /// The user id. /// The key. /// Task{UserItemData}. - /// + /// /// userId /// or /// key diff --git a/Emby.Server.Implementations/Data/SqliteUserRepository.cs b/Emby.Server.Implementations/Data/SqliteUserRepository.cs index bf00f2e65..ad37a0275 100644 --- a/Emby.Server.Implementations/Data/SqliteUserRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteUserRepository.cs @@ -200,7 +200,7 @@ namespace Emby.Server.Implementations.Data /// /// The user. /// Task. - /// user + /// user public void DeleteUser(User user) { if (user == null) diff --git a/Emby.Server.Implementations/Data/TypeMapper.cs b/Emby.Server.Implementations/Data/TypeMapper.cs index fa6a29aa3..37c952e88 100644 --- a/Emby.Server.Implementations/Data/TypeMapper.cs +++ b/Emby.Server.Implementations/Data/TypeMapper.cs @@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.Data /// /// Name of the type. /// Type. - /// + /// public Type GetType(string typeName) { if (string.IsNullOrEmpty(typeName)) diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs index 68bff962f..8877fc051 100644 --- a/Emby.Server.Implementations/Dto/DtoService.cs +++ b/Emby.Server.Implementations/Dto/DtoService.cs @@ -71,7 +71,7 @@ namespace Emby.Server.Implementations.Dto /// The user. /// The owner. /// Task{DtoBaseItem}. - /// item + /// item public BaseItemDto GetBaseItemDto(BaseItem item, ItemFields[] fields, User user = null, BaseItem owner = null) { var options = new DtoOptions @@ -463,7 +463,7 @@ namespace Emby.Server.Implementations.Dto /// /// The item. /// System.String. - /// item + /// item public string GetDtoId(BaseItem item) { return item.Id.ToString("N"); diff --git a/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs b/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs index c7bd03960..e37ea96a1 100644 --- a/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs +++ b/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs @@ -58,7 +58,7 @@ namespace Emby.Server.Implementations.EntryPoints try { - await _sessionManager.SendMessageToUserSessions(users, name, info, CancellationToken.None); + await _sessionManager.SendMessageToUserSessions(users, name, info, CancellationToken.None); } catch (ObjectDisposedException) { diff --git a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs index 72828f0d4..255e1476f 100644 --- a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs +++ b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs @@ -82,7 +82,7 @@ namespace Emby.Server.Implementations.HttpClientManager /// The host. /// if set to true [enable HTTP compression]. /// HttpClient. - /// host + /// host private HttpClientInfo GetHttpClient(string host, bool enableHttpCompression) { if (string.IsNullOrEmpty(host)) @@ -125,7 +125,7 @@ namespace Emby.Server.Implementations.HttpClientManager { string url = options.Url; - Uri uriAddress = new Uri(url); + var uriAddress = new Uri(url); string userInfo = uriAddress.UserInfo; if (!string.IsNullOrWhiteSpace(userInfo)) { @@ -133,7 +133,7 @@ namespace Emby.Server.Implementations.HttpClientManager url = url.Replace(userInfo + "@", string.Empty); } - WebRequest request = CreateWebRequest(url); + var request = CreateWebRequest(url); if (request is HttpWebRequest httpWebRequest) { @@ -188,7 +188,7 @@ namespace Emby.Server.Implementations.HttpClientManager private static CredentialCache GetCredential(string url, string username, string password) { //ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3; - CredentialCache credentialCache = new CredentialCache(); + var credentialCache = new CredentialCache(); credentialCache.Add(new Uri(url), "Basic", new NetworkCredential(username, password)); return credentialCache; } @@ -807,7 +807,7 @@ namespace Emby.Server.Implementations.HttpClientManager { var taskCompletion = new TaskCompletionSource(); - Task asyncTask = Task.Factory.FromAsync(request.BeginGetResponse, request.EndGetResponse, null); + var asyncTask = Task.Factory.FromAsync(request.BeginGetResponse, request.EndGetResponse, null); ThreadPool.RegisterWaitForSingleObject((asyncTask as IAsyncResult).AsyncWaitHandle, TimeoutCallback, request, timeout, true); var callback = new TaskCallback { taskCompletion = taskCompletion }; @@ -823,7 +823,7 @@ namespace Emby.Server.Implementations.HttpClientManager { if (timedOut && state != null) { - WebRequest request = (WebRequest)state; + var request = (WebRequest)state; request.Abort(); } } diff --git a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs index 1ad92a83f..b9146d007 100644 --- a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs +++ b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs @@ -77,7 +77,7 @@ namespace Emby.Server.Implementations.HttpServer /// The remote end point. /// The json serializer. /// The logger. - /// socket + /// socket public WebSocketConnection(IWebSocket socket, string remoteEndPoint, IJsonSerializer jsonSerializer, ILogger logger, ITextEncoding textEncoding) { if (socket == null) @@ -215,7 +215,7 @@ namespace Emby.Server.Implementations.HttpServer /// The message. /// The cancellation token. /// Task. - /// message + /// message public Task SendAsync(WebSocketMessage message, CancellationToken cancellationToken) { if (message == null) diff --git a/Emby.Server.Implementations/IO/IsoManager.cs b/Emby.Server.Implementations/IO/IsoManager.cs index e82335d65..f0a15097c 100644 --- a/Emby.Server.Implementations/IO/IsoManager.cs +++ b/Emby.Server.Implementations/IO/IsoManager.cs @@ -23,8 +23,8 @@ namespace Emby.Server.Implementations.IO /// The iso path. /// The cancellation token. /// IsoMount. - /// isoPath - /// + /// isoPath + /// public Task Mount(string isoPath, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(isoPath)) diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.cs index 39ed1afa7..2c92e6543 100644 --- a/Emby.Server.Implementations/IO/LibraryMonitor.cs +++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs @@ -263,7 +263,7 @@ namespace Emby.Server.Implementations.IO /// The LST. /// The path. /// true if [contains parent folder] [the specified LST]; otherwise, false. - /// path + /// path private static bool ContainsParentFolder(IEnumerable lst, string path) { if (string.IsNullOrEmpty(path)) diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs index 7574eb0e9..ae1470190 100644 --- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs @@ -101,7 +101,7 @@ namespace Emby.Server.Implementations.IO /// /// The filename. /// true if the specified filename is shortcut; otherwise, false. - /// filename + /// filename public virtual bool IsShortcut(string filename) { if (string.IsNullOrEmpty(filename)) @@ -118,7 +118,7 @@ namespace Emby.Server.Implementations.IO /// /// The filename. /// System.String. - /// filename + /// filename public virtual string ResolveShortcut(string filename) { if (string.IsNullOrEmpty(filename)) @@ -185,7 +185,7 @@ namespace Emby.Server.Implementations.IO /// /// The shortcut path. /// The target. - /// + /// /// shortcutPath /// or /// target @@ -344,7 +344,7 @@ namespace Emby.Server.Implementations.IO /// /// The filename. /// System.String. - /// filename + /// filename public string GetValidFilename(string filename) { var builder = new StringBuilder(filename); @@ -526,7 +526,7 @@ namespace Emby.Server.Implementations.IO } else { - FileAttributes attributes = File.GetAttributes(path); + var attributes = File.GetAttributes(path); attributes = RemoveAttribute(attributes, FileAttributes.Hidden); File.SetAttributes(path, attributes); } @@ -550,7 +550,7 @@ namespace Emby.Server.Implementations.IO } else { - FileAttributes attributes = File.GetAttributes(path); + var attributes = File.GetAttributes(path); attributes = RemoveAttribute(attributes, FileAttributes.ReadOnly); File.SetAttributes(path, attributes); } diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 9c2759f13..0d25cbc92 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -711,7 +711,7 @@ namespace Emby.Server.Implementations.Library /// Creates the root media folder /// /// AggregateFolder. - /// Cannot create the root folder until plugins have loaded + /// Cannot create the root folder until plugins have loaded public AggregateFolder CreateRootFolder() { var rootFolderPath = ConfigurationManager.ApplicationPaths.RootFolderPath; @@ -905,7 +905,7 @@ namespace Emby.Server.Implementations.Library /// /// The value. /// Task{Year}. - /// + /// public Year GetYear(int value) { if (value <= 0) @@ -1233,7 +1233,7 @@ namespace Emby.Server.Implementations.Library /// /// The id. /// BaseItem. - /// id + /// id public BaseItem GetItemById(Guid id) { if (id.Equals(Guid.Empty)) @@ -2075,7 +2075,7 @@ namespace Emby.Server.Implementations.Library public string GetConfiguredContentType(BaseItem item, bool inheritConfiguredPath) { - ICollectionFolder collectionFolder = item as ICollectionFolder; + var collectionFolder = item as ICollectionFolder; if (collectionFolder != null) { return collectionFolder.CollectionType; @@ -2417,11 +2417,11 @@ namespace Emby.Server.Implementations.Library var episodeInfo = episode.IsFileProtocol ? resolver.Resolve(episode.Path, isFolder, null, null, isAbsoluteNaming) : - new Emby.Naming.TV.EpisodeInfo(); + new Naming.TV.EpisodeInfo(); if (episodeInfo == null) { - episodeInfo = new Emby.Naming.TV.EpisodeInfo(); + episodeInfo = new Naming.TV.EpisodeInfo(); } var changed = false; diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.cs index dcda95742..fb0f33a2f 100644 --- a/Emby.Server.Implementations/Library/MediaSourceManager.cs +++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs @@ -127,7 +127,7 @@ namespace Emby.Server.Implementations.Library if (allowMediaProbe && mediaSources[0].Type != MediaSourceType.Placeholder && !mediaSources[0].MediaStreams.Any(i => i.Type == MediaStreamType.Audio || i.Type == MediaStreamType.Video)) { - await item.RefreshMetadata(new MediaBrowser.Controller.Providers.MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem)) + await item.RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem)) { EnableRemoteContentProbe = true, MetadataRefreshMode = MediaBrowser.Controller.Providers.MetadataRefreshMode.FullRefresh diff --git a/Emby.Server.Implementations/Library/PathExtensions.cs b/Emby.Server.Implementations/Library/PathExtensions.cs index 6a3adda5a..d3a81f622 100644 --- a/Emby.Server.Implementations/Library/PathExtensions.cs +++ b/Emby.Server.Implementations/Library/PathExtensions.cs @@ -11,7 +11,7 @@ namespace Emby.Server.Implementations.Library /// The STR. /// The attrib. /// System.String. - /// attrib + /// attrib public static string GetAttributeValue(this string str, string attrib) { if (string.IsNullOrEmpty(str)) diff --git a/Emby.Server.Implementations/Library/ResolverHelper.cs b/Emby.Server.Implementations/Library/ResolverHelper.cs index 7484fc743..96d1bff92 100644 --- a/Emby.Server.Implementations/Library/ResolverHelper.cs +++ b/Emby.Server.Implementations/Library/ResolverHelper.cs @@ -21,7 +21,7 @@ namespace Emby.Server.Implementations.Library /// The file system. /// The library manager. /// The directory service. - /// Item must have a path + /// Item must have a path public static void SetInitialItemValues(BaseItem item, Folder parent, IFileSystem fileSystem, ILibraryManager libraryManager, IDirectoryService directoryService) { // This version of the below method has no ItemResolveArgs, so we have to require the path already being set diff --git a/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs b/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs index bd5132c4b..d992f8d03 100644 --- a/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs +++ b/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs @@ -49,7 +49,7 @@ namespace Emby.Server.Implementations.Library.Resolvers var namingOptions = ((LibraryManager)LibraryManager).GetNamingOptions(); // If the path is a file check for a matching extensions - var parser = new Emby.Naming.Video.VideoResolver(namingOptions); + var parser = new VideoResolver(namingOptions); if (args.IsDirectory) { diff --git a/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs b/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs index a806c842f..ce1386e91 100644 --- a/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs +++ b/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs @@ -63,7 +63,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV if (!season.IndexNumber.HasValue || !seasonParserResult.IsSeasonFolder) { - var resolver = new Emby.Naming.TV.EpisodeResolver(namingOptions); + var resolver = new Naming.TV.EpisodeResolver(namingOptions); var folderName = System.IO.Path.GetFileName(path); var testPath = "\\\\test\\" + folderName; diff --git a/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs b/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs index 3bd5b78a5..16b5a2d3a 100644 --- a/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs +++ b/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs @@ -151,7 +151,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV var namingOptions = ((LibraryManager)libraryManager).GetNamingOptions(); - var episodeResolver = new Emby.Naming.TV.EpisodeResolver(namingOptions); + var episodeResolver = new Naming.TV.EpisodeResolver(namingOptions); bool? isNamed = null; bool? isOptimistic = null; @@ -179,7 +179,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV /// /// The path. /// true if [is place holder] [the specified path]; otherwise, false. - /// path + /// path private static bool IsVideoPlaceHolder(string path) { if (string.IsNullOrEmpty(path)) diff --git a/Emby.Server.Implementations/Library/SearchEngine.cs b/Emby.Server.Implementations/Library/SearchEngine.cs index 06f76311c..71638b197 100644 --- a/Emby.Server.Implementations/Library/SearchEngine.cs +++ b/Emby.Server.Implementations/Library/SearchEngine.cs @@ -76,7 +76,7 @@ namespace Emby.Server.Implementations.Library /// The query. /// The user. /// IEnumerable{SearchHintResult}. - /// searchTerm + /// searchTerm private List GetSearchHints(SearchQuery query, User user) { var searchTerm = query.SearchTerm; diff --git a/Emby.Server.Implementations/Library/UserDataManager.cs b/Emby.Server.Implementations/Library/UserDataManager.cs index f2921e354..dfa1edaff 100644 --- a/Emby.Server.Implementations/Library/UserDataManager.cs +++ b/Emby.Server.Implementations/Library/UserDataManager.cs @@ -193,7 +193,7 @@ namespace Emby.Server.Implementations.Library /// /// The data. /// DtoUserItemData. - /// + /// private UserItemDataDto GetUserItemDataDto(UserItemData data) { if (data == null) diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs index e4c9f775e..f06c71386 100644 --- a/Emby.Server.Implementations/Library/UserManager.cs +++ b/Emby.Server.Implementations/Library/UserManager.cs @@ -158,7 +158,7 @@ namespace Emby.Server.Implementations.Library /// /// The id. /// User. - /// + /// public User GetUserById(Guid id) { if (id.Equals(Guid.Empty)) @@ -619,8 +619,8 @@ namespace Emby.Server.Implementations.Library /// The user. /// The new name. /// Task. - /// user - /// + /// user + /// public async Task RenameUser(User user, string newName) { if (user == null) @@ -652,8 +652,8 @@ namespace Emby.Server.Implementations.Library /// Updates the user. /// /// The user. - /// user - /// + /// user + /// public void UpdateUser(User user) { if (user == null) @@ -683,8 +683,8 @@ namespace Emby.Server.Implementations.Library /// /// The name. /// User. - /// name - /// + /// name + /// public async Task CreateUser(string name) { if (string.IsNullOrWhiteSpace(name)) @@ -731,8 +731,8 @@ namespace Emby.Server.Implementations.Library /// /// The user. /// Task. - /// user - /// + /// user + /// public async Task DeleteUser(User user) { if (user == null) diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 909e6eaee..0ee53281d 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -478,7 +478,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV private static string GetMappedChannel(string channelId, NameValuePair[] mappings) { - foreach (NameValuePair mapping in mappings) + foreach (var mapping in mappings) { if (StringHelper.EqualsIgnoreCase(mapping.Name, channelId)) { @@ -2002,7 +2002,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV CloseOutput = false }; - using (XmlWriter writer = XmlWriter.Create(stream, settings)) + using (var writer = XmlWriter.Create(stream, settings)) { writer.WriteStartDocument(true); writer.WriteStartElement("tvshow"); @@ -2069,7 +2069,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV var isSeriesEpisode = timer.IsProgramSeries; - using (XmlWriter writer = XmlWriter.Create(stream, settings)) + using (var writer = XmlWriter.Create(stream, settings)) { writer.WriteStartDocument(true); diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs index 25ad02e5d..05d92dfcb 100644 --- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs +++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs @@ -42,7 +42,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings private static List GetScheduleRequestDates(DateTime startDateUtc, DateTime endDateUtc) { - List dates = new List(); + var dates = new List(); var start = new List { startDateUtc, startDateUtc.ToLocalTime() }.Min().Date; var end = new List { endDateUtc, endDateUtc.ToLocalTime() }.Max().Date; @@ -104,7 +104,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings httpOptions.RequestHeaders["token"] = token; using (var response = await Post(httpOptions, true, info).ConfigureAwait(false)) - using (StreamReader reader = new StreamReader(response.Content)) + using (var reader = new StreamReader(response.Content)) { var dailySchedules = await _jsonSerializer.DeserializeFromStreamAsync>(response.Content).ConfigureAwait(false); _logger.LogDebug("Found {ScheduleCount} programs on {ChannelID} ScheduleDirect", dailySchedules.Count, channelId); @@ -125,7 +125,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings httpOptions.RequestContent = "[\"" + string.Join("\", \"", programsID) + "\"]"; using (var innerResponse = await Post(httpOptions, true, info).ConfigureAwait(false)) - using (StreamReader innerReader = new StreamReader(innerResponse.Content)) + using (var innerReader = new StreamReader(innerResponse.Content)) { var programDetails = await _jsonSerializer.DeserializeFromStreamAsync>(innerResponse.Content).ConfigureAwait(false); var programDict = programDetails.ToDictionary(p => p.programID, y => y); @@ -136,8 +136,8 @@ namespace Emby.Server.Implementations.LiveTv.Listings var images = await GetImageForPrograms(info, programIdsWithImages, cancellationToken).ConfigureAwait(false); - List programsInfo = new List(); - foreach (ScheduleDirect.Program schedule in dailySchedules.SelectMany(d => d.programs)) + var programsInfo = new List(); + foreach (var schedule in dailySchedules.SelectMany(d => d.programs)) { //_logger.LogDebug("Proccesing Schedule for statio ID " + stationID + // " which corresponds to channel " + channelNumber + " and program id " + @@ -222,9 +222,9 @@ namespace Emby.Server.Implementations.LiveTv.Listings private ProgramInfo GetProgram(string channelId, ScheduleDirect.Program programInfo, ScheduleDirect.ProgramDetails details) { - DateTime startAt = GetDate(programInfo.airDateTime); - DateTime endAt = startAt.AddSeconds(programInfo.duration); - ProgramAudio audioType = ProgramAudio.Stereo; + var startAt = GetDate(programInfo.airDateTime); + var endAt = startAt.AddSeconds(programInfo.duration); + var audioType = ProgramAudio.Stereo; var programId = programInfo.programID ?? string.Empty; @@ -526,15 +526,15 @@ namespace Emby.Server.Implementations.LiveTv.Listings try { using (var httpResponse = await Get(options, false, info).ConfigureAwait(false)) - using (Stream responce = httpResponse.Content) + using (var responce = httpResponse.Content) { var root = await _jsonSerializer.DeserializeFromStreamAsync>(responce).ConfigureAwait(false); if (root != null) { - foreach (ScheduleDirect.Headends headend in root) + foreach (var headend in root) { - foreach (ScheduleDirect.Lineup lineup in headend.lineups) + foreach (var lineup in headend.lineups) { lineups.Add(new NameIdPair { @@ -887,7 +887,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings var allStations = root.stations ?? Enumerable.Empty(); - foreach (ScheduleDirect.Map map in root.map) + foreach (var map in root.map) { var channelNumber = GetChannelNumber(map); diff --git a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs index 2b1ee84a8..0cbfbe0b4 100644 --- a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs +++ b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs @@ -269,7 +269,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings string path = await GetXml(info.Path, CancellationToken.None).ConfigureAwait(false); _logger.LogDebug("Opening XmlTvReader for {path}", path); var reader = new XmlTvReader(path, GetLanguage(info)); - IEnumerable results = reader.GetChannels(); + var results = reader.GetChannels(); // Should this method be async? return results.Select(c => new NameIdPair() { Id = c.Id, Name = c.DisplayName }).ToList(); @@ -281,7 +281,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings string path = await GetXml(info.Path, cancellationToken).ConfigureAwait(false); _logger.LogDebug("Opening XmlTvReader for {path}", path); var reader = new XmlTvReader(path, GetLanguage(info)); - IEnumerable results = reader.GetChannels(); + var results = reader.GetChannels(); // Should this method be async? return results.Select(c => new ChannelInfo diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index 4ad58c7e4..379927191 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -242,7 +242,7 @@ namespace Emby.Server.Implementations.LiveTv var channel = (LiveTvChannel)_libraryManager.GetItemById(id); bool isVideo = channel.ChannelType == ChannelType.TV; - ILiveTvService service = GetService(channel); + var service = GetService(channel); _logger.LogInformation("Opening channel stream from {0}, external channel Id: {1}", service.Name, channel.ExternalId); MediaSourceInfo info; @@ -892,7 +892,7 @@ namespace Emby.Server.Implementations.LiveTv var programList = _libraryManager.QueryItems(internalQuery).Items; var totalCount = programList.Length; - IOrderedEnumerable orderedPrograms = programList.Cast().OrderBy(i => i.StartDate.Date); + var orderedPrograms = programList.Cast().OrderBy(i => i.StartDate.Date); if (query.IsAiring ?? false) { @@ -2302,7 +2302,7 @@ namespace Emby.Server.Implementations.LiveTv // ServerConfiguration.SaveConfiguration crashes during xml serialization for AddListingProvider info = _jsonSerializer.DeserializeFromString(_jsonSerializer.SerializeToString(info)); - IListingsProvider provider = _listingProviders.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase)); + var provider = _listingProviders.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase)); if (provider == null) { @@ -2313,9 +2313,9 @@ namespace Emby.Server.Implementations.LiveTv await provider.Validate(info, validateLogin, validateListings).ConfigureAwait(false); - LiveTvOptions config = GetConfiguration(); + var config = GetConfiguration(); - List list = config.ListingProviders.ToList(); + var list = config.ListingProviders.ToList(); int index = list.FindIndex(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase)); if (index == -1 || string.IsNullOrWhiteSpace(info.Id)) diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs index 3714a0321..36f688c43 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs @@ -262,7 +262,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun var name = string.Format("Tuner {0}", i + 1); var currentChannel = "none"; /// @todo Get current channel and map back to Station Id var isAvailable = await manager.CheckTunerAvailability(ipInfo, i, cancellationToken).ConfigureAwait(false); - LiveTvTunerStatus status = isAvailable ? LiveTvTunerStatus.Available : LiveTvTunerStatus.LiveTv; + var status = isAvailable ? LiveTvTunerStatus.Available : LiveTvTunerStatus.LiveTv; tuners.Add(new LiveTvTunerInfo { Name = name, diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs index 1ec5894d0..67eeec21d 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs @@ -173,7 +173,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun continue; var commandList = commands.GetCommands(); - foreach (Tuple command in commandList) + foreach (var command in commandList) { var channelMsg = CreateSetMessage(i, command.Item1, command.Item2, lockKeyValue); await tcpClient.SendToAsync(channelMsg, 0, channelMsg.Length, ipEndPoint, cancellationToken).ConfigureAwait(false); @@ -216,7 +216,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun var commandList = commands.GetCommands(); var receiveBuffer = new byte[8192]; - foreach (Tuple command in commandList) + foreach (var command in commandList) { var channelMsg = CreateSetMessage(_activeTuner, command.Item1, command.Item2, _lockkey); await tcpClient.SendToAsync(channelMsg, 0, channelMsg.Length, new IpEndPointInfo(_remoteIp, HdHomeRunPort), cancellationToken).ConfigureAwait(false); diff --git a/Emby.Server.Implementations/Net/DisposableManagedObjectBase.cs b/Emby.Server.Implementations/Net/DisposableManagedObjectBase.cs index 9d880b0c9..304b44565 100644 --- a/Emby.Server.Implementations/Net/DisposableManagedObjectBase.cs +++ b/Emby.Server.Implementations/Net/DisposableManagedObjectBase.cs @@ -19,10 +19,10 @@ namespace Emby.Server.Implementations.Net //TODO Remove and reimplement using the IsDisposed property directly. /// - /// Throws an if the property is true. + /// Throws an if the property is true. /// /// - /// Thrown if the property is true. + /// Thrown if the property is true. /// protected virtual void ThrowIfDisposed() { diff --git a/Emby.Server.Implementations/Net/UdpSocket.cs b/Emby.Server.Implementations/Net/UdpSocket.cs index cdfdb7210..d48855486 100644 --- a/Emby.Server.Implementations/Net/UdpSocket.cs +++ b/Emby.Server.Implementations/Net/UdpSocket.cs @@ -133,8 +133,8 @@ namespace Emby.Server.Implementations.Net { ThrowIfDisposed(); - IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0); - EndPoint remoteEndPoint = (EndPoint)sender; + var sender = new IPEndPoint(IPAddress.Any, 0); + var remoteEndPoint = (EndPoint)sender; var receivedBytes = _Socket.EndReceiveFrom(result, ref remoteEndPoint); diff --git a/Emby.Server.Implementations/Networking/IPNetwork/BigIntegerExt.cs b/Emby.Server.Implementations/Networking/IPNetwork/BigIntegerExt.cs index 1a2ad665b..447cbf403 100644 --- a/Emby.Server.Implementations/Networking/IPNetwork/BigIntegerExt.cs +++ b/Emby.Server.Implementations/Networking/IPNetwork/BigIntegerExt.cs @@ -7,7 +7,7 @@ namespace System.Net using System.Text; /// - /// Extension methods to convert + /// Extension methods to convert /// instances to hexadecimal, octal, and binary strings. /// public static class BigIntegerExtensions @@ -17,7 +17,7 @@ namespace System.Net /// /// A . /// - /// A containing a binary + /// A containing a binary /// representation of the supplied . /// public static string ToBinaryString(this BigInteger bigint) @@ -54,7 +54,7 @@ namespace System.Net /// /// A . /// - /// A containing a hexadecimal + /// A containing a hexadecimal /// representation of the supplied . /// public static string ToHexadecimalString(this BigInteger bigint) @@ -67,7 +67,7 @@ namespace System.Net /// /// A . /// - /// A containing an octal + /// A containing an octal /// representation of the supplied . /// public static string ToOctalString(this BigInteger bigint) diff --git a/Emby.Server.Implementations/Networking/IPNetwork/IPAddressCollection.cs b/Emby.Server.Implementations/Networking/IPNetwork/IPAddressCollection.cs index c2a6305f6..c5853135c 100644 --- a/Emby.Server.Implementations/Networking/IPNetwork/IPAddressCollection.cs +++ b/Emby.Server.Implementations/Networking/IPNetwork/IPAddressCollection.cs @@ -30,7 +30,7 @@ namespace System.Net throw new ArgumentOutOfRangeException(nameof(i)); } byte width = this._ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetwork ? (byte)32 : (byte)128; - IPNetworkCollection ipn = this._ipnetwork.Subnet(width); + var ipn = this._ipnetwork.Subnet(width); return ipn[i].Network; } } diff --git a/Emby.Server.Implementations/Networking/IPNetwork/IPNetwork.cs b/Emby.Server.Implementations/Networking/IPNetwork/IPNetwork.cs index 321d4a3c5..21feaea33 100644 --- a/Emby.Server.Implementations/Networking/IPNetwork/IPNetwork.cs +++ b/Emby.Server.Implementations/Networking/IPNetwork/IPNetwork.cs @@ -33,7 +33,7 @@ namespace System.Net { get { - BigInteger uintNetwork = this._ipaddress & this._netmask; + var uintNetwork = this._ipaddress & this._netmask; return uintNetwork; } } @@ -61,7 +61,7 @@ namespace System.Net { int width = this._family == Sockets.AddressFamily.InterNetwork ? 4 : 16; - BigInteger uintBroadcast = this._network + this._netmask.PositiveReverse(width); + var uintBroadcast = this._network + this._netmask.PositiveReverse(width); return uintBroadcast; } } @@ -88,7 +88,7 @@ namespace System.Net { get { - BigInteger fisrt = this._family == Sockets.AddressFamily.InterNetworkV6 + var fisrt = this._family == Sockets.AddressFamily.InterNetworkV6 ? this._network : (this.Usable <= 0) ? this._network : this._network + 1; return IPNetwork.ToIPAddress(fisrt, this._family); @@ -102,7 +102,7 @@ namespace System.Net { get { - BigInteger last = this._family == Sockets.AddressFamily.InterNetworkV6 + var last = this._family == Sockets.AddressFamily.InterNetworkV6 ? this._broadcast : (this.Usable <= 0) ? this._network : this._broadcast - 1; return IPNetwork.ToIPAddress(last, this._family); @@ -122,8 +122,8 @@ namespace System.Net return this.Total; } byte[] mask = new byte[] { 0xff, 0xff, 0xff, 0xff, 0x00 }; - BigInteger bmask = new BigInteger(mask); - BigInteger usableIps = (_cidr > 30) ? 0 : ((bmask >> _cidr) - 1); + var bmask = new BigInteger(mask); + var usableIps = (_cidr > 30) ? 0 : ((bmask >> _cidr) - 1); return usableIps; } } @@ -137,7 +137,7 @@ namespace System.Net { int max = this._family == Sockets.AddressFamily.InterNetwork ? 32 : 128; - BigInteger count = BigInteger.Pow(2, (max - _cidr)); + var count = BigInteger.Pow(2, (max - _cidr)); return count; } } @@ -523,7 +523,7 @@ namespace System.Net return; } - BigInteger uintIpAddress = IPNetwork.ToBigInteger(ipaddress); + var uintIpAddress = IPNetwork.ToBigInteger(ipaddress); byte? cidr2 = null; bool parsed = IPNetwork.TryToCidr(netmask, out cidr2); if (parsed == false) @@ -537,7 +537,7 @@ namespace System.Net } byte cidr = (byte)cidr2; - IPNetwork ipnet = new IPNetwork(uintIpAddress, ipaddress.AddressFamily, cidr); + var ipnet = new IPNetwork(uintIpAddress, ipaddress.AddressFamily, cidr); ipnetwork = ipnet; return; @@ -754,7 +754,7 @@ namespace System.Net return; } - BigInteger mask = new BigInteger(new byte[] { + var mask = new BigInteger(new byte[] { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -762,7 +762,7 @@ namespace System.Net 0x00 }); - BigInteger masked = cidr == 0 ? 0 : mask << (128 - cidr); + var masked = cidr == 0 ? 0 : mask << (128 - cidr); byte[] m = masked.ToByteArray(); byte[] bmask = new byte[17]; int copy = m.Length > 16 ? 16 : m.Length; @@ -858,7 +858,7 @@ namespace System.Net /// cidr = null; /// return; /// } - BigInteger uintNetmask = (BigInteger)uintNetmask2; + var uintNetmask = (BigInteger)uintNetmask2; byte? cidr2 = null; IPNetwork.InternalToCidr(tryParse, uintNetmask, netmask.AddressFamily, out cidr2); @@ -951,8 +951,8 @@ namespace System.Net return; } - BigInteger mask = IPNetwork.ToUint(cidr, family); - IPAddress netmask2 = IPNetwork.ToIPAddress(mask, family); + var mask = IPNetwork.ToUint(cidr, family); + var netmask2 = IPNetwork.ToIPAddress(mask, family); netmask = netmask2; return; @@ -990,7 +990,7 @@ namespace System.Net /// public static uint BitsSet(IPAddress netmask) { - BigInteger uintNetmask = IPNetwork.ToBigInteger(netmask); + var uintNetmask = IPNetwork.ToBigInteger(netmask); uint bits = IPNetwork.BitsSet(uintNetmask, netmask.AddressFamily); return bits; } @@ -1013,7 +1013,7 @@ namespace System.Net { throw new ArgumentNullException(nameof(netmask)); } - BigInteger uintNetmask = IPNetwork.ToBigInteger(netmask); + var uintNetmask = IPNetwork.ToBigInteger(netmask); bool valid = IPNetwork.InternalValidNetmask(uintNetmask, netmask.AddressFamily); return valid; } @@ -1042,7 +1042,7 @@ namespace System.Net 0x00 }); - BigInteger neg = ((~netmask) & (mask)); + var neg = ((~netmask) & (mask)); bool isNetmask = ((neg + 1) & neg) == 0; return isNetmask; @@ -1068,7 +1068,7 @@ namespace System.Net Array.Reverse(bytes2); byte[] sized = Resize(bytes2, family); - IPAddress ip = new IPAddress(sized); + var ip = new IPAddress(sized); return ip; } @@ -1122,9 +1122,9 @@ namespace System.Net return false; } - BigInteger uintNetwork = _network; - BigInteger uintBroadcast = _broadcast; - BigInteger uintAddress = IPNetwork.ToBigInteger(ipaddress); + var uintNetwork = _network; + var uintBroadcast = _broadcast; + var uintAddress = IPNetwork.ToBigInteger(ipaddress); bool contains = (uintAddress >= uintNetwork && uintAddress <= uintBroadcast); @@ -1146,11 +1146,11 @@ namespace System.Net throw new ArgumentNullException(nameof(network2)); } - BigInteger uintNetwork = _network; - BigInteger uintBroadcast = _broadcast; + var uintNetwork = _network; + var uintBroadcast = _broadcast; - BigInteger uintFirst = network2._network; - BigInteger uintLast = network2._broadcast; + var uintFirst = network2._network; + var uintLast = network2._broadcast; bool contains = (uintFirst >= uintNetwork && uintLast <= uintBroadcast); @@ -1175,11 +1175,11 @@ namespace System.Net throw new ArgumentNullException(nameof(network2)); } - BigInteger uintNetwork = _network; - BigInteger uintBroadcast = _broadcast; + var uintNetwork = _network; + var uintBroadcast = _broadcast; - BigInteger uintFirst = network2._network; - BigInteger uintLast = network2._broadcast; + var uintFirst = network2._network; + var uintLast = network2._broadcast; bool overlap = (uintFirst >= uintNetwork && uintFirst <= uintBroadcast) @@ -1428,8 +1428,8 @@ namespace System.Net return; } - IPNetwork first = (network1._network < network2._network) ? network1 : network2; - IPNetwork last = (network1._network > network2._network) ? network1 : network2; + var first = (network1._network < network2._network) ? network1 : network2; + var last = (network1._network > network2._network) ? network1 : network2; /// Starting from here : /// network1 and network2 have the same cidr, @@ -1449,10 +1449,10 @@ namespace System.Net return; } - BigInteger uintSupernet = first._network; + var uintSupernet = first._network; byte cidrSupernet = (byte)(first._cidr - 1); - IPNetwork networkSupernet = new IPNetwork(uintSupernet, first._family, cidrSupernet); + var networkSupernet = new IPNetwork(uintSupernet, first._family, cidrSupernet); if (networkSupernet._network != first._network) { if (trySupernet == false) @@ -1535,9 +1535,9 @@ namespace System.Net return true; } - List supernetted = new List(); - List ipns = IPNetwork.Array2List(ipnetworks); - Stack current = IPNetwork.List2Stack(ipns); + var supernetted = new List(); + var ipns = IPNetwork.Array2List(ipnetworks); + var current = IPNetwork.List2Stack(ipns); int previousCount = 0; int currentCount = current.Count; @@ -1547,8 +1547,8 @@ namespace System.Net supernetted.Clear(); while (current.Count > 1) { - IPNetwork ipn1 = current.Pop(); - IPNetwork ipn2 = current.Peek(); + var ipn1 = current.Pop(); + var ipn2 = current.Peek(); IPNetwork outNetwork = null; bool success = ipn1.TrySupernet(ipn2, out outNetwork); @@ -1578,7 +1578,7 @@ namespace System.Net private static Stack List2Stack(List list) { - Stack stack = new Stack(); + var stack = new Stack(); list.ForEach(new Action( delegate (IPNetwork ipn) { @@ -1590,7 +1590,7 @@ namespace System.Net private static List Array2List(IPNetwork[] array) { - List ipns = new List(); + var ipns = new List(); ipns.AddRange(array); IPNetwork.RemoveNull(ipns); ipns.Sort(new Comparison( @@ -1659,10 +1659,10 @@ namespace System.Net throw new NotSupportedException("MixedAddressFamily"); } - IPNetwork ipnetwork = new IPNetwork(0, startIP.AddressFamily, 0); + var ipnetwork = new IPNetwork(0, startIP.AddressFamily, 0); for (byte cidr = 32; cidr >= 0; cidr--) { - IPNetwork wideSubnet = IPNetwork.Parse(start, cidr); + var wideSubnet = IPNetwork.Parse(start, cidr); if (wideSubnet.Contains(endIP)) { ipnetwork = wideSubnet; @@ -1707,7 +1707,7 @@ namespace System.Net } - IPNetwork[] nnin = Array.FindAll(ipnetworks, new Predicate( + IPNetwork[] nnin = Array.FindAll(ipnetworks, new Predicate( delegate (IPNetwork ipnet) { return ipnet != null; @@ -1726,19 +1726,19 @@ namespace System.Net if (nnin.Length == 1) { - IPNetwork ipn0 = nnin[0]; + var ipn0 = nnin[0]; ipnetwork = ipn0; return; } - Array.Sort(nnin); - IPNetwork nnin0 = nnin[0]; - BigInteger uintNnin0 = nnin0._ipaddress; + Array.Sort(nnin); + var nnin0 = nnin[0]; + var uintNnin0 = nnin0._ipaddress; - IPNetwork nninX = nnin[nnin.Length - 1]; - IPAddress ipaddressX = nninX.Broadcast; + var nninX = nnin[nnin.Length - 1]; + var ipaddressX = nninX.Broadcast; - AddressFamily family = ipnetworks[0]._family; + var family = ipnetworks[0]._family; foreach (var ipnx in ipnetworks) { if (ipnx._family != family) @@ -1747,10 +1747,10 @@ namespace System.Net } } - IPNetwork ipn = new IPNetwork(0, family, 0); + var ipn = new IPNetwork(0, family, 0); for (byte cidr = nnin0._cidr; cidr >= 0; cidr--) { - IPNetwork wideSubnet = new IPNetwork(uintNnin0, family, cidr); + var wideSubnet = new IPNetwork(uintNnin0, family, cidr); if (wideSubnet.Contains(ipaddressX)) { ipn = wideSubnet; @@ -1773,7 +1773,7 @@ namespace System.Net public string Print() { - StringWriter sw = new StringWriter(); + var sw = new StringWriter(); sw.WriteLine("IPNetwork : {0}", ToString()); sw.WriteLine("Network : {0}", Network); @@ -1819,7 +1819,7 @@ namespace System.Net cidr = 64; return true; } - BigInteger uintIPAddress = IPNetwork.ToBigInteger(ipaddress); + var uintIPAddress = IPNetwork.ToBigInteger(ipaddress); uintIPAddress = uintIPAddress >> 29; if (uintIPAddress <= 3) { diff --git a/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs b/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs index 1827af77a..7d3106624 100644 --- a/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs +++ b/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs @@ -47,7 +47,7 @@ namespace System.Net { get { - BigInteger count = BigInteger.Pow(2, this._cidrSubnet - this._cidr); + var count = BigInteger.Pow(2, this._cidrSubnet - this._cidr); return count; } } @@ -61,11 +61,11 @@ namespace System.Net throw new ArgumentOutOfRangeException(nameof(i)); } - BigInteger last = this._ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetworkV6 + var last = this._ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetworkV6 ? this._lastUsable : this._broadcast; - BigInteger increment = (last - this._network) / this.Count; - BigInteger uintNetwork = this._network + ((increment + 1) * i); - IPNetwork ipn = new IPNetwork(uintNetwork, this._ipnetwork.AddressFamily, this._cidrSubnet); + var increment = (last - this._network) / this.Count; + var uintNetwork = this._network + ((increment + 1) * i); + var ipn = new IPNetwork(uintNetwork, this._ipnetwork.AddressFamily, this._cidrSubnet); return ipn; } } diff --git a/Emby.Server.Implementations/Networking/NetworkManager.cs b/Emby.Server.Implementations/Networking/NetworkManager.cs index 568981abb..70d8376a9 100644 --- a/Emby.Server.Implementations/Networking/NetworkManager.cs +++ b/Emby.Server.Implementations/Networking/NetworkManager.cs @@ -214,9 +214,9 @@ namespace Emby.Server.Implementations.Networking subnets = new List(); - foreach (NetworkInterface adapter in NetworkInterface.GetAllNetworkInterfaces()) + foreach (var adapter in NetworkInterface.GetAllNetworkInterfaces()) { - foreach (UnicastIPAddressInformation unicastIPAddressInformation in adapter.GetIPProperties().UnicastAddresses) + foreach (var unicastIPAddressInformation in adapter.GetIPProperties().UnicastAddresses) { if (unicastIPAddressInformation.Address.AddressFamily == AddressFamily.InterNetwork && endpointFirstPart == unicastIPAddressInformation.Address.ToString().Split('.')[0]) { @@ -461,7 +461,7 @@ namespace Emby.Server.Implementations.Networking public int GetRandomUnusedUdpPort() { - IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, 0); + var localEndPoint = new IPEndPoint(IPAddress.Any, 0); using (var udpClient = new UdpClient(localEndPoint)) { var port = ((IPEndPoint)(udpClient.Client.LocalEndPoint)).Port; @@ -522,8 +522,8 @@ namespace Emby.Server.Implementations.Networking /// The endpointstring. /// The defaultport. /// IPEndPoint. - /// Endpoint descriptor may not be empty. - /// + /// Endpoint descriptor may not be empty. + /// private static async Task Parse(string endpointstring, int defaultport) { if (string.IsNullOrEmpty(endpointstring) @@ -585,7 +585,7 @@ namespace Emby.Server.Implementations.Networking /// /// The p. /// System.Int32. - /// + /// private static int GetPort(string p) { int port; @@ -605,7 +605,7 @@ namespace Emby.Server.Implementations.Networking /// /// The p. /// IPAddress. - /// + /// private static async Task GetIPfromHost(string p) { var hosts = await Dns.GetHostAddressesAsync(p).ConfigureAwait(false); diff --git a/Emby.Server.Implementations/Playlists/PlaylistManager.cs b/Emby.Server.Implementations/Playlists/PlaylistManager.cs index 6dbefa910..c39897b53 100644 --- a/Emby.Server.Implementations/Playlists/PlaylistManager.cs +++ b/Emby.Server.Implementations/Playlists/PlaylistManager.cs @@ -469,12 +469,12 @@ namespace Emby.Server.Implementations.Playlists folderPath = folderPath + Path.DirectorySeparatorChar; } - Uri folderUri = new Uri(folderPath); - Uri fileAbsoluteUri = new Uri(fileAbsolutePath); + var folderUri = new Uri(folderPath); + var fileAbsoluteUri = new Uri(fileAbsolutePath); if (folderUri.Scheme != fileAbsoluteUri.Scheme) { return fileAbsolutePath; } // path can't be made relative. - Uri relativeUri = folderUri.MakeRelativeUri(fileAbsoluteUri); + var relativeUri = folderUri.MakeRelativeUri(fileAbsoluteUri); string relativePath = Uri.UnescapeDataString(relativeUri.ToString()); if (fileAbsoluteUri.Scheme.Equals("file", StringComparison.CurrentCultureIgnoreCase)) diff --git a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs index dc60b9990..44f6e2d7b 100644 --- a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs +++ b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs @@ -63,7 +63,7 @@ namespace Emby.Server.Implementations.ScheduledTasks /// The task manager. /// The json serializer. /// The logger. - /// + /// /// scheduledTask /// or /// applicationPaths @@ -256,7 +256,7 @@ namespace Emby.Server.Implementations.ScheduledTasks /// Gets the triggers that define when the task will run /// /// The triggers. - /// value + /// value public TaskTriggerInfo[] Triggers { get @@ -365,7 +365,7 @@ namespace Emby.Server.Implementations.ScheduledTasks /// /// Task options. /// Task. - /// Cannot execute a Task that is already running + /// Cannot execute a Task that is already running public async Task Execute(TaskOptions options) { var task = Task.Run(async () => await ExecuteInternal(options).ConfigureAwait(false)); @@ -461,7 +461,7 @@ namespace Emby.Server.Implementations.ScheduledTasks /// /// Stops the task if it is currently executing /// - /// Cannot cancel a Task unless it is in the Running state. + /// Cannot cancel a Task unless it is in the Running state. public void Cancel() { if (State != TaskState.Running) @@ -705,8 +705,8 @@ namespace Emby.Server.Implementations.ScheduledTasks /// /// The info. /// BaseTaskTrigger. - /// - /// Invalid trigger type: + info.Type + /// + /// Invalid trigger type: + info.Type private ITaskTrigger GetTrigger(TaskTriggerInfo info) { var options = new TaskOptions diff --git a/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs b/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs index 754fb1633..ac47c9625 100644 --- a/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs +++ b/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs @@ -61,7 +61,7 @@ namespace Emby.Server.Implementations.ScheduledTasks /// The application paths. /// The json serializer. /// The logger. - /// kernel + /// kernel public TaskManager(IApplicationPaths applicationPaths, IJsonSerializer jsonSerializer, ILogger logger, IFileSystem fileSystem, ISystemEvents systemEvents) { ApplicationPaths = applicationPaths; diff --git a/Emby.Server.Implementations/Security/EncryptionManager.cs b/Emby.Server.Implementations/Security/EncryptionManager.cs index c60872346..fa8872ccc 100644 --- a/Emby.Server.Implementations/Security/EncryptionManager.cs +++ b/Emby.Server.Implementations/Security/EncryptionManager.cs @@ -11,7 +11,7 @@ namespace Emby.Server.Implementations.Security /// /// The value. /// System.String. - /// value + /// value public string EncryptString(string value) { if (value == null) @@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.Security /// /// The value. /// System.String. - /// value + /// value public string DecryptString(string value) { if (value == null) diff --git a/Emby.Server.Implementations/Serialization/JsonSerializer.cs b/Emby.Server.Implementations/Serialization/JsonSerializer.cs index 26c648d72..60bf2d5a9 100644 --- a/Emby.Server.Implementations/Serialization/JsonSerializer.cs +++ b/Emby.Server.Implementations/Serialization/JsonSerializer.cs @@ -27,7 +27,7 @@ namespace Emby.Common.Implementations.Serialization /// /// The obj. /// The stream. - /// obj + /// obj public void SerializeToStream(object obj, Stream stream) { if (obj == null) @@ -48,7 +48,7 @@ namespace Emby.Common.Implementations.Serialization /// /// The obj. /// The file. - /// obj + /// obj public void SerializeToFile(object obj, string file) { if (obj == null) @@ -61,7 +61,7 @@ namespace Emby.Common.Implementations.Serialization throw new ArgumentNullException(nameof(file)); } - using (Stream stream = _fileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read)) + using (var stream = _fileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read)) { SerializeToStream(obj, stream); } @@ -79,7 +79,7 @@ namespace Emby.Common.Implementations.Serialization /// The type. /// The file. /// System.Object. - /// type + /// type public object DeserializeFromFile(Type type, string file) { if (type == null) @@ -92,7 +92,7 @@ namespace Emby.Common.Implementations.Serialization throw new ArgumentNullException(nameof(file)); } - using (Stream stream = OpenFile(file)) + using (var stream = OpenFile(file)) { return DeserializeFromStream(stream, type); } @@ -104,7 +104,7 @@ namespace Emby.Common.Implementations.Serialization /// /// The file. /// ``0. - /// file + /// file public T DeserializeFromFile(string file) where T : class { @@ -113,7 +113,7 @@ namespace Emby.Common.Implementations.Serialization throw new ArgumentNullException(nameof(file)); } - using (Stream stream = OpenFile(file)) + using (var stream = OpenFile(file)) { return DeserializeFromStream(stream); } @@ -125,7 +125,7 @@ namespace Emby.Common.Implementations.Serialization /// /// The stream. /// ``0. - /// stream + /// stream public T DeserializeFromStream(Stream stream) { if (stream == null) @@ -153,7 +153,7 @@ namespace Emby.Common.Implementations.Serialization /// /// The text. /// ``0. - /// text + /// text public T DeserializeFromString(string text) { if (string.IsNullOrEmpty(text)) @@ -170,7 +170,7 @@ namespace Emby.Common.Implementations.Serialization /// The stream. /// The type. /// System.Object. - /// stream + /// stream public object DeserializeFromStream(Stream stream, Type type) { if (stream == null) @@ -236,7 +236,7 @@ namespace Emby.Common.Implementations.Serialization /// The json. /// The type. /// System.Object. - /// json + /// json public object DeserializeFromString(string json, Type type) { if (string.IsNullOrEmpty(json)) @@ -257,7 +257,7 @@ namespace Emby.Common.Implementations.Serialization /// /// The obj. /// System.String. - /// obj + /// obj public string SerializeToString(object obj) { if (obj == null) diff --git a/Emby.Server.Implementations/Services/ServiceController.cs b/Emby.Server.Implementations/Services/ServiceController.cs index f82c64823..b34832f45 100644 --- a/Emby.Server.Implementations/Services/ServiceController.cs +++ b/Emby.Server.Implementations/Services/ServiceController.cs @@ -72,7 +72,7 @@ namespace Emby.Server.Implementations.Services public void RegisterRestPaths(HttpListenerHost appHost, Type requestType, Type serviceType) { var attrs = appHost.GetRouteAttributes(requestType); - foreach (RouteAttribute attr in attrs) + foreach (var attr in attrs) { var restPath = new RestPath(appHost.CreateInstance, appHost.GetParseFn, requestType, serviceType, attr.Path, attr.Verbs, attr.IsHidden, attr.Summary, attr.Description); diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index d99130228..e398b58cc 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -201,8 +201,8 @@ namespace Emby.Server.Implementations.Session /// The remote end point. /// The user. /// Task. - /// user - /// + /// user + /// public SessionInfo LogSessionActivity(string appName, string appVersion, string deviceId, @@ -365,7 +365,7 @@ namespace Emby.Server.Implementations.Session /// Removes the now playing item id. /// /// The session. - /// item + /// item private void RemoveNowPlayingItem(SessionInfo session) { session.NowPlayingItem = null; @@ -404,7 +404,7 @@ namespace Emby.Server.Implementations.Session CheckDisposed(); - SessionInfo sessionInfo = _activeConnections.GetOrAdd(key, k => + var sessionInfo = _activeConnections.GetOrAdd(key, k => { return CreateSession(k, appName, appVersion, deviceId, deviceName, remoteEndPoint, user); }); @@ -571,7 +571,7 @@ namespace Emby.Server.Implementations.Session /// /// The info. /// Task. - /// info + /// info public async Task OnPlaybackStart(PlaybackStartInfo info) { CheckDisposed(); @@ -784,8 +784,8 @@ namespace Emby.Server.Implementations.Session /// /// The info. /// Task. - /// info - /// positionTicks + /// info + /// positionTicks public async Task OnPlaybackStopped(PlaybackStopInfo info) { CheckDisposed(); @@ -1284,8 +1284,8 @@ namespace Emby.Server.Implementations.Session /// /// The session identifier. /// The user identifier. - /// Cannot modify additional users without authenticating first. - /// The requested user is already the primary user of the session. + /// Cannot modify additional users without authenticating first. + /// The requested user is already the primary user of the session. public void AddAdditionalUser(string sessionId, Guid userId) { CheckDisposed(); @@ -1318,8 +1318,8 @@ namespace Emby.Server.Implementations.Session /// /// The session identifier. /// The user identifier. - /// Cannot modify additional users without authenticating first. - /// The requested user is already the primary user of the session. + /// Cannot modify additional users without authenticating first. + /// The requested user is already the primary user of the session. public void RemoveAdditionalUser(string sessionId, Guid userId) { CheckDisposed(); diff --git a/Emby.Server.Implementations/Sorting/AlphanumComparator.cs b/Emby.Server.Implementations/Sorting/AlphanumComparator.cs index f21f905df..2e00c24d7 100644 --- a/Emby.Server.Implementations/Sorting/AlphanumComparator.cs +++ b/Emby.Server.Implementations/Sorting/AlphanumComparator.cs @@ -29,8 +29,8 @@ namespace Emby.Server.Implementations.Sorting char thisCh = s1[thisMarker]; char thatCh = s2[thatMarker]; - StringBuilder thisChunk = new StringBuilder(); - StringBuilder thatChunk = new StringBuilder(); + var thisChunk = new StringBuilder(); + var thatChunk = new StringBuilder(); while ((thisMarker < s1.Length) && (thisChunk.Length == 0 || SortHelper.InChunk(thisCh, thisChunk[0]))) { diff --git a/Emby.Server.Implementations/TV/TVSeriesManager.cs b/Emby.Server.Implementations/TV/TVSeriesManager.cs index 3a9d99aa1..630ef4893 100644 --- a/Emby.Server.Implementations/TV/TVSeriesManager.cs +++ b/Emby.Server.Implementations/TV/TVSeriesManager.cs @@ -118,7 +118,7 @@ namespace Emby.Server.Implementations.TV OrderBy = new[] { new ValueTuple(ItemSortBy.DatePlayed, SortOrder.Descending) }, SeriesPresentationUniqueKey = presentationUniqueKey, Limit = limit, - DtoOptions = new MediaBrowser.Controller.Dto.DtoOptions + DtoOptions = new DtoOptions { Fields = new ItemFields[] { @@ -196,7 +196,7 @@ namespace Emby.Server.Implementations.TV IsPlayed = true, Limit = 1, ParentIndexNumberNotEquals = 0, - DtoOptions = new MediaBrowser.Controller.Dto.DtoOptions + DtoOptions = new DtoOptions { Fields = new ItemFields[] { diff --git a/Emby.Server.Implementations/TextEncoding/NLangDetect/Detector.cs b/Emby.Server.Implementations/TextEncoding/NLangDetect/Detector.cs index 507dd5e42..097c7b8b7 100644 --- a/Emby.Server.Implementations/TextEncoding/NLangDetect/Detector.cs +++ b/Emby.Server.Implementations/TextEncoding/NLangDetect/Detector.cs @@ -164,7 +164,7 @@ namespace NLangDetect.Core public string Detect() { - List probabilities = GetProbabilities(); + var probabilities = GetProbabilities(); return probabilities.Count > 0 @@ -179,7 +179,7 @@ namespace NLangDetect.Core DetectBlock(); } - List list = SortProbability(_langprob); + var list = SortProbability(_langprob); return list; } @@ -241,7 +241,7 @@ namespace NLangDetect.Core { CleanText(); - List ngrams = ExtractNGrams(); + var ngrams = ExtractNGrams(); if (ngrams.Count == 0) { @@ -250,7 +250,7 @@ namespace NLangDetect.Core _langprob = new double[_langlist.Count]; - Random rand = (_seed.HasValue ? new Random(_seed.Value) : new Random()); + var rand = (_seed.HasValue ? new Random(_seed.Value) : new Random()); for (int t = 0; t < _trialsCount; t++) { @@ -305,7 +305,7 @@ namespace NLangDetect.Core private List ExtractNGrams() { var list = new List(); - NGram ngram = new NGram(); + var ngram = new NGram(); for (int i = 0; i < _text.Length; i++) { @@ -332,7 +332,7 @@ namespace NLangDetect.Core return; } - ProbVector langProbMap = _wordLangProbMap[word]; + var langProbMap = _wordLangProbMap[word]; double weight = alpha / _BaseFreq; for (int i = 0; i < prob.Length; i++) diff --git a/Emby.Server.Implementations/TextEncoding/NLangDetect/DetectorFactory.cs b/Emby.Server.Implementations/TextEncoding/NLangDetect/DetectorFactory.cs index c80757e68..08e98d62e 100644 --- a/Emby.Server.Implementations/TextEncoding/NLangDetect/DetectorFactory.cs +++ b/Emby.Server.Implementations/TextEncoding/NLangDetect/DetectorFactory.cs @@ -54,7 +54,7 @@ namespace NLangDetect.Core public static Detector Create(double alpha) { - Detector detector = CreateDetector(); + var detector = CreateDetector(); detector.SetAlpha(alpha); diff --git a/Emby.Server.Implementations/TextEncoding/NLangDetect/GenProfile.cs b/Emby.Server.Implementations/TextEncoding/NLangDetect/GenProfile.cs index c2b007c05..26157483b 100644 --- a/Emby.Server.Implementations/TextEncoding/NLangDetect/GenProfile.cs +++ b/Emby.Server.Implementations/TextEncoding/NLangDetect/GenProfile.cs @@ -13,8 +13,8 @@ namespace NLangDetect.Core public static LangProfile load(string lang, string file) { - LangProfile profile = new LangProfile(lang); - TagExtractor tagextractor = new TagExtractor("abstract", 100); + var profile = new LangProfile(lang); + var tagextractor = new TagExtractor("abstract", 100); Stream inputStream = null; try @@ -28,7 +28,7 @@ namespace NLangDetect.Core inputStream = new GZipStream(inputStream, CompressionMode.Decompress); } - using (XmlReader xmlReader = XmlReader.Create(inputStream)) + using (var xmlReader = XmlReader.Create(inputStream)) { while (xmlReader.Read()) { diff --git a/Emby.Server.Implementations/TextEncoding/NLangDetect/LanguageDetector.cs b/Emby.Server.Implementations/TextEncoding/NLangDetect/LanguageDetector.cs index 98c4f623c..a26f236a8 100644 --- a/Emby.Server.Implementations/TextEncoding/NLangDetect/LanguageDetector.cs +++ b/Emby.Server.Implementations/TextEncoding/NLangDetect/LanguageDetector.cs @@ -25,7 +25,7 @@ namespace NLangDetect.Core { if (string.IsNullOrEmpty(plainText)) { throw new ArgumentException("Argument can't be null nor empty.", nameof(plainText)); } - Detector detector = DetectorFactory.Create(_DefaultAlpha); + var detector = DetectorFactory.Create(_DefaultAlpha); detector.Append(plainText); diff --git a/Emby.Server.Implementations/TextEncoding/NLangDetect/Utils/LangProfile.cs b/Emby.Server.Implementations/TextEncoding/NLangDetect/Utils/LangProfile.cs index 0413edfad..78b44e1fc 100644 --- a/Emby.Server.Implementations/TextEncoding/NLangDetect/Utils/LangProfile.cs +++ b/Emby.Server.Implementations/TextEncoding/NLangDetect/Utils/LangProfile.cs @@ -59,8 +59,8 @@ namespace NLangDetect.Core.Utils ICollection keys = freq.Keys; int roman = 0; // TODO IMM HI: move up? - Regex regex1 = new Regex("^[A-Za-z]$", RegexOptions.Compiled); - List keysToRemove = new List(); + var regex1 = new Regex("^[A-Za-z]$", RegexOptions.Compiled); + var keysToRemove = new List(); foreach (string key in keys) { @@ -93,7 +93,7 @@ namespace NLangDetect.Core.Utils ICollection keys2 = freq.Keys; // TODO IMM HI: move up? - Regex regex2 = new Regex(".*[A-Za-z].*", RegexOptions.Compiled); + var regex2 = new Regex(".*[A-Za-z].*", RegexOptions.Compiled); foreach (string key in keys2) { diff --git a/Emby.Server.Implementations/TextEncoding/NLangDetect/Utils/Messages.cs b/Emby.Server.Implementations/TextEncoding/NLangDetect/Utils/Messages.cs index 058f350b2..d7dab8528 100644 --- a/Emby.Server.Implementations/TextEncoding/NLangDetect/Utils/Messages.cs +++ b/Emby.Server.Implementations/TextEncoding/NLangDetect/Utils/Messages.cs @@ -30,7 +30,7 @@ namespace NLangDetect.Core.Utils { var manifestName = typeof(Messages).Assembly.GetManifestResourceNames().FirstOrDefault(i => i.IndexOf("messages.properties", StringComparison.Ordinal) != -1); - Stream messagesStream = + var messagesStream = typeof(Messages).Assembly .GetManifestResourceStream(manifestName); diff --git a/Emby.Server.Implementations/TextEncoding/TextEncodingDetect.cs b/Emby.Server.Implementations/TextEncoding/TextEncodingDetect.cs index 49a371efa..03ff0863f 100644 --- a/Emby.Server.Implementations/TextEncoding/TextEncodingDetect.cs +++ b/Emby.Server.Implementations/TextEncoding/TextEncodingDetect.cs @@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.TextEncoding public CharacterEncoding DetectEncoding(byte[] buffer, int size) { // First check if we have a BOM and return that if so - CharacterEncoding encoding = CheckBom(buffer, size); + var encoding = CheckBom(buffer, size); if (encoding != CharacterEncoding.None) { return encoding; diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CharDistributionAnalyser.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CharDistributionAnalyser.cs index 472dfdc51..601b4906a 100644 --- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CharDistributionAnalyser.cs +++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CharDistributionAnalyser.cs @@ -83,7 +83,7 @@ namespace UniversalDetector.Core /// convert this encoding string to a number, here called order. /// This allow multiple encoding of a language to share one frequency table /// - /// A + /// A /// /// public abstract int GetOrder(byte[] buf, int offset); @@ -91,7 +91,7 @@ namespace UniversalDetector.Core /// /// Feed a character with known length /// - /// A + /// A /// buf offset public void HandleOneChar(byte[] buf, int offset, int charLen) { diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CharsetProber.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CharsetProber.cs index 158dc8969..e61e5848d 100644 --- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CharsetProber.cs +++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CharsetProber.cs @@ -108,7 +108,7 @@ namespace UniversalDetector.Core { byte[] result = null; - using (MemoryStream ms = new MemoryStream(buf.Length)) + using (var ms = new MemoryStream(buf.Length)) { bool meetMSB = false; @@ -156,7 +156,7 @@ namespace UniversalDetector.Core { byte[] result = null; - using (MemoryStream ms = new MemoryStream(buf.Length)) + using (var ms = new MemoryStream(buf.Length)) { bool inTag = false; diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EscCharsetProber.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EscCharsetProber.cs index e8da73c1c..b10c41c77 100644 --- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EscCharsetProber.cs +++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EscCharsetProber.cs @@ -84,7 +84,7 @@ namespace UniversalDetector.Core } else if (j != activeSM) { - CodingStateMachine t = codingSM[activeSM]; + var t = codingSM[activeSM]; codingSM[activeSM] = codingSM[j]; codingSM[j] = t; } diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/MBCSGroupProber.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/MBCSGroupProber.cs index e7fa2d719..b23e499c3 100644 --- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/MBCSGroupProber.cs +++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/MBCSGroupProber.cs @@ -122,7 +122,7 @@ namespace UniversalDetector.Core } } - ProbingState st = ProbingState.NotMe; + var st = ProbingState.NotMe; for (int i = 0; i < probers.Length; i++) { diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCSGroupProber.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCSGroupProber.cs index 336726aab..cdbc16891 100644 --- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCSGroupProber.cs +++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCSGroupProber.cs @@ -59,7 +59,7 @@ namespace UniversalDetector.Core probers[7] = new SingleByteCharSetProber(new Win1253Model()); probers[8] = new SingleByteCharSetProber(new Latin5BulgarianModel()); probers[9] = new SingleByteCharSetProber(new Win1251BulgarianModel()); - HebrewProber hebprober = new HebrewProber(); + var hebprober = new HebrewProber(); probers[10] = hebprober; // Logical probers[11] = new SingleByteCharSetProber(new Win1255Model(), false, hebprober); @@ -75,7 +75,7 @@ namespace UniversalDetector.Core public override ProbingState HandleData(byte[] buf, int offset, int len) { - ProbingState st = ProbingState.NotMe; + var st = ProbingState.NotMe; //apply filter to original buffer, and we got new buffer back //depend on what script it is, we will feed them the new buffer diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/UniversalDetector.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/UniversalDetector.cs index 28a50ea3e..812a9a793 100644 --- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/UniversalDetector.cs +++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/UniversalDetector.cs @@ -168,7 +168,7 @@ namespace UniversalDetector.Core } } - ProbingState st = ProbingState.NotMe; + var st = ProbingState.NotMe; switch (inputState) { diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs index 74d66fd41..68cb7821d 100644 --- a/Emby.Server.Implementations/Updates/InstallationManager.cs +++ b/Emby.Server.Implementations/Updates/InstallationManager.cs @@ -415,7 +415,7 @@ namespace Emby.Server.Implementations.Updates /// The progress. /// The cancellation token. /// Task. - /// package + /// package public async Task InstallPackage(PackageVersionInfo package, bool isPlugin, IProgress progress, CancellationToken cancellationToken) { if (package == null) @@ -626,7 +626,7 @@ namespace Emby.Server.Implementations.Updates /// Uninstalls a plugin /// /// The plugin. - /// + /// public void UninstallPlugin(IPlugin plugin) { plugin.OnUninstalling(); diff --git a/Emby.XmlTv/Emby.XmlTv/Classes/XmlTvReader.cs b/Emby.XmlTv/Emby.XmlTv/Classes/XmlTvReader.cs index aa4840664..8234393c2 100644 --- a/Emby.XmlTv/Emby.XmlTv/Classes/XmlTvReader.cs +++ b/Emby.XmlTv/Emby.XmlTv/Classes/XmlTvReader.cs @@ -34,7 +34,7 @@ namespace Emby.XmlTv.Classes private static XmlReader CreateXmlTextReader(string path) { - XmlReaderSettings settings = new XmlReaderSettings(); + var settings = new XmlReaderSettings(); // https://msdn.microsoft.com/en-us/library/system.xml.xmlreadersettings.xmlresolver(v=vs.110).aspx // Looks like we don't need this anyway? diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index 15a01ec3c..62c65d32e 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -36,8 +36,8 @@ namespace Jellyfin.Server public static async Task Main(string[] args) { - StartupOptions options = new StartupOptions(args); - Version version = Assembly.GetEntryAssembly().GetName().Version; + var options = new StartupOptions(args); + var version = Assembly.GetEntryAssembly().GetName().Version; if (options.ContainsOption("-v") || options.ContainsOption("--version")) { @@ -45,7 +45,7 @@ namespace Jellyfin.Server return 0; } - ServerApplicationPaths appPaths = createApplicationPaths(options); + var appPaths = createApplicationPaths(options); // $JELLYFIN_LOG_DIR needs to be set for the logger configuration manager Environment.SetEnvironmentVariable("JELLYFIN_LOG_DIR", appPaths.LogDirectoryPath); await createLogger(appPaths); @@ -57,7 +57,7 @@ namespace Jellyfin.Server _logger.LogInformation("Jellyfin version: {Version}", version); - EnvironmentInfo environmentInfo = new EnvironmentInfo(getOperatingSystem()); + var environmentInfo = new EnvironmentInfo(getOperatingSystem()); ApplicationHost.LogEnvironmentInfo(_logger, appPaths, environmentInfo); SQLitePCL.Batteries_V2.Init(); @@ -173,7 +173,7 @@ namespace Jellyfin.Server if (!File.Exists(configPath)) { // For some reason the csproj name is used instead of the assembly name - using (Stream rscstr = typeof(Program).Assembly + using (var rscstr = typeof(Program).Assembly .GetManifestResourceStream("Jellyfin.Server.Resources.Configuration.logging.json")) using (Stream fstr = File.Open(configPath, FileMode.CreateNew)) { diff --git a/Jellyfin.Server/SocketSharp/RequestMono.cs b/Jellyfin.Server/SocketSharp/RequestMono.cs index 6e5a4e75a..0e3d2ad65 100644 --- a/Jellyfin.Server/SocketSharp/RequestMono.cs +++ b/Jellyfin.Server/SocketSharp/RequestMono.cs @@ -75,7 +75,7 @@ namespace Jellyfin.SocketSharp // // We use a substream, as in 2.x we will support large uploads streamed to disk, // - HttpPostedFile sub = new HttpPostedFile(e.Filename, e.ContentType, input, e.Start, e.Length); + var sub = new HttpPostedFile(e.Filename, e.ContentType, input, e.Start, e.Length); files[e.Name] = sub; } } @@ -207,17 +207,17 @@ namespace Jellyfin.SocketSharp async Task LoadWwwForm(WebROCollection form) { - using (Stream input = InputStream) + using (var input = InputStream) { using (var ms = new MemoryStream()) { await input.CopyToAsync(ms).ConfigureAwait(false); ms.Position = 0; - using (StreamReader s = new StreamReader(ms, ContentEncoding)) + using (var s = new StreamReader(ms, ContentEncoding)) { - StringBuilder key = new StringBuilder(); - StringBuilder value = new StringBuilder(); + var key = new StringBuilder(); + var value = new StringBuilder(); int c; while ((c = s.Read()) != -1) @@ -269,7 +269,7 @@ namespace Jellyfin.SocketSharp { public override string ToString() { - StringBuilder result = new StringBuilder(); + var result = new StringBuilder(); foreach (var pair in this) { if (result.Length > 0) @@ -715,7 +715,7 @@ namespace Jellyfin.SocketSharp if (at_eof || ReadBoundary()) return null; - Element elem = new Element(); + var elem = new Element(); string header; while ((header = ReadHeaders()) != null) { diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs index 12d807a7e..1248f7316 100644 --- a/MediaBrowser.Api/Library/LibraryService.cs +++ b/MediaBrowser.Api/Library/LibraryService.cs @@ -902,7 +902,7 @@ namespace MediaBrowser.Api.Library var dtoOptions = GetDtoOptions(_authContext, request); - BaseItem parent = item.GetParent(); + var parent = item.GetParent(); while (parent != null) { diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index cdf9c7d0b..6d4af16e7 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -751,7 +751,7 @@ namespace MediaBrowser.Api.Playback MediaSourceInfo mediaSource = null; if (string.IsNullOrWhiteSpace(request.LiveStreamId)) { - TranscodingJob currentJob = !string.IsNullOrWhiteSpace(request.PlaySessionId) ? + var currentJob = !string.IsNullOrWhiteSpace(request.PlaySessionId) ? ApiEntryPoint.Instance.GetTranscodingJob(request.PlaySessionId) : null; diff --git a/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs b/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs index 502403cfe..16b036912 100644 --- a/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs +++ b/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs @@ -168,7 +168,7 @@ namespace MediaBrowser.Api.ScheduledTasks /// /// The request. /// IEnumerable{TaskInfo}. - /// Task not found + /// Task not found public object Get(GetScheduledTask request) { var task = TaskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, request.Id)); @@ -187,7 +187,7 @@ namespace MediaBrowser.Api.ScheduledTasks /// Posts the specified request. /// /// The request. - /// Task not found + /// Task not found public void Post(StartScheduledTask request) { var task = TaskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, request.Id)); @@ -214,7 +214,7 @@ namespace MediaBrowser.Api.ScheduledTasks /// Posts the specified request. /// /// The request. - /// Task not found + /// Task not found public void Delete(StopScheduledTask request) { var task = TaskManager.ScheduledTasks.FirstOrDefault(i => string.Equals(i.Id, request.Id)); @@ -231,7 +231,7 @@ namespace MediaBrowser.Api.ScheduledTasks /// Posts the specified request. /// /// The request. - /// Task not found + /// Task not found public void Post(UpdateScheduledTaskTriggers request) { // We need to parse this manually because we told service stack not to with IRequiresRequestStream diff --git a/MediaBrowser.Api/SimilarItemsHelper.cs b/MediaBrowser.Api/SimilarItemsHelper.cs index 20a6969df..44bb24ef2 100644 --- a/MediaBrowser.Api/SimilarItemsHelper.cs +++ b/MediaBrowser.Api/SimilarItemsHelper.cs @@ -95,7 +95,7 @@ namespace MediaBrowser.Api var items = GetSimilaritems(item, libraryManager, inputItems, getSimilarityScore) .ToList(); - List returnItems = items; + var returnItems = items; if (request.Limit.HasValue) { diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs index 3daa5779c..4cccc0cb5 100644 --- a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs +++ b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs @@ -459,7 +459,7 @@ namespace MediaBrowser.Api.UserLibrary if (string.IsNullOrEmpty(val)) { - return Array.Empty>(); + return Array.Empty>(); } var vals = val.Split(','); @@ -470,7 +470,7 @@ namespace MediaBrowser.Api.UserLibrary var sortOrders = requestedSortOrder.Split(','); - var result = new ValueTuple[vals.Length]; + var result = new ValueTuple[vals.Length]; for (var i = 0; i < vals.Length; i++) { @@ -479,7 +479,7 @@ namespace MediaBrowser.Api.UserLibrary var sortOrderValue = sortOrders.Length > sortOrderIndex ? sortOrders[sortOrderIndex] : null; var sortOrder = string.Equals(sortOrderValue, "Descending", StringComparison.OrdinalIgnoreCase) ? MediaBrowser.Model.Entities.SortOrder.Descending : MediaBrowser.Model.Entities.SortOrder.Ascending; - result[i] = new ValueTuple(vals[i], sortOrder); + result[i] = new ValueTuple(vals[i], sortOrder); } return result; diff --git a/MediaBrowser.Common/Net/IHttpClient.cs b/MediaBrowser.Common/Net/IHttpClient.cs index 5f4e3e5d1..5aaf7e0be 100644 --- a/MediaBrowser.Common/Net/IHttpClient.cs +++ b/MediaBrowser.Common/Net/IHttpClient.cs @@ -43,7 +43,7 @@ namespace MediaBrowser.Common.Net /// The options. /// Task{System.String}. /// progress - /// + /// Task GetTempFile(HttpRequestOptions options); /// diff --git a/MediaBrowser.Common/Plugins/BasePlugin.cs b/MediaBrowser.Common/Plugins/BasePlugin.cs index a14c9fb34..1ff2e98ef 100644 --- a/MediaBrowser.Common/Plugins/BasePlugin.cs +++ b/MediaBrowser.Common/Plugins/BasePlugin.cs @@ -212,7 +212,7 @@ namespace MediaBrowser.Common.Plugins /// Returns true or false indicating success or failure /// /// The configuration. - /// configuration + /// configuration public virtual void UpdateConfiguration(BasePluginConfiguration configuration) { if (configuration == null) diff --git a/MediaBrowser.Common/Plugins/IPlugin.cs b/MediaBrowser.Common/Plugins/IPlugin.cs index 037e11ce8..32527c299 100644 --- a/MediaBrowser.Common/Plugins/IPlugin.cs +++ b/MediaBrowser.Common/Plugins/IPlugin.cs @@ -69,7 +69,7 @@ namespace MediaBrowser.Common.Plugins /// Returns true or false indicating success or failure /// /// The configuration. - /// configuration + /// configuration void UpdateConfiguration(BasePluginConfiguration configuration); /// diff --git a/MediaBrowser.Common/Updates/IInstallationManager.cs b/MediaBrowser.Common/Updates/IInstallationManager.cs index 52d5d7dcb..8bef78400 100644 --- a/MediaBrowser.Common/Updates/IInstallationManager.cs +++ b/MediaBrowser.Common/Updates/IInstallationManager.cs @@ -108,14 +108,14 @@ namespace MediaBrowser.Common.Updates /// The progress. /// The cancellation token. /// Task. - /// package + /// package Task InstallPackage(PackageVersionInfo package, bool isPlugin, IProgress progress, CancellationToken cancellationToken); /// /// Uninstalls a plugin /// /// The plugin. - /// + /// void UninstallPlugin(IPlugin plugin); } } diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs index 522b3e33e..054df21e5 100644 --- a/MediaBrowser.Controller/Entities/AggregateFolder.cs +++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs @@ -164,7 +164,7 @@ namespace MediaBrowser.Controller.Entities /// Adds the virtual child. /// /// The child. - /// + /// public void AddVirtualChild(BaseItem child) { if (child == null) @@ -180,7 +180,7 @@ namespace MediaBrowser.Controller.Entities /// /// The id. /// BaseItem. - /// id + /// id public BaseItem FindVirtualChild(Guid id) { if (id.Equals(Guid.Empty)) diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 995f39483..68374c8df 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -367,7 +367,7 @@ namespace MediaBrowser.Controller.Entities } char thisCh = s1[thisMarker]; - StringBuilder thisChunk = new StringBuilder(); + var thisChunk = new StringBuilder(); while ((thisMarker < s1.Length) && (thisChunk.Length == 0 || SortHelper.InChunk(thisCh, thisChunk[0]))) { @@ -548,9 +548,9 @@ namespace MediaBrowser.Controller.Entities public static IMediaSourceManager MediaSourceManager { get; set; } /// - /// Returns a that represents this instance. + /// Returns a that represents this instance. /// - /// A that represents this instance. + /// A that represents this instance. public override string ToString() { return Name; @@ -1661,7 +1661,7 @@ namespace MediaBrowser.Controller.Entities /// /// The user. /// true if [is parental allowed] [the specified user]; otherwise, false. - /// user + /// user public bool IsParentalAllowed(User user) { if (user == null) @@ -1811,7 +1811,7 @@ namespace MediaBrowser.Controller.Entities /// /// The user. /// true if the specified user is visible; otherwise, false. - /// user + /// user public virtual bool IsVisible(User user) { if (user == null) @@ -1971,7 +1971,7 @@ namespace MediaBrowser.Controller.Entities /// Adds a studio to the item /// /// The name. - /// + /// public void AddStudio(string name) { if (string.IsNullOrEmpty(name)) @@ -2004,7 +2004,7 @@ namespace MediaBrowser.Controller.Entities /// Adds a genre to the item /// /// The name. - /// + /// public void AddGenre(string name) { if (string.IsNullOrEmpty(name)) @@ -2028,7 +2028,7 @@ namespace MediaBrowser.Controller.Entities /// The date played. /// if set to true [reset position]. /// Task. - /// + /// public virtual void MarkPlayed(User user, DateTime? datePlayed, bool resetPosition) @@ -2065,7 +2065,7 @@ namespace MediaBrowser.Controller.Entities /// /// The user. /// Task. - /// + /// public virtual void MarkUnplayed(User user) { if (user == null) @@ -2104,7 +2104,7 @@ namespace MediaBrowser.Controller.Entities /// The type. /// Index of the image. /// true if the specified type has image; otherwise, false. - /// Backdrops should be accessed using Item.Backdrops + /// Backdrops should be accessed using Item.Backdrops public bool HasImage(ImageType type, int imageIndex) { return GetImageInfo(type, imageIndex) != null; @@ -2232,9 +2232,9 @@ namespace MediaBrowser.Controller.Entities /// Type of the image. /// Index of the image. /// System.String. - /// + /// /// - /// item + /// item public string GetImagePath(ImageType imageType, int imageIndex) { var info = GetImageInfo(imageType, imageIndex); @@ -2294,7 +2294,7 @@ namespace MediaBrowser.Controller.Entities /// Type of the image. /// The images. /// true if XXXX, false otherwise. - /// Cannot call AddImages with chapter images + /// Cannot call AddImages with chapter images public bool AddImages(ImageType imageType, List images) { if (imageType == ImageType.Chapter) diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index fe53d2f05..bbee594f6 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -135,7 +135,7 @@ namespace MediaBrowser.Controller.Entities /// The item. /// The cancellation token. /// Task. - /// Unable to add + item.Name + /// Unable to add + item.Name public void AddChild(BaseItem item, CancellationToken cancellationToken) { item.SetParent(this); @@ -1261,7 +1261,7 @@ namespace MediaBrowser.Controller.Entities /// The user. /// if set to true [include linked children]. /// IEnumerable{BaseItem}. - /// + /// public IEnumerable GetRecursiveChildren(User user, bool includeLinkedChildren = true) { return GetRecursiveChildren(user, null); diff --git a/MediaBrowser.Controller/Entities/Person.cs b/MediaBrowser.Controller/Entities/Person.cs index 0ba8b3b48..dd0183489 100644 --- a/MediaBrowser.Controller/Entities/Person.cs +++ b/MediaBrowser.Controller/Entities/Person.cs @@ -175,9 +175,9 @@ namespace MediaBrowser.Controller.Entities public Dictionary ProviderIds { get; set; } /// - /// Returns a that represents this instance. + /// Returns a that represents this instance. /// - /// A that represents this instance. + /// A that represents this instance. public override string ToString() { return Name; diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index 5ba4613c0..4539ab0f2 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -119,7 +119,7 @@ namespace MediaBrowser.Controller.Entities.TV IncludeItemTypes = new[] { typeof(Season).Name }, IsVirtualItem = false, Limit = 0, - DtoOptions = new Dto.DtoOptions(false) + DtoOptions = new DtoOptions(false) { EnableImages = false } @@ -136,7 +136,7 @@ namespace MediaBrowser.Controller.Entities.TV { AncestorWithPresentationUniqueKey = null, SeriesPresentationUniqueKey = seriesKey, - DtoOptions = new Dto.DtoOptions(false) + DtoOptions = new DtoOptions(false) { EnableImages = false } diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs index 16fef9a82..10fe096a4 100644 --- a/MediaBrowser.Controller/Entities/User.cs +++ b/MediaBrowser.Controller/Entities/User.cs @@ -149,7 +149,7 @@ namespace MediaBrowser.Controller.Entities /// /// The new name. /// Task. - /// + /// public Task Rename(string newName) { if (string.IsNullOrEmpty(newName)) diff --git a/MediaBrowser.Controller/Entities/UserItemData.cs b/MediaBrowser.Controller/Entities/UserItemData.cs index 8a87aff5f..f7136bdf2 100644 --- a/MediaBrowser.Controller/Entities/UserItemData.cs +++ b/MediaBrowser.Controller/Entities/UserItemData.cs @@ -28,7 +28,7 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the users 0-10 rating /// /// The rating. - /// Rating;A 0 to 10 rating is required for UserItemData. + /// Rating;A 0 to 10 rating is required for UserItemData. public double? Rating { get => _rating; diff --git a/MediaBrowser.Controller/IO/FileData.cs b/MediaBrowser.Controller/IO/FileData.cs index e7c27d846..4bbb60283 100644 --- a/MediaBrowser.Controller/IO/FileData.cs +++ b/MediaBrowser.Controller/IO/FileData.cs @@ -34,7 +34,7 @@ namespace MediaBrowser.Controller.IO /// The flatten folder depth. /// if set to true [resolve shortcuts]. /// Dictionary{System.StringFileSystemInfo}. - /// path + /// path public static FileSystemMetadata[] GetFilteredFileSystemEntries(IDirectoryService directoryService, string path, IFileSystem fileSystem, diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index 0ada91b2e..9d404ba1a 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -100,7 +100,7 @@ namespace MediaBrowser.Controller.Library /// /// The value. /// Task{Year}. - /// + /// Year GetYear(int value); /// diff --git a/MediaBrowser.Controller/Library/IUserManager.cs b/MediaBrowser.Controller/Library/IUserManager.cs index bf60aa25a..925d91a37 100644 --- a/MediaBrowser.Controller/Library/IUserManager.cs +++ b/MediaBrowser.Controller/Library/IUserManager.cs @@ -43,7 +43,7 @@ namespace MediaBrowser.Controller.Library /// /// The id. /// User. - /// + /// User GetUserById(Guid id); /// @@ -73,16 +73,16 @@ namespace MediaBrowser.Controller.Library /// The user. /// The new name. /// Task. - /// user - /// + /// user + /// Task RenameUser(User user, string newName); /// /// Updates the user. /// /// The user. - /// user - /// + /// user + /// void UpdateUser(User user); /// @@ -90,8 +90,8 @@ namespace MediaBrowser.Controller.Library /// /// The name. /// User. - /// name - /// + /// name + /// Task CreateUser(string name); /// @@ -99,8 +99,8 @@ namespace MediaBrowser.Controller.Library /// /// The user. /// Task. - /// user - /// + /// user + /// Task DeleteUser(User user); /// diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.cs index eb459e890..7bb8325f8 100644 --- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs +++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs @@ -138,7 +138,7 @@ namespace MediaBrowser.Controller.Library /// Adds the additional location. /// /// The path. - /// + /// public void AddAdditionalLocation(string path) { if (string.IsNullOrEmpty(path)) @@ -173,7 +173,7 @@ namespace MediaBrowser.Controller.Library /// /// The name. /// FileSystemInfo. - /// + /// public FileSystemMetadata GetFileSystemEntryByName(string name) { if (string.IsNullOrEmpty(name)) @@ -189,7 +189,7 @@ namespace MediaBrowser.Controller.Library /// /// The path. /// FileSystemInfo. - /// + /// public FileSystemMetadata GetFileSystemEntryByPath(string path) { if (string.IsNullOrEmpty(path)) @@ -228,10 +228,10 @@ namespace MediaBrowser.Controller.Library #region Equality Overrides /// - /// Determines whether the specified is equal to this instance. + /// Determines whether the specified is equal to this instance. /// /// The object to compare with the current object. - /// true if the specified is equal to this instance; otherwise, false. + /// true if the specified is equal to this instance; otherwise, false. public override bool Equals(object obj) { return Equals(obj as ItemResolveArgs); diff --git a/MediaBrowser.Controller/Net/IWebSocketConnection.cs b/MediaBrowser.Controller/Net/IWebSocketConnection.cs index 6d31c6dbb..a09b2f7a2 100644 --- a/MediaBrowser.Controller/Net/IWebSocketConnection.cs +++ b/MediaBrowser.Controller/Net/IWebSocketConnection.cs @@ -62,7 +62,7 @@ namespace MediaBrowser.Controller.Net /// The message. /// The cancellation token. /// Task. - /// message + /// message Task SendAsync(WebSocketMessage message, CancellationToken cancellationToken); /// @@ -79,7 +79,7 @@ namespace MediaBrowser.Controller.Net /// The text. /// The cancellation token. /// Task. - /// buffer + /// buffer Task SendAsync(string text, CancellationToken cancellationToken); } } diff --git a/MediaBrowser.Controller/Session/ISessionManager.cs b/MediaBrowser.Controller/Session/ISessionManager.cs index 6a4f0aa08..771027103 100644 --- a/MediaBrowser.Controller/Session/ISessionManager.cs +++ b/MediaBrowser.Controller/Session/ISessionManager.cs @@ -90,7 +90,7 @@ namespace MediaBrowser.Controller.Session /// /// The info. /// Task. - /// + /// Task OnPlaybackProgress(PlaybackProgressInfo info); Task OnPlaybackProgress(PlaybackProgressInfo info, bool isAutomated); @@ -100,7 +100,7 @@ namespace MediaBrowser.Controller.Session /// /// The info. /// Task. - /// + /// Task OnPlaybackStopped(PlaybackStopInfo info); /// diff --git a/MediaBrowser.Controller/Sorting/SortExtensions.cs b/MediaBrowser.Controller/Sorting/SortExtensions.cs index 56d9c1a64..111f4f17f 100644 --- a/MediaBrowser.Controller/Sorting/SortExtensions.cs +++ b/MediaBrowser.Controller/Sorting/SortExtensions.cs @@ -72,8 +72,8 @@ namespace MediaBrowser.Controller.Sorting char thisCh = s1[thisMarker]; char thatCh = s2[thatMarker]; - StringBuilder thisChunk = new StringBuilder(); - StringBuilder thatChunk = new StringBuilder(); + var thisChunk = new StringBuilder(); + var thatChunk = new StringBuilder(); while ((thisMarker < s1.Length) && (thisChunk.Length == 0 || InChunk(thisCh, thisChunk[0]))) { diff --git a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs index 0a4928ed7..e4efa2c35 100644 --- a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs +++ b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs @@ -96,7 +96,7 @@ namespace MediaBrowser.LocalMetadata.Images public List GetImages(BaseItem item, IEnumerable paths, bool arePathsInMediaFolders, IDirectoryService directoryService) { - IEnumerable files = paths.SelectMany(i => _fileSystem.GetFiles(i, BaseItem.SupportedImageExtensions, true, false)); + var files = paths.SelectMany(i => _fileSystem.GetFiles(i, BaseItem.SupportedImageExtensions, true, false)); files = files .OrderBy(i => Array.IndexOf(BaseItem.SupportedImageExtensions, i.Extension ?? string.Empty)); diff --git a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs index fef673bfd..0ee283325 100644 --- a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs +++ b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs @@ -51,7 +51,7 @@ namespace MediaBrowser.LocalMetadata.Parsers /// The item. /// The metadata file. /// The cancellation token. - /// + /// public void Fetch(MetadataResult item, string metadataFile, CancellationToken cancellationToken) { if (item == null) @@ -102,7 +102,7 @@ namespace MediaBrowser.LocalMetadata.Parsers { item.ResetPeople(); - using (Stream fileStream = FileSystem.OpenRead(metadataFile)) + using (var fileStream = FileSystem.OpenRead(metadataFile)) { using (var streamReader = new StreamReader(fileStream, encoding)) { @@ -263,7 +263,7 @@ namespace MediaBrowser.LocalMetadata.Parsers { MetadataFields field; - if (Enum.TryParse(i, true, out field)) + if (Enum.TryParse(i, true, out field)) { return (MetadataFields?)field; } @@ -384,7 +384,7 @@ namespace MediaBrowser.LocalMetadata.Parsers case "Director": { - foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new Controller.Entities.PersonInfo { Name = v.Trim(), Type = PersonType.Director })) + foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new PersonInfo { Name = v.Trim(), Type = PersonType.Director })) { if (string.IsNullOrWhiteSpace(p.Name)) { @@ -396,7 +396,7 @@ namespace MediaBrowser.LocalMetadata.Parsers } case "Writer": { - foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new Controller.Entities.PersonInfo { Name = v.Trim(), Type = PersonType.Writer })) + foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new PersonInfo { Name = v.Trim(), Type = PersonType.Writer })) { if (string.IsNullOrWhiteSpace(p.Name)) { @@ -421,7 +421,7 @@ namespace MediaBrowser.LocalMetadata.Parsers else { // Old-style piped string - foreach (var p in SplitNames(actors).Select(v => new Controller.Entities.PersonInfo { Name = v.Trim(), Type = PersonType.Actor })) + foreach (var p in SplitNames(actors).Select(v => new PersonInfo { Name = v.Trim(), Type = PersonType.Actor })) { if (string.IsNullOrWhiteSpace(p.Name)) { @@ -435,7 +435,7 @@ namespace MediaBrowser.LocalMetadata.Parsers case "GuestStars": { - foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new Controller.Entities.PersonInfo { Name = v.Trim(), Type = PersonType.GuestStar })) + foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new PersonInfo { Name = v.Trim(), Type = PersonType.GuestStar })) { if (string.IsNullOrWhiteSpace(p.Name)) { diff --git a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs index 2ddf922f9..2eac35f28 100644 --- a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs +++ b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs @@ -130,7 +130,7 @@ namespace MediaBrowser.LocalMetadata.Savers CloseOutput = false }; - using (XmlWriter writer = XmlWriter.Create(stream, settings)) + using (var writer = XmlWriter.Create(stream, settings)) { var root = GetRootElementName(item); diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs index 262772959..c0578aad1 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs @@ -152,7 +152,7 @@ namespace MediaBrowser.MediaEncoding.Encoder private string GetProcessOutput(string path, string arguments) { - IProcess process = _processFactory.Create(new ProcessOptions + var process = _processFactory.Create(new ProcessOptions { CreateNoWindow = true, UseShellExecute = false, diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index 8489cc9b1..63642b571 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -457,7 +457,7 @@ namespace MediaBrowser.MediaEncoding.Encoder /// The input files. /// The protocol. /// System.String. - /// Unrecognized InputType + /// Unrecognized InputType public string GetInputArgument(string[] inputFiles, MediaProtocol protocol) { return EncodingUtils.GetInputArgument(inputFiles.ToList(), protocol); diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs index 51d2bcba7..7b8964707 100644 --- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs +++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs @@ -300,7 +300,7 @@ namespace MediaBrowser.MediaEncoding.Probing private void ReadFromDictNode(XmlReader reader, MediaInfo info) { string currentKey = null; - List pairs = new List(); + var pairs = new List(); reader.MoveToContent(); reader.Read(); @@ -360,7 +360,7 @@ namespace MediaBrowser.MediaEncoding.Probing private List ReadValueArray(XmlReader reader) { - List pairs = new List(); + var pairs = new List(); reader.MoveToContent(); reader.Read(); @@ -881,7 +881,7 @@ namespace MediaBrowser.MediaEncoding.Probing } } - private void SetSize(InternalMediaInfoResult data, Model.MediaInfo.MediaInfo info) + private void SetSize(InternalMediaInfoResult data, MediaInfo info) { if (data.format != null) { @@ -901,7 +901,7 @@ namespace MediaBrowser.MediaEncoding.Probing var composer = FFProbeHelpers.GetDictionaryValue(tags, "composer"); if (!string.IsNullOrWhiteSpace(composer)) { - List peoples = new List(); + var peoples = new List(); foreach (var person in Split(composer, false)) { peoples.Add(new BaseItemPerson { Name = person, Type = PersonType.Composer }); @@ -932,7 +932,7 @@ namespace MediaBrowser.MediaEncoding.Probing if (!string.IsNullOrWhiteSpace(writer)) { - List peoples = new List(); + var peoples = new List(); foreach (var person in Split(writer, false)) { peoples.Add(new BaseItemPerson { Name = person, Type = PersonType.Writer }); @@ -1125,7 +1125,7 @@ namespace MediaBrowser.MediaEncoding.Probing if (!string.IsNullOrEmpty(val)) { var studios = Split(val, true); - List studioList = new List(); + var studioList = new List(); foreach (var studio in studios) { @@ -1160,7 +1160,7 @@ namespace MediaBrowser.MediaEncoding.Probing if (!string.IsNullOrEmpty(val)) { - List genres = new List(info.Genres); + var genres = new List(info.Genres); foreach (var genre in Split(val, true)) { genres.Add(genre); diff --git a/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs b/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs index 0aa6a3e44..7f312eaec 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs @@ -17,7 +17,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles public SubtitleTrackInfo Parse(Stream stream, CancellationToken cancellationToken) { var trackInfo = new SubtitleTrackInfo(); - List trackEvents = new List(); + var trackEvents = new List(); var eventIndex = 1; using (var reader = new StreamReader(stream)) { diff --git a/MediaBrowser.MediaEncoding/Subtitles/SrtParser.cs b/MediaBrowser.MediaEncoding/Subtitles/SrtParser.cs index c3f6d4947..02ce71ec3 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/SrtParser.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/SrtParser.cs @@ -24,7 +24,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles public SubtitleTrackInfo Parse(Stream stream, CancellationToken cancellationToken) { var trackInfo = new SubtitleTrackInfo(); - List trackEvents = new List(); + var trackEvents = new List(); using (var reader = new StreamReader(stream)) { string line; diff --git a/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs b/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs index 1cd714f32..8281de764 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs @@ -16,7 +16,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles public SubtitleTrackInfo Parse(Stream stream, CancellationToken cancellationToken) { var trackInfo = new SubtitleTrackInfo(); - List trackEvents = new List(); + var trackEvents = new List(); using (var reader = new StreamReader(stream)) { diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs index 3b7514613..4f424d39b 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs @@ -408,7 +408,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles /// The output path. /// The cancellation token. /// Task. - /// + /// /// inputPath /// or /// outputPath @@ -525,7 +525,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles /// The output path. /// The cancellation token. /// Task. - /// Must use inputPath list overload + /// Must use inputPath list overload private async Task ExtractTextSubtitle( string[] inputFiles, MediaProtocol protocol, @@ -734,7 +734,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles { if (protocol == MediaProtocol.Http) { - HttpRequestOptions opts = new HttpRequestOptions() + var opts = new HttpRequestOptions() { Url = path, CancellationToken = cancellationToken diff --git a/MediaBrowser.MediaEncoding/Subtitles/VttWriter.cs b/MediaBrowser.MediaEncoding/Subtitles/VttWriter.cs index d67d1dad8..2e328ba63 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/VttWriter.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/VttWriter.cs @@ -19,8 +19,8 @@ namespace MediaBrowser.MediaEncoding.Subtitles { cancellationToken.ThrowIfCancellationRequested(); - TimeSpan startTime = TimeSpan.FromTicks(trackEvent.StartPositionTicks); - TimeSpan endTime = TimeSpan.FromTicks(trackEvent.EndPositionTicks); + var startTime = TimeSpan.FromTicks(trackEvent.StartPositionTicks); + var endTime = TimeSpan.FromTicks(trackEvent.EndPositionTicks); // make sure the start and end times are different and seqential if (endTime.TotalMilliseconds <= startTime.TotalMilliseconds) diff --git a/MediaBrowser.Model/Configuration/LibraryOptions.cs b/MediaBrowser.Model/Configuration/LibraryOptions.cs index ec9b276a0..b3d035be2 100644 --- a/MediaBrowser.Model/Configuration/LibraryOptions.cs +++ b/MediaBrowser.Model/Configuration/LibraryOptions.cs @@ -100,7 +100,7 @@ namespace MediaBrowser.Model.Configuration public ImageOption GetImageOptions(ImageType type) { - foreach (ImageOption i in ImageOptions) + foreach (var i in ImageOptions) { if (i.Type == type) { @@ -111,7 +111,7 @@ namespace MediaBrowser.Model.Configuration ImageOption[] options; if (DefaultImageOptions.TryGetValue(Type, out options)) { - foreach (ImageOption i in options) + foreach (var i in options) { if (i.Type == type) { diff --git a/MediaBrowser.Model/Dlna/ConditionProcessor.cs b/MediaBrowser.Model/Dlna/ConditionProcessor.cs index fe8926735..ae7d17275 100644 --- a/MediaBrowser.Model/Dlna/ConditionProcessor.cs +++ b/MediaBrowser.Model/Dlna/ConditionProcessor.cs @@ -267,7 +267,7 @@ namespace MediaBrowser.Model.Dlna return !condition.IsRequired; } - TransportStreamTimestamp expected = (TransportStreamTimestamp)Enum.Parse(typeof(TransportStreamTimestamp), condition.Value, true); + var expected = (TransportStreamTimestamp)Enum.Parse(typeof(TransportStreamTimestamp), condition.Value, true); switch (condition.Condition) { diff --git a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs index ecca415d3..b71531bf1 100644 --- a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs +++ b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs @@ -24,14 +24,14 @@ namespace MediaBrowser.Model.Dlna // 0 = native, 1 = transcoded var orgCi = isDirectStream ? ";DLNA.ORG_CI=0" : ";DLNA.ORG_CI=1"; - DlnaFlags flagValue = DlnaFlags.BackgroundTransferMode | + var flagValue = DlnaFlags.BackgroundTransferMode | DlnaFlags.InteractiveTransferMode | DlnaFlags.DlnaV15; string dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}", DlnaMaps.FlagsToString(flagValue)); - ResponseProfile mediaProfile = _profile.GetImageMediaProfile(container, + var mediaProfile = _profile.GetImageMediaProfile(container, width, height); @@ -66,7 +66,7 @@ namespace MediaBrowser.Model.Dlna // 0 = native, 1 = transcoded string orgCi = isDirectStream ? ";DLNA.ORG_CI=0" : ";DLNA.ORG_CI=1"; - DlnaFlags flagValue = DlnaFlags.StreamingTransferMode | + var flagValue = DlnaFlags.StreamingTransferMode | DlnaFlags.BackgroundTransferMode | DlnaFlags.InteractiveTransferMode | DlnaFlags.DlnaV15; @@ -83,7 +83,7 @@ namespace MediaBrowser.Model.Dlna string dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}", DlnaMaps.FlagsToString(flagValue)); - ResponseProfile mediaProfile = _profile.GetAudioMediaProfile(container, + var mediaProfile = _profile.GetAudioMediaProfile(container, audioCodec, audioChannels, audioBitrate, @@ -131,7 +131,7 @@ namespace MediaBrowser.Model.Dlna // 0 = native, 1 = transcoded string orgCi = isDirectStream ? ";DLNA.ORG_CI=0" : ";DLNA.ORG_CI=1"; - DlnaFlags flagValue = DlnaFlags.StreamingTransferMode | + var flagValue = DlnaFlags.StreamingTransferMode | DlnaFlags.BackgroundTransferMode | DlnaFlags.InteractiveTransferMode | DlnaFlags.DlnaV15; @@ -148,7 +148,7 @@ namespace MediaBrowser.Model.Dlna string dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}", DlnaMaps.FlagsToString(flagValue)); - ResponseProfile mediaProfile = _profile.GetVideoMediaProfile(container, + var mediaProfile = _profile.GetVideoMediaProfile(container, audioCodec, videoCodec, width, @@ -168,7 +168,7 @@ namespace MediaBrowser.Model.Dlna videoCodecTag, isAvc); - List orgPnValues = new List(); + var orgPnValues = new List(); if (mediaProfile != null && !string.IsNullOrEmpty(mediaProfile.OrgPn)) { @@ -183,7 +183,7 @@ namespace MediaBrowser.Model.Dlna } } - List contentFeatureList = new List(); + var contentFeatureList = new List(); foreach (string orgPn in orgPnValues) { diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.cs index 3a626deaa..8124cf528 100644 --- a/MediaBrowser.Model/Dlna/DeviceProfile.cs +++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs @@ -21,7 +21,7 @@ namespace MediaBrowser.Model.Dlna /// Gets or sets the identification. /// /// The identification. - public MediaBrowser.Model.Dlna.DeviceIdentification Identification { get; set; } + public DeviceIdentification Identification { get; set; } public string FriendlyName { get; set; } public string Manufacturer { get; set; } @@ -191,7 +191,7 @@ namespace MediaBrowser.Model.Dlna var conditionProcessor = new ConditionProcessor(); var anyOff = false; - foreach (ProfileCondition c in i.Conditions) + foreach (var c in i.Conditions) { if (!conditionProcessor.IsAudioConditionSatisfied(GetModelProfileCondition(c), audioChannels, audioBitrate, audioSampleRate, audioBitDepth)) { @@ -238,7 +238,7 @@ namespace MediaBrowser.Model.Dlna var conditionProcessor = new ConditionProcessor(); var anyOff = false; - foreach (ProfileCondition c in i.Conditions) + foreach (var c in i.Conditions) { if (!conditionProcessor.IsImageConditionSatisfied(GetModelProfileCondition(c), width, height)) { @@ -304,7 +304,7 @@ namespace MediaBrowser.Model.Dlna var conditionProcessor = new ConditionProcessor(); var anyOff = false; - foreach (ProfileCondition c in i.Conditions) + foreach (var c in i.Conditions) { if (!conditionProcessor.IsVideoConditionSatisfied(GetModelProfileCondition(c), width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc)) { diff --git a/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs b/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs index 42c78e335..672784589 100644 --- a/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs +++ b/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs @@ -91,7 +91,7 @@ namespace MediaBrowser.Model.Dlna if (StringHelper.EqualsIgnoreCase(videoCodec, "mpeg2video")) { - List list = new List(); + var list = new List(); list.Add(ValueOf("MPEG_TS_SD_NA" + suffix)); list.Add(ValueOf("MPEG_TS_SD_EU" + suffix)); diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index f1ec71d1d..2335f0553 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -32,7 +32,7 @@ namespace MediaBrowser.Model.Dlna ValidateAudioInput(options); var mediaSources = new List(); - foreach (MediaSourceInfo i in options.MediaSources) + foreach (var i in options.MediaSources) { if (string.IsNullOrEmpty(options.MediaSourceId) || StringHelper.EqualsIgnoreCase(i.Id, options.MediaSourceId)) @@ -42,16 +42,16 @@ namespace MediaBrowser.Model.Dlna } var streams = new List(); - foreach (MediaSourceInfo i in mediaSources) + foreach (var i in mediaSources) { - StreamInfo streamInfo = BuildAudioItem(i, options); + var streamInfo = BuildAudioItem(i, options); if (streamInfo != null) { streams.Add(streamInfo); } } - foreach (StreamInfo stream in streams) + foreach (var stream in streams) { stream.DeviceId = options.DeviceId; stream.DeviceProfileId = options.Profile.Id; @@ -65,7 +65,7 @@ namespace MediaBrowser.Model.Dlna ValidateInput(options); var mediaSources = new List(); - foreach (MediaSourceInfo i in options.MediaSources) + foreach (var i in options.MediaSources) { if (string.IsNullOrEmpty(options.MediaSourceId) || StringHelper.EqualsIgnoreCase(i.Id, options.MediaSourceId)) @@ -75,16 +75,16 @@ namespace MediaBrowser.Model.Dlna } var streams = new List(); - foreach (MediaSourceInfo i in mediaSources) + foreach (var i in mediaSources) { - StreamInfo streamInfo = BuildVideoItem(i, options); + var streamInfo = BuildVideoItem(i, options); if (streamInfo != null) { streams.Add(streamInfo); } } - foreach (StreamInfo stream in streams) + foreach (var stream in streams) { stream.DeviceId = options.DeviceId; stream.DeviceProfileId = options.Profile.Id; @@ -97,7 +97,7 @@ namespace MediaBrowser.Model.Dlna { var sorted = SortMediaSources(streams, maxBitrate); - foreach (StreamInfo stream in sorted) + foreach (var stream in sorted) { return stream; } @@ -284,7 +284,7 @@ namespace MediaBrowser.Model.Dlna { var transcodeReasons = new List(); - StreamInfo playlistItem = new StreamInfo + var playlistItem = new StreamInfo { ItemId = options.ItemId, MediaType = DlnaProfileType.Audio, @@ -308,14 +308,14 @@ namespace MediaBrowser.Model.Dlna return playlistItem; } - MediaStream audioStream = item.GetDefaultAudioStream(null); + var audioStream = item.GetDefaultAudioStream(null); var directPlayInfo = GetAudioDirectPlayMethods(item, audioStream, options); var directPlayMethods = directPlayInfo.Item1; transcodeReasons.AddRange(directPlayInfo.Item2); - ConditionProcessor conditionProcessor = new ConditionProcessor(); + var conditionProcessor = new ConditionProcessor(); int? inputAudioChannels = audioStream == null ? null : audioStream.Channels; int? inputAudioBitrate = audioStream == null ? null : audioStream.BitDepth; @@ -328,12 +328,12 @@ namespace MediaBrowser.Model.Dlna // Make sure audio codec profiles are satisfied var conditions = new List(); - foreach (CodecProfile i in options.Profile.CodecProfiles) + foreach (var i in options.Profile.CodecProfiles) { if (i.Type == CodecType.Audio && i.ContainsAnyCodec(audioCodec, item.Container)) { bool applyConditions = true; - foreach (ProfileCondition applyCondition in i.ApplyConditions) + foreach (var applyCondition in i.ApplyConditions) { if (!conditionProcessor.IsAudioConditionSatisfied(applyCondition, inputAudioChannels, inputAudioBitrate, inputAudioSampleRate, inputAudioBitDepth)) { @@ -345,7 +345,7 @@ namespace MediaBrowser.Model.Dlna if (applyConditions) { - foreach (ProfileCondition c in i.Conditions) + foreach (var c in i.Conditions) { conditions.Add(c); } @@ -354,7 +354,7 @@ namespace MediaBrowser.Model.Dlna } bool all = true; - foreach (ProfileCondition c in conditions) + foreach (var c in conditions) { if (!conditionProcessor.IsAudioConditionSatisfied(c, inputAudioChannels, inputAudioBitrate, inputAudioSampleRate, inputAudioBitDepth)) { @@ -383,7 +383,7 @@ namespace MediaBrowser.Model.Dlna } TranscodingProfile transcodingProfile = null; - foreach (TranscodingProfile i in options.Profile.TranscodingProfiles) + foreach (var i in options.Profile.TranscodingProfiles) { if (i.Type == playlistItem.MediaType && i.Context == options.Context) { @@ -405,7 +405,7 @@ namespace MediaBrowser.Model.Dlna SetStreamInfoOptionsFromTranscodingProfile(playlistItem, transcodingProfile); var audioCodecProfiles = new List(); - foreach (CodecProfile i in options.Profile.CodecProfiles) + foreach (var i in options.Profile.CodecProfiles) { if (i.Type == CodecType.Audio && i.ContainsAnyCodec(transcodingProfile.AudioCodec, transcodingProfile.Container)) { @@ -416,10 +416,10 @@ namespace MediaBrowser.Model.Dlna } var audioTranscodingConditions = new List(); - foreach (CodecProfile i in audioCodecProfiles) + foreach (var i in audioCodecProfiles) { bool applyConditions = true; - foreach (ProfileCondition applyCondition in i.ApplyConditions) + foreach (var applyCondition in i.ApplyConditions) { if (!conditionProcessor.IsAudioConditionSatisfied(applyCondition, inputAudioChannels, inputAudioBitrate, inputAudioSampleRate, inputAudioBitDepth)) { @@ -431,7 +431,7 @@ namespace MediaBrowser.Model.Dlna if (applyConditions) { - foreach (ProfileCondition c in i.Conditions) + foreach (var c in i.Conditions) { audioTranscodingConditions.Add(c); } @@ -478,7 +478,7 @@ namespace MediaBrowser.Model.Dlna var transcodeReasons = new List(); DirectPlayProfile directPlayProfile = null; - foreach (DirectPlayProfile i in options.Profile.DirectPlayProfiles) + foreach (var i in options.Profile.DirectPlayProfiles) { if (i.Type == DlnaProfileType.Audio && IsAudioDirectPlaySupported(i, item, audioStream)) { @@ -607,7 +607,7 @@ namespace MediaBrowser.Model.Dlna { int highestScore = -1; - foreach (MediaStream stream in item.MediaStreams) + foreach (var stream in item.MediaStreams) { if (stream.Type == MediaStreamType.Subtitle && stream.Score.HasValue) { @@ -619,7 +619,7 @@ namespace MediaBrowser.Model.Dlna } var topStreams = new List(); - foreach (MediaStream stream in item.MediaStreams) + foreach (var stream in item.MediaStreams) { if (stream.Type == MediaStreamType.Subtitle && stream.Score.HasValue && stream.Score.Value == highestScore) { @@ -630,9 +630,9 @@ namespace MediaBrowser.Model.Dlna // If multiple streams have an equal score, try to pick the most efficient one if (topStreams.Count > 1) { - foreach (MediaStream stream in topStreams) + foreach (var stream in topStreams) { - foreach (SubtitleProfile profile in subtitleProfiles) + foreach (var profile in subtitleProfiles) { if (profile.Method == SubtitleDeliveryMethod.External && StringHelper.EqualsIgnoreCase(profile.Format, stream.Codec)) { @@ -705,7 +705,7 @@ namespace MediaBrowser.Model.Dlna var transcodeReasons = new List(); - StreamInfo playlistItem = new StreamInfo + var playlistItem = new StreamInfo { ItemId = options.ItemId, MediaType = DlnaProfileType.Video, @@ -716,15 +716,15 @@ namespace MediaBrowser.Model.Dlna }; playlistItem.SubtitleStreamIndex = options.SubtitleStreamIndex ?? GetDefaultSubtitleStreamIndex(item, options.Profile.SubtitleProfiles); - MediaStream subtitleStream = playlistItem.SubtitleStreamIndex.HasValue ? item.GetMediaStream(MediaStreamType.Subtitle, playlistItem.SubtitleStreamIndex.Value) : null; + var subtitleStream = playlistItem.SubtitleStreamIndex.HasValue ? item.GetMediaStream(MediaStreamType.Subtitle, playlistItem.SubtitleStreamIndex.Value) : null; - MediaStream audioStream = item.GetDefaultAudioStream(options.AudioStreamIndex ?? item.DefaultAudioStreamIndex); + var audioStream = item.GetDefaultAudioStream(options.AudioStreamIndex ?? item.DefaultAudioStreamIndex); if (audioStream != null) { playlistItem.AudioStreamIndex = audioStream.Index; } - MediaStream videoStream = item.VideoStream; + var videoStream = item.VideoStream; // TODO: This doesn't accout for situation of device being able to handle media bitrate, but wifi connection not fast enough var directPlayEligibilityResult = IsEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options, true) ?? 0, subtitleStream, options, PlayMethod.DirectPlay); @@ -751,7 +751,7 @@ namespace MediaBrowser.Model.Dlna if (subtitleStream != null) { - SubtitleProfile subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, directPlay.Value, _transcoderSupport, item.Container, null); + var subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, directPlay.Value, _transcoderSupport, item.Container, null); playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method; playlistItem.SubtitleFormat = subtitleProfile.Format; @@ -775,7 +775,7 @@ namespace MediaBrowser.Model.Dlna // Can't direct play, find the transcoding profile TranscodingProfile transcodingProfile = null; - foreach (TranscodingProfile i in options.Profile.TranscodingProfiles) + foreach (var i in options.Profile.TranscodingProfiles) { if (i.Type == playlistItem.MediaType && i.Context == options.Context) { @@ -793,7 +793,7 @@ namespace MediaBrowser.Model.Dlna if (subtitleStream != null) { - SubtitleProfile subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.Transcode, _transcoderSupport, transcodingProfile.Container, transcodingProfile.Protocol); + var subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.Transcode, _transcoderSupport, transcodingProfile.Container, transcodingProfile.Protocol); playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method; playlistItem.SubtitleFormat = subtitleProfile.Format; @@ -804,15 +804,15 @@ namespace MediaBrowser.Model.Dlna SetStreamInfoOptionsFromTranscodingProfile(playlistItem, transcodingProfile); - ConditionProcessor conditionProcessor = new ConditionProcessor(); + var conditionProcessor = new ConditionProcessor(); var isFirstAppliedCodecProfile = true; - foreach (CodecProfile i in options.Profile.CodecProfiles) + foreach (var i in options.Profile.CodecProfiles) { if (i.Type == CodecType.Video && i.ContainsAnyCodec(transcodingProfile.VideoCodec, transcodingProfile.Container)) { bool applyConditions = true; - foreach (ProfileCondition applyCondition in i.ApplyConditions) + foreach (var applyCondition in i.ApplyConditions) { int? width = videoStream == null ? null : videoStream.Width; int? height = videoStream == null ? null : videoStream.Height; @@ -863,12 +863,12 @@ namespace MediaBrowser.Model.Dlna playlistItem.AudioBitrate = Math.Min(playlistItem.AudioBitrate ?? audioBitrate, audioBitrate); isFirstAppliedCodecProfile = true; - foreach (CodecProfile i in options.Profile.CodecProfiles) + foreach (var i in options.Profile.CodecProfiles) { if (i.Type == CodecType.VideoAudio && i.ContainsAnyCodec(transcodingProfile.AudioCodec, transcodingProfile.Container)) { bool applyConditions = true; - foreach (ProfileCondition applyCondition in i.ApplyConditions) + foreach (var applyCondition in i.ApplyConditions) { bool? isSecondaryAudio = audioStream == null ? null : item.IsSecondaryAudio(audioStream); int? inputAudioBitrate = audioStream == null ? null : audioStream.BitRate; @@ -998,7 +998,7 @@ namespace MediaBrowser.Model.Dlna bool isEligibleForDirectPlay, bool isEligibleForDirectStream) { - DeviceProfile profile = options.Profile; + var profile = options.Profile; if (options.ForceDirectPlay) { @@ -1011,7 +1011,7 @@ namespace MediaBrowser.Model.Dlna // See if it can be direct played DirectPlayProfile directPlay = null; - foreach (DirectPlayProfile i in profile.DirectPlayProfiles) + foreach (var i in profile.DirectPlayProfiles) { if (i.Type == DlnaProfileType.Video && IsVideoDirectPlaySupported(i, mediaSource, videoStream, audioStream)) { @@ -1032,19 +1032,19 @@ namespace MediaBrowser.Model.Dlna string container = mediaSource.Container; var conditions = new List(); - foreach (ContainerProfile i in profile.ContainerProfiles) + foreach (var i in profile.ContainerProfiles) { if (i.Type == DlnaProfileType.Video && i.ContainsContainer(container)) { - foreach (ProfileCondition c in i.Conditions) + foreach (var c in i.Conditions) { conditions.Add(c); } } } - ConditionProcessor conditionProcessor = new ConditionProcessor(); + var conditionProcessor = new ConditionProcessor(); int? width = videoStream == null ? null : videoStream.Width; int? height = videoStream == null ? null : videoStream.Height; @@ -1072,7 +1072,7 @@ namespace MediaBrowser.Model.Dlna int? numVideoStreams = mediaSource.GetStreamCount(MediaStreamType.Video); // Check container conditions - foreach (ProfileCondition i in conditions) + foreach (var i in conditions) { if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc)) { @@ -1090,12 +1090,12 @@ namespace MediaBrowser.Model.Dlna string videoCodec = videoStream == null ? null : videoStream.Codec; conditions = new List(); - foreach (CodecProfile i in profile.CodecProfiles) + foreach (var i in profile.CodecProfiles) { if (i.Type == CodecType.Video && i.ContainsAnyCodec(videoCodec, container)) { bool applyConditions = true; - foreach (ProfileCondition applyCondition in i.ApplyConditions) + foreach (var applyCondition in i.ApplyConditions) { if (!conditionProcessor.IsVideoConditionSatisfied(applyCondition, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc)) { @@ -1107,7 +1107,7 @@ namespace MediaBrowser.Model.Dlna if (applyConditions) { - foreach (ProfileCondition c in i.Conditions) + foreach (var c in i.Conditions) { conditions.Add(c); } @@ -1115,7 +1115,7 @@ namespace MediaBrowser.Model.Dlna } } - foreach (ProfileCondition i in conditions) + foreach (var i in conditions) { if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc)) { @@ -1137,12 +1137,12 @@ namespace MediaBrowser.Model.Dlna conditions = new List(); bool? isSecondaryAudio = audioStream == null ? null : mediaSource.IsSecondaryAudio(audioStream); - foreach (CodecProfile i in profile.CodecProfiles) + foreach (var i in profile.CodecProfiles) { if (i.Type == CodecType.VideoAudio && i.ContainsAnyCodec(audioCodec, container)) { bool applyConditions = true; - foreach (ProfileCondition applyCondition in i.ApplyConditions) + foreach (var applyCondition in i.ApplyConditions) { if (!conditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, audioBitrate, audioSampleRate, audioBitDepth, audioProfile, isSecondaryAudio)) { @@ -1154,7 +1154,7 @@ namespace MediaBrowser.Model.Dlna if (applyConditions) { - foreach (ProfileCondition c in i.Conditions) + foreach (var c in i.Conditions) { conditions.Add(c); } @@ -1162,7 +1162,7 @@ namespace MediaBrowser.Model.Dlna } } - foreach (ProfileCondition i in conditions) + foreach (var i in conditions) { if (!conditionProcessor.IsVideoAudioConditionSatisfied(i, audioChannels, audioBitrate, audioSampleRate, audioBitDepth, audioProfile, isSecondaryAudio)) { @@ -1206,7 +1206,7 @@ namespace MediaBrowser.Model.Dlna { if (subtitleStream != null) { - SubtitleProfile subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, playMethod, _transcoderSupport, item.Container, null); + var subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, playMethod, _transcoderSupport, item.Container, null); if (subtitleProfile.Method != SubtitleDeliveryMethod.External && subtitleProfile.Method != SubtitleDeliveryMethod.Embed) { @@ -1230,7 +1230,7 @@ namespace MediaBrowser.Model.Dlna if (!subtitleStream.IsExternal && (playMethod != PlayMethod.Transcode || !string.Equals(transcodingSubProtocol, "hls", StringComparison.OrdinalIgnoreCase))) { // Look for supported embedded subs of the same format - foreach (SubtitleProfile profile in subtitleProfiles) + foreach (var profile in subtitleProfiles) { if (!profile.SupportsLanguage(subtitleStream.Language)) { @@ -1259,7 +1259,7 @@ namespace MediaBrowser.Model.Dlna } // Look for supported embedded subs of a convertible format - foreach (SubtitleProfile profile in subtitleProfiles) + foreach (var profile in subtitleProfiles) { if (!profile.SupportsLanguage(subtitleStream.Language)) { @@ -1328,7 +1328,7 @@ namespace MediaBrowser.Model.Dlna private static SubtitleProfile GetExternalSubtitleProfile(MediaSourceInfo mediaSource, MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, PlayMethod playMethod, ITranscoderSupport transcoderSupport, bool allowConversion) { - foreach (SubtitleProfile profile in subtitleProfiles) + foreach (var profile in subtitleProfiles) { if (profile.Method != SubtitleDeliveryMethod.External && profile.Method != SubtitleDeliveryMethod.Hls) { @@ -1467,7 +1467,7 @@ namespace MediaBrowser.Model.Dlna private void ApplyTranscodingConditions(StreamInfo item, IEnumerable conditions, string qualifier, bool enableQualifiedConditions, bool enableNonQualifiedConditions) { - foreach (ProfileCondition condition in conditions) + foreach (var condition in conditions) { string value = condition.Value; diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs index 86d7c9d62..84bd1f429 100644 --- a/MediaBrowser.Model/Dlna/StreamInfo.cs +++ b/MediaBrowser.Model/Dlna/StreamInfo.cs @@ -145,8 +145,8 @@ namespace MediaBrowser.Model.Dlna throw new ArgumentNullException(nameof(baseUrl)); } - List list = new List(); - foreach (NameValuePair pair in BuildParams(this, accessToken)) + var list = new List(); + foreach (var pair in BuildParams(this, accessToken)) { if (string.IsNullOrEmpty(pair.Value)) { @@ -211,7 +211,7 @@ namespace MediaBrowser.Model.Dlna private static List BuildParams(StreamInfo item, string accessToken) { - List list = new List(); + var list = new List(); string audioCodecs = item.AudioCodecs.Length == 0 ? string.Empty : @@ -346,11 +346,11 @@ namespace MediaBrowser.Model.Dlna public List GetExternalSubtitles(ITranscoderSupport transcoderSupport, bool includeSelectedTrackOnly, bool enableAllProfiles, string baseUrl, string accessToken) { - List list = GetSubtitleProfiles(transcoderSupport, includeSelectedTrackOnly, enableAllProfiles, baseUrl, accessToken); - List newList = new List(); + var list = GetSubtitleProfiles(transcoderSupport, includeSelectedTrackOnly, enableAllProfiles, baseUrl, accessToken); + var newList = new List(); // First add the selected track - foreach (SubtitleStreamInfo stream in list) + foreach (var stream in list) { if (stream.DeliveryMethod == SubtitleDeliveryMethod.External) { @@ -368,7 +368,7 @@ namespace MediaBrowser.Model.Dlna public List GetSubtitleProfiles(ITranscoderSupport transcoderSupport, bool includeSelectedTrackOnly, bool enableAllProfiles, string baseUrl, string accessToken) { - List list = new List(); + var list = new List(); // HLS will preserve timestamps so we can just grab the full subtitle stream long startPositionTicks = StringHelper.EqualsIgnoreCase(SubProtocol, "hls") @@ -378,7 +378,7 @@ namespace MediaBrowser.Model.Dlna // First add the selected track if (SubtitleStreamIndex.HasValue) { - foreach (MediaStream stream in MediaSource.MediaStreams) + foreach (var stream in MediaSource.MediaStreams) { if (stream.Type == MediaStreamType.Subtitle && stream.Index == SubtitleStreamIndex.Value) { @@ -389,7 +389,7 @@ namespace MediaBrowser.Model.Dlna if (!includeSelectedTrackOnly) { - foreach (MediaStream stream in MediaSource.MediaStreams) + foreach (var stream in MediaSource.MediaStreams) { if (stream.Type == MediaStreamType.Subtitle && (!SubtitleStreamIndex.HasValue || stream.Index != SubtitleStreamIndex.Value)) { @@ -405,16 +405,16 @@ namespace MediaBrowser.Model.Dlna { if (enableAllProfiles) { - foreach (SubtitleProfile profile in DeviceProfile.SubtitleProfiles) + foreach (var profile in DeviceProfile.SubtitleProfiles) { - SubtitleStreamInfo info = GetSubtitleStreamInfo(stream, baseUrl, accessToken, startPositionTicks, new[] { profile }, transcoderSupport); + var info = GetSubtitleStreamInfo(stream, baseUrl, accessToken, startPositionTicks, new[] { profile }, transcoderSupport); list.Add(info); } } else { - SubtitleStreamInfo info = GetSubtitleStreamInfo(stream, baseUrl, accessToken, startPositionTicks, DeviceProfile.SubtitleProfiles, transcoderSupport); + var info = GetSubtitleStreamInfo(stream, baseUrl, accessToken, startPositionTicks, DeviceProfile.SubtitleProfiles, transcoderSupport); list.Add(info); } @@ -422,8 +422,8 @@ namespace MediaBrowser.Model.Dlna private SubtitleStreamInfo GetSubtitleStreamInfo(MediaStream stream, string baseUrl, string accessToken, long startPositionTicks, SubtitleProfile[] subtitleProfiles, ITranscoderSupport transcoderSupport) { - SubtitleProfile subtitleProfile = StreamBuilder.GetSubtitleProfile(MediaSource, stream, subtitleProfiles, PlayMethod, transcoderSupport, Container, SubProtocol); - SubtitleStreamInfo info = new SubtitleStreamInfo + var subtitleProfile = StreamBuilder.GetSubtitleProfile(MediaSource, stream, subtitleProfiles, PlayMethod, transcoderSupport, Container, SubProtocol); + var info = new SubtitleStreamInfo { IsForced = stream.IsForced, Language = stream.Language, @@ -502,7 +502,7 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream stream = TargetAudioStream; + var stream = TargetAudioStream; return stream == null ? null : stream.SampleRate; } } @@ -584,7 +584,7 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream stream = TargetVideoStream; + var stream = TargetVideoStream; return MaxFramerate.HasValue && !IsDirectStream ? MaxFramerate : stream == null ? null : stream.AverageFrameRate ?? stream.RealFrameRate; @@ -689,7 +689,7 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream stream = TargetVideoStream; + var stream = TargetVideoStream; return !IsDirectStream ? null : stream == null ? null : stream.PacketLength; @@ -727,7 +727,7 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream stream = TargetVideoStream; + var stream = TargetVideoStream; return !IsDirectStream ? null : stream == null ? null : stream.CodecTag; @@ -741,7 +741,7 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream stream = TargetAudioStream; + var stream = TargetAudioStream; return AudioBitrate.HasValue && !IsDirectStream ? AudioBitrate : stream == null ? null : stream.BitRate; @@ -797,7 +797,7 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream stream = TargetAudioStream; + var stream = TargetAudioStream; string inputCodec = stream == null ? null : stream.Codec; @@ -822,7 +822,7 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream stream = TargetVideoStream; + var stream = TargetVideoStream; string inputCodec = stream == null ? null : stream.Codec; @@ -878,7 +878,7 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream stream = TargetVideoStream; + var stream = TargetVideoStream; return VideoBitrate.HasValue && !IsDirectStream ? VideoBitrate @@ -890,7 +890,7 @@ namespace MediaBrowser.Model.Dlna { get { - TransportStreamTimestamp defaultValue = StringHelper.EqualsIgnoreCase(Container, "m2ts") + var defaultValue = StringHelper.EqualsIgnoreCase(Container, "m2ts") ? TransportStreamTimestamp.Valid : TransportStreamTimestamp.None; @@ -955,11 +955,11 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream videoStream = TargetVideoStream; + var videoStream = TargetVideoStream; if (videoStream != null && videoStream.Width.HasValue && videoStream.Height.HasValue) { - ImageSize size = new ImageSize + var size = new ImageSize { Width = videoStream.Width.Value, Height = videoStream.Height.Value @@ -968,7 +968,7 @@ namespace MediaBrowser.Model.Dlna double? maxWidth = MaxWidth.HasValue ? (double)MaxWidth.Value : (double?)null; double? maxHeight = MaxHeight.HasValue ? (double)MaxHeight.Value : (double?)null; - ImageSize newSize = DrawingUtils.Resize(size, + var newSize = DrawingUtils.Resize(size, 0, 0, maxWidth ?? 0, @@ -985,11 +985,11 @@ namespace MediaBrowser.Model.Dlna { get { - MediaStream videoStream = TargetVideoStream; + var videoStream = TargetVideoStream; if (videoStream != null && videoStream.Width.HasValue && videoStream.Height.HasValue) { - ImageSize size = new ImageSize + var size = new ImageSize { Width = videoStream.Width.Value, Height = videoStream.Height.Value @@ -998,7 +998,7 @@ namespace MediaBrowser.Model.Dlna double? maxWidth = MaxWidth.HasValue ? (double)MaxWidth.Value : (double?)null; double? maxHeight = MaxHeight.HasValue ? (double)MaxHeight.Value : (double?)null; - ImageSize newSize = DrawingUtils.Resize(size, + var newSize = DrawingUtils.Resize(size, 0, 0, maxWidth ?? 0, @@ -1059,9 +1059,9 @@ namespace MediaBrowser.Model.Dlna public List GetSelectableStreams(MediaStreamType type) { - List list = new List(); + var list = new List(); - foreach (MediaStream stream in MediaSource.MediaStreams) + foreach (var stream in MediaSource.MediaStreams) { if (type == stream.Type) { diff --git a/MediaBrowser.Model/Dto/MediaSourceInfo.cs b/MediaBrowser.Model/Dto/MediaSourceInfo.cs index c2219dc33..92e40fb01 100644 --- a/MediaBrowser.Model/Dto/MediaSourceInfo.cs +++ b/MediaBrowser.Model/Dto/MediaSourceInfo.cs @@ -120,7 +120,7 @@ namespace MediaBrowser.Model.Dto { var val = defaultIndex.Value; - foreach (MediaStream i in MediaStreams) + foreach (var i in MediaStreams) { if (i.Type == MediaStreamType.Audio && i.Index == val) { @@ -129,7 +129,7 @@ namespace MediaBrowser.Model.Dto } } - foreach (MediaStream i in MediaStreams) + foreach (var i in MediaStreams) { if (i.Type == MediaStreamType.Audio && i.IsDefault) { @@ -137,7 +137,7 @@ namespace MediaBrowser.Model.Dto } } - foreach (MediaStream i in MediaStreams) + foreach (var i in MediaStreams) { if (i.Type == MediaStreamType.Audio) { @@ -153,7 +153,7 @@ namespace MediaBrowser.Model.Dto { get { - foreach (MediaStream i in MediaStreams) + foreach (var i in MediaStreams) { if (i.Type == MediaStreamType.Video) { @@ -167,7 +167,7 @@ namespace MediaBrowser.Model.Dto public MediaStream GetMediaStream(MediaStreamType type, int index) { - foreach (MediaStream i in MediaStreams) + foreach (var i in MediaStreams) { if (i.Type == type && i.Index == index) { @@ -183,7 +183,7 @@ namespace MediaBrowser.Model.Dto int numMatches = 0; int numStreams = 0; - foreach (MediaStream i in MediaStreams) + foreach (var i in MediaStreams) { numStreams++; if (i.Type == type) @@ -203,7 +203,7 @@ namespace MediaBrowser.Model.Dto public bool? IsSecondaryAudio(MediaStream stream) { // Look for the first audio track marked as default - foreach (MediaStream currentStream in MediaStreams) + foreach (var currentStream in MediaStreams) { if (currentStream.Type == MediaStreamType.Audio && currentStream.IsDefault) { @@ -215,7 +215,7 @@ namespace MediaBrowser.Model.Dto } // Look for the first audio track - foreach (MediaStream currentStream in MediaStreams) + foreach (var currentStream in MediaStreams) { if (currentStream.Type == MediaStreamType.Audio) { diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index b51942af8..e0c3bead1 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -76,7 +76,7 @@ namespace MediaBrowser.Model.Entities // return AddLanguageIfNeeded(Title); //} - List attributes = new List(); + var attributes = new List(); if (!string.IsNullOrEmpty(Language)) { @@ -109,7 +109,7 @@ namespace MediaBrowser.Model.Entities if (Type == MediaStreamType.Video) { - List attributes = new List(); + var attributes = new List(); var resolutionText = GetResolutionText(); @@ -133,7 +133,7 @@ namespace MediaBrowser.Model.Entities // return AddLanguageIfNeeded(Title); //} - List attributes = new List(); + var attributes = new List(); if (!string.IsNullOrEmpty(Language)) { diff --git a/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs b/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs index edede8ba9..a5ae7c7a5 100644 --- a/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs +++ b/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs @@ -36,7 +36,7 @@ namespace MediaBrowser.Model.MediaInfo DirectPlayProtocols = new MediaProtocol[] { MediaProtocol.Http }; - VideoOptions videoOptions = options as VideoOptions; + var videoOptions = options as VideoOptions; if (videoOptions != null) { AudioStreamIndex = videoOptions.AudioStreamIndex; diff --git a/MediaBrowser.Model/Net/MimeTypes.cs b/MediaBrowser.Model/Net/MimeTypes.cs index e5d1ab462..77cba0f71 100644 --- a/MediaBrowser.Model/Net/MimeTypes.cs +++ b/MediaBrowser.Model/Net/MimeTypes.cs @@ -48,7 +48,7 @@ namespace MediaBrowser.Model.Net private static Dictionary GetVideoFileExtensionsDictionary() { - Dictionary dict = new Dictionary(StringComparer.OrdinalIgnoreCase); + var dict = new Dictionary(StringComparer.OrdinalIgnoreCase); foreach (string ext in VideoFileExtensions) { @@ -65,7 +65,7 @@ namespace MediaBrowser.Model.Net private static Dictionary GetMimeTypeLookup() { - Dictionary dict = new Dictionary(StringComparer.OrdinalIgnoreCase); + var dict = new Dictionary(StringComparer.OrdinalIgnoreCase); dict.Add(".jpg", "image/jpeg"); dict.Add(".jpeg", "image/jpeg"); diff --git a/MediaBrowser.Model/Notifications/NotificationOptions.cs b/MediaBrowser.Model/Notifications/NotificationOptions.cs index f48b5ee7f..cf8555423 100644 --- a/MediaBrowser.Model/Notifications/NotificationOptions.cs +++ b/MediaBrowser.Model/Notifications/NotificationOptions.cs @@ -77,7 +77,7 @@ namespace MediaBrowser.Model.Notifications public NotificationOption GetOptions(string type) { - foreach (NotificationOption i in Options) + foreach (var i in Options) { if (StringHelper.EqualsIgnoreCase(type, i.Type)) return i; } @@ -86,14 +86,14 @@ namespace MediaBrowser.Model.Notifications public bool IsEnabled(string type) { - NotificationOption opt = GetOptions(type); + var opt = GetOptions(type); return opt != null && opt.Enabled; } public bool IsServiceEnabled(string service, string notificationType) { - NotificationOption opt = GetOptions(notificationType); + var opt = GetOptions(notificationType); return opt == null || !ListHelper.ContainsIgnoreCase(opt.DisabledServices, service); @@ -101,7 +101,7 @@ namespace MediaBrowser.Model.Notifications public bool IsEnabledToMonitorUser(string type, Guid userId) { - NotificationOption opt = GetOptions(type); + var opt = GetOptions(type); return opt != null && opt.Enabled && !ListHelper.ContainsIgnoreCase(opt.DisabledMonitorUsers, userId.ToString("")); @@ -109,7 +109,7 @@ namespace MediaBrowser.Model.Notifications public bool IsEnabledToSendToUser(string type, string userId, UserPolicy userPolicy) { - NotificationOption opt = GetOptions(type); + var opt = GetOptions(type); if (opt != null && opt.Enabled) { diff --git a/MediaBrowser.Model/Services/HttpUtility.cs b/MediaBrowser.Model/Services/HttpUtility.cs index 98882e114..be180334c 100644 --- a/MediaBrowser.Model/Services/HttpUtility.cs +++ b/MediaBrowser.Model/Services/HttpUtility.cs @@ -445,8 +445,8 @@ namespace MediaBrowser.Model.Services if (s.IndexOf('&') == -1) return s; - StringBuilder entity = new StringBuilder(); - StringBuilder output = new StringBuilder(); + var entity = new StringBuilder(); + var output = new StringBuilder(); int len = s.Length; // 0 -> nothing, // 1 -> right after '&' @@ -623,7 +623,7 @@ namespace MediaBrowser.Model.Services if (query[0] == '?') query = query.Substring(1); - QueryParamCollection result = new QueryParamCollection(); + var result = new QueryParamCollection(); ParseQueryString(query, encoding, result); return result; } diff --git a/MediaBrowser.Model/System/IEnvironmentInfo.cs b/MediaBrowser.Model/System/IEnvironmentInfo.cs index 757d3c949..3ffcc7de1 100644 --- a/MediaBrowser.Model/System/IEnvironmentInfo.cs +++ b/MediaBrowser.Model/System/IEnvironmentInfo.cs @@ -4,7 +4,7 @@ namespace MediaBrowser.Model.System { public interface IEnvironmentInfo { - MediaBrowser.Model.System.OperatingSystem OperatingSystem { get; } + OperatingSystem OperatingSystem { get; } string OperatingSystemName { get; } string OperatingSystemVersion { get; } Architecture SystemArchitecture { get; } diff --git a/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs b/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs index 2b73fdcd3..b87f688e1 100644 --- a/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs +++ b/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs @@ -132,7 +132,7 @@ namespace Priority_Queue int parent = node.QueueIndex / 2; while (parent >= 1) { - TItem parentNode = _nodes[parent]; + var parentNode = _nodes[parent]; if (HasHigherPriority(parentNode, node)) break; @@ -163,7 +163,7 @@ namespace Priority_Queue break; } - TItem childLeft = _nodes[childLeftIndex]; + var childLeft = _nodes[childLeftIndex]; if (HasHigherPriority(childLeft, newParent)) { newParent = childLeft; @@ -173,7 +173,7 @@ namespace Priority_Queue int childRightIndex = childLeftIndex + 1; if (childRightIndex <= _numNodes) { - TItem childRight = _nodes[childRightIndex]; + var childRight = _nodes[childRightIndex]; if (HasHigherPriority(childRight, newParent)) { newParent = childRight; @@ -234,7 +234,7 @@ namespace Priority_Queue } #endif - TItem returnMe = _nodes[1]; + var returnMe = _nodes[1]; Remove(returnMe); item = returnMe; return true; @@ -316,7 +316,7 @@ namespace Priority_Queue { //Bubble the updated node up or down as appropriate int parentIndex = node.QueueIndex / 2; - TItem parentNode = _nodes[parentIndex]; + var parentNode = _nodes[parentIndex]; if (parentIndex > 0 && HasHigherPriority(node, parentNode)) { @@ -356,7 +356,7 @@ namespace Priority_Queue } //Swap the node with the last node - TItem formerLastNode = _nodes[_numNodes]; + var formerLastNode = _nodes[_numNodes]; Swap(node, formerLastNode); _nodes[_numNodes] = null; _numNodes--; diff --git a/MediaBrowser.Providers/Manager/ImageSaver.cs b/MediaBrowser.Providers/Manager/ImageSaver.cs index 616086406..d0d00ef12 100644 --- a/MediaBrowser.Providers/Manager/ImageSaver.cs +++ b/MediaBrowser.Providers/Manager/ImageSaver.cs @@ -63,7 +63,7 @@ namespace MediaBrowser.Providers.Manager /// Index of the image. /// The cancellation token. /// Task. - /// mimeType + /// mimeType public Task SaveImage(BaseItem item, Stream source, string mimeType, ImageType type, int? imageIndex, CancellationToken cancellationToken) { return SaveImage(item, source, mimeType, type, imageIndex, null, cancellationToken); @@ -299,7 +299,7 @@ namespace MediaBrowser.Providers.Manager /// The type. /// Index of the image. /// System.String. - /// + /// /// imageIndex /// or /// imageIndex @@ -316,7 +316,7 @@ namespace MediaBrowser.Providers.Manager /// The type. /// Index of the image. /// The path. - /// imageIndex + /// imageIndex /// or /// imageIndex private void SetImagePath(BaseItem item, ImageType type, int? imageIndex, string path) @@ -333,7 +333,7 @@ namespace MediaBrowser.Providers.Manager /// Type of the MIME. /// if set to true [save locally]. /// System.String. - /// + /// /// imageIndex /// or /// imageIndex @@ -490,7 +490,7 @@ namespace MediaBrowser.Providers.Manager /// Index of the image. /// Type of the MIME. /// IEnumerable{System.String}. - /// imageIndex + /// imageIndex private string[] GetCompatibleSavePaths(BaseItem item, ImageType type, int? imageIndex, string mimeType) { var season = item as Season; diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index 3322582cc..1972ad290 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -415,7 +415,7 @@ namespace MediaBrowser.Providers.Manager var folder = item as Folder; if (folder != null && folder.SupportsDateLastMediaAdded) { - DateTime dateLastMediaAdded = DateTime.MinValue; + var dateLastMediaAdded = DateTime.MinValue; var any = false; foreach (var child in children) diff --git a/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs b/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs index 9cfd5ab5c..71e979e2c 100644 --- a/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs +++ b/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs @@ -80,7 +80,7 @@ namespace Priority_Queue throw new InvalidOperationException("Cannot call .First on an empty queue"); } - SimpleNode first = _queue.First; + var first = _queue.First; return (first != null ? first.Data : default(TItem)); } } @@ -155,7 +155,7 @@ namespace Priority_Queue { lock (_queue) { - SimpleNode node = new SimpleNode(item); + var node = new SimpleNode(item); if (_queue.Count == _queue.MaxSize) { _queue.Resize(_queue.MaxSize * 2 + 1); @@ -199,7 +199,7 @@ namespace Priority_Queue { try { - SimpleNode updateMe = GetExistingNode(item); + var updateMe = GetExistingNode(item); _queue.UpdatePriority(updateMe, priority); } catch (InvalidOperationException ex) @@ -211,7 +211,7 @@ namespace Priority_Queue public IEnumerator GetEnumerator() { - List queueData = new List(); + var queueData = new List(); lock (_queue) { //Copy to a separate list because we don't want to 'yield return' inside a lock diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs index ef5c781dc..88d9a346b 100644 --- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs @@ -140,7 +140,7 @@ namespace MediaBrowser.Providers.Movies return _tmdbSettings; } - using (HttpResponseInfo response = await GetMovieDbResponse(new HttpRequestOptions + using (var response = await GetMovieDbResponse(new HttpRequestOptions { Url = string.Format(TmdbConfigUrl, ApiKey), CancellationToken = cancellationToken, @@ -148,7 +148,7 @@ namespace MediaBrowser.Providers.Movies }).ConfigureAwait(false)) { - using (Stream json = response.Content) + using (var json = response.Content) { _tmdbSettings = await _jsonSerializer.DeserializeFromStreamAsync(json).ConfigureAwait(false); diff --git a/MediaBrowser.Providers/Music/ArtistMetadataService.cs b/MediaBrowser.Providers/Music/ArtistMetadataService.cs index de9551f83..5b8782554 100644 --- a/MediaBrowser.Providers/Music/ArtistMetadataService.cs +++ b/MediaBrowser.Providers/Music/ArtistMetadataService.cs @@ -16,7 +16,7 @@ namespace MediaBrowser.Providers.Music protected override IList GetChildrenForMetadataUpdates(MusicArtist item) { return item.IsAccessedByName ? - item.GetTaggedItems(new Controller.Entities.InternalItemsQuery + item.GetTaggedItems(new InternalItemsQuery { Recursive = true, IsFolder = false diff --git a/MediaBrowser.Providers/Omdb/OmdbImageProvider.cs b/MediaBrowser.Providers/Omdb/OmdbImageProvider.cs index 8592b5c67..4e6d223a7 100644 --- a/MediaBrowser.Providers/Omdb/OmdbImageProvider.cs +++ b/MediaBrowser.Providers/Omdb/OmdbImageProvider.cs @@ -50,7 +50,7 @@ namespace MediaBrowser.Providers.Omdb if (!string.IsNullOrWhiteSpace(imdbId)) { - OmdbProvider.RootObject rootObject = await provider.GetRootObject(imdbId, cancellationToken).ConfigureAwait(false); + var rootObject = await provider.GetRootObject(imdbId, cancellationToken).ConfigureAwait(false); if (!string.IsNullOrEmpty(rootObject.Poster)) { diff --git a/MediaBrowser.Providers/Omdb/OmdbProvider.cs b/MediaBrowser.Providers/Omdb/OmdbProvider.cs index c9018a42c..618e5eb2d 100644 --- a/MediaBrowser.Providers/Omdb/OmdbProvider.cs +++ b/MediaBrowser.Providers/Omdb/OmdbProvider.cs @@ -43,7 +43,7 @@ namespace MediaBrowser.Providers.Omdb throw new ArgumentNullException(nameof(imdbId)); } - T item = itemResult.Item; + var item = itemResult.Item; var result = await GetRootObject(imdbId, cancellationToken).ConfigureAwait(false); @@ -113,7 +113,7 @@ namespace MediaBrowser.Providers.Omdb throw new ArgumentNullException(nameof(seriesImdbId)); } - T item = itemResult.Item; + var item = itemResult.Item; var seasonResult = await GetSeasonRootObject(seriesImdbId, seasonNumber, cancellationToken).ConfigureAwait(false); @@ -220,7 +220,7 @@ namespace MediaBrowser.Providers.Omdb string resultString; - using (Stream stream = _fileSystem.GetFileStream(path, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read)) + using (var stream = _fileSystem.GetFileStream(path, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read)) { using (var reader = new StreamReader(stream, new UTF8Encoding(false))) { @@ -239,7 +239,7 @@ namespace MediaBrowser.Providers.Omdb string resultString; - using (Stream stream = _fileSystem.GetFileStream(path, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read)) + using (var stream = _fileSystem.GetFileStream(path, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.Read)) { using (var reader = new StreamReader(stream, new UTF8Encoding(false))) { @@ -394,7 +394,7 @@ namespace MediaBrowser.Providers.Omdb private void ParseAdditionalMetadata(MetadataResult itemResult, RootObject result) where T : BaseItem { - T item = itemResult.Item; + var item = itemResult.Item; var isConfiguredForEnglish = IsConfiguredForEnglish(item) || _configurationManager.Configuration.EnableNewOmdbSupport; diff --git a/MediaBrowser.Providers/People/MovieDbPersonProvider.cs b/MediaBrowser.Providers/People/MovieDbPersonProvider.cs index 8fc5f40f8..9d9d8fef3 100644 --- a/MediaBrowser.Providers/People/MovieDbPersonProvider.cs +++ b/MediaBrowser.Providers/People/MovieDbPersonProvider.cs @@ -265,7 +265,7 @@ namespace MediaBrowser.Providers.People public class PersonSearchResult { /// - /// Gets or sets a value indicating whether this is adult. + /// Gets or sets a value indicating whether this is adult. /// /// true if adult; otherwise, false. public bool Adult { get; set; } @@ -300,7 +300,7 @@ namespace MediaBrowser.Providers.People /// Gets or sets the results. /// /// The results. - public List Results { get; set; } + public List Results { get; set; } /// /// Gets or sets the total_ pages. /// diff --git a/MediaBrowser.Providers/Playlists/PlaylistItemsProvider.cs b/MediaBrowser.Providers/Playlists/PlaylistItemsProvider.cs index 2f2d8eaeb..89c4acf04 100644 --- a/MediaBrowser.Providers/Playlists/PlaylistItemsProvider.cs +++ b/MediaBrowser.Providers/Playlists/PlaylistItemsProvider.cs @@ -131,7 +131,7 @@ namespace MediaBrowser.Providers.Playlists private IEnumerable GetWplItems(Stream stream) { - WplContent content = new WplContent(); + var content = new WplContent(); var playlist = content.GetFromStream(stream); return playlist.PlaylistEntries.Select(i => new LinkedChild diff --git a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs index 0c7fe1e0f..544cfba0d 100644 --- a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs +++ b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs @@ -245,7 +245,7 @@ namespace MediaBrowser.Providers.Subtitles { if (video.VideoType != VideoType.VideoFile) { - return Task.FromResult(new RemoteSubtitleInfo[] { }); + return Task.FromResult(new RemoteSubtitleInfo[] { }); } VideoContentType mediaType; @@ -261,7 +261,7 @@ namespace MediaBrowser.Providers.Subtitles else { // These are the only supported types - return Task.FromResult(new RemoteSubtitleInfo[] { }); + return Task.FromResult(new RemoteSubtitleInfo[] { }); } var request = new SubtitleSearchRequest diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs index f4fe6ee27..958312633 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs @@ -1118,7 +1118,7 @@ namespace MediaBrowser.Providers.TV private void FetchDataFromSeriesNode(MetadataResult result, XmlReader reader, CancellationToken cancellationToken) { - Series item = result.Item; + var item = result.Item; reader.MoveToContent(); reader.Read(); diff --git a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs index 55b49d273..3744df9b4 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs @@ -54,7 +54,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers /// The item. /// The metadata file. /// The cancellation token. - /// + /// /// public void Fetch(MetadataResult item, string metadataFile, CancellationToken cancellationToken) { @@ -225,7 +225,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers protected void ParseProviderLinks(T item, string xml) { //Look for a match for the Regex pattern "tt" followed by 7 digits - Match m = Regex.Match(xml, @"tt([0-9]{7})", RegexOptions.IgnoreCase); + var m = Regex.Match(xml, @"tt([0-9]{7})", RegexOptions.IgnoreCase); if (m.Success) { item.SetProviderId(MetadataProviders.Imdb, m.Value); @@ -379,7 +379,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers { MetadataFields field; - if (Enum.TryParse(i, true, out field)) + if (Enum.TryParse(i, true, out field)) { return (MetadataFields?)field; } diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs index efc6b3358..1efffff3d 100644 --- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs @@ -229,7 +229,7 @@ namespace MediaBrowser.XbmcMetadata.Savers CloseOutput = false }; - using (XmlWriter writer = XmlWriter.Create(stream, settings)) + using (var writer = XmlWriter.Create(stream, settings)) { var root = GetRootElementName(item); diff --git a/Mono.Nat/Mapping.cs b/Mono.Nat/Mapping.cs index 438068934..5b15d4e14 100644 --- a/Mono.Nat/Mapping.cs +++ b/Mono.Nat/Mapping.cs @@ -102,7 +102,7 @@ namespace Mono.Nat public override bool Equals(object obj) { - Mapping other = obj as Mapping; + var other = obj as Mapping; return other == null ? false : this.protocol == other.protocol && this.privatePort == other.privatePort && this.publicPort == other.publicPort; } diff --git a/Mono.Nat/Pmp/PmpNatDevice.cs b/Mono.Nat/Pmp/PmpNatDevice.cs index 9398e2bf9..95bd72a6c 100644 --- a/Mono.Nat/Pmp/PmpNatDevice.cs +++ b/Mono.Nat/Pmp/PmpNatDevice.cs @@ -66,7 +66,7 @@ namespace Mono.Nat.Pmp public override bool Equals(object obj) { - PmpNatDevice device = obj as PmpNatDevice; + var device = obj as PmpNatDevice; return (device == null) ? false : this.Equals(device); } diff --git a/Mono.Nat/Pmp/PmpSearcher.cs b/Mono.Nat/Pmp/PmpSearcher.cs index 5e4155841..cbd0d3686 100644 --- a/Mono.Nat/Pmp/PmpSearcher.cs +++ b/Mono.Nat/Pmp/PmpSearcher.cs @@ -81,14 +81,14 @@ namespace Mono.Nat try { - foreach (NetworkInterface n in NetworkInterface.GetAllNetworkInterfaces()) + foreach (var n in NetworkInterface.GetAllNetworkInterfaces()) { if (n.OperationalStatus != OperationalStatus.Up && n.OperationalStatus != OperationalStatus.Unknown) continue; - IPInterfaceProperties properties = n.GetIPProperties(); - List gatewayList = new List(); + var properties = n.GetIPProperties(); + var gatewayList = new List(); - foreach (GatewayIPAddressInformation gateway in properties.GatewayAddresses) + foreach (var gateway in properties.GatewayAddresses) { if (gateway.Address.AddressFamily == AddressFamily.InterNetwork) { @@ -120,7 +120,7 @@ namespace Mono.Nat if (gatewayList.Count > 0) { - foreach (UnicastIPAddressInformation address in properties.UnicastAddresses) + foreach (var address in properties.UnicastAddresses) { if (address.Address.AddressFamily == AddressFamily.InterNetwork) { @@ -150,7 +150,7 @@ namespace Mono.Nat public async void Search() { - foreach (UdpClient s in sockets) + foreach (var s in sockets) { try { @@ -181,7 +181,7 @@ namespace Mono.Nat // The nat-pmp search message. Must be sent to GatewayIP:53531 byte[] buffer = new byte[] { PmpConstants.Version, PmpConstants.OperationCode }; - foreach (IPEndPoint gatewayEndpoint in gatewayLists[client]) + foreach (var gatewayEndpoint in gatewayLists[client]) { await client.SendAsync(buffer, buffer.Length, gatewayEndpoint).ConfigureAwait(false); } @@ -189,8 +189,8 @@ namespace Mono.Nat bool IsSearchAddress(IPAddress address) { - foreach (List gatewayList in gatewayLists.Values) - foreach (IPEndPoint gatewayEndpoint in gatewayList) + foreach (var gatewayList in gatewayLists.Values) + foreach (var gatewayEndpoint in gatewayList) if (gatewayEndpoint.Address.Equals(address)) return true; return false; @@ -210,7 +210,7 @@ namespace Mono.Nat if (errorcode != 0) _logger.LogDebug("Non zero error: {0}", errorcode); - IPAddress publicIp = new IPAddress(new byte[] { response[8], response[9], response[10], response[11] }); + var publicIp = new IPAddress(new byte[] { response[8], response[9], response[10], response[11] }); nextSearch = DateTime.Now.AddMinutes(5); timeout = 250; diff --git a/Mono.Nat/Upnp/Messages/Requests/CreatePortMappingMessage.cs b/Mono.Nat/Upnp/Messages/Requests/CreatePortMappingMessage.cs index 5a2ab009a..217095e49 100644 --- a/Mono.Nat/Upnp/Messages/Requests/CreatePortMappingMessage.cs +++ b/Mono.Nat/Upnp/Messages/Requests/CreatePortMappingMessage.cs @@ -54,10 +54,10 @@ namespace Mono.Nat.Upnp public override HttpRequestOptions Encode() { - CultureInfo culture = CultureInfo.InvariantCulture; + var culture = CultureInfo.InvariantCulture; - StringBuilder builder = new StringBuilder(256); - XmlWriter writer = CreateWriter(builder); + var builder = new StringBuilder(256); + var writer = CreateWriter(builder); WriteFullElement(writer, "NewRemoteHost", string.Empty); WriteFullElement(writer, "NewExternalPort", this.mapping.PublicPort.ToString(culture)); diff --git a/Mono.Nat/Upnp/Messages/UpnpMessage.cs b/Mono.Nat/Upnp/Messages/UpnpMessage.cs index e734db8f4..1151dd997 100644 --- a/Mono.Nat/Upnp/Messages/UpnpMessage.cs +++ b/Mono.Nat/Upnp/Messages/UpnpMessage.cs @@ -91,7 +91,7 @@ namespace Mono.Nat.Upnp protected XmlWriter CreateWriter(StringBuilder sb) { - XmlWriterSettings settings = new XmlWriterSettings(); + var settings = new XmlWriterSettings(); settings.ConformanceLevel = ConformanceLevel.Fragment; return XmlWriter.Create(sb, settings); } diff --git a/Mono.Nat/Upnp/Searchers/UpnpSearcher.cs b/Mono.Nat/Upnp/Searchers/UpnpSearcher.cs index 57ecdeca9..b70768b6f 100644 --- a/Mono.Nat/Upnp/Searchers/UpnpSearcher.cs +++ b/Mono.Nat/Upnp/Searchers/UpnpSearcher.cs @@ -82,7 +82,7 @@ namespace Mono.Nat * prefix. */ // We have an internet gateway device now - UpnpNatDevice d = new UpnpNatDevice(localAddress, deviceInfo, endpoint, string.Empty, _logger, _httpClient); + var d = new UpnpNatDevice(localAddress, deviceInfo, endpoint, string.Empty, _logger, _httpClient); await d.GetServicesList().ConfigureAwait(false); diff --git a/Mono.Nat/Upnp/UpnpNatDevice.cs b/Mono.Nat/Upnp/UpnpNatDevice.cs index f37d6dd0c..63a28ebdc 100644 --- a/Mono.Nat/Upnp/UpnpNatDevice.cs +++ b/Mono.Nat/Upnp/UpnpNatDevice.cs @@ -109,8 +109,8 @@ namespace Mono.Nat.Upnp int abortCount = 0; int bytesRead = 0; byte[] buffer = new byte[10240]; - StringBuilder servicesXml = new StringBuilder(); - XmlDocument xmldoc = new XmlDocument(); + var servicesXml = new StringBuilder(); + var xmldoc = new XmlDocument(); using (var s = response.Content) { @@ -144,9 +144,9 @@ namespace Mono.Nat.Upnp } } - XmlNamespaceManager ns = new XmlNamespaceManager(xmldoc.NameTable); + var ns = new XmlNamespaceManager(xmldoc.NameTable); ns.AddNamespace("ns", "urn:schemas-upnp-org:device-1-0"); - XmlNodeList nodes = xmldoc.SelectNodes("//*/ns:serviceList", ns); + var nodes = xmldoc.SelectNodes("//*/ns:serviceList", ns); foreach (XmlNode node in nodes) { @@ -169,7 +169,7 @@ namespace Mono.Nat.Upnp { if (u.IsAbsoluteUri) { - EndPoint old = hostEndPoint; + var old = hostEndPoint; IPAddress parsedHostIpAddress; if (IPAddress.TryParse(u.Host, out parsedHostIpAddress)) { @@ -228,7 +228,7 @@ namespace Mono.Nat.Upnp public override async Task CreatePortMap(Mapping mapping) { - CreatePortMappingMessage message = new CreatePortMappingMessage(mapping, localAddress, this); + var message = new CreatePortMappingMessage(mapping, localAddress, this); using (await _httpClient.SendAsync(message.Encode(), message.Method).ConfigureAwait(false)) { @@ -237,7 +237,7 @@ namespace Mono.Nat.Upnp public override bool Equals(object obj) { - UpnpNatDevice device = obj as UpnpNatDevice; + var device = obj as UpnpNatDevice; return (device == null) ? false : this.Equals((device)); } diff --git a/OpenSubtitlesHandler/Console/OSHConsole.cs b/OpenSubtitlesHandler/Console/OSHConsole.cs index 586377e53..396b28cbc 100644 --- a/OpenSubtitlesHandler/Console/OSHConsole.cs +++ b/OpenSubtitlesHandler/Console/OSHConsole.cs @@ -58,7 +58,7 @@ namespace OpenSubtitlesHandler.Console /// /// Console Debug Args /// - public class DebugEventArgs : System.EventArgs + public class DebugEventArgs : EventArgs { public DebugCode Code { get; private set; } public string Text { get; private set; } diff --git a/OpenSubtitlesHandler/MovieHasher.cs b/OpenSubtitlesHandler/MovieHasher.cs index 5a93edd5c..25d91c1ac 100644 --- a/OpenSubtitlesHandler/MovieHasher.cs +++ b/OpenSubtitlesHandler/MovieHasher.cs @@ -37,7 +37,7 @@ namespace OpenSubtitlesHandler public static string ToHexadecimal(byte[] bytes) { - StringBuilder hexBuilder = new StringBuilder(); + var hexBuilder = new StringBuilder(); for (int i = 0; i < bytes.Length; i++) { hexBuilder.Append(bytes[i].ToString("x2")); diff --git a/OpenSubtitlesHandler/OpenSubtitles.cs b/OpenSubtitlesHandler/OpenSubtitles.cs index 4a44ccde3..ddf2e83e8 100644 --- a/OpenSubtitlesHandler/OpenSubtitles.cs +++ b/OpenSubtitlesHandler/OpenSubtitles.cs @@ -57,12 +57,12 @@ namespace OpenSubtitlesHandler public static IMethodResponse LogIn(string userName, string password, string language) { // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(userName)); parms.Add(new XmlRpcValueBasic(password)); parms.Add(new XmlRpcValueBasic(language)); parms.Add(new XmlRpcValueBasic(XML_PRC_USERAGENT)); - XmlRpcMethodCall call = new XmlRpcMethodCall("LogIn", parms); + var call = new XmlRpcMethodCall("LogIn", parms); OSHConsole.WriteLine("Sending LogIn request to the server ...", DebugCode.Good); //File.WriteAllText(".\\request.txt", Encoding.UTF8.GetString(XmlRpcGenerator.Generate(call))); @@ -77,9 +77,9 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; - MethodResponseLogIn re = new MethodResponseLogIn("Success", "Log in successful."); - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var re = new MethodResponseLogIn("Success", "Log in successful."); + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { @@ -103,12 +103,12 @@ namespace OpenSubtitlesHandler public static async Task LogInAsync(string userName, string password, string language, CancellationToken cancellationToken) { // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(userName)); parms.Add(new XmlRpcValueBasic(password)); parms.Add(new XmlRpcValueBasic(language)); parms.Add(new XmlRpcValueBasic(XML_PRC_USERAGENT)); - XmlRpcMethodCall call = new XmlRpcMethodCall("LogIn", parms); + var call = new XmlRpcMethodCall("LogIn", parms); OSHConsole.WriteLine("Sending LogIn request to the server ...", DebugCode.Good); //File.WriteAllText(".\\request.txt", Encoding.UTF8.GetString(XmlRpcGenerator.Generate(call))); @@ -126,9 +126,9 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; - MethodResponseLogIn re = new MethodResponseLogIn("Success", "Log in successful."); - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var re = new MethodResponseLogIn("Success", "Log in successful."); + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { @@ -170,9 +170,9 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(TOKEN, XmlRpcBasicValueType.String)); - XmlRpcMethodCall call = new XmlRpcMethodCall("LogOut", parms); + var call = new XmlRpcMethodCall("LogOut", parms); OSHConsole.WriteLine("Sending LogOut request to the server ...", DebugCode.Good); // Send the request to the server @@ -185,10 +185,10 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct strct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var strct = (XmlRpcValueStruct)calls[0].Parameters[0]; OSHConsole.WriteLine("STATUS=" + ((XmlRpcValueBasic)strct.Members[0].Data).Data.ToString()); OSHConsole.WriteLine("SECONDS=" + ((XmlRpcValueBasic)strct.Members[1].Data).Data.ToString()); - MethodResponseLogIn re = new MethodResponseLogIn("Success", "Log out successful."); + var re = new MethodResponseLogIn("Success", "Log out successful."); re.Status = ((XmlRpcValueBasic)strct.Members[0].Data).Data.ToString(); re.Seconds = (double)((XmlRpcValueBasic)strct.Members[1].Data).Data; return re; @@ -214,10 +214,10 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(TOKEN, XmlRpcBasicValueType.String)); parms.Add(new XmlRpcValueBasic(XML_PRC_USERAGENT, XmlRpcBasicValueType.String)); - XmlRpcMethodCall call = new XmlRpcMethodCall("NoOperation", parms); + var call = new XmlRpcMethodCall("NoOperation", parms); OSHConsole.WriteLine("Sending NoOperation request to the server ...", DebugCode.Good); // Send the request to the server @@ -230,18 +230,18 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - MethodResponseNoOperation R = new MethodResponseNoOperation(); - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var R = new MethodResponseNoOperation(); + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { case "status": R.Status = (string)MEMBER.Data.Data; OSHConsole.WriteLine(MEMBER.Name + "= " + MEMBER.Data.Data); break; case "seconds": R.Seconds = (double)MEMBER.Data.Data; OSHConsole.WriteLine(MEMBER.Name + "= " + MEMBER.Data.Data); break; case "download_limits": - XmlRpcValueStruct dlStruct = (XmlRpcValueStruct)MEMBER.Data; - foreach (XmlRpcStructMember dlmember in dlStruct.Members) + var dlStruct = (XmlRpcValueStruct)MEMBER.Data; + foreach (var dlmember in dlStruct.Members) { OSHConsole.WriteLine(" >" + dlmember.Name + "= " + dlmember.Data.Data.ToString()); switch (dlmember.Name) @@ -292,16 +292,16 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "No subtitle search parameter passed"); } // Method call .. - List parms = new List(); + var parms = new List(); // Add token param parms.Add(new XmlRpcValueBasic(TOKEN, XmlRpcBasicValueType.String)); // Add subtitle search parameters. Each one will be like 'array' of structs. - XmlRpcValueArray array = new XmlRpcValueArray(); - foreach (SubtitleSearchParameters param in parameters) + var array = new XmlRpcValueArray(); + foreach (var param in parameters) { - XmlRpcValueStruct strct = new XmlRpcValueStruct(new List()); + var strct = new XmlRpcValueStruct(new List()); // sublanguageid member - XmlRpcStructMember member = new XmlRpcStructMember("sublanguageid", + var member = new XmlRpcStructMember("sublanguageid", new XmlRpcValueBasic(param.SubLangaugeID, XmlRpcBasicValueType.String)); strct.Members.Add(member); // moviehash member @@ -345,7 +345,7 @@ namespace OpenSubtitlesHandler // Add the array to the parameters parms.Add(array); // Call ! - XmlRpcMethodCall call = new XmlRpcMethodCall("SearchSubtitles", parms); + var call = new XmlRpcMethodCall("SearchSubtitles", parms); OSHConsole.WriteLine("Sending SearchSubtitles request to the server ...", DebugCode.Good); // Send the request to the server string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT)); @@ -362,11 +362,11 @@ namespace OpenSubtitlesHandler //* the first is status //* the second is [array of structs, each one includes subtitle file]. //* the third is [double basic value] represent seconds token by server. - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseSubtitleSearch R = new MethodResponseSubtitleSearch(); + var R = new MethodResponseSubtitleSearch(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { if (MEMBER.Name == "status") { @@ -384,14 +384,14 @@ namespace OpenSubtitlesHandler { OSHConsole.WriteLine("Search results: "); - XmlRpcValueArray rarray = (XmlRpcValueArray)MEMBER.Data; - foreach (IXmlRpcValue subStruct in rarray.Values) + var rarray = (XmlRpcValueArray)MEMBER.Data; + foreach (var subStruct in rarray.Values) { if (subStruct == null) continue; if (!(subStruct is XmlRpcValueStruct)) continue; - SubtitleSearchResult result = new SubtitleSearchResult(); - foreach (XmlRpcStructMember submember in ((XmlRpcValueStruct)subStruct).Members) + var result = new SubtitleSearchResult(); + foreach (var submember in ((XmlRpcValueStruct)subStruct).Members) { // To avoid errors of arranged info or missing ones, let's do it with switch.. switch (submember.Name) @@ -472,16 +472,16 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "No subtitle search parameter passed"); } // Method call .. - List parms = new List(); + var parms = new List(); // Add token param parms.Add(new XmlRpcValueBasic(TOKEN, XmlRpcBasicValueType.String)); // Add subtitle search parameters. Each one will be like 'array' of structs. - XmlRpcValueArray array = new XmlRpcValueArray(); - foreach (SubtitleSearchParameters param in parameters) + var array = new XmlRpcValueArray(); + foreach (var param in parameters) { - XmlRpcValueStruct strct = new XmlRpcValueStruct(new List()); + var strct = new XmlRpcValueStruct(new List()); // sublanguageid member - XmlRpcStructMember member = new XmlRpcStructMember("sublanguageid", + var member = new XmlRpcStructMember("sublanguageid", new XmlRpcValueBasic(param.SubLangaugeID, XmlRpcBasicValueType.String)); strct.Members.Add(member); // moviehash member @@ -525,7 +525,7 @@ namespace OpenSubtitlesHandler // Add the array to the parameters parms.Add(array); // Call ! - XmlRpcMethodCall call = new XmlRpcMethodCall("SearchSubtitles", parms); + var call = new XmlRpcMethodCall("SearchSubtitles", parms); OSHConsole.WriteLine("Sending SearchSubtitles request to the server ...", DebugCode.Good); // Send the request to the server string response = Utilities.GetStreamString(await Utilities.SendRequestAsync(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT, cancellationToken).ConfigureAwait(false)); @@ -542,11 +542,11 @@ namespace OpenSubtitlesHandler //* the first is status //* the second is [array of structs, each one includes subtitle file]. //* the third is [double basic value] represent seconds token by server. - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseSubtitleSearch R = new MethodResponseSubtitleSearch(); + var R = new MethodResponseSubtitleSearch(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { if (MEMBER.Name == "status") { @@ -564,14 +564,14 @@ namespace OpenSubtitlesHandler { OSHConsole.WriteLine("Search results: "); - XmlRpcValueArray rarray = (XmlRpcValueArray)MEMBER.Data; - foreach (IXmlRpcValue subStruct in rarray.Values) + var rarray = (XmlRpcValueArray)MEMBER.Data; + foreach (var subStruct in rarray.Values) { if (subStruct == null) continue; if (!(subStruct is XmlRpcValueStruct)) continue; - SubtitleSearchResult result = new SubtitleSearchResult(); - foreach (XmlRpcStructMember submember in ((XmlRpcValueStruct)subStruct).Members) + var result = new SubtitleSearchResult(); + foreach (var submember in ((XmlRpcValueStruct)subStruct).Members) { // To avoid errors of arranged info or missing ones, let's do it with switch.. switch (submember.Name) @@ -657,11 +657,11 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "No subtitle id passed"); } // Method call .. - List parms = new List(); + var parms = new List(); // Add token param parms.Add(new XmlRpcValueBasic(TOKEN, XmlRpcBasicValueType.String)); // Add subtitle search parameters. Each one will be like 'array' of structs. - XmlRpcValueArray array = new XmlRpcValueArray(); + var array = new XmlRpcValueArray(); foreach (int id in subIDS) { array.Values.Add(new XmlRpcValueBasic(id, XmlRpcBasicValueType.Int)); @@ -669,7 +669,7 @@ namespace OpenSubtitlesHandler // Add the array to the parameters parms.Add(array); // Call ! - XmlRpcMethodCall call = new XmlRpcMethodCall("DownloadSubtitles", parms); + var call = new XmlRpcMethodCall("DownloadSubtitles", parms); OSHConsole.WriteLine("Sending DownloadSubtitles request to the server ...", DebugCode.Good); // Send the request to the server string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT)); @@ -685,12 +685,12 @@ namespace OpenSubtitlesHandler //* the first is status //* the second is [array of structs, each one includes subtitle file]. //* the third is [double basic value] represent seconds token by server. - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseSubtitleDownload R = new MethodResponseSubtitleDownload(); + var R = new MethodResponseSubtitleDownload(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { if (MEMBER.Name == "status") { @@ -707,14 +707,14 @@ namespace OpenSubtitlesHandler if (MEMBER.Data is XmlRpcValueArray) { OSHConsole.WriteLine("Download results:"); - XmlRpcValueArray rarray = (XmlRpcValueArray)MEMBER.Data; - foreach (IXmlRpcValue subStruct in rarray.Values) + var rarray = (XmlRpcValueArray)MEMBER.Data; + foreach (var subStruct in rarray.Values) { if (subStruct == null) continue; if (!(subStruct is XmlRpcValueStruct)) continue; - SubtitleDownloadResult result = new SubtitleDownloadResult(); - foreach (XmlRpcStructMember submember in ((XmlRpcValueStruct)subStruct).Members) + var result = new SubtitleDownloadResult(); + foreach (var submember in ((XmlRpcValueStruct)subStruct).Members) { // To avoid errors of arranged info or missing ones, let's do it with switch.. switch (submember.Name) @@ -764,11 +764,11 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "No subtitle id passed"); } // Method call .. - List parms = new List(); + var parms = new List(); // Add token param parms.Add(new XmlRpcValueBasic(TOKEN, XmlRpcBasicValueType.String)); // Add subtitle search parameters. Each one will be like 'array' of structs. - XmlRpcValueArray array = new XmlRpcValueArray(); + var array = new XmlRpcValueArray(); foreach (int id in subIDS) { array.Values.Add(new XmlRpcValueBasic(id, XmlRpcBasicValueType.Int)); @@ -776,7 +776,7 @@ namespace OpenSubtitlesHandler // Add the array to the parameters parms.Add(array); // Call ! - XmlRpcMethodCall call = new XmlRpcMethodCall("DownloadSubtitles", parms); + var call = new XmlRpcMethodCall("DownloadSubtitles", parms); OSHConsole.WriteLine("Sending DownloadSubtitles request to the server ...", DebugCode.Good); // Send the request to the server @@ -795,12 +795,12 @@ namespace OpenSubtitlesHandler //* the first is status //* the second is [array of structs, each one includes subtitle file]. //* the third is [double basic value] represent seconds token by server. - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseSubtitleDownload R = new MethodResponseSubtitleDownload(); + var R = new MethodResponseSubtitleDownload(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { if (MEMBER.Name == "status") { @@ -817,14 +817,14 @@ namespace OpenSubtitlesHandler if (MEMBER.Data is XmlRpcValueArray) { OSHConsole.WriteLine("Download results:"); - XmlRpcValueArray rarray = (XmlRpcValueArray)MEMBER.Data; - foreach (IXmlRpcValue subStruct in rarray.Values) + var rarray = (XmlRpcValueArray)MEMBER.Data; + foreach (var subStruct in rarray.Values) { if (subStruct == null) continue; if (!(subStruct is XmlRpcValueStruct)) continue; - SubtitleDownloadResult result = new SubtitleDownloadResult(); - foreach (XmlRpcStructMember submember in ((XmlRpcValueStruct)subStruct).Members) + var result = new SubtitleDownloadResult(); + foreach (var submember in ((XmlRpcValueStruct)subStruct).Members) { // To avoid errors of arranged info or missing ones, let's do it with switch.. switch (submember.Name) @@ -879,15 +879,15 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "No subtitle id passed"); } // Method call .. - List parms = new List(); + var parms = new List(); // Add token param parms.Add(new XmlRpcValueBasic(TOKEN)); // Add subtitle search parameters. Each one will be like 'array' of structs. - XmlRpcValueArray array = new XmlRpcValueArray(subIDS); + var array = new XmlRpcValueArray(subIDS); // Add the array to the parameters parms.Add(array); // Call ! - XmlRpcMethodCall call = new XmlRpcMethodCall("GetComments", parms); + var call = new XmlRpcMethodCall("GetComments", parms); OSHConsole.WriteLine("Sending GetComments request to the server ...", DebugCode.Good); // Send the request to the server string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT)); @@ -899,12 +899,12 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseGetComments R = new MethodResponseGetComments(); + var R = new MethodResponseGetComments(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { if (MEMBER.Name == "status") { @@ -921,14 +921,14 @@ namespace OpenSubtitlesHandler if (MEMBER.Data is XmlRpcValueArray) { OSHConsole.WriteLine("Comments results:"); - XmlRpcValueArray rarray = (XmlRpcValueArray)MEMBER.Data; - foreach (IXmlRpcValue commentStruct in rarray.Values) + var rarray = (XmlRpcValueArray)MEMBER.Data; + foreach (var commentStruct in rarray.Values) { if (commentStruct == null) continue; if (!(commentStruct is XmlRpcValueStruct)) continue; - GetCommentsResult result = new GetCommentsResult(); - foreach (XmlRpcStructMember commentmember in ((XmlRpcValueStruct)commentStruct).Members) + var result = new GetCommentsResult(); + foreach (var commentmember in ((XmlRpcValueStruct)commentStruct).Members) { // To avoid errors of arranged info or missing ones, let's do it with switch.. switch (commentmember.Name) @@ -977,22 +977,22 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(TOKEN, XmlRpcBasicValueType.String)); // Array of sub langs - XmlRpcValueArray a = new XmlRpcValueArray(languageIDS); + var a = new XmlRpcValueArray(languageIDS); parms.Add(a); // Array of video parameters a = new XmlRpcValueArray(); - foreach (SearchToMailMovieParameter p in movies) + foreach (var p in movies) { - XmlRpcValueStruct str = new XmlRpcValueStruct(new List()); + var str = new XmlRpcValueStruct(new List()); str.Members.Add(new XmlRpcStructMember("moviehash", new XmlRpcValueBasic(p.moviehash))); str.Members.Add(new XmlRpcStructMember("moviesize", new XmlRpcValueBasic(p.moviesize))); a.Values.Add(str); } parms.Add(a); - XmlRpcMethodCall call = new XmlRpcMethodCall("SearchToMail", parms); + var call = new XmlRpcMethodCall("SearchToMail", parms); OSHConsole.WriteLine("Sending SearchToMail request to the server ...", DebugCode.Good); // Send the request to the server @@ -1005,12 +1005,12 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseSearchToMail R = new MethodResponseSearchToMail(); + var R = new MethodResponseSearchToMail(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { @@ -1044,13 +1044,13 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); // Add token param parms.Add(new XmlRpcValueBasic(TOKEN, XmlRpcBasicValueType.String)); // Add query param parms.Add(new XmlRpcValueBasic(query, XmlRpcBasicValueType.String)); // Call ! - XmlRpcMethodCall call = new XmlRpcMethodCall("SearchMoviesOnIMDB", parms); + var call = new XmlRpcMethodCall("SearchMoviesOnIMDB", parms); OSHConsole.WriteLine("Sending SearchMoviesOnIMDB request to the server ...", DebugCode.Good); // Send the request to the server string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT)); @@ -1062,12 +1062,12 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseMovieSearch R = new MethodResponseMovieSearch(); + var R = new MethodResponseMovieSearch(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { if (MEMBER.Name == "status") { @@ -1084,14 +1084,14 @@ namespace OpenSubtitlesHandler if (MEMBER.Data is XmlRpcValueArray) { OSHConsole.WriteLine("Search results:"); - XmlRpcValueArray rarray = (XmlRpcValueArray)MEMBER.Data; - foreach (IXmlRpcValue subStruct in rarray.Values) + var rarray = (XmlRpcValueArray)MEMBER.Data; + foreach (var subStruct in rarray.Values) { if (subStruct == null) continue; if (!(subStruct is XmlRpcValueStruct)) continue; - MovieSearchResult result = new MovieSearchResult(); - foreach (XmlRpcStructMember submember in ((XmlRpcValueStruct)subStruct).Members) + var result = new MovieSearchResult(); + foreach (var submember in ((XmlRpcValueStruct)subStruct).Members) { // To avoid errors of arranged info or missing ones, let's do it with switch.. switch (submember.Name) @@ -1135,13 +1135,13 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); // Add token param parms.Add(new XmlRpcValueBasic(TOKEN)); // Add query param parms.Add(new XmlRpcValueBasic(imdbid)); // Call ! - XmlRpcMethodCall call = new XmlRpcMethodCall("GetIMDBMovieDetails", parms); + var call = new XmlRpcMethodCall("GetIMDBMovieDetails", parms); OSHConsole.WriteLine("Sending GetIMDBMovieDetails request to the server ...", DebugCode.Good); // Send the request to the server string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT)); @@ -1153,12 +1153,12 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseMovieDetails R = new MethodResponseMovieDetails(); + var R = new MethodResponseMovieDetails(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { if (MEMBER.Name == "status") { @@ -1176,8 +1176,8 @@ namespace OpenSubtitlesHandler if (MEMBER.Data is XmlRpcValueStruct) { OSHConsole.WriteLine("Details result:"); - XmlRpcValueStruct detailsStruct = (XmlRpcValueStruct)MEMBER.Data; - foreach (XmlRpcStructMember dmem in detailsStruct.Members) + var detailsStruct = (XmlRpcValueStruct)MEMBER.Data; + foreach (var dmem in detailsStruct.Members) { switch (dmem.Name) { @@ -1193,8 +1193,8 @@ namespace OpenSubtitlesHandler case "cast": // this is another struct with cast members... OSHConsole.WriteLine(">" + dmem.Name + "= "); - XmlRpcValueStruct castStruct = (XmlRpcValueStruct)dmem.Data; - foreach (XmlRpcStructMember castMemeber in castStruct.Members) + var castStruct = (XmlRpcValueStruct)dmem.Data; + foreach (var castMemeber in castStruct.Members) { R.Cast.Add(castMemeber.Data.Data.ToString()); OSHConsole.WriteLine(" >" + castMemeber.Data.Data.ToString()); @@ -1203,8 +1203,8 @@ namespace OpenSubtitlesHandler case "directors": OSHConsole.WriteLine(">" + dmem.Name + "= "); // this is another struct with directors members... - XmlRpcValueStruct directorsStruct = (XmlRpcValueStruct)dmem.Data; - foreach (XmlRpcStructMember directorsMember in directorsStruct.Members) + var directorsStruct = (XmlRpcValueStruct)dmem.Data; + foreach (var directorsMember in directorsStruct.Members) { R.Directors.Add(directorsMember.Data.Data.ToString()); OSHConsole.WriteLine(" >" + directorsMember.Data.Data.ToString()); @@ -1213,8 +1213,8 @@ namespace OpenSubtitlesHandler case "writers": OSHConsole.WriteLine(">" + dmem.Name + "= "); // this is another struct with writers members... - XmlRpcValueStruct writersStruct = (XmlRpcValueStruct)dmem.Data; - foreach (XmlRpcStructMember writersMember in writersStruct.Members) + var writersStruct = (XmlRpcValueStruct)dmem.Data; + foreach (var writersMember in writersStruct.Members) { R.Writers.Add(writersMember.Data.Data.ToString()); OSHConsole.WriteLine("+->" + writersMember.Data.Data.ToString()); @@ -1222,7 +1222,7 @@ namespace OpenSubtitlesHandler break; case "awards": // this is an array of genres... - XmlRpcValueArray awardsArray = (XmlRpcValueArray)dmem.Data; + var awardsArray = (XmlRpcValueArray)dmem.Data; foreach (XmlRpcValueBasic award in awardsArray.Values) { R.Awards.Add(award.Data.ToString()); @@ -1232,7 +1232,7 @@ namespace OpenSubtitlesHandler case "genres": OSHConsole.WriteLine(">" + dmem.Name + "= "); // this is an array of genres... - XmlRpcValueArray genresArray = (XmlRpcValueArray)dmem.Data; + var genresArray = (XmlRpcValueArray)dmem.Data; foreach (XmlRpcValueBasic genre in genresArray.Values) { R.Genres.Add(genre.Data.ToString()); @@ -1242,7 +1242,7 @@ namespace OpenSubtitlesHandler case "country": OSHConsole.WriteLine(">" + dmem.Name + "= "); // this is an array of country... - XmlRpcValueArray countryArray = (XmlRpcValueArray)dmem.Data; + var countryArray = (XmlRpcValueArray)dmem.Data; foreach (XmlRpcValueBasic country in countryArray.Values) { R.Country.Add(country.Data.ToString()); @@ -1252,7 +1252,7 @@ namespace OpenSubtitlesHandler case "language": OSHConsole.WriteLine(">" + dmem.Name + "= "); // this is an array of language... - XmlRpcValueArray languageArray = (XmlRpcValueArray)dmem.Data; + var languageArray = (XmlRpcValueArray)dmem.Data; foreach (XmlRpcValueBasic language in languageArray.Values) { R.Language.Add(language.Data.ToString()); @@ -1262,7 +1262,7 @@ namespace OpenSubtitlesHandler case "certification": OSHConsole.WriteLine(">" + dmem.Name + "= "); // this is an array of certification... - XmlRpcValueArray certificationArray = (XmlRpcValueArray)dmem.Data; + var certificationArray = (XmlRpcValueArray)dmem.Data; foreach (XmlRpcValueBasic certification in certificationArray.Values) { R.Certification.Add(certification.Data.ToString()); @@ -1304,16 +1304,16 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); // Add token param parms.Add(new XmlRpcValueBasic(TOKEN, XmlRpcBasicValueType.String)); // Add movieinfo struct - XmlRpcValueStruct movieinfo = new XmlRpcValueStruct(new List()); + var movieinfo = new XmlRpcValueStruct(new List()); movieinfo.Members.Add(new XmlRpcStructMember("moviename", new XmlRpcValueBasic(movieName))); movieinfo.Members.Add(new XmlRpcStructMember("movieyear", new XmlRpcValueBasic(movieyear))); parms.Add(movieinfo); // Call ! - XmlRpcMethodCall call = new XmlRpcMethodCall("InsertMovie", parms); + var call = new XmlRpcMethodCall("InsertMovie", parms); OSHConsole.WriteLine("Sending InsertMovie request to the server ...", DebugCode.Good); // Send the request to the server string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT)); @@ -1325,12 +1325,12 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseInsertMovie R = new MethodResponseInsertMovie(); + var R = new MethodResponseInsertMovie(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { if (MEMBER.Name == "status") { @@ -1373,11 +1373,11 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(TOKEN, XmlRpcBasicValueType.String)); - foreach (InsertMovieHashParameters p in parameters) + foreach (var p in parameters) { - XmlRpcValueStruct pstruct = new XmlRpcValueStruct(new List()); + var pstruct = new XmlRpcValueStruct(new List()); pstruct.Members.Add(new XmlRpcStructMember("moviehash", new XmlRpcValueBasic(p.moviehash))); pstruct.Members.Add(new XmlRpcStructMember("moviebytesize", new XmlRpcValueBasic(p.moviebytesize))); pstruct.Members.Add(new XmlRpcStructMember("imdbid", new XmlRpcValueBasic(p.imdbid))); @@ -1386,7 +1386,7 @@ namespace OpenSubtitlesHandler pstruct.Members.Add(new XmlRpcStructMember("moviefilename", new XmlRpcValueBasic(p.moviefilename))); parms.Add(pstruct); } - XmlRpcMethodCall call = new XmlRpcMethodCall("InsertMovieHash", parms); + var call = new XmlRpcMethodCall("InsertMovieHash", parms); OSHConsole.WriteLine("Sending InsertMovieHash request to the server ...", DebugCode.Good); // Send the request to the server @@ -1399,12 +1399,12 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseInsertMovieHash R = new MethodResponseInsertMovieHash(); + var R = new MethodResponseInsertMovieHash(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { @@ -1417,14 +1417,14 @@ namespace OpenSubtitlesHandler OSHConsole.WriteLine(">" + MEMBER.Name + "= " + MEMBER.Data.Data.ToString()); break; case "data": - XmlRpcValueStruct dataStruct = (XmlRpcValueStruct)MEMBER.Data; - foreach (XmlRpcStructMember dataMember in dataStruct.Members) + var dataStruct = (XmlRpcValueStruct)MEMBER.Data; + foreach (var dataMember in dataStruct.Members) { switch (dataMember.Name) { case "accepted_moviehashes": - XmlRpcValueArray mh = (XmlRpcValueArray)dataMember.Data; - foreach (IXmlRpcValue val in mh.Values) + var mh = (XmlRpcValueArray)dataMember.Data; + foreach (var val in mh.Values) { if (val is XmlRpcValueBasic) { @@ -1433,8 +1433,8 @@ namespace OpenSubtitlesHandler } break; case "new_imdbs": - XmlRpcValueArray mi = (XmlRpcValueArray)dataMember.Data; - foreach (IXmlRpcValue val in mi.Values) + var mi = (XmlRpcValueArray)dataMember.Data; + foreach (var val in mi.Values) { if (val is XmlRpcValueBasic) { @@ -1472,10 +1472,10 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(TOKEN, XmlRpcBasicValueType.String)); parms.Add(new XmlRpcValueBasic(XML_PRC_USERAGENT, XmlRpcBasicValueType.String)); - XmlRpcMethodCall call = new XmlRpcMethodCall("ServerInfo", parms); + var call = new XmlRpcMethodCall("ServerInfo", parms); OSHConsole.WriteLine("Sending ServerInfo request to the server ...", DebugCode.Good); // Send the request to the server @@ -1488,12 +1488,12 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseServerInfo R = new MethodResponseServerInfo(); + var R = new MethodResponseServerInfo(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { @@ -1568,8 +1568,8 @@ namespace OpenSubtitlesHandler case "last_update_strings": //R.total_subtitles_languages = (string)MEMBER.Data.Data; OSHConsole.WriteLine(">" + MEMBER.Name + ":"); - XmlRpcValueStruct luStruct = (XmlRpcValueStruct)MEMBER.Data; - foreach (XmlRpcStructMember luMemeber in luStruct.Members) + var luStruct = (XmlRpcValueStruct)MEMBER.Data; + foreach (var luMemeber in luStruct.Members) { R.last_update_strings.Add(luMemeber.Name + " [" + luMemeber.Data.Data.ToString() + "]"); OSHConsole.WriteLine(" >" + luMemeber.Name + "= " + luMemeber.Data.Data.ToString()); @@ -1602,10 +1602,10 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(TOKEN, XmlRpcBasicValueType.String)); parms.Add(new XmlRpcValueBasic(IDSubMovieFile, XmlRpcBasicValueType.String)); - XmlRpcMethodCall call = new XmlRpcMethodCall("ReportWrongMovieHash", parms); + var call = new XmlRpcMethodCall("ReportWrongMovieHash", parms); OSHConsole.WriteLine("Sending ReportWrongMovieHash request to the server ...", DebugCode.Good); // Send the request to the server @@ -1618,12 +1618,12 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseReportWrongMovieHash R = new MethodResponseReportWrongMovieHash(); + var R = new MethodResponseReportWrongMovieHash(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { @@ -1666,14 +1666,14 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(TOKEN, XmlRpcBasicValueType.String)); - XmlRpcValueStruct s = new XmlRpcValueStruct(new List()); + var s = new XmlRpcValueStruct(new List()); s.Members.Add(new XmlRpcStructMember("moviehash", new XmlRpcValueBasic(moviehash))); s.Members.Add(new XmlRpcStructMember("moviebytesize", new XmlRpcValueBasic(moviebytesize))); s.Members.Add(new XmlRpcStructMember("imdbid", new XmlRpcValueBasic(imdbid))); parms.Add(s); - XmlRpcMethodCall call = new XmlRpcMethodCall("ReportWrongImdbMovie", parms); + var call = new XmlRpcMethodCall("ReportWrongImdbMovie", parms); OSHConsole.WriteLine("Sending ReportWrongImdbMovie request to the server ...", DebugCode.Good); // Send the request to the server @@ -1686,12 +1686,12 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseAddComment R = new MethodResponseAddComment(); + var R = new MethodResponseAddComment(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { @@ -1725,13 +1725,13 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(TOKEN, XmlRpcBasicValueType.String)); - XmlRpcValueStruct s = new XmlRpcValueStruct(new List()); + var s = new XmlRpcValueStruct(new List()); s.Members.Add(new XmlRpcStructMember("idsubtitle", new XmlRpcValueBasic(idsubtitle))); s.Members.Add(new XmlRpcStructMember("score", new XmlRpcValueBasic(score))); parms.Add(s); - XmlRpcMethodCall call = new XmlRpcMethodCall("SubtitlesVote", parms); + var call = new XmlRpcMethodCall("SubtitlesVote", parms); OSHConsole.WriteLine("Sending SubtitlesVote request to the server ...", DebugCode.Good); // Send the request to the server @@ -1744,20 +1744,20 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseSubtitlesVote R = new MethodResponseSubtitlesVote(); + var R = new MethodResponseSubtitlesVote(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { case "status": R.Status = (string)MEMBER.Data.Data; OSHConsole.WriteLine(">" + MEMBER.Name + "= " + MEMBER.Data.Data.ToString()); break; case "seconds": R.Seconds = (double)MEMBER.Data.Data; OSHConsole.WriteLine(">" + MEMBER.Name + "= " + MEMBER.Data.Data.ToString()); break; case "data": - XmlRpcValueStruct dataStruct = (XmlRpcValueStruct)MEMBER.Data; - foreach (XmlRpcStructMember dataMemeber in dataStruct.Members) + var dataStruct = (XmlRpcValueStruct)MEMBER.Data; + foreach (var dataMemeber in dataStruct.Members) { OSHConsole.WriteLine(" >" + dataMemeber.Name + "= " + dataMemeber.Data.Data.ToString()); switch (dataMemeber.Name) @@ -1797,14 +1797,14 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(TOKEN, XmlRpcBasicValueType.String)); - XmlRpcValueStruct s = new XmlRpcValueStruct(new List()); + var s = new XmlRpcValueStruct(new List()); s.Members.Add(new XmlRpcStructMember("idsubtitle", new XmlRpcValueBasic(idsubtitle))); s.Members.Add(new XmlRpcStructMember("comment", new XmlRpcValueBasic(comment))); s.Members.Add(new XmlRpcStructMember("badsubtitle", new XmlRpcValueBasic(badsubtitle))); parms.Add(s); - XmlRpcMethodCall call = new XmlRpcMethodCall("AddComment", parms); + var call = new XmlRpcMethodCall("AddComment", parms); OSHConsole.WriteLine("Sending AddComment request to the server ...", DebugCode.Good); // Send the request to the server @@ -1817,12 +1817,12 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseAddComment R = new MethodResponseAddComment(); + var R = new MethodResponseAddComment(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { @@ -1857,14 +1857,14 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(TOKEN, XmlRpcBasicValueType.String)); - XmlRpcValueStruct s = new XmlRpcValueStruct(new List()); + var s = new XmlRpcValueStruct(new List()); s.Members.Add(new XmlRpcStructMember("sublanguageid", new XmlRpcValueBasic(sublanguageid))); s.Members.Add(new XmlRpcStructMember("idmovieimdb", new XmlRpcValueBasic(idmovieimdb))); s.Members.Add(new XmlRpcStructMember("comment", new XmlRpcValueBasic(comment))); parms.Add(s); - XmlRpcMethodCall call = new XmlRpcMethodCall("AddRequest", parms); + var call = new XmlRpcMethodCall("AddRequest", parms); OSHConsole.WriteLine("Sending AddRequest request to the server ...", DebugCode.Good); // Send the request to the server @@ -1877,20 +1877,20 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseAddRequest R = new MethodResponseAddRequest(); + var R = new MethodResponseAddRequest(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { case "status": R.Status = (string)MEMBER.Data.Data; OSHConsole.WriteLine(">" + MEMBER.Name + "= " + MEMBER.Data.Data.ToString()); break; case "seconds": R.Seconds = (double)MEMBER.Data.Data; OSHConsole.WriteLine(">" + MEMBER.Name + "= " + MEMBER.Data.Data.ToString()); break; case "data": - XmlRpcValueStruct dataStruct = (XmlRpcValueStruct)MEMBER.Data; - foreach (XmlRpcStructMember dataMemeber in dataStruct.Members) + var dataStruct = (XmlRpcValueStruct)MEMBER.Data; + foreach (var dataMemeber in dataStruct.Members) { switch (dataMemeber.Name) { @@ -1926,10 +1926,10 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(TOKEN)); parms.Add(new XmlRpcValueBasic(language)); - XmlRpcMethodCall call = new XmlRpcMethodCall("GetSubLanguages", parms); + var call = new XmlRpcMethodCall("GetSubLanguages", parms); OSHConsole.WriteLine("Sending GetSubLanguages request to the server ...", DebugCode.Good); // Send the request to the server @@ -1942,27 +1942,27 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseGetSubLanguages R = new MethodResponseGetSubLanguages(); + var R = new MethodResponseGetSubLanguages(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { case "status": R.Status = (string)MEMBER.Data.Data; OSHConsole.WriteLine(">" + MEMBER.Name + "= " + MEMBER.Data.Data.ToString()); break; case "seconds": R.Seconds = (double)MEMBER.Data.Data; OSHConsole.WriteLine(">" + MEMBER.Name + "= " + MEMBER.Data.Data.ToString()); break; case "data":// array of structs - XmlRpcValueArray array = (XmlRpcValueArray)MEMBER.Data; - foreach (IXmlRpcValue value in array.Values) + var array = (XmlRpcValueArray)MEMBER.Data; + foreach (var value in array.Values) { if (value is XmlRpcValueStruct) { - XmlRpcValueStruct valueStruct = (XmlRpcValueStruct)value; - SubtitleLanguage lang = new SubtitleLanguage(); + var valueStruct = (XmlRpcValueStruct)value; + var lang = new SubtitleLanguage(); OSHConsole.WriteLine(">SubLanguage:"); - foreach (XmlRpcStructMember langMemeber in valueStruct.Members) + foreach (var langMemeber in valueStruct.Members) { OSHConsole.WriteLine(" >" + langMemeber.Name + "= " + langMemeber.Data.Data.ToString()); switch (langMemeber.Name) @@ -2009,10 +2009,10 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(TOKEN, XmlRpcBasicValueType.String)); // We need to gzip texts then code them with base 24 - List decodedTexts = new List(); + var decodedTexts = new List(); foreach (string text in texts) { // compress @@ -2025,7 +2025,7 @@ namespace OpenSubtitlesHandler decodedTexts.Add(Convert.ToBase64String(data)); } parms.Add(new XmlRpcValueArray(decodedTexts.ToArray())); - XmlRpcMethodCall call = new XmlRpcMethodCall("DetectLanguage", parms); + var call = new XmlRpcMethodCall("DetectLanguage", parms); OSHConsole.WriteLine("Sending DetectLanguage request to the server ...", DebugCode.Good); // Send the request to the server @@ -2038,12 +2038,12 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseDetectLanguage R = new MethodResponseDetectLanguage(); + var R = new MethodResponseDetectLanguage(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { @@ -2053,10 +2053,10 @@ namespace OpenSubtitlesHandler if (MEMBER.Data is XmlRpcValueStruct) { OSHConsole.WriteLine(">Languages:"); - XmlRpcValueStruct dataStruct = (XmlRpcValueStruct)MEMBER.Data; - foreach (XmlRpcStructMember dataMember in dataStruct.Members) + var dataStruct = (XmlRpcValueStruct)MEMBER.Data; + foreach (var dataMember in dataStruct.Members) { - DetectLanguageResult lang = new DetectLanguageResult(); + var lang = new DetectLanguageResult(); lang.InputSample = dataMember.Name; lang.LanguageID = dataMember.Data.Data.ToString(); R.Results.Add(lang); @@ -2095,10 +2095,10 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(TOKEN)); parms.Add(new XmlRpcValueBasic(program)); - XmlRpcMethodCall call = new XmlRpcMethodCall("GetAvailableTranslations", parms); + var call = new XmlRpcMethodCall("GetAvailableTranslations", parms); OSHConsole.WriteLine("Sending GetAvailableTranslations request to the server ...", DebugCode.Good); // Send the request to the server @@ -2111,29 +2111,29 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseGetAvailableTranslations R = new MethodResponseGetAvailableTranslations(); + var R = new MethodResponseGetAvailableTranslations(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { case "status": R.Status = (string)MEMBER.Data.Data; OSHConsole.WriteLine(">" + MEMBER.Name + "= " + MEMBER.Data.Data.ToString()); break; case "seconds": R.Seconds = (double)MEMBER.Data.Data; OSHConsole.WriteLine(">" + MEMBER.Name + "= " + MEMBER.Data.Data.ToString()); break; case "data": - XmlRpcValueStruct dataStruct = (XmlRpcValueStruct)MEMBER.Data; + var dataStruct = (XmlRpcValueStruct)MEMBER.Data; OSHConsole.WriteLine(">data:"); - foreach (XmlRpcStructMember dataMember in dataStruct.Members) + foreach (var dataMember in dataStruct.Members) { if (dataMember.Data is XmlRpcValueStruct) { - XmlRpcValueStruct resStruct = (XmlRpcValueStruct)dataMember.Data; - GetAvailableTranslationsResult res = new GetAvailableTranslationsResult(); + var resStruct = (XmlRpcValueStruct)dataMember.Data; + var res = new GetAvailableTranslationsResult(); res.LanguageID = dataMember.Name; OSHConsole.WriteLine(" >LanguageID: " + dataMember.Name); - foreach (XmlRpcStructMember resMember in resStruct.Members) + foreach (var resMember in resStruct.Members) { switch (resMember.Name) { @@ -2178,12 +2178,12 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(TOKEN)); parms.Add(new XmlRpcValueBasic(iso639)); parms.Add(new XmlRpcValueBasic(format)); parms.Add(new XmlRpcValueBasic(program)); - XmlRpcMethodCall call = new XmlRpcMethodCall("GetTranslation", parms); + var call = new XmlRpcMethodCall("GetTranslation", parms); OSHConsole.WriteLine("Sending GetTranslation request to the server ...", DebugCode.Good); // Send the request to the server @@ -2197,12 +2197,12 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseGetTranslation R = new MethodResponseGetTranslation(); + var R = new MethodResponseGetTranslation(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { @@ -2236,12 +2236,12 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); }*/ // Method call .. - List parms = new List(); + var parms = new List(); // parms.Add(new XmlRpcValueBasic(TOKEN)); parms.Add(new XmlRpcValueBasic(program)); // parms.Add(new XmlRpcValueBasic(XML_PRC_USERAGENT)); - XmlRpcMethodCall call = new XmlRpcMethodCall("AutoUpdate", parms); + var call = new XmlRpcMethodCall("AutoUpdate", parms); OSHConsole.WriteLine("Sending AutoUpdate request to the server ...", DebugCode.Good); // Send the request to the server string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT)); @@ -2253,12 +2253,12 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseAutoUpdate R = new MethodResponseAutoUpdate(); + var R = new MethodResponseAutoUpdate(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { @@ -2296,10 +2296,10 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(TOKEN)); parms.Add(new XmlRpcValueArray(hashes)); - XmlRpcMethodCall call = new XmlRpcMethodCall("CheckMovieHash", parms); + var call = new XmlRpcMethodCall("CheckMovieHash", parms); OSHConsole.WriteLine("Sending CheckMovieHash request to the server ...", DebugCode.Good); // Send the request to the server @@ -2312,27 +2312,27 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseCheckMovieHash R = new MethodResponseCheckMovieHash(); + var R = new MethodResponseCheckMovieHash(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { case "status": R.Status = (string)MEMBER.Data.Data; OSHConsole.WriteLine(">" + MEMBER.Name + "= " + MEMBER.Data.Data.ToString()); break; case "seconds": R.Seconds = (double)MEMBER.Data.Data; OSHConsole.WriteLine(">" + MEMBER.Name + "= " + MEMBER.Data.Data.ToString()); break; case "data": - XmlRpcValueStruct dataStruct = (XmlRpcValueStruct)MEMBER.Data; + var dataStruct = (XmlRpcValueStruct)MEMBER.Data; OSHConsole.WriteLine(">Data:"); - foreach (XmlRpcStructMember dataMember in dataStruct.Members) + foreach (var dataMember in dataStruct.Members) { - CheckMovieHashResult res = new CheckMovieHashResult(); + var res = new CheckMovieHashResult(); res.Name = dataMember.Name; OSHConsole.WriteLine(" >" + res.Name + ":"); - XmlRpcValueStruct movieStruct = (XmlRpcValueStruct)dataMember.Data; - foreach (XmlRpcStructMember movieMember in movieStruct.Members) + var movieStruct = (XmlRpcValueStruct)dataMember.Data; + foreach (var movieMember in movieStruct.Members) { switch (movieMember.Name) { @@ -2373,10 +2373,10 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(TOKEN)); parms.Add(new XmlRpcValueArray(hashes)); - XmlRpcMethodCall call = new XmlRpcMethodCall("CheckMovieHash2", parms); + var call = new XmlRpcMethodCall("CheckMovieHash2", parms); OSHConsole.WriteLine("Sending CheckMovieHash2 request to the server ...", DebugCode.Good); // Send the request to the server @@ -2389,31 +2389,31 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseCheckMovieHash2 R = new MethodResponseCheckMovieHash2(); + var R = new MethodResponseCheckMovieHash2(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { case "status": R.Status = (string)MEMBER.Data.Data; OSHConsole.WriteLine(">" + MEMBER.Name + "= " + MEMBER.Data.Data.ToString()); break; case "seconds": R.Seconds = (double)MEMBER.Data.Data; OSHConsole.WriteLine(">" + MEMBER.Name + "= " + MEMBER.Data.Data.ToString()); break; case "data": - XmlRpcValueStruct dataStruct = (XmlRpcValueStruct)MEMBER.Data; + var dataStruct = (XmlRpcValueStruct)MEMBER.Data; OSHConsole.WriteLine(">Data:"); - foreach (XmlRpcStructMember dataMember in dataStruct.Members) + foreach (var dataMember in dataStruct.Members) { - CheckMovieHash2Result res = new CheckMovieHash2Result(); + var res = new CheckMovieHash2Result(); res.Name = dataMember.Name; OSHConsole.WriteLine(" >" + res.Name + ":"); - XmlRpcValueArray dataArray = (XmlRpcValueArray)dataMember.Data; + var dataArray = (XmlRpcValueArray)dataMember.Data; foreach (XmlRpcValueStruct movieStruct in dataArray.Values) { - CheckMovieHash2Data d = new CheckMovieHash2Data(); - foreach (XmlRpcStructMember movieMember in movieStruct.Members) + var d = new CheckMovieHash2Data(); + foreach (var movieMember in movieStruct.Members) { switch (movieMember.Name) { @@ -2459,10 +2459,10 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(TOKEN)); parms.Add(new XmlRpcValueArray(hashes)); - XmlRpcMethodCall call = new XmlRpcMethodCall("CheckSubHash", parms); + var call = new XmlRpcMethodCall("CheckSubHash", parms); OSHConsole.WriteLine("Sending CheckSubHash request to the server ...", DebugCode.Good); // Send the request to the server @@ -2475,12 +2475,12 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseCheckSubHash R = new MethodResponseCheckSubHash(); + var R = new MethodResponseCheckSubHash(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { @@ -2488,11 +2488,11 @@ namespace OpenSubtitlesHandler case "seconds": R.Seconds = (double)MEMBER.Data.Data; OSHConsole.WriteLine(">" + MEMBER.Name + "= " + MEMBER.Data.Data.ToString()); break; case "data": OSHConsole.WriteLine(">Data:"); - XmlRpcValueStruct dataStruct = (XmlRpcValueStruct)MEMBER.Data; - foreach (XmlRpcStructMember dataMember in dataStruct.Members) + var dataStruct = (XmlRpcValueStruct)MEMBER.Data; + foreach (var dataMember in dataStruct.Members) { OSHConsole.WriteLine(" >" + dataMember.Name + "= " + dataMember.Data.Data.ToString()); - CheckSubHashResult r = new CheckSubHashResult(); + var r = new CheckSubHashResult(); r.Hash = dataMember.Name; r.SubID = dataMember.Data.Data.ToString(); R.Results.Add(r); @@ -2526,14 +2526,14 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(TOKEN, XmlRpcBasicValueType.String)); - XmlRpcValueStruct s = new XmlRpcValueStruct(new List()); + var s = new XmlRpcValueStruct(new List()); int i = 1; - foreach (TryUploadSubtitlesParameters cd in subs) + foreach (var cd in subs) { - XmlRpcStructMember member = new XmlRpcStructMember("cd" + i, null); - XmlRpcValueStruct memberStruct = new XmlRpcValueStruct(new List()); + var member = new XmlRpcStructMember("cd" + i, null); + var memberStruct = new XmlRpcValueStruct(new List()); memberStruct.Members.Add(new XmlRpcStructMember("subhash", new XmlRpcValueBasic(cd.subhash))); memberStruct.Members.Add(new XmlRpcStructMember("subfilename", new XmlRpcValueBasic(cd.subfilename))); memberStruct.Members.Add(new XmlRpcStructMember("moviehash", new XmlRpcValueBasic(cd.moviehash))); @@ -2547,7 +2547,7 @@ namespace OpenSubtitlesHandler i++; } parms.Add(s); - XmlRpcMethodCall call = new XmlRpcMethodCall("TryUploadSubtitles", parms); + var call = new XmlRpcMethodCall("TryUploadSubtitles", parms); OSHConsole.WriteLine("Sending TryUploadSubtitles request to the server ...", DebugCode.Good); // Send the request to the server @@ -2560,12 +2560,12 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseTryUploadSubtitles R = new MethodResponseTryUploadSubtitles(); + var R = new MethodResponseTryUploadSubtitles(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { @@ -2577,14 +2577,14 @@ namespace OpenSubtitlesHandler { OSHConsole.WriteLine("Results: "); - XmlRpcValueArray rarray = (XmlRpcValueArray)MEMBER.Data; - foreach (IXmlRpcValue subStruct in rarray.Values) + var rarray = (XmlRpcValueArray)MEMBER.Data; + foreach (var subStruct in rarray.Values) { if (subStruct == null) continue; if (!(subStruct is XmlRpcValueStruct)) continue; - SubtitleSearchResult result = new SubtitleSearchResult(); - foreach (XmlRpcStructMember submember in ((XmlRpcValueStruct)subStruct).Members) + var result = new SubtitleSearchResult(); + foreach (var submember in ((XmlRpcValueStruct)subStruct).Members) { // To avoid errors of arranged info or missing ones, let's do it with switch.. switch (submember.Name) @@ -2658,14 +2658,14 @@ namespace OpenSubtitlesHandler return new MethodResponseError("Fail", "Can't do this call, 'token' value not set. Please use Log In method first."); } // Method call .. - List parms = new List(); + var parms = new List(); parms.Add(new XmlRpcValueBasic(TOKEN)); // Main struct - XmlRpcValueStruct s = new XmlRpcValueStruct(new List()); + var s = new XmlRpcValueStruct(new List()); // Base info member as struct - XmlRpcStructMember member = new XmlRpcStructMember("baseinfo", null); - XmlRpcValueStruct memberStruct = new XmlRpcValueStruct(new List()); + var member = new XmlRpcStructMember("baseinfo", null); + var memberStruct = new XmlRpcValueStruct(new List()); memberStruct.Members.Add(new XmlRpcStructMember("idmovieimdb", new XmlRpcValueBasic(info.idmovieimdb))); memberStruct.Members.Add(new XmlRpcStructMember("sublanguageid", new XmlRpcValueBasic(info.sublanguageid))); memberStruct.Members.Add(new XmlRpcStructMember("moviereleasename", new XmlRpcValueBasic(info.moviereleasename))); @@ -2679,10 +2679,10 @@ namespace OpenSubtitlesHandler // CDS members int i = 1; - foreach (UploadSubtitleParameters cd in info.CDS) + foreach (var cd in info.CDS) { - XmlRpcStructMember member2 = new XmlRpcStructMember("cd" + i, null); - XmlRpcValueStruct memberStruct2 = new XmlRpcValueStruct(new List()); + var member2 = new XmlRpcStructMember("cd" + i, null); + var memberStruct2 = new XmlRpcValueStruct(new List()); memberStruct2.Members.Add(new XmlRpcStructMember("subhash", new XmlRpcValueBasic(cd.subhash))); memberStruct2.Members.Add(new XmlRpcStructMember("subfilename", new XmlRpcValueBasic(cd.subfilename))); memberStruct2.Members.Add(new XmlRpcStructMember("moviehash", new XmlRpcValueBasic(cd.moviehash))); @@ -2701,7 +2701,7 @@ namespace OpenSubtitlesHandler parms.Add(s); // add user agent //parms.Add(new XmlRpcValueBasic(XML_PRC_USERAGENT)); - XmlRpcMethodCall call = new XmlRpcMethodCall("UploadSubtitles", parms); + var call = new XmlRpcMethodCall("UploadSubtitles", parms); OSHConsole.WriteLine("Sending UploadSubtitles request to the server ...", DebugCode.Good); // Send the request to the server string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT)); @@ -2713,12 +2713,12 @@ namespace OpenSubtitlesHandler { if (calls[0].Parameters.Count > 0) { - XmlRpcValueStruct mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; + var mainStruct = (XmlRpcValueStruct)calls[0].Parameters[0]; // Create the response, we'll need it later - MethodResponseUploadSubtitles R = new MethodResponseUploadSubtitles(); + var R = new MethodResponseUploadSubtitles(); // To make sure response is not currepted by server, do it in loop - foreach (XmlRpcStructMember MEMBER in mainStruct.Members) + foreach (var MEMBER in mainStruct.Members) { switch (MEMBER.Name) { diff --git a/OpenSubtitlesHandler/Utilities.cs b/OpenSubtitlesHandler/Utilities.cs index 468fdd254..8ea0c546d 100644 --- a/OpenSubtitlesHandler/Utilities.cs +++ b/OpenSubtitlesHandler/Utilities.cs @@ -56,9 +56,9 @@ namespace OpenSubtitlesHandler /// Bytes array of decompressed data public static byte[] Decompress(Stream dataToDecompress) { - using (MemoryStream target = new MemoryStream()) + using (var target = new MemoryStream()) { - using (System.IO.Compression.GZipStream decompressionStream = new System.IO.Compression.GZipStream(dataToDecompress, System.IO.Compression.CompressionMode.Decompress)) + using (var decompressionStream = new System.IO.Compression.GZipStream(dataToDecompress, System.IO.Compression.CompressionMode.Decompress)) { decompressionStream.CopyTo(target); } @@ -116,7 +116,7 @@ namespace OpenSubtitlesHandler using (responseStream) { // Handle response, should be XML text. - List data = new List(); + var data = new List(); while (true) { int r = responseStream.ReadByte(); diff --git a/OpenSubtitlesHandler/XML-RPC/Values/XmlRpcValueArray.cs b/OpenSubtitlesHandler/XML-RPC/Values/XmlRpcValueArray.cs index 3303e3848..d10a80175 100644 --- a/OpenSubtitlesHandler/XML-RPC/Values/XmlRpcValueArray.cs +++ b/OpenSubtitlesHandler/XML-RPC/Values/XmlRpcValueArray.cs @@ -82,7 +82,7 @@ namespace XmlRpcHandler base() { values = new List(); - foreach (DateTime val in dates) + foreach (var val in dates) { values.Add(new XmlRpcValueBasic(val)); } @@ -91,7 +91,7 @@ namespace XmlRpcHandler base() { values = new List(); - foreach (XmlRpcValueBasic val in basicValues) + foreach (var val in basicValues) { values.Add(val); } @@ -100,7 +100,7 @@ namespace XmlRpcHandler base() { values = new List(); - foreach (XmlRpcValueStruct val in structs) + foreach (var val in structs) { values.Add(val); } @@ -109,7 +109,7 @@ namespace XmlRpcHandler base() { values = new List(); - foreach (XmlRpcValueArray val in arrays) + foreach (var val in arrays) { values.Add(val); } diff --git a/OpenSubtitlesHandler/XML-RPC/XmlRpcGenerator.cs b/OpenSubtitlesHandler/XML-RPC/XmlRpcGenerator.cs index 3d02622da..b1351f9e3 100644 --- a/OpenSubtitlesHandler/XML-RPC/XmlRpcGenerator.cs +++ b/OpenSubtitlesHandler/XML-RPC/XmlRpcGenerator.cs @@ -50,17 +50,17 @@ namespace XmlRpcHandler if (methods.Length == 0) throw new Exception("No method to write !"); // Create xml - XmlWriterSettings sett = new XmlWriterSettings(); + var sett = new XmlWriterSettings(); sett.Indent = true; sett.Encoding = Encoding.UTF8; using (var ms = new MemoryStream()) { - using (XmlWriter XMLwrt = XmlWriter.Create(ms, sett)) + using (var XMLwrt = XmlWriter.Create(ms, sett)) { // Let's write the methods - foreach (XmlRpcMethodCall method in methods) + foreach (var method in methods) { XMLwrt.WriteStartElement("methodCall");//methodCall XMLwrt.WriteStartElement("methodName");//methodName @@ -68,7 +68,7 @@ namespace XmlRpcHandler XMLwrt.WriteEndElement();//methodName XMLwrt.WriteStartElement("params");//params // Write values - foreach (IXmlRpcValue p in method.Parameters) + foreach (var p in method.Parameters) { XMLwrt.WriteStartElement("param");//param if (p is XmlRpcValueBasic) @@ -101,8 +101,8 @@ namespace XmlRpcHandler /// public static XmlRpcMethodCall[] DecodeMethodResponse(string xmlResponse) { - List methods = new List(); - XmlReaderSettings sett = new XmlReaderSettings(); + var methods = new List(); + var sett = new XmlReaderSettings(); sett.DtdProcessing = DtdProcessing.Ignore; sett.IgnoreWhitespace = true; MemoryStream str; @@ -116,15 +116,15 @@ namespace XmlRpcHandler } using (str) { - using (XmlReader XMLread = XmlReader.Create(str, sett)) + using (var XMLread = XmlReader.Create(str, sett)) { - XmlRpcMethodCall call = new XmlRpcMethodCall("methodResponse"); + var call = new XmlRpcMethodCall("methodResponse"); // Read parameters while (XMLread.Read()) { if (XMLread.Name == "param" && XMLread.IsStartElement()) { - IXmlRpcValue val = ReadValue(XMLread); + var val = ReadValue(XMLread); if (val != null) call.Parameters.Add(val); } @@ -169,7 +169,7 @@ namespace XmlRpcHandler // Get date time format if (val.Data != null) { - DateTime time = (DateTime)val.Data; + var time = (DateTime)val.Data; string dt = time.Year + time.Month.ToString("D2") + time.Day.ToString("D2") + "T" + time.Hour.ToString("D2") + ":" + time.Minute.ToString("D2") + ":" + time.Second.ToString("D2"); @@ -190,7 +190,7 @@ namespace XmlRpcHandler { XMLwrt.WriteStartElement("value");//value XMLwrt.WriteStartElement("struct");//struct - foreach (XmlRpcStructMember member in val.Members) + foreach (var member in val.Members) { XMLwrt.WriteStartElement("member");//member @@ -221,7 +221,7 @@ namespace XmlRpcHandler XMLwrt.WriteStartElement("value");//value XMLwrt.WriteStartElement("array");//array XMLwrt.WriteStartElement("data");//data - foreach (IXmlRpcValue o in val.Values) + foreach (var o in val.Values) { if (o is XmlRpcValueBasic) { @@ -283,7 +283,7 @@ namespace XmlRpcHandler int hour = int.Parse(date.Substring(9, 2), UsCulture); int minute = int.Parse(date.Substring(12, 2), UsCulture);//19980717T14:08:55 int sec = int.Parse(date.Substring(15, 2), UsCulture); - DateTime time = new DateTime(year, month, day, hour, minute, sec); + var time = new DateTime(year, month, day, hour, minute, sec); return new XmlRpcValueBasic(time, XmlRpcBasicValueType.dateTime_iso8601); } else if (xmlReader.Name == "base64" && xmlReader.IsStartElement()) @@ -293,17 +293,17 @@ namespace XmlRpcHandler } else if (xmlReader.Name == "struct" && xmlReader.IsStartElement()) { - XmlRpcValueStruct strct = new XmlRpcValueStruct(new List()); + var strct = new XmlRpcValueStruct(new List()); // Read members... while (xmlReader.Read()) { if (xmlReader.Name == "member" && xmlReader.IsStartElement()) { - XmlRpcStructMember member = new XmlRpcStructMember("", null); + var member = new XmlRpcStructMember("", null); xmlReader.Read();// read name member.Name = ReadString(xmlReader); - IXmlRpcValue val = ReadValue(xmlReader, true); + var val = ReadValue(xmlReader, true); if (val != null) { member.Data = val; @@ -319,7 +319,7 @@ namespace XmlRpcHandler } else if (xmlReader.Name == "array" && xmlReader.IsStartElement()) { - XmlRpcValueArray array = new XmlRpcValueArray(); + var array = new XmlRpcValueArray(); // Read members... while (xmlReader.Read()) { @@ -329,7 +329,7 @@ namespace XmlRpcHandler } else { - IXmlRpcValue val = ReadValue(xmlReader); + var val = ReadValue(xmlReader); if (val != null) array.Values.Add(val); } diff --git a/RSSDP/DeviceAvailableEventArgs.cs b/RSSDP/DeviceAvailableEventArgs.cs index e52e801c4..9106e27e5 100644 --- a/RSSDP/DeviceAvailableEventArgs.cs +++ b/RSSDP/DeviceAvailableEventArgs.cs @@ -7,7 +7,7 @@ using MediaBrowser.Model.Net; namespace Rssdp { /// - /// Event arguments for the event. + /// Event arguments for the event. /// public sealed class DeviceAvailableEventArgs : EventArgs { @@ -18,17 +18,17 @@ namespace Rssdp private readonly DiscoveredSsdpDevice _DiscoveredDevice; private readonly bool _IsNewlyDiscovered; - #endregion + #endregion - #region Constructors + #region Constructors - /// - /// Full constructor. - /// - /// A instance representing the available device. - /// A boolean value indicating whether or not this device came from the cache. See for more detail. - /// Thrown if the parameter is null. - public DeviceAvailableEventArgs(DiscoveredSsdpDevice discoveredDevice, bool isNewlyDiscovered) + /// + /// Full constructor. + /// + /// A instance representing the available device. + /// A boolean value indicating whether or not this device came from the cache. See for more detail. + /// Thrown if the parameter is null. + public DeviceAvailableEventArgs(DiscoveredSsdpDevice discoveredDevice, bool isNewlyDiscovered) { if (discoveredDevice == null) throw new ArgumentNullException(nameof(discoveredDevice)); @@ -48,10 +48,10 @@ namespace Rssdp get { return _IsNewlyDiscovered; } } - /// - /// A reference to a instance containing the discovered details and allowing access to the full device description. - /// - public DiscoveredSsdpDevice DiscoveredDevice + /// + /// A reference to a instance containing the discovered details and allowing access to the full device description. + /// + public DiscoveredSsdpDevice DiscoveredDevice { get { return _DiscoveredDevice; } } diff --git a/RSSDP/DeviceEventArgs.cs b/RSSDP/DeviceEventArgs.cs index 55b23b68c..3925ba248 100644 --- a/RSSDP/DeviceEventArgs.cs +++ b/RSSDP/DeviceEventArgs.cs @@ -22,7 +22,7 @@ namespace Rssdp /// Constructs a new instance for the specified . /// /// The associated with the event this argument class is being used for. - /// Thrown if the argument is null. + /// Thrown if the argument is null. public DeviceEventArgs(SsdpDevice device) { if (device == null) throw new ArgumentNullException(nameof(device)); diff --git a/RSSDP/DeviceUnavailableEventArgs.cs b/RSSDP/DeviceUnavailableEventArgs.cs index ecba7c013..d90ddfb60 100644 --- a/RSSDP/DeviceUnavailableEventArgs.cs +++ b/RSSDP/DeviceUnavailableEventArgs.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace Rssdp { /// - /// Event arguments for the event. + /// Event arguments for the event. /// public sealed class DeviceUnavailableEventArgs : EventArgs { @@ -25,7 +25,7 @@ namespace Rssdp /// /// A instance representing the device that has become unavailable. /// A boolean value indicating whether this device is unavailable because it expired, or because it explicitly sent a byebye notification.. See for more detail. - /// Thrown if the parameter is null. + /// Thrown if the parameter is null. public DeviceUnavailableEventArgs(DiscoveredSsdpDevice discoveredDevice, bool expired) { if (discoveredDevice == null) throw new ArgumentNullException(nameof(discoveredDevice)); @@ -47,7 +47,7 @@ namespace Rssdp } /// - /// A reference to a instance containing the discovery details of the removed device. + /// A reference to a instance containing the discovery details of the removed device. /// public DiscoveredSsdpDevice DiscoveredDevice { diff --git a/RSSDP/DiscoveredSsdpDevice.cs b/RSSDP/DiscoveredSsdpDevice.cs index b643e3f08..f42e7c674 100644 --- a/RSSDP/DiscoveredSsdpDevice.cs +++ b/RSSDP/DiscoveredSsdpDevice.cs @@ -11,7 +11,7 @@ namespace Rssdp /// Represents a discovered device, containing basic information about the device and the location of it's full device description document. Also provides convenience methods for retrieving the device description document. /// /// - /// + /// public sealed class DiscoveredSsdpDevice { diff --git a/RSSDP/DisposableManagedObjectBase.cs b/RSSDP/DisposableManagedObjectBase.cs index 9933194bc..0f656fb46 100644 --- a/RSSDP/DisposableManagedObjectBase.cs +++ b/RSSDP/DisposableManagedObjectBase.cs @@ -20,10 +20,10 @@ namespace Rssdp.Infrastructure protected abstract void Dispose(bool disposing); /// - /// Throws and if the property is true. + /// Throws and if the property is true. /// /// - /// Thrown if the property is true. + /// Thrown if the property is true. /// protected virtual void ThrowIfDisposed() { diff --git a/RSSDP/HttpParserBase.cs b/RSSDP/HttpParserBase.cs index db496fe6f..18712470d 100644 --- a/RSSDP/HttpParserBase.cs +++ b/RSSDP/HttpParserBase.cs @@ -26,19 +26,19 @@ namespace Rssdp.Infrastructure private static byte[] EmptyByteArray = new byte[]{}; /// - /// Parses the provided into either a or object. + /// Parses the provided into either a or object. /// /// A string containing the HTTP message to parse. - /// Either a or object containing the parsed data. + /// Either a or object containing the parsed data. public abstract T Parse(string data); /// - /// Parses a string containing either an HTTP request or response into a or object. + /// Parses a string containing either an HTTP request or response into a or object. /// - /// A or object representing the parsed message. + /// A or object representing the parsed message. /// A reference to the collection for the object. /// A string containing the data to be parsed. - /// An object containing the content of the parsed message. + /// An object containing the content of the parsed message. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times", Justification = "Honestly, it's fine. MemoryStream doesn't mind.")] protected virtual void Parse(T message, System.Net.Http.Headers.HttpHeaders headers, string data) { @@ -61,7 +61,7 @@ namespace Rssdp.Infrastructure /// Used to parse the first line of an HTTP request or response and assign the values to the appropriate properties on the . /// /// The first line of the HTTP message to be parsed. - /// Either a or to assign the parsed values to. + /// Either a or to assign the parsed values to. protected abstract void ParseStatusLine(string data, T message); /// diff --git a/RSSDP/HttpRequestParser.cs b/RSSDP/HttpRequestParser.cs index 1af7f0d51..d4505b8ad 100644 --- a/RSSDP/HttpRequestParser.cs +++ b/RSSDP/HttpRequestParser.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; namespace Rssdp.Infrastructure { /// - /// Parses a string into a or throws an exception. + /// Parses a string into a or throws an exception. /// public sealed class HttpRequestParser : HttpParserBase { @@ -26,17 +26,17 @@ namespace Rssdp.Infrastructure #region Public Methods /// - /// Parses the specified data into a instance. + /// Parses the specified data into a instance. /// /// A string containing the data to parse. - /// A instance containing the parsed data. - public override System.Net.Http.HttpRequestMessage Parse(string data) + /// A instance containing the parsed data. + public override HttpRequestMessage Parse(string data) { - System.Net.Http.HttpRequestMessage retVal = null; + HttpRequestMessage retVal = null; try { - retVal = new System.Net.Http.HttpRequestMessage(); + retVal = new HttpRequestMessage(); Parse(retVal, retVal.Headers, data); @@ -57,7 +57,7 @@ namespace Rssdp.Infrastructure /// Used to parse the first line of an HTTP request or response and assign the values to the appropriate properties on the . /// /// The first line of the HTTP message to be parsed. - /// Either a or to assign the parsed values to. + /// Either a or to assign the parsed values to. protected override void ParseStatusLine(string data, HttpRequestMessage message) { if (data == null) throw new ArgumentNullException(nameof(data)); diff --git a/RSSDP/HttpResponseParser.cs b/RSSDP/HttpResponseParser.cs index d864a8bb7..a77c898ff 100644 --- a/RSSDP/HttpResponseParser.cs +++ b/RSSDP/HttpResponseParser.cs @@ -9,9 +9,9 @@ using System.Threading.Tasks; namespace Rssdp.Infrastructure { /// - /// Parses a string into a or throws an exception. + /// Parses a string into a or throws an exception. /// - public sealed class HttpResponseParser : HttpParserBase + public sealed class HttpResponseParser : HttpParserBase { #region Fields & Constants @@ -26,16 +26,16 @@ namespace Rssdp.Infrastructure #region Public Methods /// - /// Parses the specified data into a instance. + /// Parses the specified data into a instance. /// /// A string containing the data to parse. - /// A instance containing the parsed data. + /// A instance containing the parsed data. public override HttpResponseMessage Parse(string data) { - System.Net.Http.HttpResponseMessage retVal = null; + HttpResponseMessage retVal = null; try { - retVal = new System.Net.Http.HttpResponseMessage(); + retVal = new HttpResponseMessage(); Parse(retVal, retVal.Headers, data); @@ -68,7 +68,7 @@ namespace Rssdp.Infrastructure /// Used to parse the first line of an HTTP request or response and assign the values to the appropriate properties on the . /// /// The first line of the HTTP message to be parsed. - /// Either a or to assign the parsed values to. + /// Either a or to assign the parsed values to. protected override void ParseStatusLine(string data, HttpResponseMessage message) { if (data == null) throw new ArgumentNullException(nameof(data)); diff --git a/RSSDP/ISsdpDeviceLocator.cs b/RSSDP/ISsdpDeviceLocator.cs index 2351f5d62..8f0d39e75 100644 --- a/RSSDP/ISsdpDeviceLocator.cs +++ b/RSSDP/ISsdpDeviceLocator.cs @@ -128,7 +128,7 @@ namespace Rssdp.Infrastructure /// /// Does nothing if this instance is not already listening for notifications. /// - /// Throw if the property is true. + /// Throw if the property is true. /// /// /// diff --git a/RSSDP/ISsdpDevicePublisher.cs b/RSSDP/ISsdpDevicePublisher.cs index da2607fc4..7e914c109 100644 --- a/RSSDP/ISsdpDevicePublisher.cs +++ b/RSSDP/ISsdpDevicePublisher.cs @@ -17,14 +17,14 @@ namespace Rssdp.Infrastructure /// Adds a device (and it's children) to the list of devices being published by this server, making them discoverable to SSDP clients. /// /// The instance to add. - /// An awaitable . + /// An awaitable . void AddDevice(SsdpRootDevice device); /// /// Removes a device (and it's children) from the list of devices being published by this server, making them undiscoverable. /// /// The instance to add. - /// An awaitable . + /// An awaitable . Task RemoveDevice(SsdpRootDevice device); /// diff --git a/RSSDP/SsdpCommunicationsServer.cs b/RSSDP/SsdpCommunicationsServer.cs index 8fb33924f..abd0dbdad 100644 --- a/RSSDP/SsdpCommunicationsServer.cs +++ b/RSSDP/SsdpCommunicationsServer.cs @@ -73,7 +73,7 @@ namespace Rssdp.Infrastructure /// /// Minimum constructor. /// - /// The argument is null. + /// The argument is null. public SsdpCommunicationsServer(ISocketFactory socketFactory, INetworkManager networkManager, ILogger logger, bool enableMultiSocketBinding) : this(socketFactory, 0, SsdpConstants.SsdpDefaultMulticastTimeToLive, networkManager, logger, enableMultiSocketBinding) { @@ -82,8 +82,8 @@ namespace Rssdp.Infrastructure /// /// Full constructor. /// - /// The argument is null. - /// The argument is less than or equal to zero. + /// The argument is null. + /// The argument is less than or equal to zero. public SsdpCommunicationsServer(ISocketFactory socketFactory, int localPort, int multicastTimeToLive, INetworkManager networkManager, ILogger logger, bool enableMultiSocketBinding) { if (socketFactory == null) throw new ArgumentNullException(nameof(socketFactory)); @@ -111,7 +111,7 @@ namespace Rssdp.Infrastructure /// /// Causes the server to begin listening for multicast messages, being SSDP search requests and notifications. /// - /// Thrown if the property is true (because has been called previously). + /// Thrown if the property is true (because has been called previously). public void BeginListeningForBroadcasts() { ThrowIfDisposed(); @@ -138,7 +138,7 @@ namespace Rssdp.Infrastructure /// /// Causes the server to stop listening for multicast messages, being SSDP search requests and notifications. /// - /// Thrown if the property is true (because has been called previously). + /// Thrown if the property is true (because has been called previously). public void StopListeningForBroadcasts() { lock (_BroadcastListenSocketSynchroniser) @@ -269,7 +269,7 @@ namespace Rssdp.Infrastructure /// /// Stops listening for search responses on the local, unicast socket. /// - /// Thrown if the property is true (because has been called previously). + /// Thrown if the property is true (because has been called previously). public void StopListeningForResponses() { lock (_SendSocketSynchroniser) diff --git a/RSSDP/SsdpDevice.cs b/RSSDP/SsdpDevice.cs index 8dc1805c5..b4c4a88fd 100644 --- a/RSSDP/SsdpDevice.cs +++ b/RSSDP/SsdpDevice.cs @@ -276,8 +276,8 @@ namespace Rssdp /// If the device is already a member of the collection, this method does nothing. /// Also sets the property of the added device and all descendant devices to the relevant instance. /// - /// Thrown if the argument is null. - /// Thrown if the is already associated with a different instance than used in this tree. Can occur if you try to add the same device instance to more than one tree. Also thrown if you try to add a device to itself. + /// Thrown if the argument is null. + /// Thrown if the is already associated with a different instance than used in this tree. Can occur if you try to add the same device instance to more than one tree. Also thrown if you try to add a device to itself. /// public void AddDevice(SsdpEmbeddedDevice device) { @@ -305,7 +305,7 @@ namespace Rssdp /// If the device is not a member of the collection, this method does nothing. /// Also sets the property to null for the removed device and all descendant devices. /// - /// Thrown if the argument is null. + /// Thrown if the argument is null. /// public void RemoveDevice(SsdpEmbeddedDevice device) { diff --git a/RSSDP/SsdpDeviceLocator.cs b/RSSDP/SsdpDeviceLocator.cs index ca6093725..1348cce8d 100644 --- a/RSSDP/SsdpDeviceLocator.cs +++ b/RSSDP/SsdpDeviceLocator.cs @@ -185,7 +185,7 @@ namespace Rssdp.Infrastructure /// /// /// - /// Throw if the ty is true. + /// Throw if the ty is true. public void StartListeningForNotifications() { ThrowIfDisposed(); @@ -204,7 +204,7 @@ namespace Rssdp.Infrastructure /// /// /// - /// Throw if the property is true. + /// Throw if the property is true. public void StopListeningForNotifications() { ThrowIfDisposed(); diff --git a/RSSDP/SsdpDevicePublisher.cs b/RSSDP/SsdpDevicePublisher.cs index 031b908dd..8a73e6a2d 100644 --- a/RSSDP/SsdpDevicePublisher.cs +++ b/RSSDP/SsdpDevicePublisher.cs @@ -76,8 +76,8 @@ namespace Rssdp.Infrastructure /// This method ignores duplicate device adds (if the same device instance is added multiple times, the second and subsequent add calls do nothing). /// /// The instance to add. - /// Thrown if the argument is null. - /// Thrown if the contains property values that are not acceptable to the UPnP 1.0 specification. + /// Thrown if the argument is null. + /// Thrown if the contains property values that are not acceptable to the UPnP 1.0 specification. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals", MessageId = "t", Justification = "Capture task to local variable supresses compiler warning, but task is not really needed.")] public void AddDevice(SsdpRootDevice device) { @@ -85,7 +85,7 @@ namespace Rssdp.Infrastructure ThrowIfDisposed(); - TimeSpan minCacheTime = TimeSpan.Zero; + var minCacheTime = TimeSpan.Zero; bool wasAdded = false; lock (_Devices) { @@ -113,13 +113,13 @@ namespace Rssdp.Infrastructure /// This method does nothing if the device was not found in the collection. /// /// The instance to add. - /// Thrown if the argument is null. + /// Thrown if the argument is null. public async Task RemoveDevice(SsdpRootDevice device) { if (device == null) throw new ArgumentNullException(nameof(device)); bool wasRemoved = false; - TimeSpan minCacheTime = TimeSpan.Zero; + var minCacheTime = TimeSpan.Zero; lock (_Devices) { if (_Devices.Contains(device)) diff --git a/SocketHttpListener/Ext.cs b/SocketHttpListener/Ext.cs index 6b7564828..1251d19c0 100644 --- a/SocketHttpListener/Ext.cs +++ b/SocketHttpListener/Ext.cs @@ -161,7 +161,7 @@ namespace SocketHttpListener internal static bool Contains(this IEnumerable source, Func condition) { - foreach (T elm in source) + foreach (var elm in source) if (condition(elm)) return true; diff --git a/SocketHttpListener/MessageEventArgs.cs b/SocketHttpListener/MessageEventArgs.cs index d9bccbf3f..8e2151cb7 100644 --- a/SocketHttpListener/MessageEventArgs.cs +++ b/SocketHttpListener/MessageEventArgs.cs @@ -9,8 +9,8 @@ namespace SocketHttpListener /// /// A event occurs when the receives /// a text or binary data frame. - /// If you want to get the received data, you access the or - /// property. + /// If you want to get the received data, you access the or + /// property. /// public class MessageEventArgs : EventArgs { diff --git a/SocketHttpListener/Net/ChunkStream.cs b/SocketHttpListener/Net/ChunkStream.cs index 4bf3a6dea..3836947d4 100644 --- a/SocketHttpListener/Net/ChunkStream.cs +++ b/SocketHttpListener/Net/ChunkStream.cs @@ -108,7 +108,7 @@ namespace SocketHttpListener.Net var chunksForRemoving = new List(count); for (int i = 0; i < count; i++) { - Chunk chunk = _chunks[i]; + var chunk = _chunks[i]; if (chunk.Offset == chunk.Bytes.Length) { @@ -189,7 +189,7 @@ namespace SocketHttpListener.Net int count = _chunks.Count; for (int i = 0; i < count; i++) { - Chunk ch = _chunks[i]; + var ch = _chunks[i]; if (ch == null || ch.Bytes == null) continue; if (ch.Bytes.Length > 0 && ch.Offset < ch.Bytes.Length) @@ -368,7 +368,7 @@ namespace SocketHttpListener.Net return State.Trailer; } - StringReader reader = new StringReader(_saved.ToString()); + var reader = new StringReader(_saved.ToString()); string line; while ((line = reader.ReadLine()) != null && line != "") _headers.Add(line); @@ -378,7 +378,7 @@ namespace SocketHttpListener.Net private static void ThrowProtocolViolation(string message) { - WebException we = new WebException(message, null, WebExceptionStatus.ServerProtocolViolation, null); + var we = new WebException(message, null, WebExceptionStatus.ServerProtocolViolation, null); throw we; } } diff --git a/SocketHttpListener/Net/ChunkedInputStream.cs b/SocketHttpListener/Net/ChunkedInputStream.cs index cdf7ac649..8d59a7907 100644 --- a/SocketHttpListener/Net/ChunkedInputStream.cs +++ b/SocketHttpListener/Net/ChunkedInputStream.cs @@ -61,7 +61,7 @@ namespace SocketHttpListener.Net : base(stream, buffer, offset, length) { _context = context; - WebHeaderCollection coll = (WebHeaderCollection)context.Request.Headers; + var coll = (WebHeaderCollection)context.Request.Headers; _decoder = new ChunkStream(coll); } @@ -73,13 +73,13 @@ namespace SocketHttpListener.Net protected override int ReadCore(byte[] buffer, int offset, int count) { - IAsyncResult ares = BeginReadCore(buffer, offset, count, null, null); + var ares = BeginReadCore(buffer, offset, count, null, null); return EndRead(ares); } protected override IAsyncResult BeginReadCore(byte[] buffer, int offset, int size, AsyncCallback cback, object state) { - HttpStreamAsyncResult ares = new HttpStreamAsyncResult(this); + var ares = new HttpStreamAsyncResult(this); ares._callback = cback; ares._state = state; if (_no_more_data || size == 0 || _closed) @@ -107,7 +107,7 @@ namespace SocketHttpListener.Net ares._buffer = new byte[8192]; ares._offset = 0; ares._count = 8192; - ReadBufferState rb = new ReadBufferState(buffer, offset, size, ares); + var rb = new ReadBufferState(buffer, offset, size, ares); rb.InitialCount += nread; base.BeginReadCore(ares._buffer, ares._offset, ares._count, OnRead, rb); return ares; @@ -115,8 +115,8 @@ namespace SocketHttpListener.Net private void OnRead(IAsyncResult base_ares) { - ReadBufferState rb = (ReadBufferState)base_ares.AsyncState; - HttpStreamAsyncResult ares = rb.Ares; + var rb = (ReadBufferState)base_ares.AsyncState; + var ares = rb.Ares; try { int nread = base.EndRead(base_ares); @@ -155,7 +155,7 @@ namespace SocketHttpListener.Net if (asyncResult == null) throw new ArgumentNullException(nameof(asyncResult)); - HttpStreamAsyncResult ares = asyncResult as HttpStreamAsyncResult; + var ares = asyncResult as HttpStreamAsyncResult; if (ares == null || !ReferenceEquals(this, ares._parent)) { throw new ArgumentException("Invalid async result"); diff --git a/SocketHttpListener/Net/HttpConnection.cs b/SocketHttpListener/Net/HttpConnection.cs index f6db5f0b2..e87503118 100644 --- a/SocketHttpListener/Net/HttpConnection.cs +++ b/SocketHttpListener/Net/HttpConnection.cs @@ -212,7 +212,7 @@ namespace SocketHttpListener.Net private static void OnRead(IAsyncResult ares) { - HttpConnection cnc = (HttpConnection)ares.AsyncState; + var cnc = (HttpConnection)ares.AsyncState; cnc.OnReadInternal(ares); } @@ -269,7 +269,7 @@ namespace SocketHttpListener.Net Close(true); return; } - HttpListener listener = _epl.Listener; + var listener = _epl.Listener; if (_lastListener != listener) { RemoveConnection(); @@ -417,7 +417,7 @@ namespace SocketHttpListener.Net { try { - HttpListenerResponse response = _context.Response; + var response = _context.Response; response.StatusCode = status; response.ContentType = "text/html"; string description = HttpStatusDescription.Get(status); @@ -509,7 +509,7 @@ namespace SocketHttpListener.Net return; } - Socket s = _socket; + var s = _socket; _socket = null; try { diff --git a/SocketHttpListener/Net/HttpEndPointListener.cs b/SocketHttpListener/Net/HttpEndPointListener.cs index 0f1ce696f..d002c13b2 100644 --- a/SocketHttpListener/Net/HttpEndPointListener.cs +++ b/SocketHttpListener/Net/HttpEndPointListener.cs @@ -160,7 +160,7 @@ namespace SocketHttpListener.Net } catch (Exception ex) { - HttpEndPointListener epl = (HttpEndPointListener)acceptEventArg.UserToken; + var epl = (HttpEndPointListener)acceptEventArg.UserToken; epl._logger.LogError(ex, "Error in socket.AcceptAsync"); } @@ -176,7 +176,7 @@ namespace SocketHttpListener.Net private static async void ProcessAccept(SocketAsyncEventArgs args) { - HttpEndPointListener epl = (HttpEndPointListener)args.UserToken; + var epl = (HttpEndPointListener)args.UserToken; if (epl._closed) { @@ -214,7 +214,7 @@ namespace SocketHttpListener.Net var localEndPointString = accepted.LocalEndPoint == null ? string.Empty : accepted.LocalEndPoint.ToString(); //_logger.LogInformation("HttpEndPointListener Accepting connection from {0} to {1} secure connection requested: {2}", remoteEndPointString, localEndPointString, _secure); - HttpConnection conn = new HttpConnection(epl._logger, accepted, epl, epl._secure, epl._cert, epl._cryptoProvider, epl._streamHelper, epl._textEncoding, epl._fileSystem, epl._environment); + var conn = new HttpConnection(epl._logger, accepted, epl, epl._secure, epl._cert, epl._cryptoProvider, epl._streamHelper, epl._textEncoding, epl._fileSystem, epl._environment); await conn.Init().ConfigureAwait(false); @@ -276,9 +276,9 @@ namespace SocketHttpListener.Net public bool BindContext(HttpListenerContext context) { - HttpListenerRequest req = context.Request; + var req = context.Request; ListenerPrefix prefix; - HttpListener listener = SearchListener(req.Url, out prefix); + var listener = SearchListener(req.Url, out prefix); if (listener == null) return false; @@ -310,8 +310,8 @@ namespace SocketHttpListener.Net if (host != null && host != "") { - Dictionary localPrefixes = _prefixes; - foreach (ListenerPrefix p in localPrefixes.Keys) + var localPrefixes = _prefixes; + foreach (var p in localPrefixes.Keys) { string ppath = p.Path; if (ppath.Length < bestLength) @@ -331,7 +331,7 @@ namespace SocketHttpListener.Net return bestMatch; } - List list = _unhandledPrefixes; + var list = _unhandledPrefixes; bestMatch = MatchFromList(host, path, list, out prefix); if (path != pathSlash && bestMatch == null) @@ -361,7 +361,7 @@ namespace SocketHttpListener.Net HttpListener bestMatch = null; int bestLength = -1; - foreach (ListenerPrefix p in list) + foreach (var p in list) { string ppath = p.Path; if (ppath.Length < bestLength) @@ -383,7 +383,7 @@ namespace SocketHttpListener.Net if (list == null) return; - foreach (ListenerPrefix p in list) + foreach (var p in list) { if (p.Path == prefix.Path) throw new Exception("net_listener_already"); @@ -399,7 +399,7 @@ namespace SocketHttpListener.Net int c = list.Count; for (int i = 0; i < c; i++) { - ListenerPrefix p = list[i]; + var p = list[i]; if (p.Path == prefix.Path) { list.RemoveAt(i); @@ -414,7 +414,7 @@ namespace SocketHttpListener.Net if (_prefixes.Count > 0) return; - List list = _unhandledPrefixes; + var list = _unhandledPrefixes; if (list != null && list.Count > 0) return; @@ -434,7 +434,7 @@ namespace SocketHttpListener.Net // Clone the list because RemoveConnection can be called from Close var connections = new List(_unregisteredConnections.Keys); - foreach (HttpConnection c in connections) + foreach (var c in connections) c.Close(true); _unregisteredConnections.Clear(); } diff --git a/SocketHttpListener/Net/HttpEndPointManager.cs b/SocketHttpListener/Net/HttpEndPointManager.cs index 787730ed4..98986333b 100644 --- a/SocketHttpListener/Net/HttpEndPointManager.cs +++ b/SocketHttpListener/Net/HttpEndPointManager.cs @@ -17,7 +17,7 @@ namespace SocketHttpListener.Net public static void AddListener(ILogger logger, HttpListener listener) { - List added = new List(); + var added = new List(); try { lock ((s_ipEndPoints as ICollection).SyncRoot) @@ -64,7 +64,7 @@ namespace SocketHttpListener.Net } } - ListenerPrefix lp = new ListenerPrefix(p); + var lp = new ListenerPrefix(p); if (lp.Host != "*" && lp.Host != "+" && Uri.CheckHostName(lp.Host) == UriHostNameType.Unknown) throw new HttpListenerException((int)HttpStatusCode.BadRequest, "net_listener_host"); @@ -75,7 +75,7 @@ namespace SocketHttpListener.Net throw new HttpListenerException((int)HttpStatusCode.BadRequest, "net_invalid_path"); // listens on all the interfaces if host name cannot be parsed by IPAddress. - HttpEndPointListener epl = GetEPListener(logger, lp.Host, lp.Port, listener, lp.Secure); + var epl = GetEPListener(logger, lp.Host, lp.Port, listener, lp.Secure); epl.AddPrefix(lp, listener); } @@ -179,14 +179,14 @@ namespace SocketHttpListener.Net private static void RemovePrefixInternal(ILogger logger, string prefix, HttpListener listener) { - ListenerPrefix lp = new ListenerPrefix(prefix); + var lp = new ListenerPrefix(prefix); if (lp.Path.IndexOf('%') != -1) return; if (lp.Path.IndexOf("//", StringComparison.Ordinal) != -1) return; - HttpEndPointListener epl = GetEPListener(logger, lp.Host, lp.Port, listener, lp.Secure); + var epl = GetEPListener(logger, lp.Host, lp.Port, listener, lp.Secure); epl.RemovePrefix(lp, listener); } } diff --git a/SocketHttpListener/Net/HttpListenerContext.Managed.cs b/SocketHttpListener/Net/HttpListenerContext.Managed.cs index a6622c479..4cdb6882e 100644 --- a/SocketHttpListener/Net/HttpListenerContext.Managed.cs +++ b/SocketHttpListener/Net/HttpListenerContext.Managed.cs @@ -44,7 +44,7 @@ namespace SocketHttpListener.Net } internal IPrincipal ParseBasicAuthentication(string authData) => - TryParseBasicAuth(authData, out HttpStatusCode errorCode, out string username, out string password) ? + TryParseBasicAuth(authData, out var errorCode, out string username, out string password) ? new GenericPrincipal(new HttpListenerBasicIdentity(username, password), Array.Empty()) : null; diff --git a/SocketHttpListener/Net/HttpListenerRequest.Managed.cs b/SocketHttpListener/Net/HttpListenerRequest.Managed.cs index 3f9e32f08..41d075045 100644 --- a/SocketHttpListener/Net/HttpListenerRequest.Managed.cs +++ b/SocketHttpListener/Net/HttpListenerRequest.Managed.cs @@ -180,7 +180,7 @@ namespace SocketHttpListener.Net if (string.Compare(Headers[HttpKnownHeaderNames.Expect], "100-continue", StringComparison.OrdinalIgnoreCase) == 0) { - HttpResponseStream output = _context.Connection.GetResponseStream(); + var output = _context.Connection.GetResponseStream(); output.InternalWrite(s_100continue, 0, s_100continue.Length); } } @@ -256,7 +256,7 @@ namespace SocketHttpListener.Net { try { - IAsyncResult ares = InputStream.BeginRead(bytes, 0, length, null, null); + var ares = InputStream.BeginRead(bytes, 0, length, null, null); if (!ares.IsCompleted && !ares.AsyncWaitHandle.WaitOne(1000)) return false; if (InputStream.EndRead(ares) <= 0) diff --git a/SocketHttpListener/Net/HttpListenerRequest.cs b/SocketHttpListener/Net/HttpListenerRequest.cs index 2e8396f6f..1c832367e 100644 --- a/SocketHttpListener/Net/HttpListenerRequest.cs +++ b/SocketHttpListener/Net/HttpListenerRequest.cs @@ -23,7 +23,7 @@ namespace SocketHttpListener.Net private static CookieCollection ParseCookies(Uri uri, string setCookieHeader) { - CookieCollection cookies = new CookieCollection(); + var cookies = new CookieCollection(); return cookies; } @@ -171,7 +171,7 @@ namespace SocketHttpListener.Net { get { - QueryParamCollection queryString = new QueryParamCollection(); + var queryString = new QueryParamCollection(); Helpers.FillFromString(queryString, Url.Query, true, ContentEncoding); return queryString; } @@ -197,7 +197,7 @@ namespace SocketHttpListener.Net return null; } - bool success = Uri.TryCreate(referrer, UriKind.RelativeOrAbsolute, out Uri urlReferrer); + bool success = Uri.TryCreate(referrer, UriKind.RelativeOrAbsolute, out var urlReferrer); return success ? urlReferrer : null; } } @@ -296,7 +296,7 @@ namespace SocketHttpListener.Net // collect comma-separated values into list - List values = new List(); + var values = new List(); int i = 0; while (i < l) @@ -341,7 +341,7 @@ namespace SocketHttpListener.Net private static string UrlDecodeStringFromStringInternal(string s, Encoding e) { int count = s.Length; - UrlDecoder helper = new UrlDecoder(count, e); + var helper = new UrlDecoder(count, e); // go through the string's chars collapsing %XX and %uXXXX and // appending each char as char, with exception of %XX constructs diff --git a/SocketHttpListener/Net/HttpListenerRequestUriBuilder.cs b/SocketHttpListener/Net/HttpListenerRequestUriBuilder.cs index f1a0af0bf..310c71a0d 100644 --- a/SocketHttpListener/Net/HttpListenerRequestUriBuilder.cs +++ b/SocketHttpListener/Net/HttpListenerRequestUriBuilder.cs @@ -54,7 +54,7 @@ namespace SocketHttpListener.Net public static Uri GetRequestUri(string rawUri, string cookedUriScheme, string cookedUriHost, string cookedUriPath, string cookedUriQuery) { - HttpListenerRequestUriBuilder builder = new HttpListenerRequestUriBuilder(rawUri, + var builder = new HttpListenerRequestUriBuilder(rawUri, cookedUriScheme, cookedUriHost, cookedUriPath, cookedUriQuery); return builder.Build(); @@ -94,10 +94,10 @@ namespace SocketHttpListener.Net // Try to check the raw path using first the primary encoding (according to http.sys settings); // if it fails try the secondary encoding. - ParsingResult result = BuildRequestUriUsingRawPath(GetEncoding(EncodingType.Primary)); + var result = BuildRequestUriUsingRawPath(GetEncoding(EncodingType.Primary)); if (result == ParsingResult.EncodingError) { - Encoding secondaryEncoding = GetEncoding(EncodingType.Secondary); + var secondaryEncoding = GetEncoding(EncodingType.Secondary); result = BuildRequestUriUsingRawPath(secondaryEncoding); } isValid = (result == ParsingResult.Success) ? true : false; @@ -136,7 +136,7 @@ namespace SocketHttpListener.Net _requestUriString.Append(Uri.SchemeDelimiter); _requestUriString.Append(_cookedUriHost); - ParsingResult result = ParseRawPath(encoding); + var result = ParseRawPath(encoding); if (result == ParsingResult.Success) { _requestUriString.Append(_cookedUriQuery); @@ -327,7 +327,7 @@ namespace SocketHttpListener.Net private static string GetOctetsAsString(IEnumerable octets) { - StringBuilder octetString = new StringBuilder(); + var octetString = new StringBuilder(); bool first = true; foreach (byte octet in octets) diff --git a/SocketHttpListener/Net/HttpListenerResponse.Managed.cs b/SocketHttpListener/Net/HttpListenerResponse.Managed.cs index 198cdcf76..9f9b8384d 100644 --- a/SocketHttpListener/Net/HttpListenerResponse.Managed.cs +++ b/SocketHttpListener/Net/HttpListenerResponse.Managed.cs @@ -263,8 +263,8 @@ namespace SocketHttpListener.Net ComputeCookies(); } - Encoding encoding = _textEncoding.GetDefaultEncoding(); - StreamWriter writer = new StreamWriter(ms, encoding, 256); + var encoding = _textEncoding.GetDefaultEncoding(); + var writer = new StreamWriter(ms, encoding, 256); writer.Write("HTTP/1.1 {0} ", _statusCode); // "1.1" matches Windows implementation, which ignores the response version writer.Flush(); byte[] statusDescriptionBytes = WebHeaderEncoding.GetBytes(StatusDescription); diff --git a/SocketHttpListener/Net/HttpRequestStream.Managed.cs b/SocketHttpListener/Net/HttpRequestStream.Managed.cs index 73a673531..42fc4d97c 100644 --- a/SocketHttpListener/Net/HttpRequestStream.Managed.cs +++ b/SocketHttpListener/Net/HttpRequestStream.Managed.cs @@ -124,7 +124,7 @@ namespace SocketHttpListener.Net { if (size == 0 || _closed) { - HttpStreamAsyncResult ares = new HttpStreamAsyncResult(this); + var ares = new HttpStreamAsyncResult(this); ares._callback = cback; ares._state = state; ares.Complete(); @@ -134,7 +134,7 @@ namespace SocketHttpListener.Net int nread = FillFromBuffer(buffer, offset, size); if (nread > 0 || nread == -1) { - HttpStreamAsyncResult ares = new HttpStreamAsyncResult(this); + var ares = new HttpStreamAsyncResult(this); ares._buffer = buffer; ares._offset = offset; ares._count = size; diff --git a/SocketHttpListener/Net/HttpResponseStream.Managed.cs b/SocketHttpListener/Net/HttpResponseStream.Managed.cs index b4c223418..cda4fe8bc 100644 --- a/SocketHttpListener/Net/HttpResponseStream.Managed.cs +++ b/SocketHttpListener/Net/HttpResponseStream.Managed.cs @@ -70,7 +70,7 @@ namespace SocketHttpListener.Net private void DisposeCore() { byte[] bytes = null; - MemoryStream ms = GetHeaders(true); + var ms = GetHeaders(true); bool chunked = _response.SendChunked; if (_stream.CanWrite) { @@ -110,7 +110,7 @@ namespace SocketHttpListener.Net if (_stream.CanWrite) { - MemoryStream ms = GetHeaders(closing: false, isWebSocketHandshake: true); + var ms = GetHeaders(closing: false, isWebSocketHandshake: true); bool chunked = _response.SendChunked; long start = ms.Position; @@ -146,7 +146,7 @@ namespace SocketHttpListener.Net return null; } - MemoryStream ms = new MemoryStream(); + var ms = new MemoryStream(); _response.SendHeaders(closing, ms, isWebSocketHandshake); return ms; } @@ -190,7 +190,7 @@ namespace SocketHttpListener.Net return; byte[] bytes = null; - MemoryStream ms = GetHeaders(false); + var ms = GetHeaders(false); bool chunked = _response.SendChunked; if (ms != null) { @@ -226,7 +226,7 @@ namespace SocketHttpListener.Net { if (_closed) { - HttpStreamAsyncResult ares = new HttpStreamAsyncResult(this); + var ares = new HttpStreamAsyncResult(this); ares._callback = cback; ares._state = state; ares.Complete(); @@ -234,7 +234,7 @@ namespace SocketHttpListener.Net } byte[] bytes = null; - MemoryStream ms = GetHeaders(false); + var ms = GetHeaders(false); bool chunked = _response.SendChunked; if (ms != null) { diff --git a/SocketHttpListener/Net/ListenerPrefix.cs b/SocketHttpListener/Net/ListenerPrefix.cs index 3e78752fd..edfcb8904 100644 --- a/SocketHttpListener/Net/ListenerPrefix.cs +++ b/SocketHttpListener/Net/ListenerPrefix.cs @@ -40,7 +40,7 @@ namespace SocketHttpListener.Net // Equals and GetHashCode are required to detect duplicates in HttpListenerPrefixCollection. public override bool Equals(object o) { - ListenerPrefix other = o as ListenerPrefix; + var other = o as ListenerPrefix; if (other == null) return false; diff --git a/SocketHttpListener/Net/WebHeaderCollection.cs b/SocketHttpListener/Net/WebHeaderCollection.cs index 8c3395df5..02d3cf61f 100644 --- a/SocketHttpListener/Net/WebHeaderCollection.cs +++ b/SocketHttpListener/Net/WebHeaderCollection.cs @@ -234,7 +234,7 @@ namespace SocketHttpListener.Net internal string ToStringMultiValue() { - StringBuilder sb = new StringBuilder(); + var sb = new StringBuilder(); int count = base.Count; for (int i = 0; i < count; i++) @@ -263,7 +263,7 @@ namespace SocketHttpListener.Net public override string ToString() { - StringBuilder sb = new StringBuilder(); + var sb = new StringBuilder(); int count = base.Count; for (int i = 0; i < count; i++) diff --git a/SocketHttpListener/Net/WebSockets/HttpWebSocket.Managed.cs b/SocketHttpListener/Net/WebSockets/HttpWebSocket.Managed.cs index 79f87dfc9..f51f72dba 100644 --- a/SocketHttpListener/Net/WebSockets/HttpWebSocket.Managed.cs +++ b/SocketHttpListener/Net/WebSockets/HttpWebSocket.Managed.cs @@ -16,8 +16,8 @@ namespace SocketHttpListener.Net.WebSockets ValidateOptions(subProtocol, receiveBufferSize, MinSendBufferSize, keepAliveInterval); // get property will create a new response if one doesn't exist. - HttpListenerResponse response = context.Response; - HttpListenerRequest request = context.Request; + var response = context.Response; + var request = context.Request; ValidateWebSocketHeaders(context); string secWebSocketVersion = request.Headers[HttpKnownHeaderNames.SecWebSocketVersion]; @@ -50,15 +50,15 @@ namespace SocketHttpListener.Net.WebSockets response.StatusCode = (int)HttpStatusCode.SwitchingProtocols; // HTTP 101 response.StatusDescription = HttpStatusDescription.Get(HttpStatusCode.SwitchingProtocols); - HttpResponseStream responseStream = response.OutputStream as HttpResponseStream; + var responseStream = response.OutputStream as HttpResponseStream; // Send websocket handshake headers await responseStream.WriteWebSocketHandshakeHeadersAsync().ConfigureAwait(false); //WebSocket webSocket = WebSocket.CreateFromStream(context.Connection.ConnectedStream, isServer: true, subProtocol, keepAliveInterval); - WebSocket webSocket = new WebSocket(subProtocol); + var webSocket = new WebSocket(subProtocol); - HttpListenerWebSocketContext webSocketContext = new HttpListenerWebSocketContext( + var webSocketContext = new HttpListenerWebSocketContext( request.Url, request.Headers, request.Cookies, diff --git a/SocketHttpListener/Net/WebSockets/HttpWebSocket.cs b/SocketHttpListener/Net/WebSockets/HttpWebSocket.cs index 4667275c5..b346cc98e 100644 --- a/SocketHttpListener/Net/WebSockets/HttpWebSocket.cs +++ b/SocketHttpListener/Net/WebSockets/HttpWebSocket.cs @@ -19,7 +19,7 @@ namespace SocketHttpListener.Net.WebSockets string retVal; // SHA1 used only for hashing purposes, not for crypto. Check here for FIPS compat. - using (SHA1 sha1 = SHA1.Create()) + using (var sha1 = SHA1.Create()) { string acceptString = string.Concat(secWebSocketKey, HttpWebSocket.SecWebSocketKeyGuid); byte[] toHash = Encoding.UTF8.GetBytes(acceptString); diff --git a/SocketHttpListener/Net/WebSockets/WebSocketValidate.cs b/SocketHttpListener/Net/WebSockets/WebSocketValidate.cs index 0469e3b6c..3f61e55fc 100644 --- a/SocketHttpListener/Net/WebSockets/WebSocketValidate.cs +++ b/SocketHttpListener/Net/WebSockets/WebSocketValidate.cs @@ -20,7 +20,7 @@ namespace SocketHttpListener.Net.WebSockets if (validStates != null && validStates.Length > 0) { - foreach (WebSocketState validState in validStates) + foreach (var validState in validStates) { if (currentState == validState) { -- cgit v1.2.3