aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.dockerignore3
-rw-r--r--.drone.yml2
-rw-r--r--.editorconfig4
-rw-r--r--.gitignore36
-rw-r--r--.gitmodules3
-rw-r--r--BDInfo/BDInfo.csproj4
-rw-r--r--BDInfo/BDROM.cs10
-rw-r--r--BDInfo/Properties/AssemblyInfo.cs26
-rw-r--r--BDInfo/TSCodecDTS.cs2
-rw-r--r--BDInfo/TSCodecDTSHD.cs10
-rw-r--r--BDInfo/TSCodecMPEG2.cs4
-rw-r--r--BDInfo/TSCodecTrueHD.cs12
-rw-r--r--BDInfo/TSCodecVC1.cs6
-rw-r--r--BDInfo/TSPlaylistFile.cs24
-rw-r--r--BDInfo/TSStream.cs16
-rw-r--r--BDInfo/TSStreamClipFile.cs10
-rw-r--r--BDInfo/TSStreamFile.cs140
-rw-r--r--CONTRIBUTORS.md4
-rw-r--r--Dockerfile9
-rw-r--r--Dockerfile.arm (renamed from Dockerfile.aarch64)10
-rw-r--r--DvdLib/DvdLib.csproj4
-rw-r--r--DvdLib/Ifo/Dvd.cs2
-rw-r--r--DvdLib/Ifo/DvdTime.cs4
-rw-r--r--DvdLib/Ifo/ProgramChain.cs2
-rw-r--r--DvdLib/Ifo/Title.cs2
-rw-r--r--DvdLib/Properties/AssemblyInfo.cs26
-rw-r--r--Emby.Dlna/Common/Argument.cs2
-rw-r--r--Emby.Dlna/ConnectionManager/ConnectionManagerXmlBuilder.cs4
-rw-r--r--Emby.Dlna/ConnectionManager/ServiceActionListBuilder.cs8
-rw-r--r--Emby.Dlna/ContentDirectory/ContentDirectoryXmlBuilder.cs6
-rw-r--r--Emby.Dlna/ContentDirectory/ServiceActionListBuilder.cs14
-rw-r--r--Emby.Dlna/Didl/DidlBuilder.cs6
-rw-r--r--Emby.Dlna/DlnaManager.cs6
-rw-r--r--Emby.Dlna/Emby.Dlna.csproj4
-rw-r--r--Emby.Dlna/IUpnpService.cs2
-rw-r--r--Emby.Dlna/Main/DlnaEntryPoint.cs40
-rw-r--r--Emby.Dlna/MediaReceiverRegistrar/ControlHandler.cs6
-rw-r--r--Emby.Dlna/MediaReceiverRegistrar/MediaReceiverRegistrarXmlBuilder.cs4
-rw-r--r--Emby.Dlna/MediaReceiverRegistrar/ServiceActionListBuilder.cs10
-rw-r--r--Emby.Dlna/PlayTo/Device.cs16
-rw-r--r--Emby.Dlna/PlayTo/PlayToController.cs8
-rw-r--r--Emby.Dlna/PlayTo/PlaylistItemFactory.cs4
-rw-r--r--Emby.Dlna/PlayTo/SsdpHttpClient.cs30
-rw-r--r--Emby.Dlna/PlayTo/TransportCommands.cs4
-rw-r--r--Emby.Dlna/PlayTo/UpnpContainer.cs2
-rw-r--r--Emby.Dlna/PlayTo/uBaseObject.cs4
-rw-r--r--Emby.Dlna/PlayTo/uParser.cs4
-rw-r--r--Emby.Dlna/Profiles/SonyBravia2010Profile.cs2
-rw-r--r--Emby.Dlna/Properties/AssemblyInfo.cs19
-rw-r--r--Emby.Dlna/Server/DescriptionXmlBuilder.cs11
-rw-r--r--Emby.Dlna/Service/BaseService.cs2
-rw-r--r--Emby.Dlna/Service/ControlErrorHandler.cs2
-rw-r--r--Emby.Dlna/Service/ServiceXmlBuilder.cs6
-rw-r--r--Emby.Dlna/Ssdp/DeviceDiscovery.cs4
-rw-r--r--Emby.Drawing.Skia/Properties/AssemblyInfo.cs22
-rw-r--r--Emby.Drawing.Skia/SkiaEncoder.cs10
-rw-r--r--Emby.Drawing.Skia/StripCollageBuilder.cs7
-rw-r--r--Emby.Drawing/Common/ImageHeader.cs11
-rw-r--r--Emby.Drawing/ImageProcessor.cs22
-rw-r--r--Emby.Drawing/Properties/AssemblyInfo.cs18
-rw-r--r--Emby.IsoMounting/IsoMounter/IsoMounter.csproj4
-rw-r--r--Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs62
-rw-r--r--Emby.IsoMounting/IsoMounter/LinuxMount.cs2
-rw-r--r--Emby.IsoMounting/IsoMounter/Properties/AssemblyInfo.cs21
-rw-r--r--Emby.Naming/AudioBook/AudioBookInfo.cs2
-rw-r--r--Emby.Naming/AudioBook/AudioBookResolver.cs4
-rw-r--r--Emby.Naming/Common/NamingOptions.cs2
-rw-r--r--Emby.Naming/Emby.Naming.csproj4
-rw-r--r--Emby.Naming/Properties/AssemblyInfo.cs21
-rw-r--r--Emby.Naming/Subtitles/SubtitleParser.cs4
-rw-r--r--Emby.Naming/TV/EpisodePathParser.cs4
-rw-r--r--Emby.Naming/TV/EpisodeResolver.cs4
-rw-r--r--Emby.Naming/Video/CleanDateTimeParser.cs6
-rw-r--r--Emby.Naming/Video/CleanStringParser.cs4
-rw-r--r--Emby.Naming/Video/FlagParser.cs2
-rw-r--r--Emby.Naming/Video/Format3DParser.cs4
-rw-r--r--Emby.Naming/Video/StackResolver.cs2
-rw-r--r--Emby.Naming/Video/StubResolver.cs2
-rw-r--r--Emby.Naming/Video/VideoFileInfo.cs2
-rw-r--r--Emby.Naming/Video/VideoInfo.cs2
-rw-r--r--Emby.Naming/Video/VideoListResolver.cs8
-rw-r--r--Emby.Naming/Video/VideoResolver.cs2
-rw-r--r--Emby.Notifications/Emby.Notifications.csproj4
-rw-r--r--Emby.Notifications/Properties/AssemblyInfo.cs27
-rw-r--r--Emby.Photos/Properties/AssemblyInfo.cs31
-rw-r--r--Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs8
-rw-r--r--Emby.Server.Implementations/Activity/ActivityRepository.cs8
-rw-r--r--Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs71
-rw-r--r--Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs5
-rw-r--r--Emby.Server.Implementations/AppBase/ConfigurationHelper.cs3
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs124
-rw-r--r--Emby.Server.Implementations/Archiving/ZipClient.cs18
-rw-r--r--Emby.Server.Implementations/Browser/BrowserLauncher.cs2
-rw-r--r--Emby.Server.Implementations/Channels/ChannelImageProvider.cs5
-rw-r--r--Emby.Server.Implementations/Channels/ChannelManager.cs25
-rw-r--r--Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs39
-rw-r--r--Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs15
-rw-r--r--Emby.Server.Implementations/Data/BaseSqliteRepository.cs33
-rw-r--r--Emby.Server.Implementations/Data/SqliteDisplayPreferencesRepository.cs16
-rw-r--r--Emby.Server.Implementations/Data/SqliteExtensions.cs4
-rw-r--r--Emby.Server.Implementations/Data/SqliteItemRepository.cs74
-rw-r--r--Emby.Server.Implementations/Data/SqliteUserDataRepository.cs44
-rw-r--r--Emby.Server.Implementations/Data/SqliteUserRepository.cs15
-rw-r--r--Emby.Server.Implementations/Data/TypeMapper.cs2
-rw-r--r--Emby.Server.Implementations/Devices/DeviceId.cs31
-rw-r--r--Emby.Server.Implementations/Devices/DeviceManager.cs13
-rw-r--r--Emby.Server.Implementations/Diagnostics/CommonProcess.cs25
-rw-r--r--Emby.Server.Implementations/Dto/DtoService.cs18
-rw-r--r--Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs4
-rw-r--r--Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs8
-rw-r--r--Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs4
-rw-r--r--Emby.Server.Implementations/EntryPoints/RefreshUsersMetadata.cs5
-rw-r--r--Emby.Server.Implementations/EnvironmentInfo/EnvironmentInfo.cs35
-rw-r--r--Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs2
-rw-r--r--Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs26
-rw-r--r--Emby.Server.Implementations/HttpServer/FileWriter.cs13
-rw-r--r--Emby.Server.Implementations/HttpServer/HttpListenerHost.cs37
-rw-r--r--Emby.Server.Implementations/HttpServer/HttpResultFactory.cs26
-rw-r--r--Emby.Server.Implementations/HttpServer/IHttpListener.cs2
-rw-r--r--Emby.Server.Implementations/HttpServer/RangeRequestWriter.cs15
-rw-r--r--Emby.Server.Implementations/HttpServer/Security/AuthService.cs6
-rw-r--r--Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs6
-rw-r--r--Emby.Server.Implementations/HttpServer/StreamWriter.cs9
-rw-r--r--Emby.Server.Implementations/HttpServer/WebSocketConnection.cs22
-rw-r--r--Emby.Server.Implementations/IO/FileRefresher.cs8
-rw-r--r--Emby.Server.Implementations/IO/IsoManager.cs2
-rw-r--r--Emby.Server.Implementations/IO/LibraryMonitor.cs10
-rw-r--r--Emby.Server.Implementations/IO/ManagedFileSystem.cs52
-rw-r--r--Emby.Server.Implementations/IO/MbLinkShortcutHandler.cs11
-rw-r--r--Emby.Server.Implementations/IO/ThrottledStream.cs59
-rw-r--r--Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs19
-rw-r--r--Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs2
-rw-r--r--Emby.Server.Implementations/Library/LibraryManager.cs65
-rw-r--r--Emby.Server.Implementations/Library/MediaSourceManager.cs19
-rw-r--r--Emby.Server.Implementations/Library/PathExtensions.cs4
-rw-r--r--Emby.Server.Implementations/Library/ResolverHelper.cs6
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs13
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs9
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs9
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs8
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/Books/BookResolver.cs6
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/FolderResolver.cs5
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/ItemResolver.cs8
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs4
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs20
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs9
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs5
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs6
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs5
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs14
-rw-r--r--Emby.Server.Implementations/Library/SearchEngine.cs6
-rw-r--r--Emby.Server.Implementations/Library/UserDataManager.cs10
-rw-r--r--Emby.Server.Implementations/Library/UserManager.cs47
-rw-r--r--Emby.Server.Implementations/Library/UserViewManager.cs2
-rw-r--r--Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs2
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs188
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs30
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs6
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs4
-rw-r--r--Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs35
-rw-r--r--Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs26
-rw-r--r--Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs11
-rw-r--r--Emby.Server.Implementations/LiveTv/LiveTvManager.cs79
-rw-r--r--Emby.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs39
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs23
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs31
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs28
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs62
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs8
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs10
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs8
-rw-r--r--Emby.Server.Implementations/Localization/LocalizationManager.cs18
-rw-r--r--Emby.Server.Implementations/Localization/TextLocalizer.cs6
-rw-r--r--Emby.Server.Implementations/MediaEncoder/EncodingManager.cs6
-rw-r--r--Emby.Server.Implementations/Net/DisposableManagedObjectBase.cs8
-rw-r--r--Emby.Server.Implementations/Net/SocketFactory.cs50
-rw-r--r--Emby.Server.Implementations/Net/UdpSocket.cs11
-rw-r--r--Emby.Server.Implementations/Networking/IPNetwork/BigIntegerExt.cs20
-rw-r--r--Emby.Server.Implementations/Networking/IPNetwork/IPAddressCollection.cs20
-rw-r--r--Emby.Server.Implementations/Networking/IPNetwork/IPNetwork.cs196
-rw-r--r--Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs36
-rw-r--r--Emby.Server.Implementations/Networking/NetworkManager.cs37
-rw-r--r--Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs21
-rw-r--r--Emby.Server.Implementations/Playlists/PlaylistManager.cs17
-rw-r--r--Emby.Server.Implementations/Properties/AssemblyInfo.cs25
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs27
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/PeopleValidationTask.cs30
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/RefreshMediaLibraryTask.cs27
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs46
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs42
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs42
-rw-r--r--Emby.Server.Implementations/Security/AuthenticationRepository.cs16
-rw-r--r--Emby.Server.Implementations/Security/EncryptionManager.cs16
-rw-r--r--Emby.Server.Implementations/Security/MBLicenseFile.cs210
-rw-r--r--Emby.Server.Implementations/Security/PluginSecurityManager.cs221
-rw-r--r--Emby.Server.Implementations/Security/RegRecord.cs12
-rw-r--r--Emby.Server.Implementations/Serialization/JsonSerializer.cs40
-rw-r--r--Emby.Server.Implementations/ServerApplicationPaths.cs149
-rw-r--r--Emby.Server.Implementations/Services/HttpResult.cs4
-rw-r--r--Emby.Server.Implementations/Services/ServiceHandler.cs2
-rw-r--r--Emby.Server.Implementations/Services/ServicePath.cs29
-rw-r--r--Emby.Server.Implementations/Services/UrlExtensions.cs2
-rw-r--r--Emby.Server.Implementations/Session/HttpSessionController.cs25
-rw-r--r--Emby.Server.Implementations/Session/SessionManager.cs43
-rw-r--r--Emby.Server.Implementations/Session/SessionWebSocketListener.cs5
-rw-r--r--Emby.Server.Implementations/Session/WebSocketController.cs18
-rw-r--r--Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs23
-rw-r--r--Emby.Server.Implementations/Sorting/AlbumArtistComparer.cs9
-rw-r--r--Emby.Server.Implementations/Sorting/AlbumComparer.cs7
-rw-r--r--Emby.Server.Implementations/Sorting/ArtistComparer.cs7
-rw-r--r--Emby.Server.Implementations/Sorting/CommunityRatingComparer.cs12
-rw-r--r--Emby.Server.Implementations/Sorting/CriticRatingComparer.cs7
-rw-r--r--Emby.Server.Implementations/Sorting/DateCreatedComparer.cs11
-rw-r--r--Emby.Server.Implementations/Sorting/DateLastMediaAddedComparer.cs9
-rw-r--r--Emby.Server.Implementations/Sorting/DatePlayedComparer.cs7
-rw-r--r--Emby.Server.Implementations/Sorting/GameSystemComparer.cs7
-rw-r--r--Emby.Server.Implementations/Sorting/IsFavoriteOrLikeComparer.cs5
-rw-r--r--Emby.Server.Implementations/Sorting/IsFolderComparer.cs7
-rw-r--r--Emby.Server.Implementations/Sorting/IsPlayedComparer.cs5
-rw-r--r--Emby.Server.Implementations/Sorting/IsUnplayedComparer.cs5
-rw-r--r--Emby.Server.Implementations/Sorting/NameComparer.cs11
-rw-r--r--Emby.Server.Implementations/Sorting/OfficialRatingComparer.cs12
-rw-r--r--Emby.Server.Implementations/Sorting/PlayCountComparer.cs7
-rw-r--r--Emby.Server.Implementations/Sorting/PlayersComparer.cs7
-rw-r--r--Emby.Server.Implementations/Sorting/PremiereDateComparer.cs9
-rw-r--r--Emby.Server.Implementations/Sorting/ProductionYearComparer.cs7
-rw-r--r--Emby.Server.Implementations/Sorting/RandomComparer.cs5
-rw-r--r--Emby.Server.Implementations/Sorting/RuntimeComparer.cs12
-rw-r--r--Emby.Server.Implementations/Sorting/SeriesSortNameComparer.cs9
-rw-r--r--Emby.Server.Implementations/Sorting/SortNameComparer.cs11
-rw-r--r--Emby.Server.Implementations/Sorting/StartDateComparer.cs7
-rw-r--r--Emby.Server.Implementations/Sorting/StudioComparer.cs11
-rw-r--r--Emby.Server.Implementations/TV/TVSeriesManager.cs8
-rw-r--r--Emby.Server.Implementations/TextEncoding/NLangDetect/Extensions/CharExtensions.cs2
-rw-r--r--Emby.Server.Implementations/TextEncoding/NLangDetect/Extensions/StringExtensions.cs38
-rw-r--r--Emby.Server.Implementations/TextEncoding/NLangDetect/LanguageDetector.cs2
-rw-r--r--Emby.Server.Implementations/TextEncoding/TextEncoding.cs13
-rw-r--r--Emby.Server.Implementations/TextEncoding/TextEncodingDetect.cs13
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/CharsetDetector.cs38
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Big5Prober.cs18
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/BitPackage.cs20
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CharDistributionAnalyser.cs147
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CharsetProber.cs44
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Charsets.cs44
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CodingStateMachine.cs32
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EUCJPProber.cs18
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EUCKRProber.cs14
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EUCTWProber.cs18
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EscCharsetProber.cs14
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EscSM.cs356
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/GB18030Prober.cs20
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/HebrewProber.cs130
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/JapaneseContextAnalyser.cs68
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangBulgarianModel.cs28
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangCyrillicModel.cs36
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangGreekModel.cs22
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangHebrewModel.cs16
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangHungarianModel.cs20
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangThaiModel.cs16
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Latin1Prober.cs38
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/MBCSGroupProber.cs16
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/MBCSSM.cs834
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCSGroupProber.cs28
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCharsetProber.cs44
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SJISProber.cs20
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SMModel.cs20
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SequenceModel.cs40
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/UTF8Prober.cs10
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/UniversalDetector.cs60
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/DetectionConfidence.cs20
-rw-r--r--Emby.Server.Implementations/TextEncoding/UniversalDetector/ICharsetDetector.cs20
-rw-r--r--Emby.Server.Implementations/Udp/UdpServer.cs10
-rw-r--r--Emby.Server.Implementations/Updates/InstallationManager.cs76
-rw-r--r--Emby.Server.Implementations/UserViews/DynamicImageProvider.cs4
-rw-r--r--Emby.Server.Implementations/UserViews/FolderImageProvider.cs2
-rw-r--r--Emby.XmlTv/Emby.XmlTv.Console/Program.cs2
-rw-r--r--Emby.XmlTv/Emby.XmlTv.Console/Properties/AssemblyInfo.cs10
-rw-r--r--Emby.XmlTv/Emby.XmlTv.Test/Properties/AssemblyInfo.cs10
-rw-r--r--Emby.XmlTv/Emby.XmlTv.Test/XmlTvReaderDateTimeTests.cs2
-rw-r--r--Emby.XmlTv/Emby.XmlTv.Test/XmlTvReaderLanguageTests.cs33
-rw-r--r--Emby.XmlTv/Emby.XmlTv/Classes/XmlTvReader.cs88
-rw-r--r--Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj4
-rw-r--r--Emby.XmlTv/Emby.XmlTv/Entities/XmlTvChannel.cs6
-rw-r--r--Emby.XmlTv/Emby.XmlTv/Entities/XmlTvCredit.cs2
-rw-r--r--Emby.XmlTv/Emby.XmlTv/Entities/XmlTvEpisode.cs6
-rw-r--r--Emby.XmlTv/Emby.XmlTv/Entities/XmlTvIcon.cs6
-rw-r--r--Emby.XmlTv/Emby.XmlTv/Entities/XmlTvLanguage.cs4
-rw-r--r--Emby.XmlTv/Emby.XmlTv/Entities/XmlTvProgram.cs2
-rw-r--r--Emby.XmlTv/Emby.XmlTv/Entities/XmlTvRating.cs6
-rw-r--r--Emby.XmlTv/Emby.XmlTv/Properties/AssemblyInfo.cs29
-rw-r--r--Jellyfin.Server/Jellyfin.Server.csproj7
-rw-r--r--Jellyfin.Server/Properties/AssemblyInfo.cs21
-rw-r--r--Jellyfin.Server/SocketSharp/RequestMono.cs22
-rw-r--r--Jellyfin.Server/SocketSharp/SharpWebSocket.cs4
-rw-r--r--Jellyfin.Server/SocketSharp/WebSocketSharpListener.cs3
-rw-r--r--Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs4
-rw-r--r--MediaBrowser.Api/ApiEntryPoint.cs6
-rw-r--r--MediaBrowser.Api/DisplayPreferencesService.cs2
-rw-r--r--MediaBrowser.Api/EnvironmentService.cs6
-rw-r--r--MediaBrowser.Api/Images/ImageByNameService.cs20
-rw-r--r--MediaBrowser.Api/Library/LibraryStructureService.cs12
-rw-r--r--MediaBrowser.Api/LiveTv/LiveTvService.cs2
-rw-r--r--MediaBrowser.Api/Playback/BaseStreamingService.cs10
-rw-r--r--MediaBrowser.Api/Playback/Hls/BaseHlsService.cs4
-rw-r--r--MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs2
-rw-r--r--MediaBrowser.Api/Playback/MediaInfoService.cs7
-rw-r--r--MediaBrowser.Api/Playback/StreamRequest.cs2
-rw-r--r--MediaBrowser.Api/Playback/StreamState.cs2
-rw-r--r--MediaBrowser.Api/PluginService.cs122
-rw-r--r--MediaBrowser.Api/Properties/AssemblyInfo.cs27
-rw-r--r--MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs4
-rw-r--r--MediaBrowser.Api/System/ActivityLogWebSocketListener.cs2
-rw-r--r--MediaBrowser.Api/System/SystemService.cs6
-rw-r--r--MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs4
-rw-r--r--MediaBrowser.Api/UserLibrary/GenresService.cs2
-rw-r--r--MediaBrowser.Api/UserLibrary/ItemsService.cs10
-rw-r--r--MediaBrowser.Api/UserLibrary/MusicGenresService.cs2
-rw-r--r--MediaBrowser.Api/UserLibrary/YearsService.cs2
-rw-r--r--MediaBrowser.Common/MediaBrowser.Common.csproj2
-rw-r--r--MediaBrowser.Common/Net/HttpResponseInfo.cs2
-rw-r--r--MediaBrowser.Common/Plugins/BasePlugin.cs4
-rw-r--r--MediaBrowser.Common/Properties/AssemblyInfo.cs24
-rw-r--r--MediaBrowser.Common/Security/IRequiresRegistration.cs15
-rw-r--r--MediaBrowser.Common/Security/ISecurityManager.cs32
-rw-r--r--MediaBrowser.Common/Security/PaymentRequiredException.cs8
-rw-r--r--MediaBrowser.Common/Updates/IInstallationManager.cs4
-rw-r--r--MediaBrowser.Controller/Authentication/AuthenticationResult.cs2
-rw-r--r--MediaBrowser.Controller/Channels/IChannelManager.cs4
-rw-r--r--MediaBrowser.Controller/Dlna/IDlnaManager.cs8
-rw-r--r--MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs2
-rw-r--r--MediaBrowser.Controller/Entities/AggregateFolder.cs4
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs20
-rw-r--r--MediaBrowser.Controller/Entities/BaseItemExtensions.cs8
-rw-r--r--MediaBrowser.Controller/Entities/Extensions.cs2
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs8
-rw-r--r--MediaBrowser.Controller/Entities/ISupportsBoxSetGrouping.cs2
-rw-r--r--MediaBrowser.Controller/Entities/InternalItemsQuery.cs2
-rw-r--r--MediaBrowser.Controller/Entities/PeopleHelper.cs8
-rw-r--r--MediaBrowser.Controller/Entities/TagExtensions.cs2
-rw-r--r--MediaBrowser.Controller/Entities/User.cs6
-rw-r--r--MediaBrowser.Controller/Entities/UserItemData.cs4
-rw-r--r--MediaBrowser.Controller/Entities/UserRootFolder.cs4
-rw-r--r--MediaBrowser.Controller/Entities/UserViewBuilder.cs4
-rw-r--r--MediaBrowser.Controller/IO/FileData.cs4
-rw-r--r--MediaBrowser.Controller/IServerApplicationHost.cs2
-rw-r--r--MediaBrowser.Controller/IServerApplicationPaths.cs3
-rw-r--r--MediaBrowser.Controller/Library/ILibraryManager.cs7
-rw-r--r--MediaBrowser.Controller/Library/IUserManager.cs4
-rw-r--r--MediaBrowser.Controller/Library/ItemResolveArgs.cs10
-rw-r--r--MediaBrowser.Controller/LiveTv/ChannelInfo.cs2
-rw-r--r--MediaBrowser.Controller/LiveTv/ILiveTvService.cs2
-rw-r--r--MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs2
-rw-r--r--MediaBrowser.Controller/LiveTv/LiveTvTunerInfo.cs6
-rw-r--r--MediaBrowser.Controller/LiveTv/RecordingInfo.cs6
-rw-r--r--MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs8
-rw-r--r--MediaBrowser.Controller/MediaBrowser.Controller.csproj2
-rw-r--r--MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs13
-rw-r--r--MediaBrowser.Controller/MediaEncoding/ImageEncodingOptions.cs4
-rw-r--r--MediaBrowser.Controller/MediaEncoding/JobLogger.cs3
-rw-r--r--MediaBrowser.Controller/Net/AuthorizationInfo.cs4
-rw-r--r--MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs17
-rw-r--r--MediaBrowser.Controller/Net/IAuthorizationContext.cs2
-rw-r--r--MediaBrowser.Controller/Net/IHttpResultFactory.cs10
-rw-r--r--MediaBrowser.Controller/Net/ISessionContext.cs2
-rw-r--r--MediaBrowser.Controller/Persistence/IUserRepository.cs3
-rw-r--r--MediaBrowser.Controller/Plugins/ILocalizablePlugin.cs2
-rw-r--r--MediaBrowser.Controller/Properties/AssemblyInfo.cs24
-rw-r--r--MediaBrowser.Controller/Providers/ILocalMetadataProvider.cs2
-rw-r--r--MediaBrowser.Controller/Providers/IPreRefreshProvider.cs2
-rw-r--r--MediaBrowser.Controller/Providers/IRemoteImageProvider.cs2
-rw-r--r--MediaBrowser.Controller/Resolvers/IItemResolver.cs2
-rw-r--r--MediaBrowser.Controller/Security/AuthenticationInfo.cs2
-rw-r--r--MediaBrowser.Controller/Security/AuthenticationInfoQuery.cs4
-rw-r--r--MediaBrowser.Controller/Security/IAuthenticationRepository.cs4
-rw-r--r--MediaBrowser.Controller/Session/ISessionManager.cs8
-rw-r--r--MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs4
-rw-r--r--MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs4
-rw-r--r--MediaBrowser.LocalMetadata/Properties/AssemblyInfo.cs30
-rw-r--r--MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.cs4
-rw-r--r--MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs2
-rw-r--r--MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs4
-rw-r--r--MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs49
-rw-r--r--MediaBrowser.MediaEncoding/Probing/FFProbeHelpers.cs2
-rw-r--r--MediaBrowser.MediaEncoding/Probing/InternalMediaInfoResult.cs2
-rw-r--r--MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs14
-rw-r--r--MediaBrowser.MediaEncoding/Properties/AssemblyInfo.cs30
-rw-r--r--MediaBrowser.MediaEncoding/Subtitles/AssParser.cs4
-rw-r--r--MediaBrowser.MediaEncoding/Subtitles/OpenSubtitleDownloader.cs2
-rw-r--r--MediaBrowser.MediaEncoding/Subtitles/SrtParser.cs4
-rw-r--r--MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs4
-rw-r--r--MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs18
-rw-r--r--MediaBrowser.MediaEncoding/Subtitles/TtmlWriter.cs2
-rw-r--r--MediaBrowser.Model/Channels/ChannelFeatures.cs2
-rw-r--r--MediaBrowser.Model/Channels/ChannelQuery.cs2
-rw-r--r--MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs2
-rw-r--r--MediaBrowser.Model/Diagnostics/IProcessFactory.cs6
-rw-r--r--MediaBrowser.Model/Dlna/AudioOptions.cs2
-rw-r--r--MediaBrowser.Model/Dlna/CodecProfile.cs2
-rw-r--r--MediaBrowser.Model/Dlna/ConditionProcessor.cs2
-rw-r--r--MediaBrowser.Model/Dlna/DlnaFlags.cs36
-rw-r--r--MediaBrowser.Model/Dlna/ProfileCondition.cs2
-rw-r--r--MediaBrowser.Model/Dlna/SearchCriteria.cs16
-rw-r--r--MediaBrowser.Model/Dlna/SortCriteria.cs2
-rw-r--r--MediaBrowser.Model/Dlna/StreamBuilder.cs4
-rw-r--r--MediaBrowser.Model/Dlna/StreamInfo.cs4
-rw-r--r--MediaBrowser.Model/Dto/BaseItemDto.cs2
-rw-r--r--MediaBrowser.Model/Dto/GameSystemSummary.cs2
-rw-r--r--MediaBrowser.Model/Dto/ImageOptions.cs2
-rw-r--r--MediaBrowser.Model/Dto/NameValuePair.cs2
-rw-r--r--MediaBrowser.Model/Dto/UserDto.cs4
-rw-r--r--MediaBrowser.Model/Entities/MBRegistrationRecord.cs14
-rw-r--r--MediaBrowser.Model/Entities/MediaStream.cs4
-rw-r--r--MediaBrowser.Model/Entities/PluginSecurityInfo.cs21
-rw-r--r--MediaBrowser.Model/Entities/ProviderIdsExtensions.cs8
-rw-r--r--MediaBrowser.Model/Extensions/LinqExtensions.cs10
-rw-r--r--MediaBrowser.Model/Extensions/ListHelper.cs2
-rw-r--r--MediaBrowser.Model/IO/IFileSystem.cs6
-rw-r--r--MediaBrowser.Model/IO/IIsoMounter.cs3
-rw-r--r--MediaBrowser.Model/LiveTv/LiveTvChannelQuery.cs2
-rw-r--r--MediaBrowser.Model/MediaBrowser.Model.csproj2
-rw-r--r--MediaBrowser.Model/Net/HttpException.cs2
-rw-r--r--MediaBrowser.Model/Net/ISocketFactory.cs15
-rw-r--r--MediaBrowser.Model/Net/IpAddressInfo.cs2
-rw-r--r--MediaBrowser.Model/Net/MimeTypes.cs4
-rw-r--r--MediaBrowser.Model/Net/SocketReceiveResult.cs18
-rw-r--r--MediaBrowser.Model/Notifications/NotificationOption.cs2
-rw-r--r--MediaBrowser.Model/Properties/AssemblyInfo.cs22
-rw-r--r--MediaBrowser.Model/Providers/RemoteImageInfo.cs2
-rw-r--r--MediaBrowser.Model/Querying/AllThemeMediaResult.cs2
-rw-r--r--MediaBrowser.Model/Querying/EpisodeQuery.cs2
-rw-r--r--MediaBrowser.Model/Querying/ItemFields.cs2
-rw-r--r--MediaBrowser.Model/Querying/NextUpQuery.cs4
-rw-r--r--MediaBrowser.Model/Search/SearchHint.cs12
-rw-r--r--MediaBrowser.Model/Serialization/IJsonSerializer.cs18
-rw-r--r--MediaBrowser.Model/Serialization/IXmlSerializer.cs2
-rw-r--r--MediaBrowser.Model/Services/ApiMemberAttribute.cs4
-rw-r--r--MediaBrowser.Model/Services/HttpUtility.cs794
-rw-r--r--MediaBrowser.Model/Services/IHasRequestFilter.cs2
-rw-r--r--MediaBrowser.Model/Services/IHttpResponse.cs2
-rw-r--r--MediaBrowser.Model/Services/QueryParamCollection.cs8
-rw-r--r--MediaBrowser.Model/Services/RouteAttribute.cs114
-rw-r--r--MediaBrowser.Model/Session/PlaybackProgressInfo.cs2
-rw-r--r--MediaBrowser.Model/System/IEnvironmentInfo.cs4
-rw-r--r--MediaBrowser.Model/System/SystemInfo.cs2
-rw-r--r--MediaBrowser.Model/Tasks/ITaskManager.cs4
-rw-r--r--MediaBrowser.Model/Tasks/TaskResult.cs2
-rw-r--r--MediaBrowser.Model/Updates/PackageInfo.cs2
-rw-r--r--MediaBrowser.Providers/BoxSets/MovieDbBoxSetImageProvider.cs2
-rw-r--r--MediaBrowser.Providers/BoxSets/MovieDbBoxSetProvider.cs8
-rw-r--r--MediaBrowser.Providers/Manager/GenericPriorityQueue.cs12
-rw-r--r--MediaBrowser.Providers/Manager/IPriorityQueue.cs4
-rw-r--r--MediaBrowser.Providers/Manager/ImageSaver.cs6
-rw-r--r--MediaBrowser.Providers/Manager/ProviderManager.cs2
-rw-r--r--MediaBrowser.Providers/Manager/ProviderUtils.cs4
-rw-r--r--MediaBrowser.Providers/Manager/SimplePriorityQueue.cs4
-rw-r--r--MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs2
-rw-r--r--MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs4
-rw-r--r--MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs4
-rw-r--r--MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs2
-rw-r--r--MediaBrowser.Providers/Movies/MovieDbImageProvider.cs2
-rw-r--r--MediaBrowser.Providers/Movies/MovieDbProvider.cs4
-rw-r--r--MediaBrowser.Providers/Music/AlbumMetadataService.cs2
-rw-r--r--MediaBrowser.Providers/Music/AudioDbAlbumImageProvider.cs4
-rw-r--r--MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs2
-rw-r--r--MediaBrowser.Providers/Music/AudioDbArtistImageProvider.cs2
-rw-r--r--MediaBrowser.Providers/Music/Extensions.cs2
-rw-r--r--MediaBrowser.Providers/Music/FanArtAlbumProvider.cs2
-rw-r--r--MediaBrowser.Providers/Music/FanArtArtistProvider.cs12
-rw-r--r--MediaBrowser.Providers/Music/MusicBrainzArtistProvider.cs6
-rw-r--r--MediaBrowser.Providers/Omdb/OmdbProvider.cs14
-rw-r--r--MediaBrowser.Providers/Properties/AssemblyInfo.cs27
-rw-r--r--MediaBrowser.Providers/Studios/StudiosImageProvider.cs2
-rw-r--r--MediaBrowser.Providers/TV/FanArt/FanArtSeasonProvider.cs2
-rw-r--r--MediaBrowser.Providers/TV/FanArt/FanartSeriesProvider.cs4
-rw-r--r--MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeImageProvider.cs2
-rw-r--r--MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs2
-rw-r--r--MediaBrowser.Providers/TV/TheMovieDb/MovieDbProviderBase.cs10
-rw-r--r--MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeasonProvider.cs10
-rw-r--r--MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesImageProvider.cs2
-rw-r--r--MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs4
-rw-r--r--MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeImageProvider.cs16
-rw-r--r--MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs7
-rw-r--r--MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs2
-rw-r--r--MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesImageProvider.cs2
-rw-r--r--MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs8
-rw-r--r--MediaBrowser.Tests/MediaEncoding/Subtitles/VttWriterTest.cs2
-rw-r--r--MediaBrowser.Tests/Properties/AssemblyInfo.cs10
-rw-r--r--MediaBrowser.WebDashboard/Api/DashboardService.cs8
-rw-r--r--MediaBrowser.WebDashboard/Api/PackageCreator.cs4
-rw-r--r--MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj2
-rw-r--r--MediaBrowser.WebDashboard/Properties/AssemblyInfo.cs27
m---------MediaBrowser.WebDashboard/jellyfin-web0
-rw-r--r--MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs6
-rw-r--r--MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs2
-rw-r--r--MediaBrowser.XbmcMetadata/Properties/AssemblyInfo.cs30
-rw-r--r--MediaBrowser.XbmcMetadata/Savers/AlbumNfoSaver.cs6
-rw-r--r--MediaBrowser.XbmcMetadata/Savers/ArtistNfoSaver.cs4
-rw-r--r--MediaBrowser.XbmcMetadata/Savers/SeasonNfoSaver.cs12
-rw-r--r--MediaBrowser.XbmcMetadata/Savers/SeriesNfoSaver.cs2
-rw-r--r--MediaBrowser.sln7
-rw-r--r--Mono.Nat/AbstractNatDevice.cs35
-rw-r--r--Mono.Nat/Enums/ProtocolType.cs16
-rw-r--r--Mono.Nat/EventArgs/DeviceEventArgs.cs34
-rw-r--r--Mono.Nat/INatDevice.cs18
-rw-r--r--Mono.Nat/ISearcher.cs4
-rw-r--r--Mono.Nat/Mapping.cs144
-rw-r--r--Mono.Nat/Pmp/PmpConstants.cs52
-rw-r--r--Mono.Nat/Pmp/PmpNatDevice.cs6
-rw-r--r--Mono.Nat/Pmp/PmpSearcher.cs10
-rw-r--r--Mono.Nat/Properties/AssemblyInfo.cs31
-rw-r--r--Mono.Nat/Upnp/Messages/GetServicesMessage.cs4
-rw-r--r--Mono.Nat/Upnp/Messages/Requests/CreatePortMappingMessage.cs4
-rw-r--r--Mono.Nat/Upnp/Messages/UpnpMessage.cs4
-rw-r--r--Mono.Nat/Upnp/Searchers/UpnpSearcher.cs22
-rw-r--r--Mono.Nat/Upnp/UpnpNatDevice.cs6
-rw-r--r--Nuget/MediaBrowser.Common.nuspec19
-rw-r--r--Nuget/MediaBrowser.Server.Core.nuspec22
-rw-r--r--Nuget/readme.txt14
-rw-r--r--OpenSubtitlesHandler/Console/OSHConsole.cs2
-rw-r--r--OpenSubtitlesHandler/MethodResponses/MethodResponseAutoUpdate.cs8
-rw-r--r--OpenSubtitlesHandler/MethodResponses/MethodResponseMovieDetails.cs2
-rw-r--r--OpenSubtitlesHandler/MethodResponses/MethodResponseServerInfo.cs18
-rw-r--r--OpenSubtitlesHandler/OpenSubtitles.cs130
-rw-r--r--OpenSubtitlesHandler/Properties/AssemblyInfo.cs29
-rw-r--r--OpenSubtitlesHandler/SubtitleTypes/SubtitleSearchParameters.cs2
-rw-r--r--OpenSubtitlesHandler/Utilities.cs2
-rw-r--r--OpenSubtitlesHandler/XML-RPC/XmlRpcGenerator.cs2
-rw-r--r--RSSDP/DeviceAvailableEventArgs.cs12
-rw-r--r--RSSDP/DeviceEventArgs.cs64
-rw-r--r--RSSDP/DeviceUnavailableEventArgs.cs106
-rw-r--r--RSSDP/DiscoveredSsdpDevice.cs168
-rw-r--r--RSSDP/DisposableManagedObjectBase.cs84
-rw-r--r--RSSDP/HttpParserBase.cs10
-rw-r--r--RSSDP/HttpRequestParser.cs152
-rw-r--r--RSSDP/HttpResponseParser.cs161
-rw-r--r--RSSDP/IEnumerableExtensions.cs38
-rw-r--r--RSSDP/ISsdpDeviceLocator.cs274
-rw-r--r--RSSDP/ISsdpDevicePublisher.cs57
-rw-r--r--RSSDP/Properties/AssemblyInfo.cs28
-rw-r--r--RSSDP/RequestReceivedEventArgs.cs100
-rw-r--r--RSSDP/ResponseReceivedEventArgs.cs85
-rw-r--r--RSSDP/SsdpCommunicationsServer.cs39
-rw-r--r--RSSDP/SsdpConstants.cs100
-rw-r--r--RSSDP/SsdpDevice.cs8
-rw-r--r--RSSDP/SsdpDeviceLocator.cs8
-rw-r--r--RSSDP/SsdpDevicePublisher.cs22
-rw-r--r--RSSDP/SsdpEmbeddedDevice.cs100
-rw-r--r--RSSDP/SsdpRootDevice.cs114
-rw-r--r--SharedVersion.cs3
-rw-r--r--SocketHttpListener/CloseEventArgs.cs4
-rw-r--r--SocketHttpListener/Ext.cs24
-rw-r--r--SocketHttpListener/HttpBase.cs2
-rw-r--r--SocketHttpListener/HttpResponse.cs6
-rw-r--r--SocketHttpListener/MessageEventArgs.cs2
-rw-r--r--SocketHttpListener/Net/ChunkStream.cs10
-rw-r--r--SocketHttpListener/Net/ChunkedInputStream.cs6
-rw-r--r--SocketHttpListener/Net/CookieHelper.cs6
-rw-r--r--SocketHttpListener/Net/HttpEndPointListener.cs7
-rw-r--r--SocketHttpListener/Net/HttpListener.cs4
-rw-r--r--SocketHttpListener/Net/HttpListenerBasicIdentity.cs6
-rw-r--r--SocketHttpListener/Net/HttpListenerContext.cs4
-rw-r--r--SocketHttpListener/Net/HttpListenerPrefixCollection.cs2
-rw-r--r--SocketHttpListener/Net/HttpListenerRequest.Managed.cs4
-rw-r--r--SocketHttpListener/Net/HttpListenerRequest.cs2
-rw-r--r--SocketHttpListener/Net/HttpListenerRequestUriBuilder.cs12
-rw-r--r--SocketHttpListener/Net/HttpListenerResponse.Managed.cs14
-rw-r--r--SocketHttpListener/Net/HttpListenerResponse.cs6
-rw-r--r--SocketHttpListener/Net/HttpRequestStream.Managed.cs6
-rw-r--r--SocketHttpListener/Net/HttpRequestStream.cs6
-rw-r--r--SocketHttpListener/Net/HttpResponseStream.Managed.cs8
-rw-r--r--SocketHttpListener/Net/WebHeaderCollection.cs140
-rw-r--r--SocketHttpListener/Net/WebSockets/HttpWebSocket.cs22
-rw-r--r--SocketHttpListener/Net/WebSockets/WebSocketCloseStatus.cs6
-rw-r--r--SocketHttpListener/Properties/AssemblyInfo.cs31
-rw-r--r--SocketHttpListener/WebSocket.cs4
-rwxr-xr-xbuild-deb.sh24
-rw-r--r--debian/source/options1
-rw-r--r--deployment/README.md8
-rwxr-xr-xdeployment/clean.sh21
-rwxr-xr-xdeployment/collect_all.sh20
-rwxr-xr-xdeployment/common.build.sh108
-rw-r--r--deployment/debian-package-x64/Dockerfile (renamed from Dockerfile.debian_package)13
-rwxr-xr-xdeployment/debian-package-x64/clean.sh7
-rwxr-xr-xdeployment/debian-package-x64/package.sh31
-rw-r--r--deployment/debian-package-x64/pkg-src/bin/jellyfin-sudoers (renamed from debian/bin/jellyfin-sudoers)0
-rw-r--r--deployment/debian-package-x64/pkg-src/bin/restart.sh (renamed from debian/bin/restart.sh)0
-rw-r--r--deployment/debian-package-x64/pkg-src/changelog (renamed from debian/changelog)0
-rw-r--r--deployment/debian-package-x64/pkg-src/compat (renamed from debian/compat)0
-rw-r--r--deployment/debian-package-x64/pkg-src/conf/jellyfin (renamed from debian/conf/jellyfin)0
-rw-r--r--deployment/debian-package-x64/pkg-src/conf/jellyfin.service.conf (renamed from debian/conf/jellyfin.service.conf)0
-rw-r--r--deployment/debian-package-x64/pkg-src/conf/logging.json (renamed from debian/conf/logging.json)0
-rw-r--r--deployment/debian-package-x64/pkg-src/control (renamed from debian/control)0
-rw-r--r--deployment/debian-package-x64/pkg-src/copyright (renamed from debian/copyright)0
-rw-r--r--deployment/debian-package-x64/pkg-src/gbp.conf (renamed from debian/gbp.conf)2
-rw-r--r--deployment/debian-package-x64/pkg-src/install (renamed from debian/install)0
-rw-r--r--deployment/debian-package-x64/pkg-src/jellyfin.init (renamed from debian/jellyfin.init)0
-rw-r--r--deployment/debian-package-x64/pkg-src/jellyfin.service (renamed from debian/jellyfin.service)0
-rw-r--r--deployment/debian-package-x64/pkg-src/jellyfin.upstart (renamed from debian/jellyfin.upstart)0
-rw-r--r--deployment/debian-package-x64/pkg-src/po/POTFILES.in (renamed from debian/po/POTFILES.in)0
-rw-r--r--deployment/debian-package-x64/pkg-src/po/templates.pot (renamed from debian/po/templates.pot)0
-rw-r--r--deployment/debian-package-x64/pkg-src/postinst (renamed from debian/postinst)0
-rw-r--r--deployment/debian-package-x64/pkg-src/postrm (renamed from debian/postrm)0
-rw-r--r--deployment/debian-package-x64/pkg-src/preinst (renamed from debian/preinst)0
-rw-r--r--deployment/debian-package-x64/pkg-src/prerm (renamed from debian/prerm)0
-rw-r--r--[-rwxr-xr-x]deployment/debian-package-x64/pkg-src/rules (renamed from debian/rules)6
-rw-r--r--deployment/debian-package-x64/pkg-src/source.lintian-overrides (renamed from debian/source.lintian-overrides)0
-rw-r--r--deployment/debian-package-x64/pkg-src/source/format (renamed from debian/source/format)0
-rw-r--r--deployment/debian-package-x64/pkg-src/source/options11
-rwxr-xr-xdeployment/debian-x64/build.sh7
-rwxr-xr-xdeployment/debian-x64/clean.sh7
-rwxr-xr-xdeployment/debian-x64/package.sh7
-rwxr-xr-xdeployment/docker/build.sh12
-rwxr-xr-xdeployment/docker/package.sh12
-rw-r--r--deployment/fedora-package-x64/Dockerfile15
-rwxr-xr-xdeployment/fedora-package-x64/clean.sh7
-rwxr-xr-xdeployment/fedora-package-x64/package.sh83
-rw-r--r--deployment/fedora-package-x64/pkg-src/.gitignore3
-rw-r--r--deployment/fedora-package-x64/pkg-src/README.md43
-rw-r--r--deployment/fedora-package-x64/pkg-src/jellyfin-firewalld.xml9
-rw-r--r--deployment/fedora-package-x64/pkg-src/jellyfin.env27
-rw-r--r--deployment/fedora-package-x64/pkg-src/jellyfin.override.conf7
-rw-r--r--deployment/fedora-package-x64/pkg-src/jellyfin.service15
-rw-r--r--deployment/fedora-package-x64/pkg-src/jellyfin.spec139
-rw-r--r--deployment/fedora-package-x64/pkg-src/jellyfin.sudoers19
-rw-r--r--deployment/fedora-package-x64/pkg-src/restart.sh6
-rwxr-xr-xdeployment/framework/build.sh8
-rwxr-xr-xdeployment/framework/clean.sh7
-rwxr-xr-xdeployment/framework/package.sh7
-rwxr-xr-xdeployment/linux-x64/build.sh7
-rwxr-xr-xdeployment/linux-x64/clean.sh7
-rwxr-xr-xdeployment/linux-x64/package.sh7
-rwxr-xr-xdeployment/make.sh34
-rwxr-xr-xdeployment/osx-x64/build.sh7
-rwxr-xr-xdeployment/osx-x64/clean.sh7
-rwxr-xr-xdeployment/osx-x64/package.sh7
-rwxr-xr-xdeployment/ubuntu-x64/build.sh7
-rwxr-xr-xdeployment/ubuntu-x64/clean.sh7
-rwxr-xr-xdeployment/ubuntu-x64/package.sh7
-rw-r--r--deployment/unraid/docker-templates/README.md15
-rw-r--r--deployment/unraid/docker-templates/jellyfin.xml51
-rw-r--r--deployment/win-generic/build-jellyfin.ps1 (renamed from build-jellyfin.ps1)220
-rw-r--r--deployment/win-generic/install-jellyfin.ps1 (renamed from install-jellyfin.ps1)0
-rw-r--r--deployment/win-generic/install.bat (renamed from install.bat)0
-rwxr-xr-xdeployment/win-x64/build.sh7
-rwxr-xr-xdeployment/win-x64/clean.sh7
-rwxr-xr-xdeployment/win-x64/package.sh9
-rwxr-xr-xdeployment/win-x86/build.sh7
-rwxr-xr-xdeployment/win-x86/clean.sh7
-rwxr-xr-xdeployment/win-x86/package.sh9
649 files changed, 6120 insertions, 7235 deletions
diff --git a/.dockerignore b/.dockerignore
index fc4d8ed26..54b0aa3a7 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -3,3 +3,6 @@
Dockerfile
CONTRIBUTORS.md
README.md
+deployment/*/dist
+deployment/*/pkg-dist
+deployment/collect-dist/
diff --git a/.drone.yml b/.drone.yml
index c6d41b555..98db4884b 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -9,4 +9,4 @@ steps:
- name: build
image: microsoft/dotnet:2-sdk
commands:
- - dotnet publish --configuration release --output /release
+ - dotnet publish --configuration release --output /release Jellyfin.Server
diff --git a/.editorconfig b/.editorconfig
index a3b72c9af..d3a988abc 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -3,11 +3,11 @@
# For emacs, vim, np++ and other editors, see here: https://github.com/editorconfig
###############################
# Core EditorConfig Options #
-###############################
+###############################
+root = true
# All files
[*]
indent_style = space
-root = true
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
diff --git a/.gitignore b/.gitignore
index befba5a20..ec683f38f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,3 @@
-!*
-
.directory
#################
@@ -49,6 +47,8 @@ ProgramData-UI*/
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
+.vs/
+
# User-specific files
*.suo
*.user
@@ -204,7 +204,6 @@ $RECYCLE.BIN/
# Mac crap
.DS_Store
-
#############
## Python
#############
@@ -234,24 +233,33 @@ pip-log.txt
#Mr Developer
.mr.developer.cfg
-MediaBrowser.WebDashboard/dashboard-ui/.idea/
-/.vs
##########
# Rider
##########
.idea/
+##########
+# Visual Studio Code
+##########
+.vscode/
+
#########################
-# Debian build artifacts
+# Build artifacts
#########################
-debian/.debhelper/
-debian/*.debhelper
-debian/debhelper-build-stamp
-debian/files
-debian/jellyfin.substvars
-debian/jellyfin/
-
+# Artifacts for debian-x64
+deployment/debian-package-x64/pkg-src/.debhelper/
+deployment/debian-package-x64/pkg-src/*.debhelper
+deployment/debian-package-x64/pkg-src/debhelper-build-stamp
+deployment/debian-package-x64/pkg-src/files
+deployment/debian-package-x64/pkg-src/jellyfin.substvars
+deployment/debian-package-x64/pkg-src/jellyfin/
# Don't ignore the debian/bin folder
-!debian/bin/
+!deployment/debian-package-x64/pkg-src/bin/
+
+deployment/**/dist/
+deployment/**/pkg-dist/
+deployment/**/pkg-dist-tmp/
+deployment/collect-dist/
+
diff --git a/.gitmodules b/.gitmodules
index 31a58ecf1..7aeb94dfc 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,6 @@
[submodule "ThirdParty/taglib-sharp"]
path = ThirdParty/taglib-sharp
url = https://github.com/mono/taglib-sharp.git
+[submodule "MediaBrowser.WebDashboard/jellyfin-web"]
+ path = MediaBrowser.WebDashboard/jellyfin-web
+ url = https://github.com/jellyfin/jellyfin-web.git
diff --git a/BDInfo/BDInfo.csproj b/BDInfo/BDInfo.csproj
index 403ecec4e..b64f5e7a7 100644
--- a/BDInfo/BDInfo.csproj
+++ b/BDInfo/BDInfo.csproj
@@ -1,6 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
+ <Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
</ItemGroup>
diff --git a/BDInfo/BDROM.cs b/BDInfo/BDROM.cs
index f00d9825a..7d8268222 100644
--- a/BDInfo/BDROM.cs
+++ b/BDInfo/BDROM.cs
@@ -77,7 +77,7 @@ namespace BDInfo
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
_fileSystem = fileSystem;
@@ -235,7 +235,7 @@ namespace BDInfo
break;
}
}
- else throw ex;
+ else throw;
}
}
@@ -273,7 +273,7 @@ namespace BDInfo
break;
}
}
- else throw ex;
+ else throw;
}
}
@@ -310,7 +310,7 @@ namespace BDInfo
break;
}
}
- else throw ex;
+ else throw;
}
}
@@ -336,7 +336,7 @@ namespace BDInfo
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
FileSystemMetadata dir = _fileSystem.GetDirectoryInfo(path);
diff --git a/BDInfo/Properties/AssemblyInfo.cs b/BDInfo/Properties/AssemblyInfo.cs
index aa44da190..77bd9df2a 100644
--- a/BDInfo/Properties/AssemblyInfo.cs
+++ b/BDInfo/Properties/AssemblyInfo.cs
@@ -1,29 +1,21 @@
-using System.Resources;
using System.Reflection;
-using System.Runtime.CompilerServices;
+using System.Resources;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BDInfo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("BDInfo")]
-[assembly: AssemblyCopyright("Copyright © 2016")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2016 CinemaSquid. Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.1")] \ No newline at end of file
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
diff --git a/BDInfo/TSCodecDTS.cs b/BDInfo/TSCodecDTS.cs
index 58eb60fc5..904dcd986 100644
--- a/BDInfo/TSCodecDTS.cs
+++ b/BDInfo/TSCodecDTS.cs
@@ -148,7 +148,7 @@ namespace BDInfo
stream.IsVBR = true;
stream.IsInitialized = true;
break;
-
+
default:
stream.IsVBR = false;
stream.IsInitialized = true;
diff --git a/BDInfo/TSCodecDTSHD.cs b/BDInfo/TSCodecDTSHD.cs
index 169a8077f..3c5ad85cc 100644
--- a/BDInfo/TSCodecDTSHD.cs
+++ b/BDInfo/TSCodecDTSHD.cs
@@ -22,9 +22,9 @@ namespace BDInfo
{
public abstract class TSCodecDTSHD
{
- private static int[] SampleRates = new int[]
+ private static int[] SampleRates = new int[]
{ 0x1F40, 0x3E80, 0x7D00, 0x0FA00, 0x1F400, 0x5622, 0x0AC44, 0x15888, 0x2B110, 0x56220, 0x2EE0, 0x5DC0, 0x0BB80, 0x17700, 0x2EE00, 0x5DC00 };
-
+
public static void Scan(
TSAudioStream stream,
TSStreamBuffer buffer,
@@ -131,7 +131,7 @@ namespace BDInfo
else
{
AssetSizes[i] = buffer.ReadBits(16) + 1;
- }
+ }
}
for (int i = 0; i < nuNumAssets; i++)
{
@@ -189,7 +189,7 @@ namespace BDInfo
}
stream.SampleRate = SampleRates[nuMaxSampleRate];
stream.BitDepth = nuBitResolution;
-
+
stream.LFE = 0;
if ((nuSpkrActivityMask & 0x8) == 0x8)
{
@@ -240,7 +240,7 @@ namespace BDInfo
stream.IsInitialized = true;
}
stream.IsInitialized = (stream.BitRate > 0 ? true : false);
- }
+ }
}
}
}
diff --git a/BDInfo/TSCodecMPEG2.cs b/BDInfo/TSCodecMPEG2.cs
index 3413a06e9..1d523528e 100644
--- a/BDInfo/TSCodecMPEG2.cs
+++ b/BDInfo/TSCodecMPEG2.cs
@@ -33,7 +33,7 @@ namespace BDInfo
int pictureParse = 0;
int sequenceHeaderParse = 0;
int extensionParse = 0;
- int sequenceExtensionParse = 0;
+ int sequenceExtensionParse = 0;
for (int i = 0; i < buffer.Length; i++)
{
@@ -189,7 +189,7 @@ namespace BDInfo
#if DEBUG
if (sequenceExtensionParse == 0)
{
- uint sequenceExtension =
+ uint sequenceExtension =
((parse & 0x8) >> 3);
if (sequenceExtension == 0)
{
diff --git a/BDInfo/TSCodecTrueHD.cs b/BDInfo/TSCodecTrueHD.cs
index baf4fa3df..6ea78614c 100644
--- a/BDInfo/TSCodecTrueHD.cs
+++ b/BDInfo/TSCodecTrueHD.cs
@@ -36,7 +36,7 @@ namespace BDInfo
for (int i = 0; i < buffer.Length; i++)
{
sync = (sync << 8) + buffer.ReadByte();
- if (sync == 0xF8726FBA)
+ if (sync == 0xF8726FBA)
{
syncFound = true;
break;
@@ -63,7 +63,7 @@ namespace BDInfo
int ratebits = buffer.ReadBits(4);
if (ratebits != 0xF)
{
- stream.SampleRate =
+ stream.SampleRate =
(((ratebits & 8) > 0 ? 44100 : 48000) << (ratebits & 7));
}
int temp1 = buffer.ReadBits(8);
@@ -149,9 +149,9 @@ namespace BDInfo
int peak_bitrate = buffer.ReadBits(15);
peak_bitrate = (peak_bitrate * stream.SampleRate) >> 4;
- double peak_bitdepth =
- (double)peak_bitrate /
- (stream.ChannelCount + stream.LFE) /
+ double peak_bitdepth =
+ (double)peak_bitrate /
+ (stream.ChannelCount + stream.LFE) /
stream.SampleRate;
if (peak_bitdepth > 14)
{
@@ -164,7 +164,7 @@ namespace BDInfo
#if DEBUG
System.Diagnostics.Debug.WriteLine(string.Format(
- "{0}\t{1}\t{2:F2}",
+ "{0}\t{1}\t{2:F2}",
stream.PID, peak_bitrate, peak_bitdepth));
#endif
/*
diff --git a/BDInfo/TSCodecVC1.cs b/BDInfo/TSCodecVC1.cs
index 164ef8c47..ce9eabdb9 100644
--- a/BDInfo/TSCodecVC1.cs
+++ b/BDInfo/TSCodecVC1.cs
@@ -50,18 +50,18 @@ namespace BDInfo
{
if ((parse & 0x80000000) == 0)
{
- pictureType =
+ pictureType =
(uint)((parse & 0x78000000) >> 13);
}
else
{
- pictureType =
+ pictureType =
(uint)((parse & 0x3c000000) >> 12);
}
}
else
{
- pictureType =
+ pictureType =
(uint)((parse & 0xf0000000) >> 14);
}
diff --git a/BDInfo/TSPlaylistFile.cs b/BDInfo/TSPlaylistFile.cs
index da6fd37cc..c4e8d62ec 100644
--- a/BDInfo/TSPlaylistFile.cs
+++ b/BDInfo/TSPlaylistFile.cs
@@ -42,7 +42,7 @@ namespace BDInfo
public List<double> Chapters = new List<double>();
- public Dictionary<ushort, TSStream> Streams =
+ public Dictionary<ushort, TSStream> Streams =
new Dictionary<ushort, TSStream>();
public Dictionary<ushort, TSStream> PlaylistStreams =
new Dictionary<ushort, TSStream>();
@@ -50,19 +50,19 @@ namespace BDInfo
new List<TSStreamClip>();
public List<Dictionary<ushort, TSStream>> AngleStreams =
new List<Dictionary<ushort, TSStream>>();
- public List<Dictionary<double, TSStreamClip>> AngleClips =
+ public List<Dictionary<double, TSStreamClip>> AngleClips =
new List<Dictionary<double, TSStreamClip>>();
public int AngleCount = 0;
- public List<TSStream> SortedStreams =
+ public List<TSStream> SortedStreams =
new List<TSStream>();
- public List<TSVideoStream> VideoStreams =
+ public List<TSVideoStream> VideoStreams =
new List<TSVideoStream>();
- public List<TSAudioStream> AudioStreams =
+ public List<TSAudioStream> AudioStreams =
new List<TSAudioStream>();
- public List<TSTextStream> TextStreams =
+ public List<TSTextStream> TextStreams =
new List<TSTextStream>();
- public List<TSGraphicsStream> GraphicsStreams =
+ public List<TSGraphicsStream> GraphicsStreams =
new List<TSGraphicsStream>();
public TSPlaylistFile(
@@ -388,8 +388,8 @@ namespace BDInfo
#if DEBUG
Debug.WriteLine(string.Format(
- "{0} : {1} -> V:{2} A:{3} PG:{4} IG:{5} 2A:{6} 2V:{7} PIP:{8}",
- Name, streamFileName, streamCountVideo, streamCountAudio, streamCountPG, streamCountIG,
+ "{0} : {1} -> V:{2} A:{3} PG:{4} IG:{5} 2A:{6} 2V:{7} PIP:{8}",
+ Name, streamFileName, streamCountVideo, streamCountAudio, streamCountPG, streamCountIG,
streamCountSecondaryAudio, streamCountSecondaryVideo, streamCountPIP));
#endif
@@ -427,7 +427,7 @@ namespace BDInfo
}
/*
* TODO
- *
+ *
for (int i = 0; i < streamCountPIP; i++)
{
TSStream stream = CreatePlaylistStream(data, ref pos);
@@ -955,7 +955,7 @@ namespace BDInfo
}
public int CompareVideoStreams(
- TSVideoStream x,
+ TSVideoStream x,
TSVideoStream y)
{
if (x == null && y == null)
@@ -996,7 +996,7 @@ namespace BDInfo
}
public int CompareAudioStreams(
- TSAudioStream x,
+ TSAudioStream x,
TSAudioStream y)
{
if (x == y)
diff --git a/BDInfo/TSStream.cs b/BDInfo/TSStream.cs
index 5afb81c5e..250308b1a 100644
--- a/BDInfo/TSStream.cs
+++ b/BDInfo/TSStream.cs
@@ -109,7 +109,7 @@ namespace BDInfo
public TSDescriptor Clone()
{
- TSDescriptor descriptor =
+ TSDescriptor descriptor =
new TSDescriptor(Name, (byte)Value.Length);
Value.CopyTo(descriptor.Value, 0);
return descriptor;
@@ -153,15 +153,15 @@ namespace BDInfo
private string _LanguageCode;
public string LanguageCode
{
- get
+ get
{
- return _LanguageCode;
+ return _LanguageCode;
}
- set
+ set
{
_LanguageCode = value;
LanguageName = LanguageCodes.GetName(value);
- }
+ }
}
public bool IsVideoStream
@@ -407,7 +407,7 @@ namespace BDInfo
}
public abstract TSStream Clone();
-
+
protected void CopyTo(TSStream stream)
{
stream.PID = PID;
@@ -435,7 +435,7 @@ namespace BDInfo
public int Width;
public int Height;
- public bool IsInterlaced;
+ public bool IsInterlaced;
public int FrameRateEnumerator;
public int FrameRateDenominator;
public TSAspectRatio AspectRatio;
@@ -581,7 +581,7 @@ namespace BDInfo
stream.FrameRate = _FrameRate;
stream.Width = Width;
stream.Height = Height;
- stream.IsInterlaced = IsInterlaced;
+ stream.IsInterlaced = IsInterlaced;
stream.FrameRateEnumerator = FrameRateEnumerator;
stream.FrameRateDenominator = FrameRateDenominator;
stream.AspectRatio = AspectRatio;
diff --git a/BDInfo/TSStreamClipFile.cs b/BDInfo/TSStreamClipFile.cs
index f2accb88d..f311dd839 100644
--- a/BDInfo/TSStreamClipFile.cs
+++ b/BDInfo/TSStreamClipFile.cs
@@ -69,7 +69,7 @@ namespace BDInfo
byte[] fileType = new byte[8];
Array.Copy(data, 0, fileType, 0, fileType.Length);
-
+
FileType = _textEncoding.GetASCIIEncoding().GetString(fileType, 0, fileType.Length);
if (FileType != "HDMV0100" &&
FileType != "HDMV0200")
@@ -78,7 +78,7 @@ namespace BDInfo
"Clip info file {0} has an unknown file type {1}.",
FileInfo.Name, FileType));
}
-#if DEBUG
+#if DEBUG
Debug.WriteLine(string.Format(
"\tFileType: {0}", FileType));
#endif
@@ -110,9 +110,9 @@ namespace BDInfo
TSStream stream = null;
ushort PID = (ushort)
- ((clipData[streamOffset] << 8) +
+ ((clipData[streamOffset] << 8) +
clipData[streamOffset + 1]);
-
+
streamOffset += 2;
TSStreamType streamType = (TSStreamType)
@@ -240,7 +240,7 @@ namespace BDInfo
}
streamOffset += clipData[streamOffset] + 1;
- }
+ }
IsValid = true;
}
finally
diff --git a/BDInfo/TSStreamFile.cs b/BDInfo/TSStreamFile.cs
index cfd402434..00e6b338e 100644
--- a/BDInfo/TSStreamFile.cs
+++ b/BDInfo/TSStreamFile.cs
@@ -391,7 +391,7 @@ namespace BDInfo
}
Dictionary<ushort, TSStream> playlistStreams = playlist.Streams;
- if (clip.AngleIndex > 0 &&
+ if (clip.AngleIndex > 0 &&
clip.AngleIndex < playlist.AngleStreams.Count + 1)
{
playlistStreams = playlist.AngleStreams[clip.AngleIndex - 1];
@@ -428,7 +428,7 @@ namespace BDInfo
TSStream stream = Streams[PID];
stream.PayloadBytes += streamState.WindowBytes;
stream.PacketCount += streamState.WindowPackets;
-
+
if (stream.IsVideoStream)
{
TSStreamDiagnostics diag = new TSStreamDiagnostics();
@@ -457,7 +457,7 @@ namespace BDInfo
int dataSize = 16384;
Stream fileStream = null;
try
- {
+ {
string fileName;
if (BDInfoSettings.EnableSSIF &&
InterleavedFile != null)
@@ -482,13 +482,13 @@ namespace BDInfo
StreamStates.Clear();
StreamDiagnostics.Clear();
- TSPacketParser parser =
+ TSPacketParser parser =
new TSPacketParser();
-
+
long fileLength = (uint)fileStream.Length;
byte[] buffer = new byte[dataSize];
int bufferLength = 0;
- while ((bufferLength =
+ while ((bufferLength =
fileStream.Read(buffer, 0, buffer.Length)) > 0)
{
int offset = 0;
@@ -598,8 +598,8 @@ namespace BDInfo
parser.StreamState.TransferCount++;
bool isFinished = ScanStream(
- parser.Stream,
- parser.StreamState,
+ parser.Stream,
+ parser.StreamState,
parser.StreamState.StreamBuffer);
if (!isFullScan && isFinished)
@@ -680,10 +680,10 @@ namespace BDInfo
for (int k = 0; k < (parser.PATOffset - 4); k += 4)
{
uint programNumber = (uint)
- ((parser.PAT[k] << 8) +
+ ((parser.PAT[k] << 8) +
parser.PAT[k + 1]);
- ushort programPID = (ushort)
+ ushort programPID = (ushort)
(((parser.PAT[k + 2] & 0x1F) << 8) +
parser.PAT[k + 3]);
@@ -985,7 +985,7 @@ namespace BDInfo
parser.PMTProgramDescriptorLength = buffer[i];
parser.PMTProgramDescriptors.Add(
new TSDescriptor(
- parser.PMTProgramDescriptor,
+ parser.PMTProgramDescriptor,
parser.PMTProgramDescriptorLength));
break;
}
@@ -998,7 +998,7 @@ namespace BDInfo
parser.PMTProgramDescriptors.Count - 1];
int valueIndex =
- descriptor.Value.Length -
+ descriptor.Value.Length -
parser.PMTProgramDescriptorLength - 1;
descriptor.Value[valueIndex] = buffer[i];
@@ -1020,8 +1020,8 @@ namespace BDInfo
parser.SyncState = false;
}
}
- else if (parser.Stream != null &&
- parser.StreamState != null &&
+ else if (parser.Stream != null &&
+ parser.StreamState != null &&
parser.TransportScramblingControl == 0)
{
TSStream stream = parser.Stream;
@@ -1032,7 +1032,7 @@ namespace BDInfo
if (streamState.TransferState)
{
- if ((bufferLength - i) >= streamState.PacketLength &&
+ if ((bufferLength - i) >= streamState.PacketLength &&
streamState.PacketLength > 0)
{
offset = streamState.PacketLength;
@@ -1085,7 +1085,7 @@ namespace BDInfo
--parser.PacketLength;
bool headerFound = false;
- if (stream.IsVideoStream &&
+ if (stream.IsVideoStream &&
streamState.Parse == 0x000001FD)
{
headerFound = true;
@@ -1170,18 +1170,18 @@ namespace BDInfo
(byte)(streamState.Parse & 0xFF);
#endif
break;
-
+
case 1:
- streamState.PESHeaderFlags =
+ streamState.PESHeaderFlags =
(byte)(streamState.Parse & 0xFF);
#if DEBUG
streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xFF);
#endif
break;
-
+
case 0:
- streamState.PESHeaderLength =
+ streamState.PESHeaderLength =
(byte)(streamState.Parse & 0xFF);
#if DEBUG
streamState.PESHeader[streamState.PESHeaderIndex++] =
@@ -1211,48 +1211,48 @@ namespace BDInfo
switch (streamState.PTSParse)
{
case 4:
- streamState.PTSTemp =
+ streamState.PTSTemp =
((streamState.Parse & 0xE) << 29);
#if DEBUG
- streamState.PESHeader[streamState.PESHeaderIndex++] =
+ streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xff);
#endif
break;
-
+
case 3:
- streamState.PTSTemp |=
+ streamState.PTSTemp |=
((streamState.Parse & 0xFF) << 22);
#if DEBUG
- streamState.PESHeader[streamState.PESHeaderIndex++] =
+ streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xFF);
#endif
break;
-
+
case 2:
- streamState.PTSTemp |=
+ streamState.PTSTemp |=
((streamState.Parse & 0xFE) << 14);
#if DEBUG
- streamState.PESHeader[streamState.PESHeaderIndex++] =
+ streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xFF);
#endif
break;
-
+
case 1:
- streamState.PTSTemp |=
+ streamState.PTSTemp |=
((streamState.Parse & 0xFF) << 7);
#if DEBUG
- streamState.PESHeader[streamState.PESHeaderIndex++] =
+ streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xFF);
#endif
break;
-
+
case 0:
- streamState.PTSTemp |=
+ streamState.PTSTemp |=
((streamState.Parse & 0xFE) >> 1);
#if DEBUG
- streamState.PESHeader[streamState.PESHeaderIndex++] =
+ streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xff);
-#endif
+#endif
streamState.PTS = streamState.PTSTemp;
if (streamState.PTS > streamState.PTSLast)
@@ -1260,13 +1260,13 @@ namespace BDInfo
if (streamState.PTSLast > 0)
{
streamState.PTSTransfer = (streamState.PTS - streamState.PTSLast);
- }
+ }
streamState.PTSLast = streamState.PTS;
}
streamState.PTSDiff = streamState.PTS - streamState.DTSPrev;
- if (streamState.PTSCount > 0 &&
+ if (streamState.PTSCount > 0 &&
stream.IsVideoStream)
{
UpdateStreamBitrates(stream.PID, streamState.PTS, streamState.PTSDiff);
@@ -1280,7 +1280,7 @@ namespace BDInfo
}
Length = (double)(parser.PTSLast - parser.PTSFirst) / 90000;
}
-
+
streamState.DTSPrev = streamState.PTS;
streamState.PTSCount++;
if (streamState.PESHeaderLength == 0)
@@ -1299,46 +1299,46 @@ namespace BDInfo
switch (streamState.DTSParse)
{
case 9:
- streamState.PTSTemp =
+ streamState.PTSTemp =
((streamState.Parse & 0xE) << 29);
#if DEBUG
- streamState.PESHeader[streamState.PESHeaderIndex++] =
+ streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xFF);
#endif
break;
-
+
case 8:
- streamState.PTSTemp |=
+ streamState.PTSTemp |=
((streamState.Parse & 0xFF) << 22);
#if DEBUG
- streamState.PESHeader[streamState.PESHeaderIndex++] =
+ streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xFF);
#endif
break;
-
+
case 7:
- streamState.PTSTemp |=
+ streamState.PTSTemp |=
((streamState.Parse & 0xFE) << 14);
#if DEBUG
- streamState.PESHeader[streamState.PESHeaderIndex++] =
+ streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xff);
#endif
break;
-
+
case 6:
- streamState.PTSTemp |=
+ streamState.PTSTemp |=
((streamState.Parse & 0xFF) << 7);
#if DEBUG
- streamState.PESHeader[streamState.PESHeaderIndex++] =
+ streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xFF);
#endif
break;
-
+
case 5:
- streamState.PTSTemp |=
+ streamState.PTSTemp |=
((streamState.Parse & 0xFE) >> 1);
#if DEBUG
- streamState.PESHeader[streamState.PESHeaderIndex++] =
+ streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xff);
#endif
streamState.PTS = streamState.PTSTemp;
@@ -1347,48 +1347,48 @@ namespace BDInfo
streamState.PTSLast = streamState.PTS;
}
break;
-
+
case 4:
- streamState.DTSTemp =
+ streamState.DTSTemp =
((streamState.Parse & 0xE) << 29);
#if DEBUG
- streamState.PESHeader[streamState.PESHeaderIndex++] =
+ streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xff);
#endif
break;
-
+
case 3:
- streamState.DTSTemp |=
+ streamState.DTSTemp |=
((streamState.Parse & 0xFF) << 22);
#if DEBUG
- streamState.PESHeader[streamState.PESHeaderIndex++] =
+ streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xff);
#endif
break;
-
+
case 2:
- streamState.DTSTemp |=
+ streamState.DTSTemp |=
((streamState.Parse & 0xFE) << 14);
#if DEBUG
- streamState.PESHeader[streamState.PESHeaderIndex++] =
+ streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xff);
#endif
break;
-
+
case 1:
- streamState.DTSTemp |=
+ streamState.DTSTemp |=
((streamState.Parse & 0xFF) << 7);
#if DEBUG
- streamState.PESHeader[streamState.PESHeaderIndex++] =
+ streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xFF);
#endif
break;
-
+
case 0:
- streamState.DTSTemp |=
+ streamState.DTSTemp |=
((streamState.Parse & 0xFE) >> 1);
#if DEBUG
- streamState.PESHeader[streamState.PESHeaderIndex++] =
+ streamState.PESHeader[streamState.PESHeaderIndex++] =
(byte)(streamState.Parse & 0xff);
#endif
streamState.PTSDiff = streamState.DTSTemp - streamState.DTSPrev;
@@ -1482,8 +1482,8 @@ namespace BDInfo
}
private TSStream CreateStream(
- ushort streamPID,
- byte streamType,
+ ushort streamPID,
+ byte streamType,
List<TSDescriptor> streamDescriptors)
{
TSStream stream = null;
@@ -1548,6 +1548,6 @@ namespace BDInfo
}
return stream;
- }
+ }
}
}
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 80c172309..f33f48fb3 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -11,7 +11,9 @@
- [AnthonyLavado](https://github.com/anthonylavado)
- [sparky8251](https://github.com/sparky8251)
- [LeoVerto](https://github.com/LeoVerto)
-
+ - [grafixeyehero](https://github.com/grafixeyehero)
+ - [cvium](https://github.com/cvium)
+
# Emby Contributors
- [LukePulverenti](https://github.com/LukePulverenti)
diff --git a/Dockerfile b/Dockerfile
index 75700e6f5..02332d40b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -15,7 +15,10 @@ WORKDIR /repo
COPY . .
RUN export DOTNET_CLI_TELEMETRY_OPTOUT=1 \
&& dotnet clean \
- && dotnet publish --configuration release --output /jellyfin
+ && dotnet publish \
+ --configuration release \
+ --output /jellyfin \
+ Jellyfin.Server
FROM microsoft/dotnet:${DOTNET_VERSION}-runtime
@@ -23,6 +26,6 @@ COPY --from=builder /jellyfin /jellyfin
COPY --from=ffmpeg /ffmpeg-bin/* /usr/bin/
EXPOSE 8096
VOLUME /config /media
-RUN apt update \
- && apt install -y libfontconfig1 # needed for Skia
+RUN apt-get update \
+ && apt-get install -y libfontconfig1 --no-install-recommends # needed for Skia
ENTRYPOINT dotnet /jellyfin/jellyfin.dll -programdata /config
diff --git a/Dockerfile.aarch64 b/Dockerfile.arm
index da4acc841..a0b3d0e1d 100644
--- a/Dockerfile.aarch64
+++ b/Dockerfile.arm
@@ -3,15 +3,19 @@ ARG DOTNET_VERSION=3.0
FROM microsoft/dotnet:${DOTNET_VERSION}-sdk as builder
WORKDIR /repo
COPY . .
+#TODO Remove or update the sed line when we update dotnet version.
RUN export DOTNET_CLI_TELEMETRY_OPTOUT=1 \
&& find . -type f -exec sed -i 's/netcoreapp2.1/netcoreapp3.0/g' {} \; \
&& dotnet clean \
- && dotnet publish --configuration release --output /jellyfin
+ && dotnet publish \
+ --configuration release \
+ --output /jellyfin \
+ Jellyfin.Server
FROM microsoft/dotnet:${DOTNET_VERSION}-runtime
COPY --from=builder /jellyfin /jellyfin
EXPOSE 8096
-RUN apt update \
- && apt install -y ffmpeg
+RUN apt-get update \
+ && apt-get install -y ffmpeg
VOLUME /config /media
ENTRYPOINT dotnet /jellyfin/jellyfin.dll -programdata /config
diff --git a/DvdLib/DvdLib.csproj b/DvdLib/DvdLib.csproj
index 403ecec4e..b64f5e7a7 100644
--- a/DvdLib/DvdLib.csproj
+++ b/DvdLib/DvdLib.csproj
@@ -1,6 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
+ <Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
</ItemGroup>
diff --git a/DvdLib/Ifo/Dvd.cs b/DvdLib/Ifo/Dvd.cs
index 508c23db4..b43f0e832 100644
--- a/DvdLib/Ifo/Dvd.cs
+++ b/DvdLib/Ifo/Dvd.cs
@@ -81,7 +81,7 @@ namespace DvdLib.Ifo
private void ReadVTS(ushort vtsNum, List<FileSystemMetadata> allFiles)
{
- var filename = String.Format("VTS_{0:00}_0.IFO", vtsNum);
+ var filename = string.Format("VTS_{0:00}_0.IFO", vtsNum);
var vtsPath = allFiles.FirstOrDefault(i => string.Equals(i.Name, filename, StringComparison.OrdinalIgnoreCase)) ??
allFiles.FirstOrDefault(i => string.Equals(i.Name, Path.ChangeExtension(filename, ".bup"), StringComparison.OrdinalIgnoreCase));
diff --git a/DvdLib/Ifo/DvdTime.cs b/DvdLib/Ifo/DvdTime.cs
index f565f5fdf..072cd8d88 100644
--- a/DvdLib/Ifo/DvdTime.cs
+++ b/DvdLib/Ifo/DvdTime.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -20,7 +20,7 @@ namespace DvdLib.Ifo
else if ((data[3] & 0x40) != 0) FrameRate = 25;
}
- private byte GetBCDValue(byte data)
+ private static byte GetBCDValue(byte data)
{
return (byte)((((data & 0xF0) >> 4) * 10) + (data & 0x0F));
}
diff --git a/DvdLib/Ifo/ProgramChain.cs b/DvdLib/Ifo/ProgramChain.cs
index 6b4e5fa32..85dfcea05 100644
--- a/DvdLib/Ifo/ProgramChain.cs
+++ b/DvdLib/Ifo/ProgramChain.cs
@@ -68,7 +68,7 @@ namespace DvdLib.Ifo
ProhibitedUserOperations = (UserOperation)br.ReadUInt32();
AudioStreamControl = br.ReadBytes(16);
SubpictureStreamControl = br.ReadBytes(128);
-
+
_nextProgramNumber = br.ReadUInt16();
_prevProgramNumber = br.ReadUInt16();
_goupProgramNumber = br.ReadUInt16();
diff --git a/DvdLib/Ifo/Title.cs b/DvdLib/Ifo/Title.cs
index 70deb45bf..6ef83b4fb 100644
--- a/DvdLib/Ifo/Title.cs
+++ b/DvdLib/Ifo/Title.cs
@@ -20,7 +20,7 @@ namespace DvdLib.Ifo
public ProgramChain EntryProgramChain { get; private set; }
public readonly List<ProgramChain> ProgramChains;
- public readonly List<Chapter> Chapters;
+ public readonly List<Chapter> Chapters;
public Title(uint titleNum)
{
diff --git a/DvdLib/Properties/AssemblyInfo.cs b/DvdLib/Properties/AssemblyInfo.cs
index cca792684..54e2c6b44 100644
--- a/DvdLib/Properties/AssemblyInfo.cs
+++ b/DvdLib/Properties/AssemblyInfo.cs
@@ -1,29 +1,21 @@
-using System.Resources;
using System.Reflection;
-using System.Runtime.CompilerServices;
+using System.Resources;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DvdLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("DvdLib")]
-[assembly: AssemblyCopyright("Copyright © 2016")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.1")] \ No newline at end of file
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
diff --git a/Emby.Dlna/Common/Argument.cs b/Emby.Dlna/Common/Argument.cs
index 7e61c3d6d..e6a220a7f 100644
--- a/Emby.Dlna/Common/Argument.cs
+++ b/Emby.Dlna/Common/Argument.cs
@@ -1,6 +1,6 @@

namespace Emby.Dlna.Common
-{
+{
public class Argument
{
public string Name { get; set; }
diff --git a/Emby.Dlna/ConnectionManager/ConnectionManagerXmlBuilder.cs b/Emby.Dlna/ConnectionManager/ConnectionManagerXmlBuilder.cs
index 0666eda22..db18025e6 100644
--- a/Emby.Dlna/ConnectionManager/ConnectionManagerXmlBuilder.cs
+++ b/Emby.Dlna/ConnectionManager/ConnectionManagerXmlBuilder.cs
@@ -1,4 +1,4 @@
-using Emby.Dlna.Common;
+using Emby.Dlna.Common;
using Emby.Dlna.Service;
using System.Collections.Generic;
@@ -11,7 +11,7 @@ namespace Emby.Dlna.ConnectionManager
return new ServiceXmlBuilder().GetXml(new ServiceActionListBuilder().GetActions(), GetStateVariables());
}
- private IEnumerable<StateVariable> GetStateVariables()
+ private static IEnumerable<StateVariable> GetStateVariables()
{
var list = new List<StateVariable>();
diff --git a/Emby.Dlna/ConnectionManager/ServiceActionListBuilder.cs b/Emby.Dlna/ConnectionManager/ServiceActionListBuilder.cs
index 9b22b7773..674bc4c8e 100644
--- a/Emby.Dlna/ConnectionManager/ServiceActionListBuilder.cs
+++ b/Emby.Dlna/ConnectionManager/ServiceActionListBuilder.cs
@@ -1,4 +1,4 @@
-using Emby.Dlna.Common;
+using Emby.Dlna.Common;
using System.Collections.Generic;
namespace Emby.Dlna.ConnectionManager
@@ -19,7 +19,7 @@ namespace Emby.Dlna.ConnectionManager
return list;
}
- private ServiceAction PrepareForConnection()
+ private static ServiceAction PrepareForConnection()
{
var action = new ServiceAction
{
@@ -77,8 +77,8 @@ namespace Emby.Dlna.ConnectionManager
return action;
}
-
- private ServiceAction GetCurrentConnectionInfo()
+
+ private static ServiceAction GetCurrentConnectionInfo()
{
var action = new ServiceAction
{
diff --git a/Emby.Dlna/ContentDirectory/ContentDirectoryXmlBuilder.cs b/Emby.Dlna/ContentDirectory/ContentDirectoryXmlBuilder.cs
index facc25214..2695a5433 100644
--- a/Emby.Dlna/ContentDirectory/ContentDirectoryXmlBuilder.cs
+++ b/Emby.Dlna/ContentDirectory/ContentDirectoryXmlBuilder.cs
@@ -1,4 +1,4 @@
-using Emby.Dlna.Common;
+using Emby.Dlna.Common;
using Emby.Dlna.Service;
using System.Collections.Generic;
@@ -8,11 +8,11 @@ namespace Emby.Dlna.ContentDirectory
{
public string GetXml()
{
- return new ServiceXmlBuilder().GetXml(new ServiceActionListBuilder().GetActions(),
+ return new ServiceXmlBuilder().GetXml(new ServiceActionListBuilder().GetActions(),
GetStateVariables());
}
- private IEnumerable<StateVariable> GetStateVariables()
+ private static IEnumerable<StateVariable> GetStateVariables()
{
var list = new List<StateVariable>();
diff --git a/Emby.Dlna/ContentDirectory/ServiceActionListBuilder.cs b/Emby.Dlna/ContentDirectory/ServiceActionListBuilder.cs
index 8e5c07ce2..7749a39af 100644
--- a/Emby.Dlna/ContentDirectory/ServiceActionListBuilder.cs
+++ b/Emby.Dlna/ContentDirectory/ServiceActionListBuilder.cs
@@ -1,4 +1,4 @@
-using Emby.Dlna.Common;
+using Emby.Dlna.Common;
using System.Collections.Generic;
namespace Emby.Dlna.ContentDirectory
@@ -20,7 +20,7 @@ namespace Emby.Dlna.ContentDirectory
};
}
- private ServiceAction GetGetSystemUpdateIDAction()
+ private static ServiceAction GetGetSystemUpdateIDAction()
{
var action = new ServiceAction
{
@@ -37,7 +37,7 @@ namespace Emby.Dlna.ContentDirectory
return action;
}
- private ServiceAction GetSearchCapabilitiesAction()
+ private static ServiceAction GetSearchCapabilitiesAction()
{
var action = new ServiceAction
{
@@ -54,7 +54,7 @@ namespace Emby.Dlna.ContentDirectory
return action;
}
- private ServiceAction GetSortCapabilitiesAction()
+ private static ServiceAction GetSortCapabilitiesAction()
{
var action = new ServiceAction
{
@@ -71,7 +71,7 @@ namespace Emby.Dlna.ContentDirectory
return action;
}
- private ServiceAction GetX_GetFeatureListAction()
+ private static ServiceAction GetX_GetFeatureListAction()
{
var action = new ServiceAction
{
@@ -88,7 +88,7 @@ namespace Emby.Dlna.ContentDirectory
return action;
}
- private ServiceAction GetSearchAction()
+ private static ServiceAction GetSearchAction()
{
var action = new ServiceAction
{
@@ -334,7 +334,7 @@ namespace Emby.Dlna.ContentDirectory
return action;
}
-
+
private ServiceAction GetXSetBookmarkAction()
{
var action = new ServiceAction
diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.cs
index 7af48ae17..a8217c0d4 100644
--- a/Emby.Dlna/Didl/DidlBuilder.cs
+++ b/Emby.Dlna/Didl/DidlBuilder.cs
@@ -375,7 +375,7 @@ namespace Emby.Dlna.Didl
? GetMimeType(filename)
: mediaProfile.MimeType;
- writer.WriteAttributeString("protocolInfo", String.Format(
+ writer.WriteAttributeString("protocolInfo", string.Format(
"http-get:*:{0}:{1}",
mimeType,
contentFeatures
@@ -573,7 +573,7 @@ namespace Emby.Dlna.Didl
streamInfo.RunTimeTicks ?? 0,
streamInfo.TranscodeSeekInfo);
- writer.WriteAttributeString("protocolInfo", String.Format(
+ writer.WriteAttributeString("protocolInfo", string.Format(
"http-get:*:{0}:{1}",
mimeType,
contentFeatures
@@ -1017,7 +1017,7 @@ namespace Emby.Dlna.Didl
var contentFeatures = new ContentFeatureBuilder(_profile)
.BuildImageHeader(format, width, height, imageInfo.IsDirectStream, org_Pn);
- writer.WriteAttributeString("protocolInfo", String.Format(
+ writer.WriteAttributeString("protocolInfo", string.Format(
"http-get:*:{0}:{1}",
GetMimeType("file." + format),
contentFeatures
diff --git a/Emby.Dlna/DlnaManager.cs b/Emby.Dlna/DlnaManager.cs
index 48a33757b..a8777cbac 100644
--- a/Emby.Dlna/DlnaManager.cs
+++ b/Emby.Dlna/DlnaManager.cs
@@ -95,7 +95,7 @@ namespace Emby.Dlna
{
if (deviceInfo == null)
{
- throw new ArgumentNullException("deviceInfo");
+ throw new ArgumentNullException(nameof(deviceInfo));
}
var profile = GetProfiles()
@@ -207,7 +207,7 @@ namespace Emby.Dlna
{
if (headers == null)
{
- throw new ArgumentNullException("headers");
+ throw new ArgumentNullException(nameof(headers));
}
// Convert to case insensitive
@@ -335,7 +335,7 @@ namespace Emby.Dlna
{
if (string.IsNullOrEmpty(id))
{
- throw new ArgumentNullException("id");
+ throw new ArgumentNullException(nameof(id));
}
var info = GetProfileInfosInternal().First(i => string.Equals(i.Info.Id, id, StringComparison.OrdinalIgnoreCase));
diff --git a/Emby.Dlna/Emby.Dlna.csproj b/Emby.Dlna/Emby.Dlna.csproj
index c58144e00..f48816453 100644
--- a/Emby.Dlna/Emby.Dlna.csproj
+++ b/Emby.Dlna/Emby.Dlna.csproj
@@ -1,6 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
+ <Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" />
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
diff --git a/Emby.Dlna/IUpnpService.cs b/Emby.Dlna/IUpnpService.cs
index caae87ba3..0a52e9acf 100644
--- a/Emby.Dlna/IUpnpService.cs
+++ b/Emby.Dlna/IUpnpService.cs
@@ -10,7 +10,7 @@ namespace Emby.Dlna
/// <param name="headers">The headers.</param>
/// <returns>System.String.</returns>
string GetServiceXml(IDictionary<string, string> headers);
-
+
/// <summary>
/// Processes the control request.
/// </summary>
diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.cs
index 6ab0767a5..eae3f22de 100644
--- a/Emby.Dlna/Main/DlnaEntryPoint.cs
+++ b/Emby.Dlna/Main/DlnaEntryPoint.cs
@@ -75,11 +75,11 @@ namespace Emby.Dlna.Main
IUserDataManager userDataManager,
ILocalizationManager localizationManager,
IMediaSourceManager mediaSourceManager,
- IDeviceDiscovery deviceDiscovery,
- IMediaEncoder mediaEncoder,
- ISocketFactory socketFactory,
- ITimerFactory timerFactory,
- IEnvironmentInfo environmentInfo,
+ IDeviceDiscovery deviceDiscovery,
+ IMediaEncoder mediaEncoder,
+ ISocketFactory socketFactory,
+ ITimerFactory timerFactory,
+ IEnvironmentInfo environmentInfo,
INetworkManager networkManager,
IUserViewManager userViewManager,
IXmlReaderSettingsFactory xmlReaderSettingsFactory,
@@ -104,19 +104,19 @@ namespace Emby.Dlna.Main
_networkManager = networkManager;
_logger = loggerFactory.CreateLogger("Dlna");
- ContentDirectory = new ContentDirectory.ContentDirectory(dlnaManager,
- userDataManager,
- imageProcessor,
- libraryManager,
- config,
- userManager,
- _logger,
- httpClient,
- localizationManager,
- mediaSourceManager,
+ ContentDirectory = new ContentDirectory.ContentDirectory(dlnaManager,
+ userDataManager,
+ imageProcessor,
+ libraryManager,
+ config,
+ userManager,
+ _logger,
+ httpClient,
+ localizationManager,
+ mediaSourceManager,
userViewManager,
- mediaEncoder,
- xmlReaderSettingsFactory,
+ mediaEncoder,
+ xmlReaderSettingsFactory,
tvSeriesManager);
ConnectionManager = new ConnectionManager.ConnectionManager(dlnaManager, config, _logger, httpClient, xmlReaderSettingsFactory);
@@ -271,12 +271,12 @@ namespace Emby.Dlna.Main
var device = new SsdpRootDevice
{
CacheLifetime = TimeSpan.FromSeconds(1800), //How long SSDP clients can cache this info.
- Location = uri, // Must point to the URL that serves your devices UPnP description document.
+ Location = uri, // Must point to the URL that serves your devices UPnP description document.
FriendlyName = "Jellyfin",
Manufacturer = "Jellyfin",
ModelName = "Jellyfin Server",
Uuid = udn
- // This must be a globally unique value that survives reboots etc. Get from storage or embedded hardware etc.
+ // This must be a globally unique value that survives reboots etc. Get from storage or embedded hardware etc.
};
SetProperies(device, fullService);
@@ -297,7 +297,7 @@ namespace Emby.Dlna.Main
Manufacturer = device.Manufacturer,
ModelName = device.ModelName,
Uuid = udn
- // This must be a globally unique value that survives reboots etc. Get from storage or embedded hardware etc.
+ // This must be a globally unique value that survives reboots etc. Get from storage or embedded hardware etc.
};
SetProperies(embeddedDevice, subDevice);
diff --git a/Emby.Dlna/MediaReceiverRegistrar/ControlHandler.cs b/Emby.Dlna/MediaReceiverRegistrar/ControlHandler.cs
index d1a595de0..5ffa30f68 100644
--- a/Emby.Dlna/MediaReceiverRegistrar/ControlHandler.cs
+++ b/Emby.Dlna/MediaReceiverRegistrar/ControlHandler.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Extensions;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration;
using Emby.Dlna.Server;
using Emby.Dlna.Service;
@@ -21,7 +21,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
throw new ResourceNotFoundException("Unexpected control request name: " + methodName);
}
- private IEnumerable<KeyValuePair<string, string>> HandleIsAuthorized()
+ private static IEnumerable<KeyValuePair<string, string>> HandleIsAuthorized()
{
return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
@@ -29,7 +29,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
};
}
- private IEnumerable<KeyValuePair<string, string>> HandleIsValidated()
+ private static IEnumerable<KeyValuePair<string, string>> HandleIsValidated()
{
return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
diff --git a/Emby.Dlna/MediaReceiverRegistrar/MediaReceiverRegistrarXmlBuilder.cs b/Emby.Dlna/MediaReceiverRegistrar/MediaReceiverRegistrarXmlBuilder.cs
index bc4bee7c9..efddbc670 100644
--- a/Emby.Dlna/MediaReceiverRegistrar/MediaReceiverRegistrarXmlBuilder.cs
+++ b/Emby.Dlna/MediaReceiverRegistrar/MediaReceiverRegistrarXmlBuilder.cs
@@ -1,4 +1,4 @@
-using Emby.Dlna.Common;
+using Emby.Dlna.Common;
using Emby.Dlna.Service;
using System.Collections.Generic;
@@ -12,7 +12,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
GetStateVariables());
}
- private IEnumerable<StateVariable> GetStateVariables()
+ private static IEnumerable<StateVariable> GetStateVariables()
{
var list = new List<StateVariable>();
diff --git a/Emby.Dlna/MediaReceiverRegistrar/ServiceActionListBuilder.cs b/Emby.Dlna/MediaReceiverRegistrar/ServiceActionListBuilder.cs
index bce8bfaef..a1f328411 100644
--- a/Emby.Dlna/MediaReceiverRegistrar/ServiceActionListBuilder.cs
+++ b/Emby.Dlna/MediaReceiverRegistrar/ServiceActionListBuilder.cs
@@ -1,4 +1,4 @@
-using Emby.Dlna.Common;
+using Emby.Dlna.Common;
using System.Collections.Generic;
namespace Emby.Dlna.MediaReceiverRegistrar
@@ -19,7 +19,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
};
}
- private ServiceAction GetIsValidated()
+ private static ServiceAction GetIsValidated()
{
var action = new ServiceAction
{
@@ -41,7 +41,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
return action;
}
- private ServiceAction GetIsAuthorized()
+ private static ServiceAction GetIsAuthorized()
{
var action = new ServiceAction
{
@@ -63,7 +63,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
return action;
}
- private ServiceAction GetRegisterDevice()
+ private static ServiceAction GetRegisterDevice()
{
var action = new ServiceAction
{
@@ -85,7 +85,7 @@ namespace Emby.Dlna.MediaReceiverRegistrar
return action;
}
- private ServiceAction GetGetValidationSucceededUpdateID()
+ private static ServiceAction GetGetValidationSucceededUpdateID()
{
var action = new ServiceAction
{
diff --git a/Emby.Dlna/PlayTo/Device.cs b/Emby.Dlna/PlayTo/Device.cs
index 13bed6b2f..cf53bb861 100644
--- a/Emby.Dlna/PlayTo/Device.cs
+++ b/Emby.Dlna/PlayTo/Device.cs
@@ -311,7 +311,7 @@ namespace Emby.Dlna.PlayTo
throw new InvalidOperationException("Unable to find service");
}
- await new SsdpHttpClient(_httpClient, _config).SendCommandAsync(Properties.BaseUrl, service, command.Name, avCommands.BuildPost(command, service.ServiceType, String.Format("{0:hh}:{0:mm}:{0:ss}", value), "REL_TIME"))
+ await new SsdpHttpClient(_httpClient, _config).SendCommandAsync(Properties.BaseUrl, service, command.Name, avCommands.BuildPost(command, service.ServiceType, string.Format("{0:hh}:{0:mm}:{0:ss}", value), "REL_TIME"))
.ConfigureAwait(false);
RestartTimer(true);
@@ -364,7 +364,7 @@ namespace Emby.Dlna.PlayTo
private string CreateDidlMeta(string value)
{
if (string.IsNullOrEmpty(value))
- return String.Empty;
+ return string.Empty;
return DescriptionXmlBuilder.Escape(value);
}
@@ -739,7 +739,7 @@ namespace Emby.Dlna.PlayTo
if (track == null)
{
- //If track is null, some vendors do this, use GetMediaInfo instead
+ //If track is null, some vendors do this, use GetMediaInfo instead
return new Tuple<bool, uBaseObject>(true, null);
}
@@ -783,7 +783,7 @@ namespace Emby.Dlna.PlayTo
{
if (container == null)
{
- throw new ArgumentNullException("container");
+ throw new ArgumentNullException(nameof(container));
}
var url = container.GetValue(uPnpNamespaces.Res);
@@ -810,7 +810,7 @@ namespace Emby.Dlna.PlayTo
{
if (container == null)
{
- throw new ArgumentNullException("container");
+ throw new ArgumentNullException(nameof(container));
}
var resElement = container.Element(uPnpNamespaces.Res);
@@ -979,7 +979,7 @@ namespace Emby.Dlna.PlayTo
if (modelDescription != null)
deviceProperties.ModelDescription = modelDescription.Value;
- deviceProperties.BaseUrl = String.Format("http://{0}:{1}", url.Host, url.Port);
+ deviceProperties.BaseUrl = string.Format("http://{0}:{1}", url.Host, url.Port);
var icon = document.Descendants(uPnpNamespaces.ud.GetName("icon")).FirstOrDefault();
@@ -1021,7 +1021,7 @@ namespace Emby.Dlna.PlayTo
{
if (element == null)
{
- throw new ArgumentNullException("element");
+ throw new ArgumentNullException(nameof(element));
}
var mimeType = element.GetDescendantValue(uPnpNamespaces.ud.GetName("mimetype"));
@@ -1173,7 +1173,7 @@ namespace Emby.Dlna.PlayTo
public override string ToString()
{
- return String.Format("{0} - {1}", Properties.Name, Properties.BaseUrl);
+ return string.Format("{0} - {1}", Properties.Name, Properties.BaseUrl);
}
}
}
diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs
index c51f220ef..c7e45b896 100644
--- a/Emby.Dlna/PlayTo/PlayToController.cs
+++ b/Emby.Dlna/PlayTo/PlayToController.cs
@@ -114,10 +114,10 @@ namespace Emby.Dlna.PlayTo
info.Headers.TryGetValue("NTS", out nts);
string usn;
- if (!info.Headers.TryGetValue("USN", out usn)) usn = String.Empty;
+ if (!info.Headers.TryGetValue("USN", out usn)) usn = string.Empty;
string nt;
- if (!info.Headers.TryGetValue("NT", out nt)) nt = String.Empty;
+ if (!info.Headers.TryGetValue("NT", out nt)) nt = string.Empty;
if (usn.IndexOf(_device.Properties.UUID, StringComparison.OrdinalIgnoreCase) != -1 &&
!_disposed)
@@ -829,7 +829,7 @@ namespace Emby.Dlna.PlayTo
{
if (string.IsNullOrEmpty(url))
{
- throw new ArgumentNullException("url");
+ throw new ArgumentNullException(nameof(url));
}
var parts = url.Split('/');
@@ -855,7 +855,7 @@ namespace Emby.Dlna.PlayTo
{
if (string.IsNullOrEmpty(url))
{
- throw new ArgumentNullException("url");
+ throw new ArgumentNullException(nameof(url));
}
var request = new StreamParams
diff --git a/Emby.Dlna/PlayTo/PlaylistItemFactory.cs b/Emby.Dlna/PlayTo/PlaylistItemFactory.cs
index e2d6e43c0..1080320e0 100644
--- a/Emby.Dlna/PlayTo/PlaylistItemFactory.cs
+++ b/Emby.Dlna/PlayTo/PlaylistItemFactory.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Session;
using System;
@@ -49,7 +49,7 @@ namespace Emby.Dlna.PlayTo
return playlistItem;
}
- private bool IsSupported(DirectPlayProfile profile, Photo item)
+ private static bool IsSupported(DirectPlayProfile profile, Photo item)
{
var mediaPath = item.Path;
diff --git a/Emby.Dlna/PlayTo/SsdpHttpClient.cs b/Emby.Dlna/PlayTo/SsdpHttpClient.cs
index bfd163bf1..963577169 100644
--- a/Emby.Dlna/PlayTo/SsdpHttpClient.cs
+++ b/Emby.Dlna/PlayTo/SsdpHttpClient.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Net;
+using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
using Emby.Dlna.Common;
using System;
@@ -25,10 +25,10 @@ namespace Emby.Dlna.PlayTo
_config = config;
}
- public async Task<XDocument> SendCommandAsync(string baseUrl,
- DeviceService service,
- string command,
- string postData,
+ public async Task<XDocument> SendCommandAsync(string baseUrl,
+ DeviceService service,
+ string command,
+ string postData,
bool logRequest = true,
string header = null)
{
@@ -47,7 +47,7 @@ namespace Emby.Dlna.PlayTo
}
}
- private string NormalizeServiceUrl(string baseUrl, string serviceUrl)
+ private static string NormalizeServiceUrl(string baseUrl, string serviceUrl)
{
// If it's already a complete url, don't stick anything onto the front of it
if (serviceUrl.StartsWith("http", StringComparison.OrdinalIgnoreCase))
@@ -62,12 +62,12 @@ namespace Emby.Dlna.PlayTo
}
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
-
- public async Task SubscribeAsync(string url,
- string ip,
- int port,
- string localIp,
- int eventport,
+
+ public async Task SubscribeAsync(string url,
+ string ip,
+ int port,
+ string localIp,
+ int eventport,
int timeOut = 3600)
{
var options = new HttpRequestOptions
@@ -121,9 +121,9 @@ namespace Emby.Dlna.PlayTo
}
}
- private Task<HttpResponseInfo> PostSoapDataAsync(string url,
- string soapAction,
- string postData,
+ private Task<HttpResponseInfo> PostSoapDataAsync(string url,
+ string soapAction,
+ string postData,
string header,
bool logRequest,
CancellationToken cancellationToken)
diff --git a/Emby.Dlna/PlayTo/TransportCommands.cs b/Emby.Dlna/PlayTo/TransportCommands.cs
index 9e055f792..e34ce8797 100644
--- a/Emby.Dlna/PlayTo/TransportCommands.cs
+++ b/Emby.Dlna/PlayTo/TransportCommands.cs
@@ -80,7 +80,7 @@ namespace Emby.Dlna.PlayTo
{
if (container == null)
{
- throw new ArgumentNullException("container");
+ throw new ArgumentNullException(nameof(container));
}
return new Argument
@@ -171,7 +171,7 @@ namespace Emby.Dlna.PlayTo
if (state != null)
{
var sendValue = state.AllowedValues.FirstOrDefault(a => string.Equals(a, commandParameter, StringComparison.OrdinalIgnoreCase)) ??
- state.AllowedValues.FirstOrDefault() ??
+ state.AllowedValues.FirstOrDefault() ??
value;
return string.Format("<{0} xmlns:dt=\"urn:schemas-microsoft-com:datatypes\" dt:dt=\"{1}\">{2}</{0}>", argument.Name, state.DataType ?? "string", sendValue);
diff --git a/Emby.Dlna/PlayTo/UpnpContainer.cs b/Emby.Dlna/PlayTo/UpnpContainer.cs
index 5bfc56bff..4c07f3605 100644
--- a/Emby.Dlna/PlayTo/UpnpContainer.cs
+++ b/Emby.Dlna/PlayTo/UpnpContainer.cs
@@ -10,7 +10,7 @@ namespace Emby.Dlna.PlayTo
{
if (container == null)
{
- throw new ArgumentNullException("container");
+ throw new ArgumentNullException(nameof(container));
}
return new uBaseObject
diff --git a/Emby.Dlna/PlayTo/uBaseObject.cs b/Emby.Dlna/PlayTo/uBaseObject.cs
index 1de46317e..3d80d7ed0 100644
--- a/Emby.Dlna/PlayTo/uBaseObject.cs
+++ b/Emby.Dlna/PlayTo/uBaseObject.cs
@@ -2,7 +2,7 @@
namespace Emby.Dlna.PlayTo
{
- public class uBaseObject
+ public class uBaseObject
{
public string Id { get; set; }
@@ -26,7 +26,7 @@ namespace Emby.Dlna.PlayTo
{
if (obj == null)
{
- throw new ArgumentNullException("obj");
+ throw new ArgumentNullException(nameof(obj));
}
return string.Equals(Id, obj.Id);
diff --git a/Emby.Dlna/PlayTo/uParser.cs b/Emby.Dlna/PlayTo/uParser.cs
index 5caf83a9a..4d26ee6b3 100644
--- a/Emby.Dlna/PlayTo/uParser.cs
+++ b/Emby.Dlna/PlayTo/uParser.cs
@@ -20,13 +20,13 @@ namespace Emby.Dlna.PlayTo
if (document == null)
return list;
-
+
var item = (from result in document.Descendants("Result") select result).FirstOrDefault();
if (item == null)
return list;
- var uPnpResponse = XElement.Parse((String)item);
+ var uPnpResponse = XElement.Parse((string)item);
var uObjects = from container in uPnpResponse.Elements(uPnpNamespaces.containers)
select new uParserObject { Element = container };
diff --git a/Emby.Dlna/Profiles/SonyBravia2010Profile.cs b/Emby.Dlna/Profiles/SonyBravia2010Profile.cs
index 75382067f..7b452c536 100644
--- a/Emby.Dlna/Profiles/SonyBravia2010Profile.cs
+++ b/Emby.Dlna/Profiles/SonyBravia2010Profile.cs
@@ -41,7 +41,7 @@ namespace Emby.Dlna.Profiles
EnableSingleAlbumArtLimit = true;
EnableAlbumArtInDidl = true;
-
+
TranscodingProfiles = new[]
{
new TranscodingProfile
diff --git a/Emby.Dlna/Properties/AssemblyInfo.cs b/Emby.Dlna/Properties/AssemblyInfo.cs
index 6f924f9e9..fd3b43369 100644
--- a/Emby.Dlna/Properties/AssemblyInfo.cs
+++ b/Emby.Dlna/Properties/AssemblyInfo.cs
@@ -1,17 +1,16 @@
-using System.Resources;
+using System.Resources;
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
-[assembly: AssemblyTitle("Emby.Dlna2")]
+[assembly: AssemblyTitle("Emby.Dlna")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Emby.Dlna2")]
-[assembly: AssemblyCopyright("Copyright © 2016")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
@@ -19,12 +18,10 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
-// Minor Version
+// Minor Version
// Build Number
// Revision
//
-// You can specify all the values or you can default the Build and Revision Numbers
+// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Emby.Dlna/Server/DescriptionXmlBuilder.cs b/Emby.Dlna/Server/DescriptionXmlBuilder.cs
index 0c0c367e4..bd57f4c43 100644
--- a/Emby.Dlna/Server/DescriptionXmlBuilder.cs
+++ b/Emby.Dlna/Server/DescriptionXmlBuilder.cs
@@ -1,4 +1,4 @@
-using Emby.Dlna.Common;
+using Emby.Dlna.Common;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Extensions;
using System;
@@ -24,12 +24,12 @@ namespace Emby.Dlna.Server
{
if (string.IsNullOrEmpty(serverUdn))
{
- throw new ArgumentNullException("serverUdn");
+ throw new ArgumentNullException(nameof(serverUdn));
}
if (string.IsNullOrEmpty(serverAddress))
{
- throw new ArgumentNullException("serverAddress");
+ throw new ArgumentNullException(nameof(serverAddress));
}
_profile = profile;
@@ -39,10 +39,7 @@ namespace Emby.Dlna.Server
_serverId = serverId;
}
- private bool EnableAbsoluteUrls
- {
- get { return false; }
- }
+ private static bool EnableAbsoluteUrls => false;
public string GetXml()
{
diff --git a/Emby.Dlna/Service/BaseService.cs b/Emby.Dlna/Service/BaseService.cs
index 92b81a7ac..10ef12c6c 100644
--- a/Emby.Dlna/Service/BaseService.cs
+++ b/Emby.Dlna/Service/BaseService.cs
@@ -14,7 +14,7 @@ namespace Emby.Dlna.Service
protected BaseService(ILogger logger, IHttpClient httpClient)
{
Logger = logger;
- HttpClient = httpClient;
+ HttpClient = httpClient;
EventManager = new EventManager(Logger, HttpClient);
}
diff --git a/Emby.Dlna/Service/ControlErrorHandler.cs b/Emby.Dlna/Service/ControlErrorHandler.cs
index a3cd77f0f..431dea932 100644
--- a/Emby.Dlna/Service/ControlErrorHandler.cs
+++ b/Emby.Dlna/Service/ControlErrorHandler.cs
@@ -10,7 +10,7 @@ namespace Emby.Dlna.Service
public class ControlErrorHandler
{
private const string NS_SOAPENV = "http://schemas.xmlsoap.org/soap/envelope/";
-
+
public ControlResponse GetResponse(Exception ex)
{
var settings = new XmlWriterSettings
diff --git a/Emby.Dlna/Service/ServiceXmlBuilder.cs b/Emby.Dlna/Service/ServiceXmlBuilder.cs
index c41f1b3be..68782ffb7 100644
--- a/Emby.Dlna/Service/ServiceXmlBuilder.cs
+++ b/Emby.Dlna/Service/ServiceXmlBuilder.cs
@@ -1,4 +1,4 @@
-using Emby.Dlna.Common;
+using Emby.Dlna.Common;
using System.Collections.Generic;
using System.Security;
using System.Text;
@@ -28,7 +28,7 @@ namespace Emby.Dlna.Service
return builder.ToString();
}
- private void AppendActionList(StringBuilder builder, IEnumerable<ServiceAction> actions)
+ private static void AppendActionList(StringBuilder builder, IEnumerable<ServiceAction> actions)
{
builder.Append("<actionList>");
@@ -59,7 +59,7 @@ namespace Emby.Dlna.Service
builder.Append("</actionList>");
}
- private void AppendServiceStateTable(StringBuilder builder, IEnumerable<StateVariable> stateVariables)
+ private static void AppendServiceStateTable(StringBuilder builder, IEnumerable<StateVariable> stateVariables)
{
builder.Append("<serviceStateTable>");
diff --git a/Emby.Dlna/Ssdp/DeviceDiscovery.cs b/Emby.Dlna/Ssdp/DeviceDiscovery.cs
index d91f711d2..e01ff8149 100644
--- a/Emby.Dlna/Ssdp/DeviceDiscovery.cs
+++ b/Emby.Dlna/Ssdp/DeviceDiscovery.cs
@@ -83,8 +83,8 @@ namespace Emby.Dlna.Ssdp
{
_deviceLocator = new SsdpDeviceLocator(_commsServer, _timerFactory);
- // (Optional) Set the filter so we only see notifications for devices we care about
- // (can be any search target value i.e device type, uuid value etc - any value that appears in the
+ // (Optional) Set the filter so we only see notifications for devices we care about
+ // (can be any search target value i.e device type, uuid value etc - any value that appears in the
// DiscoverdSsdpDevice.NotificationType property or that is used with the searchTarget parameter of the Search method).
//_DeviceLocator.NotificationFilter = "upnp:rootdevice";
diff --git a/Emby.Drawing.Skia/Properties/AssemblyInfo.cs b/Emby.Drawing.Skia/Properties/AssemblyInfo.cs
index c0dc7c5b4..521010cdb 100644
--- a/Emby.Drawing.Skia/Properties/AssemblyInfo.cs
+++ b/Emby.Drawing.Skia/Properties/AssemblyInfo.cs
@@ -1,25 +1,21 @@
-using System.Resources;
using System.Reflection;
-using System.Runtime.CompilerServices;
+using System.Resources;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Emby.Drawing.Skia")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Emby.Drawing.Skia")]
-[assembly: AssemblyCopyright("Copyright © 2017")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-// \ No newline at end of file
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
diff --git a/Emby.Drawing.Skia/SkiaEncoder.cs b/Emby.Drawing.Skia/SkiaEncoder.cs
index 0467794dc..dc5ae77cc 100644
--- a/Emby.Drawing.Skia/SkiaEncoder.cs
+++ b/Emby.Drawing.Skia/SkiaEncoder.cs
@@ -197,7 +197,7 @@ namespace Emby.Drawing.Skia
private static bool HasDiacritics(string text)
{
- return !String.Equals(text, text.RemoveDiacritics(), StringComparison.Ordinal);
+ return !string.Equals(text, text.RemoveDiacritics(), StringComparison.Ordinal);
}
private static bool RequiresSpecialCharacterHack(string path)
@@ -509,11 +509,11 @@ namespace Emby.Drawing.Skia
{
if (string.IsNullOrWhiteSpace(inputPath))
{
- throw new ArgumentNullException("inputPath");
+ throw new ArgumentNullException(nameof(inputPath));
}
if (string.IsNullOrWhiteSpace(inputPath))
{
- throw new ArgumentNullException("outputPath");
+ throw new ArgumentNullException(nameof(outputPath));
}
var skiaOutputFormat = GetImageFormat(selectedOutputFormat);
@@ -594,12 +594,12 @@ namespace Emby.Drawing.Skia
// If foreground layer present then draw
if (hasForegroundColor)
{
- if (!Double.TryParse(options.ForegroundLayer, out double opacity))
+ if (!double.TryParse(options.ForegroundLayer, out double opacity))
{
opacity = .4;
}
- canvas.DrawColor(new SKColor(0, 0, 0, (Byte)((1 - opacity) * 0xFF)), SKBlendMode.SrcOver);
+ canvas.DrawColor(new SKColor(0, 0, 0, (byte)((1 - opacity) * 0xFF)), SKBlendMode.SrcOver);
}
if (hasIndicator)
diff --git a/Emby.Drawing.Skia/StripCollageBuilder.cs b/Emby.Drawing.Skia/StripCollageBuilder.cs
index a98450e08..b3e7dbb5f 100644
--- a/Emby.Drawing.Skia/StripCollageBuilder.cs
+++ b/Emby.Drawing.Skia/StripCollageBuilder.cs
@@ -1,4 +1,4 @@
-using SkiaSharp;
+using SkiaSharp;
using MediaBrowser.Common.Configuration;
using System;
using System.IO;
@@ -20,6 +20,11 @@ namespace Emby.Drawing.Skia
public static SKEncodedImageFormat GetEncodedFormat(string outputPath)
{
+ if (outputPath == null)
+ {
+ throw new ArgumentNullException(nameof(outputPath));
+ }
+
var ext = Path.GetExtension(outputPath).ToLower();
if (ext == ".jpg" || ext == ".jpeg")
diff --git a/Emby.Drawing/Common/ImageHeader.cs b/Emby.Drawing/Common/ImageHeader.cs
index f37f396f5..3aa0cac25 100644
--- a/Emby.Drawing/Common/ImageHeader.cs
+++ b/Emby.Drawing/Common/ImageHeader.cs
@@ -50,12 +50,13 @@ namespace Emby.Drawing.Common
/// <exception cref="ArgumentException">The image was of an unrecognised format.</exception>
public static ImageSize GetDimensions(string path, ILogger logger, IFileSystem fileSystem)
{
- var extension = Path.GetExtension(path);
-
- if (string.IsNullOrEmpty(extension))
+ if (string.IsNullOrEmpty(path))
{
- throw new ArgumentException("ImageHeader doesn't support image file");
+ throw new ArgumentNullException(nameof(path));
}
+
+ string extension = Path.GetExtension(path).ToLower();
+
if (!SupportedExtensions.Contains(extension))
{
throw new ArgumentException("ImageHeader doesn't support " + extension);
@@ -94,7 +95,7 @@ namespace Emby.Drawing.Common
}
}
- throw new ArgumentException(ErrorMessage, "binaryReader");
+ throw new ArgumentException(ErrorMessage, nameof(binaryReader));
}
/// <summary>
diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs
index 6a67be56d..4e4b36507 100644
--- a/Emby.Drawing/ImageProcessor.cs
+++ b/Emby.Drawing/ImageProcessor.cs
@@ -80,7 +80,7 @@ namespace Emby.Drawing
{
if (value == null)
{
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
_imageEncoder = value;
@@ -103,7 +103,7 @@ namespace Emby.Drawing
"crw",
// Remove until supported
- //"nef",
+ //"nef",
"orf",
"pef",
"arw",
@@ -179,7 +179,7 @@ namespace Emby.Drawing
{
if (options == null)
{
- throw new ArgumentNullException("options");
+ throw new ArgumentNullException(nameof(options));
}
var originalImage = options.Image;
@@ -491,7 +491,7 @@ namespace Emby.Drawing
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
try
@@ -691,12 +691,12 @@ namespace Emby.Drawing
{
if (string.IsNullOrEmpty(originalImagePath))
{
- throw new ArgumentNullException("originalImagePath");
+ throw new ArgumentNullException(nameof(originalImagePath));
}
if (item == null)
{
- throw new ArgumentNullException("item");
+ throw new ArgumentNullException(nameof(item));
}
var treatmentRequiresTransparency = false;
@@ -779,16 +779,16 @@ namespace Emby.Drawing
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
if (string.IsNullOrEmpty(uniqueName))
{
- throw new ArgumentNullException("uniqueName");
+ throw new ArgumentNullException(nameof(uniqueName));
}
if (string.IsNullOrEmpty(fileExtension))
{
- throw new ArgumentNullException("fileExtension");
+ throw new ArgumentNullException(nameof(fileExtension));
}
var filename = uniqueName.GetMD5() + fileExtension;
@@ -811,11 +811,11 @@ namespace Emby.Drawing
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
if (string.IsNullOrEmpty(filename))
{
- throw new ArgumentNullException("filename");
+ throw new ArgumentNullException(nameof(filename));
}
var prefix = filename.Substring(0, 1);
diff --git a/Emby.Drawing/Properties/AssemblyInfo.cs b/Emby.Drawing/Properties/AssemblyInfo.cs
index b9e9c2ff7..8dfefe0af 100644
--- a/Emby.Drawing/Properties/AssemblyInfo.cs
+++ b/Emby.Drawing/Properties/AssemblyInfo.cs
@@ -1,20 +1,20 @@
-using System.Reflection;
+using System.Reflection;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Emby.Drawing")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Emby.Drawing")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
-// Minor Version
+// Minor Version
// Build Number
// Revision
-// \ No newline at end of file
+//
diff --git a/Emby.IsoMounting/IsoMounter/IsoMounter.csproj b/Emby.IsoMounting/IsoMounter/IsoMounter.csproj
index ee67a1d94..9274f9763 100644
--- a/Emby.IsoMounting/IsoMounter/IsoMounter.csproj
+++ b/Emby.IsoMounting/IsoMounter/IsoMounter.csproj
@@ -1,6 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
+ <Compile Include="..\..\SharedVersion.cs" Link="SharedVersion.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
<ProjectReference Include="..\..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
<ProjectReference Include="..\..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
</ItemGroup>
diff --git a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs
index faaed482a..ab85cb721 100644
--- a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs
+++ b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs
@@ -44,13 +44,13 @@ namespace IsoMounter
_logger.LogDebug(
"[{0}] System PATH is currently set to [{1}].",
Name,
- EnvironmentInfo.GetEnvironmentVariable("PATH") ?? ""
+ Environment.GetEnvironmentVariable("PATH") ?? ""
);
_logger.LogDebug(
"[{0}] System path separator is [{1}].",
Name,
- EnvironmentInfo.PathSeparator
+ Path.PathSeparator
);
_logger.LogDebug(
@@ -87,7 +87,7 @@ namespace IsoMounter
UmountCommand
);
- if (!String.IsNullOrEmpty(SudoCommand) && !String.IsNullOrEmpty(MountCommand) && !String.IsNullOrEmpty(UmountCommand)) {
+ if (!string.IsNullOrEmpty(SudoCommand) && !string.IsNullOrEmpty(MountCommand) && !string.IsNullOrEmpty(UmountCommand)) {
ExecutablesAvailable = true;
} else {
ExecutablesAvailable = false;
@@ -118,25 +118,27 @@ namespace IsoMounter
public bool CanMount(string path)
{
- if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Linux) {
- _logger.LogInformation(
- "[{0}] Checking we can attempt to mount [{1}], Extension = [{2}], Operating System = [{3}], Executables Available = [{4}].",
- Name,
- path,
- Path.GetExtension(path),
- EnvironmentInfo.OperatingSystem,
- ExecutablesAvailable.ToString()
- );
-
- if (ExecutablesAvailable) {
- return string.Equals(Path.GetExtension(path), ".iso", StringComparison.OrdinalIgnoreCase);
- } else {
- return false;
- }
- } else {
+ if (EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Linux)
+ {
return false;
}
+ _logger.LogInformation(
+ "[{0}] Checking we can attempt to mount [{1}], Extension = [{2}], Operating System = [{3}], Executables Available = [{4}].",
+ Name,
+ path,
+ Path.GetExtension(path),
+ EnvironmentInfo.OperatingSystem,
+ ExecutablesAvailable.ToString()
+ );
+ if (ExecutablesAvailable)
+ {
+ return string.Equals(Path.GetExtension(path), ".iso", StringComparison.OrdinalIgnoreCase);
+ }
+ else
+ {
+ return false;
+ }
}
public Task Install(CancellationToken cancellationToken)
@@ -150,7 +152,7 @@ namespace IsoMounter
return Task.FromResult<IIsoMount>(mountedISO);
}
else {
- throw new IOException(String.Format(
+ throw new IOException(string.Format(
"An error occurred trying to mount image [$0].",
isoPath
));
@@ -211,18 +213,16 @@ namespace IsoMounter
private string GetFullPathForExecutable(string name)
{
- foreach (string test in (EnvironmentInfo.GetEnvironmentVariable("PATH") ?? "").Split(EnvironmentInfo.PathSeparator)) {
-
+ foreach (string test in (Environment.GetEnvironmentVariable("PATH") ?? "").Split(Path.PathSeparator))
+ {
string path = test.Trim();
- if (!String.IsNullOrEmpty(path) && FileSystem.FileExists(path = Path.Combine(path, name))) {
+ if (!string.IsNullOrEmpty(path) && FileSystem.FileExists(path = Path.Combine(path, name))) {
return FileSystem.GetFullPath(path);
}
-
}
- return String.Empty;
-
+ return string.Empty;
}
private uint GetUID()
@@ -315,9 +315,9 @@ namespace IsoMounter
);
} else {
-
+
throw new ArgumentNullException(nameof(isoPath));
-
+
}
try
@@ -397,9 +397,9 @@ namespace IsoMounter
);
} else {
-
+
throw new ArgumentNullException(nameof(mount));
-
+
}
if (GetUID() == 0) {
@@ -444,7 +444,7 @@ namespace IsoMounter
}
#endregion
-
+
#region Internal Methods
internal void OnUnmount(LinuxMount mount)
diff --git a/Emby.IsoMounting/IsoMounter/LinuxMount.cs b/Emby.IsoMounting/IsoMounter/LinuxMount.cs
index edd26f08d..da2eb1983 100644
--- a/Emby.IsoMounting/IsoMounter/LinuxMount.cs
+++ b/Emby.IsoMounting/IsoMounter/LinuxMount.cs
@@ -48,7 +48,7 @@ namespace IsoMounter
if (disposed) {
return;
}
-
+
if (disposing) {
//
diff --git a/Emby.IsoMounting/IsoMounter/Properties/AssemblyInfo.cs b/Emby.IsoMounting/IsoMounter/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..8a26b12a2
--- /dev/null
+++ b/Emby.IsoMounting/IsoMounter/Properties/AssemblyInfo.cs
@@ -0,0 +1,21 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("IsoMounter")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
diff --git a/Emby.Naming/AudioBook/AudioBookInfo.cs b/Emby.Naming/AudioBook/AudioBookInfo.cs
index e039e5359..d7af63d91 100644
--- a/Emby.Naming/AudioBook/AudioBookInfo.cs
+++ b/Emby.Naming/AudioBook/AudioBookInfo.cs
@@ -29,7 +29,7 @@ namespace Emby.Naming.AudioBook
/// </summary>
/// <value>The alternate versions.</value>
public List<AudioBookFileInfo> AlternateVersions { get; set; }
-
+
public AudioBookInfo()
{
Files = new List<AudioBookFileInfo>();
diff --git a/Emby.Naming/AudioBook/AudioBookResolver.cs b/Emby.Naming/AudioBook/AudioBookResolver.cs
index a206ee30b..7c658f43a 100644
--- a/Emby.Naming/AudioBook/AudioBookResolver.cs
+++ b/Emby.Naming/AudioBook/AudioBookResolver.cs
@@ -30,7 +30,7 @@ namespace Emby.Naming.AudioBook
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
if (IsDirectory)
return null;
@@ -46,7 +46,7 @@ namespace Emby.Naming.AudioBook
var parsingResult = new AudioBookFilePathParser(_options)
.Parse(path, IsDirectory);
-
+
return new AudioBookFileInfo
{
Path = path,
diff --git a/Emby.Naming/Common/NamingOptions.cs b/Emby.Naming/Common/NamingOptions.cs
index 9e65440d0..014f4ebde 100644
--- a/Emby.Naming/Common/NamingOptions.cs
+++ b/Emby.Naming/Common/NamingOptions.cs
@@ -282,7 +282,7 @@ namespace Emby.Naming.Common
new EpisodeExpression(@".*(\\|\/)(?<seriesname>((?![Ss]([0-9]+)[][ ._-]*[Ee]([0-9]+))[^\\\/])*)?[Ss](?<seasonnumber>[0-9]+)[][ ._-]*[Ee](?<epnumber>[0-9]+)([^\\/]*)$")
{
IsNamed = true
- },
+ },
// <!-- foo.ep01, foo.EP_01 -->
new EpisodeExpression(@"[\._ -]()[Ee][Pp]_?([0-9]+)([^\\/]*)$"),
new EpisodeExpression("([0-9]{4})[\\.-]([0-9]{2})[\\.-]([0-9]{2})", true)
diff --git a/Emby.Naming/Emby.Naming.csproj b/Emby.Naming/Emby.Naming.csproj
index f1a736ecc..360ffaabe 100644
--- a/Emby.Naming/Emby.Naming.csproj
+++ b/Emby.Naming/Emby.Naming.csproj
@@ -4,6 +4,10 @@
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
+
+ <ItemGroup>
+ <Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" />
+ </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
diff --git a/Emby.Naming/Properties/AssemblyInfo.cs b/Emby.Naming/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..15311570b
--- /dev/null
+++ b/Emby.Naming/Properties/AssemblyInfo.cs
@@ -0,0 +1,21 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Emby.Naming")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
diff --git a/Emby.Naming/Subtitles/SubtitleParser.cs b/Emby.Naming/Subtitles/SubtitleParser.cs
index fbf0f60cb..9c279cc09 100644
--- a/Emby.Naming/Subtitles/SubtitleParser.cs
+++ b/Emby.Naming/Subtitles/SubtitleParser.cs
@@ -18,7 +18,7 @@ namespace Emby.Naming.Subtitles
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
var extension = Path.GetExtension(path);
@@ -52,7 +52,7 @@ namespace Emby.Naming.Subtitles
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
// Note: the tags need be be surrounded be either a space ( ), hyphen -, dot . or underscore _.
diff --git a/Emby.Naming/TV/EpisodePathParser.cs b/Emby.Naming/TV/EpisodePathParser.cs
index 7f8a6a70e..813be3f7a 100644
--- a/Emby.Naming/TV/EpisodePathParser.cs
+++ b/Emby.Naming/TV/EpisodePathParser.cs
@@ -1,4 +1,4 @@
-using Emby.Naming.Common;
+using Emby.Naming.Common;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -74,7 +74,7 @@ namespace Emby.Naming.TV
return result ?? new EpisodePathParserResult();
}
- private EpisodePathParserResult Parse(string name, EpisodeExpression expression)
+ private static EpisodePathParserResult Parse(string name, EpisodeExpression expression)
{
var result = new EpisodePathParserResult();
diff --git a/Emby.Naming/TV/EpisodeResolver.cs b/Emby.Naming/TV/EpisodeResolver.cs
index 2007d1307..ec5ae2fbf 100644
--- a/Emby.Naming/TV/EpisodeResolver.cs
+++ b/Emby.Naming/TV/EpisodeResolver.cs
@@ -19,7 +19,7 @@ namespace Emby.Naming.TV
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
var isStub = false;
@@ -53,7 +53,7 @@ namespace Emby.Naming.TV
var parsingResult = new EpisodePathParser(_options)
.Parse(path, IsDirectory, isNamed, isOptimistic, supportsAbsoluteNumbers, fillExtendedInfo);
-
+
return new EpisodeInfo
{
Path = path,
diff --git a/Emby.Naming/Video/CleanDateTimeParser.cs b/Emby.Naming/Video/CleanDateTimeParser.cs
index 572dd1c60..ee6ec8ba0 100644
--- a/Emby.Naming/Video/CleanDateTimeParser.cs
+++ b/Emby.Naming/Video/CleanDateTimeParser.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using Emby.Naming.Common;
using System.Globalization;
using System.IO;
@@ -38,7 +38,7 @@ namespace Emby.Naming.Video
}
catch (ArgumentException)
{
-
+
}
var result = _options.CleanDateTimeRegexes.Select(i => Clean(name, i))
@@ -63,7 +63,7 @@ namespace Emby.Naming.Video
result;
}
- private CleanDateTimeResult Clean(string name, Regex expression)
+ private static CleanDateTimeResult Clean(string name, Regex expression)
{
var result = new CleanDateTimeResult();
diff --git a/Emby.Naming/Video/CleanStringParser.cs b/Emby.Naming/Video/CleanStringParser.cs
index bddf9589b..02b90310d 100644
--- a/Emby.Naming/Video/CleanStringParser.cs
+++ b/Emby.Naming/Video/CleanStringParser.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace Emby.Naming.Video
@@ -30,7 +30,7 @@ namespace Emby.Naming.Video
};
}
- private CleanStringResult Clean(string name, Regex expression)
+ private static CleanStringResult Clean(string name, Regex expression)
{
var result = new CleanStringResult();
diff --git a/Emby.Naming/Video/FlagParser.cs b/Emby.Naming/Video/FlagParser.cs
index a2c541eeb..ef785ebf9 100644
--- a/Emby.Naming/Video/FlagParser.cs
+++ b/Emby.Naming/Video/FlagParser.cs
@@ -22,7 +22,7 @@ namespace Emby.Naming.Video
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
// Note: the tags need be be surrounded be either a space ( ), hyphen -, dot . or underscore _.
diff --git a/Emby.Naming/Video/Format3DParser.cs b/Emby.Naming/Video/Format3DParser.cs
index 42737b483..e335d1055 100644
--- a/Emby.Naming/Video/Format3DParser.cs
+++ b/Emby.Naming/Video/Format3DParser.cs
@@ -1,4 +1,4 @@
-using Emby.Naming.Common;
+using Emby.Naming.Common;
using System;
using System.Linq;
@@ -36,7 +36,7 @@ namespace Emby.Naming.Video
return new Format3DResult();
}
- private Format3DResult Parse(string[] videoFlags, Format3DRule rule)
+ private static Format3DResult Parse(string[] videoFlags, Format3DRule rule)
{
var result = new Format3DResult();
diff --git a/Emby.Naming/Video/StackResolver.cs b/Emby.Naming/Video/StackResolver.cs
index 2a7125536..995e95d42 100644
--- a/Emby.Naming/Video/StackResolver.cs
+++ b/Emby.Naming/Video/StackResolver.cs
@@ -126,7 +126,7 @@ namespace Emby.Naming.Video
}
stack.Files.Add(file2.FullName);
}
- else
+ else
{
// Sequel
offset = 0;
diff --git a/Emby.Naming/Video/StubResolver.cs b/Emby.Naming/Video/StubResolver.cs
index 69f1f50fa..33d6baefd 100644
--- a/Emby.Naming/Video/StubResolver.cs
+++ b/Emby.Naming/Video/StubResolver.cs
@@ -18,7 +18,7 @@ namespace Emby.Naming.Video
{
var result = new StubResult();
var extension = Path.GetExtension(path) ?? string.Empty;
-
+
if (_options.StubFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
{
result.IsStub = true;
diff --git a/Emby.Naming/Video/VideoFileInfo.cs b/Emby.Naming/Video/VideoFileInfo.cs
index 96839c31e..3cdc483ff 100644
--- a/Emby.Naming/Video/VideoFileInfo.cs
+++ b/Emby.Naming/Video/VideoFileInfo.cs
@@ -55,7 +55,7 @@ namespace Emby.Naming.Video
/// Gets or sets the type of the stub.
/// </summary>
/// <value>The type of the stub.</value>
- public string StubType { get; set; }
+ public string StubType { get; set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
diff --git a/Emby.Naming/Video/VideoInfo.cs b/Emby.Naming/Video/VideoInfo.cs
index f4d311b97..033a8ae2d 100644
--- a/Emby.Naming/Video/VideoInfo.cs
+++ b/Emby.Naming/Video/VideoInfo.cs
@@ -32,7 +32,7 @@ namespace Emby.Naming.Video
/// </summary>
/// <value>The alternate versions.</value>
public List<VideoFileInfo> AlternateVersions { get; set; }
-
+
public VideoInfo()
{
Files = new List<VideoFileInfo>();
diff --git a/Emby.Naming/Video/VideoListResolver.cs b/Emby.Naming/Video/VideoListResolver.cs
index 47be28104..45d4593de 100644
--- a/Emby.Naming/Video/VideoListResolver.cs
+++ b/Emby.Naming/Video/VideoListResolver.cs
@@ -1,4 +1,4 @@
-using Emby.Naming.Common;
+using Emby.Naming.Common;
using System;
using System.Collections.Generic;
using System.IO;
@@ -55,9 +55,9 @@ namespace Emby.Naming.Video
info.Year = info.Files.First().Year;
- var extraBaseNames = new List<string>
+ var extraBaseNames = new List<string>
{
- stack.Name,
+ stack.Name,
Path.GetFileNameWithoutExtension(stack.Files[0])
};
@@ -236,7 +236,7 @@ namespace Emby.Naming.Video
if (testFilename.StartsWith(folderName, StringComparison.OrdinalIgnoreCase))
{
testFilename = testFilename.Substring(folderName.Length).Trim();
- return testFilename.StartsWith("-", StringComparison.OrdinalIgnoreCase)||Regex.Replace(testFilename, @"\[([^]]*)\]", "").Trim() == String.Empty;
+ return testFilename.StartsWith("-", StringComparison.OrdinalIgnoreCase) || Regex.Replace(testFilename, @"\[([^]]*)\]", "").Trim() == string.Empty;
}
return false;
diff --git a/Emby.Naming/Video/VideoResolver.cs b/Emby.Naming/Video/VideoResolver.cs
index c4951c728..f6ab8cb87 100644
--- a/Emby.Naming/Video/VideoResolver.cs
+++ b/Emby.Naming/Video/VideoResolver.cs
@@ -45,7 +45,7 @@ namespace Emby.Naming.Video
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
var isStub = false;
diff --git a/Emby.Notifications/Emby.Notifications.csproj b/Emby.Notifications/Emby.Notifications.csproj
index 881be692b..5b5ae445e 100644
--- a/Emby.Notifications/Emby.Notifications.csproj
+++ b/Emby.Notifications/Emby.Notifications.csproj
@@ -6,6 +6,10 @@
</PropertyGroup>
<ItemGroup>
+ <Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" />
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
diff --git a/Emby.Notifications/Properties/AssemblyInfo.cs b/Emby.Notifications/Properties/AssemblyInfo.cs
index d35c8b289..fd7037551 100644
--- a/Emby.Notifications/Properties/AssemblyInfo.cs
+++ b/Emby.Notifications/Properties/AssemblyInfo.cs
@@ -1,5 +1,5 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
+using System.Reflection;
+using System.Resources;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
@@ -8,29 +8,14 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Emby.Notifications")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Emby.Notifications")]
-[assembly: AssemblyCopyright("Copyright © 2018")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("4d1d313b-60bb-4e11-acf9-cda6745266ef")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Emby.Photos/Properties/AssemblyInfo.cs b/Emby.Photos/Properties/AssemblyInfo.cs
index 49ac83345..262125d38 100644
--- a/Emby.Photos/Properties/AssemblyInfo.cs
+++ b/Emby.Photos/Properties/AssemblyInfo.cs
@@ -1,34 +1,21 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
+using System.Reflection;
+using System.Resources;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Emby.Photos")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Emby.Photos")]
-[assembly: AssemblyCopyright("Copyright © 2016")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("89ab4548-770d-41fd-a891-8daff44f452c")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")] \ No newline at end of file
diff --git a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
index 3f7b907a9..eca1ff0f5 100644
--- a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
+++ b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
@@ -202,7 +202,7 @@ namespace Emby.Server.Implementations.Activity
return name;
}
- private string GetPlaybackNotificationType(string mediaType)
+ private static string GetPlaybackNotificationType(string mediaType)
{
if (string.Equals(mediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase))
{
@@ -220,7 +220,7 @@ namespace Emby.Server.Implementations.Activity
return null;
}
- private string GetPlaybackStoppedNotificationType(string mediaType)
+ private static string GetPlaybackStoppedNotificationType(string mediaType)
{
if (string.Equals(mediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase))
{
@@ -577,8 +577,8 @@ namespace Emby.Server.Implementations.Activity
/// <param name="description">The name of this item (singular form)</param>
private static string CreateValueString(int value, string description)
{
- return String.Format("{0:#,##0} {1}",
- value, value == 1 ? description : String.Format("{0}s", description));
+ return string.Format("{0:#,##0} {1}",
+ value, value == 1 ? description : string.Format("{0}s", description));
}
}
}
diff --git a/Emby.Server.Implementations/Activity/ActivityRepository.cs b/Emby.Server.Implementations/Activity/ActivityRepository.cs
index 91a4a5fd4..822219132 100644
--- a/Emby.Server.Implementations/Activity/ActivityRepository.cs
+++ b/Emby.Server.Implementations/Activity/ActivityRepository.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
@@ -83,7 +83,7 @@ namespace Emby.Server.Implementations.Activity
{
if (entry == null)
{
- throw new ArgumentNullException("entry");
+ throw new ArgumentNullException(nameof(entry));
}
using (WriteLock.Write())
@@ -122,7 +122,7 @@ namespace Emby.Server.Implementations.Activity
{
if (entry == null)
{
- throw new ArgumentNullException("entry");
+ throw new ArgumentNullException(nameof(entry));
}
using (WriteLock.Write())
@@ -251,7 +251,7 @@ namespace Emby.Server.Implementations.Activity
}
}
- private ActivityLogEntry GetEntry(IReadOnlyList<IResultSetValue> reader)
+ private static ActivityLogEntry GetEntry(IReadOnlyList<IResultSetValue> reader)
{
var index = 0;
diff --git a/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs b/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs
index 3e12bc0b6..3ad2d4b91 100644
--- a/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs
+++ b/Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs
@@ -55,61 +55,31 @@ namespace Emby.Server.Implementations.AppBase
}
private const string _virtualDataPath = "%AppDataPath%";
- public string VirtualDataPath
- {
- get
- {
- return _virtualDataPath;
- }
- }
+ public string VirtualDataPath => _virtualDataPath;
/// <summary>
/// Gets the image cache path.
/// </summary>
/// <value>The image cache path.</value>
- public string ImageCachePath
- {
- get
- {
- return Path.Combine(CachePath, "images");
- }
- }
+ public string ImageCachePath => Path.Combine(CachePath, "images");
/// <summary>
/// Gets the path to the plugin directory
/// </summary>
/// <value>The plugins path.</value>
- public string PluginsPath
- {
- get
- {
- return Path.Combine(ProgramDataPath, "plugins");
- }
- }
+ public string PluginsPath => Path.Combine(ProgramDataPath, "plugins");
/// <summary>
/// Gets the path to the plugin configurations directory
/// </summary>
/// <value>The plugin configurations path.</value>
- public string PluginConfigurationsPath
- {
- get
- {
- return Path.Combine(PluginsPath, "configurations");
- }
- }
+ public string PluginConfigurationsPath => Path.Combine(PluginsPath, "configurations");
/// <summary>
/// Gets the path to where temporary update files will be stored
/// </summary>
/// <value>The plugin configurations path.</value>
- public string TempUpdatePath
- {
- get
- {
- return Path.Combine(ProgramDataPath, "updates");
- }
- }
+ public string TempUpdatePath => Path.Combine(ProgramDataPath, "updates");
/// <summary>
/// The _log directory
@@ -133,10 +103,7 @@ namespace Emby.Server.Implementations.AppBase
return _logDirectoryPath;
}
- set
- {
- _logDirectoryPath = value;
- }
+ set => _logDirectoryPath = value;
}
/// <summary>
@@ -161,23 +128,14 @@ namespace Emby.Server.Implementations.AppBase
return _configurationDirectoryPath;
}
- set
- {
- _configurationDirectoryPath = value;
- }
+ set => _configurationDirectoryPath = value;
}
/// <summary>
/// Gets the path to the system configuration file
/// </summary>
/// <value>The system configuration file path.</value>
- public string SystemConfigurationFilePath
- {
- get
- {
- return Path.Combine(ConfigurationDirectoryPath, "system.xml");
- }
- }
+ public string SystemConfigurationFilePath => Path.Combine(ConfigurationDirectoryPath, "system.xml");
/// <summary>
/// The _cache directory
@@ -200,22 +158,13 @@ namespace Emby.Server.Implementations.AppBase
return _cachePath;
}
- set
- {
- _cachePath = value;
- }
+ set => _cachePath = value;
}
/// <summary>
/// Gets the folder path to the temp directory within the cache folder
/// </summary>
/// <value>The temp directory.</value>
- public string TempDirectory
- {
- get
- {
- return Path.Combine(CachePath, "temp");
- }
- }
+ public string TempDirectory => Path.Combine(CachePath, "temp");
}
}
diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
index bc5168fe8..222a93a10 100644
--- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
+++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
@@ -99,6 +99,7 @@ namespace Emby.Server.Implementations.AppBase
/// <param name="applicationPaths">The application paths.</param>
/// <param name="loggerFactory">The logger factory.</param>
/// <param name="xmlSerializer">The XML serializer.</param>
+ /// <param name="fileSystem">The file system</param>
protected BaseConfigurationManager(IApplicationPaths applicationPaths, ILoggerFactory loggerFactory, IXmlSerializer xmlSerializer, IFileSystem fileSystem)
{
CommonApplicationPaths = applicationPaths;
@@ -155,7 +156,7 @@ namespace Emby.Server.Implementations.AppBase
{
if (newConfiguration == null)
{
- throw new ArgumentNullException("newConfiguration");
+ throw new ArgumentNullException(nameof(newConfiguration));
}
ValidateCachePath(newConfiguration);
diff --git a/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs b/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs
index d6a41dd67..ee6da95fe 100644
--- a/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs
+++ b/Emby.Server.Implementations/AppBase/ConfigurationHelper.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.IO;
using System.Linq;
using MediaBrowser.Model.IO;
@@ -18,6 +18,7 @@ namespace Emby.Server.Implementations.AppBase
/// <param name="type">The type.</param>
/// <param name="path">The path.</param>
/// <param name="xmlSerializer">The XML serializer.</param>
+ /// <param name="fileSystem">The file system</param>
/// <returns>System.Object.</returns>
public static object GetXmlConfiguration(Type type, string path, IXmlSerializer xmlSerializer, IFileSystem fileSystem)
{
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index fb053f0e4..e97557588 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -1,4 +1,4 @@
-using Emby.Common.Implementations.Serialization;
+using Emby.Common.Implementations.Serialization;
using Emby.Drawing;
using Emby.Photos;
using Emby.Dlna;
@@ -41,7 +41,6 @@ using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Extensions;
-using MediaBrowser.Common.Security;
using MediaBrowser.Common.Updates;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Channels;
@@ -132,13 +131,7 @@ namespace Emby.Server.Implementations
/// Gets or sets a value indicating whether this instance can self update.
/// </summary>
/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
- public virtual bool CanSelfUpdate
- {
- get
- {
- return false;
- }
- }
+ public virtual bool CanSelfUpdate => false;
public virtual bool CanLaunchWebBrowser
{
@@ -245,10 +238,7 @@ namespace Emby.Server.Implementations
}
}
- public virtual string OperatingSystemDisplayName
- {
- get { return EnvironmentInfo.OperatingSystemName; }
- }
+ public virtual string OperatingSystemDisplayName => EnvironmentInfo.OperatingSystemName;
/// <summary>
/// The container
@@ -261,10 +251,7 @@ namespace Emby.Server.Implementations
/// Gets the server configuration manager.
/// </summary>
/// <value>The server configuration manager.</value>
- public IServerConfigurationManager ServerConfigurationManager
- {
- get { return (IServerConfigurationManager)ConfigurationManager; }
- }
+ public IServerConfigurationManager ServerConfigurationManager => (IServerConfigurationManager)ConfigurationManager;
/// <summary>
/// Gets the configuration manager.
@@ -352,11 +339,6 @@ namespace Emby.Server.Implementations
/// </summary>
/// <value>The installation manager.</value>
protected IInstallationManager InstallationManager { get; private set; }
- /// <summary>
- /// Gets the security manager.
- /// </summary>
- /// <value>The security manager.</value>
- protected ISecurityManager SecurityManager { get; private set; }
/// <summary>
/// Gets or sets the zip client.
@@ -453,13 +435,7 @@ namespace Emby.Server.Implementations
/// Gets the current application version
/// </summary>
/// <value>The application version.</value>
- public Version ApplicationVersion
- {
- get
- {
- return _version ?? (_version = typeof(ApplicationHost).Assembly.GetName().Version);
- }
- }
+ public Version ApplicationVersion => _version ?? (_version = typeof(ApplicationHost).Assembly.GetName().Version);
private DeviceId _deviceId;
public string SystemId
@@ -479,15 +455,9 @@ namespace Emby.Server.Implementations
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get
- {
- return "Emby Server";
- }
- }
+ public string Name => "Emby Server";
- private Tuple<Assembly, string> GetAssembly(Type type)
+ private static Tuple<Assembly, string> GetAssembly(Type type)
{
var assembly = type.GetTypeInfo().Assembly;
string path = null;
@@ -513,7 +483,7 @@ namespace Emby.Server.Implementations
/// <summary>
/// Creates the instance safe.
/// </summary>
- /// <param name="type">The type.</param>
+ /// <param name="typeInfo">The type information.</param>
/// <returns>System.Object.</returns>
protected object CreateInstanceSafe(Tuple<Type, string> typeInfo)
{
@@ -828,10 +798,7 @@ namespace Emby.Server.Implementations
SocketFactory = new SocketFactory(LoggerFactory.CreateLogger("SocketFactory"));
RegisterSingleInstance(SocketFactory);
- SecurityManager = new PluginSecurityManager(this, HttpClient, JsonSerializer, ApplicationPaths, LoggerFactory, FileSystemManager, CryptographyProvider);
- RegisterSingleInstance(SecurityManager);
-
- InstallationManager = new InstallationManager(LoggerFactory.CreateLogger("InstallationManager"), this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, ServerConfigurationManager, FileSystemManager, CryptographyProvider, PackageRuntime);
+ InstallationManager = new InstallationManager(LoggerFactory.CreateLogger("InstallationManager"), this, ApplicationPaths, HttpClient, JsonSerializer, ServerConfigurationManager, FileSystemManager, CryptographyProvider, PackageRuntime);
RegisterSingleInstance(InstallationManager);
ZipClient = new ZipClient(FileSystemManager);
@@ -946,7 +913,7 @@ namespace Emby.Server.Implementations
PlaylistManager = new PlaylistManager(LibraryManager, FileSystemManager, LibraryMonitor, LoggerFactory.CreateLogger("PlaylistManager"), UserManager, ProviderManager);
RegisterSingleInstance<IPlaylistManager>(PlaylistManager);
- LiveTvManager = new LiveTvManager(this, HttpClient, ServerConfigurationManager, Logger, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, ProviderManager, FileSystemManager, SecurityManager, () => ChannelManager);
+ LiveTvManager = new LiveTvManager(this, HttpClient, ServerConfigurationManager, Logger, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, ProviderManager, FileSystemManager, () => ChannelManager);
RegisterSingleInstance(LiveTvManager);
UserViewManager = new UserViewManager(LibraryManager, LocalizationManager, UserManager, ChannelManager, LiveTvManager, ServerConfigurationManager);
@@ -1004,13 +971,7 @@ namespace Emby.Server.Implementations
return s => JsvReader.GetParseFn(propertyType)(s);
}
- public virtual string PackageRuntime
- {
- get
- {
- return "netcore";
- }
- }
+ public virtual string PackageRuntime => "netcore";
public static void LogEnvironmentInfo(ILogger logger, IApplicationPaths appPaths, EnvironmentInfo.EnvironmentInfo environmentInfo)
{
@@ -1049,7 +1010,7 @@ namespace Emby.Server.Implementations
return name + "/" + ApplicationVersion;
}
- private string FormatAttribute(string str)
+ private static string FormatAttribute(string str)
{
var arr = str.ToCharArray();
@@ -1066,13 +1027,7 @@ namespace Emby.Server.Implementations
return result;
}
- protected virtual bool SupportsDualModeSockets
- {
- get
- {
- return true;
- }
- }
+ protected virtual bool SupportsDualModeSockets => true;
private X509Certificate GetCertificate(CertificateInfo info)
{
@@ -1188,8 +1143,7 @@ namespace Emby.Server.Implementations
HttpClient,
ZipClient,
ProcessFactory,
- 5000,
- EnvironmentInfo);
+ 5000);
MediaEncoder = mediaEncoder;
RegisterSingleInstance(MediaEncoder);
@@ -1647,25 +1601,25 @@ namespace Emby.Server.Implementations
// Gets all plugin assemblies by first reading all bytes of the .dll and calling Assembly.Load against that
// This will prevent the .dll file from getting locked, and allow us to replace it when needed
- // Include composable parts in the Api assembly
+ // Include composable parts in the Api assembly
list.Add(GetAssembly(typeof(ApiEntryPoint)));
- // Include composable parts in the Dashboard assembly
+ // Include composable parts in the Dashboard assembly
list.Add(GetAssembly(typeof(DashboardService)));
- // Include composable parts in the Model assembly
+ // Include composable parts in the Model assembly
list.Add(GetAssembly(typeof(SystemInfo)));
- // Include composable parts in the Common assembly
+ // Include composable parts in the Common assembly
list.Add(GetAssembly(typeof(IApplicationHost)));
- // Include composable parts in the Controller assembly
+ // Include composable parts in the Controller assembly
list.Add(GetAssembly(typeof(IServerApplicationHost)));
- // Include composable parts in the Providers assembly
+ // Include composable parts in the Providers assembly
list.Add(GetAssembly(typeof(ProviderUtils)));
- // Include composable parts in the Photos assembly
+ // Include composable parts in the Photos assembly
list.Add(GetAssembly(typeof(PhotoProvider)));
// Emby.Server implementations
@@ -1674,16 +1628,16 @@ namespace Emby.Server.Implementations
// MediaEncoding
list.Add(GetAssembly(typeof(MediaBrowser.MediaEncoding.Encoder.MediaEncoder)));
- // Dlna
+ // Dlna
list.Add(GetAssembly(typeof(DlnaEntryPoint)));
- // Local metadata
+ // Local metadata
list.Add(GetAssembly(typeof(BoxSetXmlSaver)));
// Notifications
list.Add(GetAssembly(typeof(NotificationManager)));
- // Xbmc
+ // Xbmc
list.Add(GetAssembly(typeof(ArtistNfoProvider)));
list.AddRange(GetAssembliesWithPartsInternal().Select(i => new Tuple<Assembly, string>(i, null)));
@@ -1928,18 +1882,9 @@ namespace Emby.Server.Implementations
};
}
- public bool EnableHttps
- {
- get
- {
- return SupportsHttps && ServerConfigurationManager.Configuration.EnableHttps;
- }
- }
+ public bool EnableHttps => SupportsHttps && ServerConfigurationManager.Configuration.EnableHttps;
- public bool SupportsHttps
- {
- get { return Certificate != null || ServerConfigurationManager.Configuration.IsBehindProxy; }
- }
+ public bool SupportsHttps => Certificate != null || ServerConfigurationManager.Configuration.IsBehindProxy;
public async Task<string> GetLocalApiUrl(CancellationToken cancellationToken)
{
@@ -2133,15 +2078,10 @@ namespace Emby.Server.Implementations
}
}
- public string FriendlyName
- {
- get
- {
- return string.IsNullOrEmpty(ServerConfigurationManager.Configuration.ServerName)
- ? Environment.MachineName
- : ServerConfigurationManager.Configuration.ServerName;
- }
- }
+ public string FriendlyName =>
+ string.IsNullOrEmpty(ServerConfigurationManager.Configuration.ServerName)
+ ? Environment.MachineName
+ : ServerConfigurationManager.Configuration.ServerName;
public int HttpPort { get; private set; }
@@ -2178,7 +2118,7 @@ namespace Emby.Server.Implementations
private bool _hasUpdateAvailable;
public bool HasUpdateAvailable
{
- get { return _hasUpdateAvailable; }
+ get => _hasUpdateAvailable;
set
{
var fireEvent = value && !_hasUpdateAvailable;
@@ -2219,7 +2159,7 @@ namespace Emby.Server.Implementations
}
/// <summary>
- /// This returns localhost in the case of no external dns, and the hostname if the
+ /// This returns localhost in the case of no external dns, and the hostname if the
/// dns is prefixed with a valid Uri prefix.
/// </summary>
/// <param name="externalDns">The external dns prefix to get the hostname of.</param>
diff --git a/Emby.Server.Implementations/Archiving/ZipClient.cs b/Emby.Server.Implementations/Archiving/ZipClient.cs
index fd61f2617..169e7af0a 100644
--- a/Emby.Server.Implementations/Archiving/ZipClient.cs
+++ b/Emby.Server.Implementations/Archiving/ZipClient.cs
@@ -15,14 +15,14 @@ namespace Emby.Server.Implementations.Archiving
/// </summary>
public class ZipClient : IZipClient
{
- private readonly IFileSystem _fileSystem;
+ private readonly IFileSystem _fileSystem;
- public ZipClient(IFileSystem fileSystem)
- {
- _fileSystem = fileSystem;
- }
+ public ZipClient(IFileSystem fileSystem)
+ {
+ _fileSystem = fileSystem;
+ }
- /// <summary>
+ /// <summary>
/// Extracts all.
/// </summary>
/// <param name="sourceFile">The source file.</param>
@@ -30,7 +30,7 @@ namespace Emby.Server.Implementations.Archiving
/// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
public void ExtractAll(string sourceFile, string targetPath, bool overwriteExistingFiles)
{
- using (var fileStream = _fileSystem.OpenRead(sourceFile))
+ using (var fileStream = _fileSystem.OpenRead(sourceFile))
{
ExtractAll(fileStream, targetPath, overwriteExistingFiles);
}
@@ -116,7 +116,7 @@ namespace Emby.Server.Implementations.Archiving
/// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
public void ExtractAllFrom7z(string sourceFile, string targetPath, bool overwriteExistingFiles)
{
- using (var fileStream = _fileSystem.OpenRead(sourceFile))
+ using (var fileStream = _fileSystem.OpenRead(sourceFile))
{
ExtractAllFrom7z(fileStream, targetPath, overwriteExistingFiles);
}
@@ -156,7 +156,7 @@ namespace Emby.Server.Implementations.Archiving
/// <param name="overwriteExistingFiles">if set to <c>true</c> [overwrite existing files].</param>
public void ExtractAllFromTar(string sourceFile, string targetPath, bool overwriteExistingFiles)
{
- using (var fileStream = _fileSystem.OpenRead(sourceFile))
+ using (var fileStream = _fileSystem.OpenRead(sourceFile))
{
ExtractAllFromTar(fileStream, targetPath, overwriteExistingFiles);
}
diff --git a/Emby.Server.Implementations/Browser/BrowserLauncher.cs b/Emby.Server.Implementations/Browser/BrowserLauncher.cs
index 007f60a9b..4c9f442d1 100644
--- a/Emby.Server.Implementations/Browser/BrowserLauncher.cs
+++ b/Emby.Server.Implementations/Browser/BrowserLauncher.cs
@@ -41,7 +41,7 @@ namespace Emby.Server.Implementations.Browser
}
catch (NotSupportedException)
{
-
+
}
catch (Exception)
{
diff --git a/Emby.Server.Implementations/Channels/ChannelImageProvider.cs b/Emby.Server.Implementations/Channels/ChannelImageProvider.cs
index a6643e83c..7eded70c0 100644
--- a/Emby.Server.Implementations/Channels/ChannelImageProvider.cs
+++ b/Emby.Server.Implementations/Channels/ChannelImageProvider.cs
@@ -30,10 +30,7 @@ namespace Emby.Server.Implementations.Channels
return channel.GetChannelImage(type, cancellationToken);
}
- public string Name
- {
- get { return "Channel Image Provider"; }
- }
+ public string Name => "Channel Image Provider";
public bool Supports(BaseItem item)
{
diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs
index c2160d338..4cc3fd855 100644
--- a/Emby.Server.Implementations/Channels/ChannelManager.cs
+++ b/Emby.Server.Implementations/Channels/ChannelManager.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Extensions;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Configuration;
@@ -67,13 +67,7 @@ namespace Emby.Server.Implementations.Channels
_providerManager = providerManager;
}
- private TimeSpan CacheLength
- {
- get
- {
- return TimeSpan.FromHours(3);
- }
- }
+ private static TimeSpan CacheLength => TimeSpan.FromHours(3);
public void AddParts(IEnumerable<IChannel> channels)
{
@@ -269,6 +263,7 @@ namespace Emby.Server.Implementations.Channels
{
};
+ //TODO Fix The co-variant conversion (internalResult.Items) between Folder[] and BaseItem[], this can generate runtime issues.
var returnItems = _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user);
var result = new QueryResult<BaseItemDto>
@@ -419,7 +414,7 @@ namespace Emby.Server.Implementations.Channels
return list;
}
- private MediaSourceInfo NormalizeMediaSource(BaseItem item, MediaSourceInfo info)
+ private static MediaSourceInfo NormalizeMediaSource(BaseItem item, MediaSourceInfo info)
{
info.RunTimeTicks = info.RunTimeTicks ?? item.RunTimeTicks;
@@ -492,7 +487,7 @@ namespace Emby.Server.Implementations.Channels
return item;
}
- private string GetOfficialRating(ChannelParentalRating rating)
+ private static string GetOfficialRating(ChannelParentalRating rating)
{
switch (rating)
{
@@ -533,7 +528,7 @@ namespace Emby.Server.Implementations.Channels
{
if (string.IsNullOrEmpty(id))
{
- throw new ArgumentNullException("id");
+ throw new ArgumentNullException(nameof(id));
}
var channel = GetChannel(id);
@@ -577,7 +572,7 @@ namespace Emby.Server.Implementations.Channels
{
if (string.IsNullOrEmpty(name))
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
return _libraryManager.GetNewItemId("Channel " + name, typeof(Channel));
}
@@ -891,7 +886,7 @@ namespace Emby.Server.Implementations.Channels
filename + ".json");
}
- private string GetIdToHash(string externalId, string channelName)
+ private static string GetIdToHash(string externalId, string channelName)
{
// Increment this as needed to force new downloads
// Incorporate Name because it's being used to convert channel entity to provider
@@ -902,7 +897,7 @@ namespace Emby.Server.Implementations.Channels
where T : BaseItem, new()
{
var id = _libraryManager.GetNewItemId(GetIdToHash(idString, channelName), typeof(T));
-
+
T item = null;
try
@@ -1187,7 +1182,7 @@ namespace Emby.Server.Implementations.Channels
{
if (channel == null)
{
- throw new ArgumentNullException("channel");
+ throw new ArgumentNullException(nameof(channel));
}
var result = GetAllChannels()
diff --git a/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs b/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs
index ab6acf3c5..c1e9fad8a 100644
--- a/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs
+++ b/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs
@@ -25,35 +25,17 @@ namespace Emby.Server.Implementations.Channels
_libraryManager = libraryManager;
}
- public string Name
- {
- get { return "Refresh Channels"; }
- }
+ public string Name => "Refresh Channels";
- public string Description
- {
- get { return "Refreshes internet channel information."; }
- }
+ public string Description => "Refreshes internet channel information.";
- public string Category
- {
- get { return "Internet Channels"; }
- }
+ public string Category => "Internet Channels";
- public bool IsHidden
- {
- get { return ((ChannelManager)_channelManager).Channels.Length == 0; }
- }
+ public bool IsHidden => ((ChannelManager)_channelManager).Channels.Length == 0;
- public bool IsEnabled
- {
- get { return true; }
- }
+ public bool IsEnabled => true;
- public bool IsLogged
- {
- get { return true; }
- }
+ public bool IsLogged => true;
public async Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
{
@@ -70,16 +52,13 @@ namespace Emby.Server.Implementations.Channels
/// </summary>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{
- return new[] {
-
+ return new[] {
+
// Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
};
}
- public string Key
- {
- get { return "RefreshInternetChannels"; }
- }
+ public string Key => "RefreshInternetChannels";
}
}
diff --git a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs b/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs
index 015421197..6180645e4 100644
--- a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs
+++ b/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs
@@ -38,28 +38,19 @@ namespace Emby.Server.Implementations.Configuration
/// Gets the type of the configuration.
/// </summary>
/// <value>The type of the configuration.</value>
- protected override Type ConfigurationType
- {
- get { return typeof(ServerConfiguration); }
- }
+ protected override Type ConfigurationType => typeof(ServerConfiguration);
/// <summary>
/// Gets the application paths.
/// </summary>
/// <value>The application paths.</value>
- public IServerApplicationPaths ApplicationPaths
- {
- get { return (IServerApplicationPaths)CommonApplicationPaths; }
- }
+ public IServerApplicationPaths ApplicationPaths => (IServerApplicationPaths)CommonApplicationPaths;
/// <summary>
/// Gets the configuration.
/// </summary>
/// <value>The configuration.</value>
- public ServerConfiguration Configuration
- {
- get { return (ServerConfiguration)CommonConfiguration; }
- }
+ public ServerConfiguration Configuration => (ServerConfiguration)CommonConfiguration;
/// <summary>
/// Called when [configuration updated].
diff --git a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs
index 59776c373..c714ba91b 100644
--- a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs
+++ b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs
@@ -24,15 +24,9 @@ namespace Emby.Server.Implementations.Data
WriteLock = new ReaderWriterLockSlim(LockRecursionPolicy.NoRecursion);
}
- protected TransactionMode TransactionMode
- {
- get { return TransactionMode.Deferred; }
- }
+ protected TransactionMode TransactionMode => TransactionMode.Deferred;
- protected TransactionMode ReadTransactionMode
- {
- get { return TransactionMode.Deferred; }
- }
+ protected TransactionMode ReadTransactionMode => TransactionMode.Deferred;
internal static int ThreadSafeMode { get; set; }
@@ -58,10 +52,7 @@ namespace Emby.Server.Implementations.Data
private string _defaultWal;
protected ManagedConnection _connection;
- protected virtual bool EnableSingleConnection
- {
- get { return true; }
- }
+ protected virtual bool EnableSingleConnection => true;
protected ManagedConnection CreateConnection(bool isReadOnly = false)
{
@@ -238,21 +229,9 @@ namespace Emby.Server.Implementations.Data
Logger.LogInformation("PRAGMA synchronous=" + db.Query("PRAGMA synchronous").SelectScalarString().First());
}
- protected virtual bool EnableTempStoreMemory
- {
- get
- {
- return false;
- }
- }
+ protected virtual bool EnableTempStoreMemory => false;
- protected virtual int? CacheSize
- {
- get
- {
- return null;
- }
- }
+ protected virtual int? CacheSize => null;
internal static void CheckOk(int rc)
{
@@ -276,7 +255,7 @@ namespace Emby.Server.Implementations.Data
{
if (_disposed)
{
- throw new ObjectDisposedException(GetType().Name + " has been disposed and cannot be accessed.");
+ throw new ObjectDisposedException(GetType().Name ,"Object has been disposed and cannot be accessed.");
}
}
diff --git a/Emby.Server.Implementations/Data/SqliteDisplayPreferencesRepository.cs b/Emby.Server.Implementations/Data/SqliteDisplayPreferencesRepository.cs
index 00e1956cf..49d8f79a2 100644
--- a/Emby.Server.Implementations/Data/SqliteDisplayPreferencesRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteDisplayPreferencesRepository.cs
@@ -32,13 +32,7 @@ namespace Emby.Server.Implementations.Data
/// Gets the name of the repository
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get
- {
- return "SQLite";
- }
- }
+ public string Name => "SQLite";
/// <summary>
/// The _json serializer
@@ -94,11 +88,11 @@ namespace Emby.Server.Implementations.Data
{
if (displayPreferences == null)
{
- throw new ArgumentNullException("displayPreferences");
+ throw new ArgumentNullException(nameof(displayPreferences));
}
if (string.IsNullOrEmpty(displayPreferences.Id))
{
- throw new ArgumentNullException("displayPreferences.Id");
+ throw new ArgumentNullException(nameof(displayPreferences.Id));
}
cancellationToken.ThrowIfCancellationRequested();
@@ -142,7 +136,7 @@ namespace Emby.Server.Implementations.Data
{
if (displayPreferences == null)
{
- throw new ArgumentNullException("displayPreferences");
+ throw new ArgumentNullException(nameof(displayPreferences));
}
cancellationToken.ThrowIfCancellationRequested();
@@ -174,7 +168,7 @@ namespace Emby.Server.Implementations.Data
{
if (string.IsNullOrEmpty(displayPreferencesId))
{
- throw new ArgumentNullException("displayPreferencesId");
+ throw new ArgumentNullException(nameof(displayPreferencesId));
}
var guidId = displayPreferencesId.GetMD5();
diff --git a/Emby.Server.Implementations/Data/SqliteExtensions.cs b/Emby.Server.Implementations/Data/SqliteExtensions.cs
index a755c65f4..d9b2db56e 100644
--- a/Emby.Server.Implementations/Data/SqliteExtensions.cs
+++ b/Emby.Server.Implementations/Data/SqliteExtensions.cs
@@ -14,7 +14,7 @@ namespace Emby.Server.Implementations.Data
{
if (queries == null)
{
- throw new ArgumentNullException("queries");
+ throw new ArgumentNullException(nameof(queries));
}
connection.RunInTransaction(conn =>
@@ -134,7 +134,7 @@ namespace Emby.Server.Implementations.Data
{
if (obj == null)
{
- throw new ArgumentNullException("obj");
+ throw new ArgumentNullException(nameof(obj));
}
using (var stream = new MemoryStream())
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
index 0f9770e8f..f1894fd4f 100644
--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
@@ -82,11 +82,11 @@ namespace Emby.Server.Implementations.Data
{
if (config == null)
{
- throw new ArgumentNullException("config");
+ throw new ArgumentNullException(nameof(config));
}
if (jsonSerializer == null)
{
- throw new ArgumentNullException("jsonSerializer");
+ throw new ArgumentNullException(nameof(jsonSerializer));
}
_appHost = appHost;
@@ -455,7 +455,7 @@ namespace Emby.Server.Implementations.Data
"ColorTransfer"
};
- private string GetSaveItemCommandText()
+ private static string GetSaveItemCommandText()
{
var saveColumns = new List<string>
{
@@ -558,7 +558,7 @@ namespace Emby.Server.Implementations.Data
{
if (item == null)
{
- throw new ArgumentNullException("item");
+ throw new ArgumentNullException(nameof(item));
}
SaveItems(new List<BaseItem> { item }, cancellationToken);
@@ -568,7 +568,7 @@ namespace Emby.Server.Implementations.Data
{
if (item == null)
{
- throw new ArgumentNullException("item");
+ throw new ArgumentNullException(nameof(item));
}
CheckDisposed();
@@ -605,7 +605,7 @@ namespace Emby.Server.Implementations.Data
{
if (items == null)
{
- throw new ArgumentNullException("items");
+ throw new ArgumentNullException(nameof(items));
}
cancellationToken.ThrowIfCancellationRequested();
@@ -1070,7 +1070,7 @@ namespace Emby.Server.Implementations.Data
saveItemStatement.MoveNext();
}
- private string SerializeProviderIds(BaseItem item)
+ private static string SerializeProviderIds(BaseItem item)
{
// Ideally we shouldn't need this IsNullOrWhiteSpace check but we're seeing some cases of bad data slip through
var ids = item.ProviderIds
@@ -1085,7 +1085,7 @@ namespace Emby.Server.Implementations.Data
return string.Join("|", ids.Select(i => i.Key + "=" + i.Value).ToArray());
}
- private void DeserializeProviderIds(string value, BaseItem item)
+ private static void DeserializeProviderIds(string value, BaseItem item)
{
if (string.IsNullOrWhiteSpace(value))
{
@@ -1226,7 +1226,7 @@ namespace Emby.Server.Implementations.Data
{
if (id.Equals(Guid.Empty))
{
- throw new ArgumentNullException("id");
+ throw new ArgumentNullException(nameof(id));
}
CheckDisposed();
@@ -1948,7 +1948,7 @@ namespace Emby.Server.Implementations.Data
return item;
}
- private Guid[] SplitToGuids(string value)
+ private static Guid[] SplitToGuids(string value)
{
var ids = value.Split('|');
@@ -1965,7 +1965,7 @@ namespace Emby.Server.Implementations.Data
/// <summary>
/// Gets chapters for an item
/// </summary>
- /// <param name="id">The id.</param>
+ /// <param name="item">The item.</param>
/// <returns>IEnumerable{ChapterInfo}.</returns>
/// <exception cref="System.ArgumentNullException">id</exception>
public List<ChapterInfo> GetChapters(BaseItem item)
@@ -1996,7 +1996,7 @@ namespace Emby.Server.Implementations.Data
/// <summary>
/// Gets a single chapter for an item
/// </summary>
- /// <param name="id">The id.</param>
+ /// <param name="item">The item.</param>
/// <param name="index">The index.</param>
/// <returns>ChapterInfo.</returns>
/// <exception cref="System.ArgumentNullException">id</exception>
@@ -2067,12 +2067,12 @@ namespace Emby.Server.Implementations.Data
if (id.Equals(Guid.Empty))
{
- throw new ArgumentNullException("id");
+ throw new ArgumentNullException(nameof(id));
}
if (chapters == null)
{
- throw new ArgumentNullException("chapters");
+ throw new ArgumentNullException(nameof(chapters));
}
using (WriteLock.Write())
@@ -2144,7 +2144,7 @@ namespace Emby.Server.Implementations.Data
}
}
- private bool EnableJoinUserData(InternalItemsQuery query)
+ private static bool EnableJoinUserData(InternalItemsQuery query)
{
if (query.User == null)
{
@@ -2681,7 +2681,7 @@ namespace Emby.Server.Implementations.Data
{
if (query == null)
{
- throw new ArgumentNullException("query");
+ throw new ArgumentNullException(nameof(query));
}
CheckDisposed();
@@ -2739,7 +2739,7 @@ namespace Emby.Server.Implementations.Data
{
if (query == null)
{
- throw new ArgumentNullException("query");
+ throw new ArgumentNullException(nameof(query));
}
CheckDisposed();
@@ -2928,7 +2928,7 @@ namespace Emby.Server.Implementations.Data
{
if (query == null)
{
- throw new ArgumentNullException("query");
+ throw new ArgumentNullException(nameof(query));
}
CheckDisposed();
@@ -3212,7 +3212,7 @@ namespace Emby.Server.Implementations.Data
{
if (query == null)
{
- throw new ArgumentNullException("query");
+ throw new ArgumentNullException(nameof(query));
}
CheckDisposed();
@@ -3286,7 +3286,7 @@ namespace Emby.Server.Implementations.Data
{
if (query == null)
{
- throw new ArgumentNullException("query");
+ throw new ArgumentNullException(nameof(query));
}
CheckDisposed();
@@ -3362,7 +3362,7 @@ namespace Emby.Server.Implementations.Data
{
if (query == null)
{
- throw new ArgumentNullException("query");
+ throw new ArgumentNullException(nameof(query));
}
CheckDisposed();
@@ -4038,7 +4038,7 @@ namespace Emby.Server.Implementations.Data
if (query.PersonIds.Length > 0)
{
- // TODO: Should this query with CleanName ?
+ // TODO: Should this query with CleanName ?
var clauses = new List<string>();
var index = 0;
@@ -5184,7 +5184,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
{
if (id.Equals(Guid.Empty))
{
- throw new ArgumentNullException("id");
+ throw new ArgumentNullException(nameof(id));
}
CheckDisposed();
@@ -5233,7 +5233,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
{
if (query == null)
{
- throw new ArgumentNullException("query");
+ throw new ArgumentNullException(nameof(query));
}
CheckDisposed();
@@ -5273,7 +5273,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
{
if (query == null)
{
- throw new ArgumentNullException("query");
+ throw new ArgumentNullException(nameof(query));
}
CheckDisposed();
@@ -5387,19 +5387,19 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
{
if (itemId.Equals(Guid.Empty))
{
- throw new ArgumentNullException("itemId");
+ throw new ArgumentNullException(nameof(itemId));
}
if (ancestorIds == null)
{
- throw new ArgumentNullException("ancestorIds");
+ throw new ArgumentNullException(nameof(ancestorIds));
}
CheckDisposed();
var itemIdBlob = itemId.ToGuidBlob();
- // First delete
+ // First delete
deleteAncestorsStatement.Reset();
deleteAncestorsStatement.TryBind("@ItemId", itemIdBlob);
deleteAncestorsStatement.MoveNext();
@@ -5556,7 +5556,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
{
if (query == null)
{
- throw new ArgumentNullException("query");
+ throw new ArgumentNullException(nameof(query));
}
if (!query.Limit.HasValue)
@@ -5915,19 +5915,19 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
{
if (itemId.Equals(Guid.Empty))
{
- throw new ArgumentNullException("itemId");
+ throw new ArgumentNullException(nameof(itemId));
}
if (values == null)
{
- throw new ArgumentNullException("keys");
+ throw new ArgumentNullException(nameof(values));
}
CheckDisposed();
var guidBlob = itemId.ToGuidBlob();
- // First delete
+ // First delete
db.Execute("delete from ItemValues where ItemId=@Id", guidBlob);
InsertItemValues(guidBlob, values, db);
@@ -5991,12 +5991,12 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
{
if (itemId.Equals(Guid.Empty))
{
- throw new ArgumentNullException("itemId");
+ throw new ArgumentNullException(nameof(itemId));
}
if (people == null)
{
- throw new ArgumentNullException("people");
+ throw new ArgumentNullException(nameof(people));
}
CheckDisposed();
@@ -6102,7 +6102,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
if (query == null)
{
- throw new ArgumentNullException("query");
+ throw new ArgumentNullException(nameof(query));
}
var cmdText = "select " + string.Join(",", _mediaStreamSaveColumns) + " from mediastreams where";
@@ -6158,12 +6158,12 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
if (id.Equals(Guid.Empty))
{
- throw new ArgumentNullException("id");
+ throw new ArgumentNullException(nameof(id));
}
if (streams == null)
{
- throw new ArgumentNullException("streams");
+ throw new ArgumentNullException(nameof(streams));
}
cancellationToken.ThrowIfCancellationRequested();
diff --git a/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs b/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs
index 6d4ddcedd..cf60b71d6 100644
--- a/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -28,13 +28,7 @@ namespace Emby.Server.Implementations.Data
/// Gets the name of the repository
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get
- {
- return "SQLite";
- }
- }
+ public string Name => "SQLite";
/// <summary>
/// Opens the connection to the database
@@ -136,13 +130,7 @@ namespace Emby.Server.Implementations.Data
return list;
}
- protected override bool EnableTempStoreMemory
- {
- get
- {
- return true;
- }
- }
+ protected override bool EnableTempStoreMemory => true;
/// <summary>
/// Saves the user data.
@@ -151,15 +139,15 @@ namespace Emby.Server.Implementations.Data
{
if (userData == null)
{
- throw new ArgumentNullException("userData");
+ throw new ArgumentNullException(nameof(userData));
}
if (internalUserId <= 0)
{
- throw new ArgumentNullException("internalUserId");
+ throw new ArgumentNullException(nameof(internalUserId));
}
if (string.IsNullOrEmpty(key))
{
- throw new ArgumentNullException("key");
+ throw new ArgumentNullException(nameof(key));
}
PersistUserData(internalUserId, key, userData, cancellationToken);
@@ -169,11 +157,11 @@ namespace Emby.Server.Implementations.Data
{
if (userData == null)
{
- throw new ArgumentNullException("userData");
+ throw new ArgumentNullException(nameof(userData));
}
if (internalUserId <= 0)
{
- throw new ArgumentNullException("internalUserId");
+ throw new ArgumentNullException(nameof(internalUserId));
}
PersistAllUserData(internalUserId, userData, cancellationToken);
@@ -182,7 +170,7 @@ namespace Emby.Server.Implementations.Data
/// <summary>
/// Persists the user data.
/// </summary>
- /// <param name="userId">The user id.</param>
+ /// <param name="internalUserId">The user id.</param>
/// <param name="key">The key.</param>
/// <param name="userData">The user data.</param>
/// <param name="cancellationToken">The cancellation token.</param>
@@ -203,7 +191,7 @@ namespace Emby.Server.Implementations.Data
}
}
- private void SaveUserData(IDatabaseConnection db, long internalUserId, string key, UserItemData userData)
+ private static void SaveUserData(IDatabaseConnection db, long internalUserId, string key, UserItemData userData)
{
using (var statement = db.PrepareStatement("replace into UserDatas (key, userId, rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex) values (@key, @userId, @rating,@played,@playCount,@isFavorite,@playbackPositionTicks,@lastPlayedDate,@AudioStreamIndex,@SubtitleStreamIndex)"))
{
@@ -280,7 +268,7 @@ namespace Emby.Server.Implementations.Data
/// <summary>
/// Gets the user data.
/// </summary>
- /// <param name="userId">The user id.</param>
+ /// <param name="internalUserId">The user id.</param>
/// <param name="key">The key.</param>
/// <returns>Task{UserItemData}.</returns>
/// <exception cref="System.ArgumentNullException">
@@ -292,11 +280,11 @@ namespace Emby.Server.Implementations.Data
{
if (internalUserId <= 0)
{
- throw new ArgumentNullException("internalUserId");
+ throw new ArgumentNullException(nameof(internalUserId));
}
if (string.IsNullOrEmpty(key))
{
- throw new ArgumentNullException("key");
+ throw new ArgumentNullException(nameof(key));
}
using (WriteLock.Read())
@@ -323,7 +311,7 @@ namespace Emby.Server.Implementations.Data
{
if (keys == null)
{
- throw new ArgumentNullException("keys");
+ throw new ArgumentNullException(nameof(keys));
}
if (keys.Count == 0)
@@ -337,13 +325,13 @@ namespace Emby.Server.Implementations.Data
/// <summary>
/// Return all user-data associated with the given user
/// </summary>
- /// <param name="userId"></param>
+ /// <param name="internalUserId"></param>
/// <returns></returns>
public List<UserItemData> GetAllUserData(long internalUserId)
{
if (internalUserId <= 0)
{
- throw new ArgumentNullException("internalUserId");
+ throw new ArgumentNullException(nameof(internalUserId));
}
var list = new List<UserItemData>();
diff --git a/Emby.Server.Implementations/Data/SqliteUserRepository.cs b/Emby.Server.Implementations/Data/SqliteUserRepository.cs
index d490a481e..125f254c1 100644
--- a/Emby.Server.Implementations/Data/SqliteUserRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteUserRepository.cs
@@ -31,13 +31,7 @@ namespace Emby.Server.Implementations.Data
/// Gets the name of the repository
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get
- {
- return "SQLite";
- }
- }
+ public string Name => "SQLite";
/// <summary>
/// Opens the connection to the database
@@ -85,7 +79,7 @@ namespace Emby.Server.Implementations.Data
{
if (user == null)
{
- throw new ArgumentNullException("user");
+ throw new ArgumentNullException(nameof(user));
}
var serialized = _jsonSerializer.SerializeToBytes(user);
@@ -122,7 +116,7 @@ namespace Emby.Server.Implementations.Data
{
if (user == null)
{
- throw new ArgumentNullException("user");
+ throw new ArgumentNullException(nameof(user));
}
var serialized = _jsonSerializer.SerializeToBytes(user);
@@ -207,14 +201,13 @@ namespace Emby.Server.Implementations.Data
/// Deletes the user.
/// </summary>
/// <param name="user">The user.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
/// <exception cref="System.ArgumentNullException">user</exception>
public void DeleteUser(User user)
{
if (user == null)
{
- throw new ArgumentNullException("user");
+ throw new ArgumentNullException(nameof(user));
}
using (WriteLock.Write())
diff --git a/Emby.Server.Implementations/Data/TypeMapper.cs b/Emby.Server.Implementations/Data/TypeMapper.cs
index f4b37749e..e0c2de918 100644
--- a/Emby.Server.Implementations/Data/TypeMapper.cs
+++ b/Emby.Server.Implementations/Data/TypeMapper.cs
@@ -32,7 +32,7 @@ namespace Emby.Server.Implementations.Data
{
if (string.IsNullOrEmpty(typeName))
{
- throw new ArgumentNullException("typeName");
+ throw new ArgumentNullException(nameof(typeName));
}
return _typeMap.GetOrAdd(typeName, LookupType);
diff --git a/Emby.Server.Implementations/Devices/DeviceId.cs b/Emby.Server.Implementations/Devices/DeviceId.cs
index 90cef5d06..4f5950ac7 100644
--- a/Emby.Server.Implementations/Devices/DeviceId.cs
+++ b/Emby.Server.Implementations/Devices/DeviceId.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.IO;
using System.Text;
using MediaBrowser.Common.Configuration;
@@ -10,15 +10,12 @@ namespace Emby.Server.Implementations.Devices
public class DeviceId
{
private readonly IApplicationPaths _appPaths;
- private readonly ILogger _logger;
- private readonly IFileSystem _fileSystem;
+ private readonly ILogger _logger;
+ private readonly IFileSystem _fileSystem;
private readonly object _syncLock = new object();
- private string CachePath
- {
- get { return Path.Combine(_appPaths.DataPath, "device.txt"); }
- }
+ private string CachePath => Path.Combine(_appPaths.DataPath, "device.txt");
private string GetCachedId()
{
@@ -26,7 +23,7 @@ namespace Emby.Server.Implementations.Devices
{
lock (_syncLock)
{
- var value = File.ReadAllText(CachePath, Encoding.UTF8);
+ var value = File.ReadAllText(CachePath, Encoding.UTF8);
Guid guid;
if (Guid.TryParse(value, out guid))
@@ -57,7 +54,7 @@ namespace Emby.Server.Implementations.Devices
{
var path = CachePath;
- _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
+ _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
lock (_syncLock)
{
@@ -70,7 +67,7 @@ namespace Emby.Server.Implementations.Devices
}
}
- private string GetNewId()
+ private static string GetNewId()
{
return Guid.NewGuid().ToString("N");
}
@@ -92,18 +89,16 @@ namespace Emby.Server.Implementations.Devices
public DeviceId(IApplicationPaths appPaths, ILogger logger, IFileSystem fileSystem)
{
- if (fileSystem == null) {
- throw new ArgumentNullException ("fileSystem");
- }
+ if (fileSystem == null)
+ {
+ throw new ArgumentNullException(nameof(fileSystem));
+ }
_appPaths = appPaths;
_logger = logger;
- _fileSystem = fileSystem;
+ _fileSystem = fileSystem;
}
- public string Value
- {
- get { return _id ?? (_id = GetDeviceId()); }
- }
+ public string Value => _id ?? (_id = GetDeviceId());
}
}
diff --git a/Emby.Server.Implementations/Devices/DeviceManager.cs b/Emby.Server.Implementations/Devices/DeviceManager.cs
index f5314df6e..c72334577 100644
--- a/Emby.Server.Implementations/Devices/DeviceManager.cs
+++ b/Emby.Server.Implementations/Devices/DeviceManager.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Configuration;
+using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Devices;
using MediaBrowser.Controller.Library;
@@ -144,7 +144,7 @@ namespace Emby.Server.Implementations.Devices
HasUser = true
}).Items;
-
+
// TODO: DeviceQuery doesn't seem to be used from client. Not even Swagger.
if (query.SupportsSync.HasValue)
{
@@ -360,10 +360,7 @@ namespace Emby.Server.Implementations.Devices
return path;
}
- private string DefaultCameraUploadsPath
- {
- get { return Path.Combine(_config.CommonApplicationPaths.DataPath, "camerauploads"); }
- }
+ private string DefaultCameraUploadsPath => Path.Combine(_config.CommonApplicationPaths.DataPath, "camerauploads");
public bool CanAccessDevice(User user, string deviceId)
{
@@ -373,7 +370,7 @@ namespace Emby.Server.Implementations.Devices
}
if (string.IsNullOrEmpty(deviceId))
{
- throw new ArgumentNullException("deviceId");
+ throw new ArgumentNullException(nameof(deviceId));
}
if (!CanAccessDevice(user.Policy, deviceId))
@@ -389,7 +386,7 @@ namespace Emby.Server.Implementations.Devices
return true;
}
- private bool CanAccessDevice(UserPolicy policy, string id)
+ private static bool CanAccessDevice(UserPolicy policy, string id)
{
if (policy.EnableAllDevices)
{
diff --git a/Emby.Server.Implementations/Diagnostics/CommonProcess.cs b/Emby.Server.Implementations/Diagnostics/CommonProcess.cs
index a709607bd..99871a3c6 100644
--- a/Emby.Server.Implementations/Diagnostics/CommonProcess.cs
+++ b/Emby.Server.Implementations/Diagnostics/CommonProcess.cs
@@ -81,30 +81,15 @@ namespace Emby.Server.Implementations.Diagnostics
}
}
- public ProcessOptions StartInfo
- {
- get { return _options; }
- }
+ public ProcessOptions StartInfo => _options;
- public StreamWriter StandardInput
- {
- get { return _process.StandardInput; }
- }
+ public StreamWriter StandardInput => _process.StandardInput;
- public StreamReader StandardError
- {
- get { return _process.StandardError; }
- }
+ public StreamReader StandardError => _process.StandardError;
- public StreamReader StandardOutput
- {
- get { return _process.StandardOutput; }
- }
+ public StreamReader StandardOutput => _process.StandardOutput;
- public int ExitCode
- {
- get { return _process.ExitCode; }
- }
+ public int ExitCode => _process.ExitCode;
public void Start()
{
diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs
index 7871d3fb3..3d519f35d 100644
--- a/Emby.Server.Implementations/Dto/DtoService.cs
+++ b/Emby.Server.Implementations/Dto/DtoService.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common;
+using MediaBrowser.Common;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Devices;
@@ -189,7 +189,7 @@ namespace Emby.Server.Implementations.Dto
return dto;
}
- private IList<BaseItem> GetTaggedItems(IItemByName byName, User user, DtoOptions options)
+ private static IList<BaseItem> GetTaggedItems(IItemByName byName, User user, DtoOptions options)
{
return byName.GetTaggedItems(new InternalItemsQuery(user)
{
@@ -295,7 +295,7 @@ namespace Emby.Server.Implementations.Dto
return dto;
}
- private void NormalizeMediaSourceContainers(BaseItemDto dto)
+ private static void NormalizeMediaSourceContainers(BaseItemDto dto)
{
foreach (var mediaSource in dto.MediaSources)
{
@@ -347,7 +347,7 @@ namespace Emby.Server.Implementations.Dto
return dto;
}
- private void SetItemByNameInfo(BaseItem item, BaseItemDto dto, IList<BaseItem> taggedItems, User user = null)
+ private static void SetItemByNameInfo(BaseItem item, BaseItemDto dto, IList<BaseItem> taggedItems, User user = null)
{
if (item is MusicArtist)
{
@@ -447,7 +447,7 @@ namespace Emby.Server.Implementations.Dto
}
}
- private int GetChildCount(Folder folder, User user)
+ private static int GetChildCount(Folder folder, User user)
{
// Right now this is too slow to calculate for top level folders on a per-user basis
// Just return something so that apps that are expecting a value won't think the folders are empty
@@ -470,11 +470,11 @@ namespace Emby.Server.Implementations.Dto
return item.Id.ToString("N");
}
- private void SetBookProperties(BaseItemDto dto, Book item)
+ private static void SetBookProperties(BaseItemDto dto, Book item)
{
dto.SeriesName = item.SeriesName;
}
- private void SetPhotoProperties(BaseItemDto dto, Photo item)
+ private static void SetPhotoProperties(BaseItemDto dto, Photo item)
{
dto.CameraMake = item.CameraMake;
dto.CameraModel = item.CameraModel;
@@ -520,13 +520,13 @@ namespace Emby.Server.Implementations.Dto
dto.Album = item.Album;
}
- private void SetGameProperties(BaseItemDto dto, Game item)
+ private static void SetGameProperties(BaseItemDto dto, Game item)
{
dto.GameSystem = item.GameSystem;
dto.MultiPartGameFiles = item.MultiPartGameFiles;
}
- private void SetGameSystemProperties(BaseItemDto dto, GameSystem item)
+ private static void SetGameSystemProperties(BaseItemDto dto, GameSystem item)
{
dto.GameSystem = item.GameSystemName;
}
diff --git a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
index 6cd867921..6c658a695 100644
--- a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
+++ b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
@@ -227,7 +227,7 @@ namespace Emby.Server.Implementations.EntryPoints
{
if (_disposed)
{
- throw new ObjectDisposedException("PortMapper");
+ throw new ObjectDisposedException(GetType().Name);
}
// On some systems the device discovered event seems to fire repeatedly
diff --git a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
index bb8ef52f1..a5c907213 100644
--- a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Controller.Session;
@@ -142,7 +142,7 @@ namespace Emby.Server.Implementations.EntryPoints
_providerManager_RefreshProgress(sender, new GenericEventArgs<Tuple<BaseItem, double>>(new Tuple<BaseItem, double>(e.Argument, 100)));
}
- private bool EnableRefreshMessage(BaseItem item)
+ private static bool EnableRefreshMessage(BaseItem item)
{
var folder = item as Folder;
@@ -387,7 +387,7 @@ namespace Emby.Server.Implementations.EntryPoints
};
}
- private bool FilterItem(BaseItem item)
+ private static bool FilterItem(BaseItem item)
{
if (!item.IsFolder && !item.HasPathProtocol)
{
@@ -471,7 +471,7 @@ namespace Emby.Server.Implementations.EntryPoints
LibraryUpdateTimer.Dispose();
LibraryUpdateTimer = null;
}
-
+
_libraryManager.ItemAdded -= libraryManager_ItemAdded;
_libraryManager.ItemUpdated -= libraryManager_ItemUpdated;
_libraryManager.ItemRemoved -= libraryManager_ItemRemoved;
diff --git a/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs b/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs
index 0b377dc68..c7bd03960 100644
--- a/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Linq;
using System.Threading;
using MediaBrowser.Controller.Library;
@@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (ObjectDisposedException)
{
-
+ // TODO Log exception or Investigate and properly fix.
}
catch (Exception ex)
{
diff --git a/Emby.Server.Implementations/EntryPoints/RefreshUsersMetadata.cs b/Emby.Server.Implementations/EntryPoints/RefreshUsersMetadata.cs
index 660ca3a94..f0b834ccb 100644
--- a/Emby.Server.Implementations/EntryPoints/RefreshUsersMetadata.cs
+++ b/Emby.Server.Implementations/EntryPoints/RefreshUsersMetadata.cs
@@ -30,10 +30,7 @@ namespace Emby.Server.Implementations.EntryPoints
public string Description => "Refresh user infos";
- public string Category
- {
- get { return "Library"; }
- }
+ public string Category => "Library";
public bool IsHidden => true;
diff --git a/Emby.Server.Implementations/EnvironmentInfo/EnvironmentInfo.cs b/Emby.Server.Implementations/EnvironmentInfo/EnvironmentInfo.cs
index 03e10e7ea..24a3456c4 100644
--- a/Emby.Server.Implementations/EnvironmentInfo/EnvironmentInfo.cs
+++ b/Emby.Server.Implementations/EnvironmentInfo/EnvironmentInfo.cs
@@ -1,11 +1,9 @@
using System;
-using System.IO;
using MediaBrowser.Model.System;
using System.Runtime.InteropServices;
namespace Emby.Server.Implementations.EnvironmentInfo
{
- // TODO: Rework @bond
public class EnvironmentInfo : IEnvironmentInfo
{
public EnvironmentInfo(MediaBrowser.Model.System.OperatingSystem operatingSystem)
@@ -31,37 +29,8 @@ namespace Emby.Server.Implementations.EnvironmentInfo
}
}
- public string OperatingSystemVersion
- {
- get
- {
- return Environment.OSVersion.Version.ToString() + " " + Environment.OSVersion.ServicePack.ToString();
- }
- }
-
- public char PathSeparator
- {
- get
- {
- return Path.PathSeparator;
- }
- }
-
- public Architecture SystemArchitecture { get { return RuntimeInformation.OSArchitecture; } }
-
- public string GetEnvironmentVariable(string name)
- {
- return Environment.GetEnvironmentVariable(name);
- }
+ public string OperatingSystemVersion => Environment.OSVersion.Version.ToString() + " " + Environment.OSVersion.ServicePack.ToString();
- public string StackTrace
- {
- get { return Environment.StackTrace; }
- }
-
- public void SetProcessEnvironmentVariable(string name, string value)
- {
- Environment.SetEnvironmentVariable(name, value);
- }
+ public Architecture SystemArchitecture => RuntimeInformation.OSArchitecture;
}
}
diff --git a/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs b/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs
index 5f043e127..83e3cb720 100644
--- a/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs
+++ b/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs
@@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.FFMpeg
{
var encoderFilename = Path.GetFileName(info.EncoderPath);
var probeFilename = Path.GetFileName(info.ProbePath);
-
+
foreach (var directory in _fileSystem.GetDirectoryPaths(rootEncoderPath)
.ToList())
{
diff --git a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
index d3ba1b683..6494f0c6f 100644
--- a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
+++ b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Globalization;
@@ -48,11 +48,11 @@ namespace Emby.Server.Implementations.HttpClientManager
{
if (appPaths == null)
{
- throw new ArgumentNullException("appPaths");
+ throw new ArgumentNullException(nameof(appPaths));
}
if (logger == null)
{
- throw new ArgumentNullException("logger");
+ throw new ArgumentNullException(nameof(logger));
}
_logger = logger;
@@ -87,7 +87,7 @@ namespace Emby.Server.Implementations.HttpClientManager
{
if (string.IsNullOrEmpty(host))
{
- throw new ArgumentNullException("host");
+ throw new ArgumentNullException(nameof(host));
}
HttpClientInfo client;
@@ -104,7 +104,7 @@ namespace Emby.Server.Implementations.HttpClientManager
return client;
}
- private WebRequest CreateWebRequest(string url)
+ private static WebRequest CreateWebRequest(string url)
{
try
{
@@ -185,7 +185,7 @@ namespace Emby.Server.Implementations.HttpClientManager
return request;
}
- private CredentialCache GetCredential(string url, string username, string password)
+ private static CredentialCache GetCredential(string url, string username, string password)
{
//ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
CredentialCache credentialCache = new CredentialCache();
@@ -220,7 +220,7 @@ namespace Emby.Server.Implementations.HttpClientManager
}
}
- private void SetUserAgent(HttpWebRequest request, string userAgent)
+ private static void SetUserAgent(HttpWebRequest request, string userAgent)
{
request.UserAgent = userAgent;
}
@@ -491,7 +491,7 @@ namespace Emby.Server.Implementations.HttpClientManager
return responseInfo;
}
- private void SetHeaders(WebHeaderCollection headers, HttpResponseInfo responseInfo)
+ private static void SetHeaders(WebHeaderCollection headers, HttpResponseInfo responseInfo)
{
foreach (var key in headers.AllKeys)
{
@@ -541,7 +541,7 @@ namespace Emby.Server.Implementations.HttpClientManager
if (options.Progress == null)
{
- throw new ArgumentNullException("progress");
+ throw new ArgumentException("Options did not have a Progress value.",nameof(options));
}
options.CancellationToken.ThrowIfCancellationRequested();
@@ -616,7 +616,7 @@ namespace Emby.Server.Implementations.HttpClientManager
}
}
- private long? GetContentLength(HttpWebResponse response)
+ private static long? GetContentLength(HttpWebResponse response)
{
var length = response.ContentLength;
@@ -704,7 +704,7 @@ namespace Emby.Server.Implementations.HttpClientManager
{
if (string.IsNullOrEmpty(options.Url))
{
- throw new ArgumentNullException("options");
+ throw new ArgumentNullException(nameof(options));
}
}
@@ -713,7 +713,7 @@ namespace Emby.Server.Implementations.HttpClientManager
/// </summary>
/// <param name="url">The URL.</param>
/// <returns>System.String.</returns>
- private string GetHostFromUrl(string url)
+ private static string GetHostFromUrl(string url)
{
var index = url.IndexOf("://", StringComparison.OrdinalIgnoreCase);
@@ -803,7 +803,7 @@ namespace Emby.Server.Implementations.HttpClientManager
};
}
- private Task<WebResponse> GetResponseAsync(WebRequest request, TimeSpan timeout)
+ private static Task<WebResponse> GetResponseAsync(WebRequest request, TimeSpan timeout)
{
var taskCompletion = new TaskCompletionSource<WebResponse>();
diff --git a/Emby.Server.Implementations/HttpServer/FileWriter.cs b/Emby.Server.Implementations/HttpServer/FileWriter.cs
index 1a875e533..568432902 100644
--- a/Emby.Server.Implementations/HttpServer/FileWriter.cs
+++ b/Emby.Server.Implementations/HttpServer/FileWriter.cs
@@ -38,10 +38,7 @@ namespace Emby.Server.Implementations.HttpServer
/// Gets the options.
/// </summary>
/// <value>The options.</value>
- public IDictionary<string, string> Headers
- {
- get { return _options; }
- }
+ public IDictionary<string, string> Headers => _options;
public string Path { get; set; }
@@ -49,7 +46,7 @@ namespace Emby.Server.Implementations.HttpServer
{
if (string.IsNullOrEmpty(contentType))
{
- throw new ArgumentNullException("contentType");
+ throw new ArgumentNullException(nameof(contentType));
}
Path = path;
@@ -148,7 +145,7 @@ namespace Emby.Server.Implementations.HttpServer
}
}
- private string[] SkipLogExtensions = new string[]
+ private string[] SkipLogExtensions = new string[]
{
".js",
".html",
@@ -203,8 +200,8 @@ namespace Emby.Server.Implementations.HttpServer
public HttpStatusCode StatusCode
{
- get { return (HttpStatusCode)Status; }
- set { Status = (int)value; }
+ get => (HttpStatusCode)Status;
+ set => Status = (int)value;
}
public string StatusDescription { get; set; }
diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
index 69ca0f85b..8219b85a2 100644
--- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Extensions;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Net;
using Microsoft.Extensions.Logging;
@@ -13,7 +13,6 @@ using System.Threading;
using System.Threading.Tasks;
using Emby.Server.Implementations.Services;
using MediaBrowser.Common.Net;
-using MediaBrowser.Common.Security;
using MediaBrowser.Controller;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Serialization;
@@ -85,17 +84,10 @@ namespace Emby.Server.Implementations.HttpServer
{typeof (FileNotFoundException), 404},
//{typeof (DirectoryNotFoundException), 404},
{typeof (SecurityException), 401},
- {typeof (PaymentRequiredException), 402},
{typeof (ArgumentException), 400}
};
- protected ILogger Logger
- {
- get
- {
- return _logger;
- }
- }
+ protected ILogger Logger => _logger;
public object CreateInstance(Type type)
{
@@ -103,7 +95,7 @@ namespace Emby.Server.Implementations.HttpServer
}
/// <summary>
- /// Applies the request filters. Returns whether or not the request has been handled
+ /// Applies the request filters. Returns whether or not the request has been handled
/// and no more processing should be done.
/// </summary>
/// <returns></returns>
@@ -190,10 +182,9 @@ namespace Emby.Server.Implementations.HttpServer
}
}
- private Exception GetActualException(Exception ex)
+ private static Exception GetActualException(Exception ex)
{
- var agg = ex as AggregateException;
- if (agg != null)
+ if (ex is AggregateException agg)
{
var inner = agg.InnerException;
if (inner != null)
@@ -346,7 +337,7 @@ namespace Emby.Server.Implementations.HttpServer
return false;
}
- private string GetExtension(string url)
+ private static string GetExtension(string url)
{
var parts = url.Split(new[] { '?' }, 2);
@@ -379,18 +370,18 @@ namespace Emby.Server.Implementations.HttpServer
string pagePathWithoutQueryString = url.Split(new[] { '?' }, StringSplitOptions.RemoveEmptyEntries)[0];
return newQueryString.Count > 0
- ? String.Format("{0}?{1}", pagePathWithoutQueryString, newQueryString)
+ ? string.Format("{0}?{1}", pagePathWithoutQueryString, newQueryString)
: pagePathWithoutQueryString;
}
- private string GetUrlToLog(string url)
+ private static string GetUrlToLog(string url)
{
url = RemoveQueryStringByKey(url, "api_key");
return url;
}
- private string NormalizeConfiguredLocalAddress(string address)
+ private static string NormalizeConfiguredLocalAddress(string address)
{
var index = address.Trim('/').IndexOf('/');
@@ -727,7 +718,7 @@ namespace Emby.Server.Implementations.HttpServer
return null;
}
- private Task Write(IResponse response, string text)
+ private static Task Write(IResponse response, string text)
{
var bOutput = Encoding.UTF8.GetBytes(text);
response.SetContentLength(bOutput.Length);
@@ -853,7 +844,9 @@ namespace Emby.Server.Implementations.HttpServer
return _jsonSerializer.DeserializeFromStreamAsync(stream, type);
}
- private string NormalizeEmbyRoutePath(string path)
+ //TODO Add Jellyfin Route Path Normalizer
+
+ private static string NormalizeEmbyRoutePath(string path)
{
if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase))
{
@@ -863,7 +856,7 @@ namespace Emby.Server.Implementations.HttpServer
return "emby/" + path;
}
- private string NormalizeMediaBrowserRoutePath(string path)
+ private static string NormalizeMediaBrowserRoutePath(string path)
{
if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase))
{
@@ -873,7 +866,7 @@ namespace Emby.Server.Implementations.HttpServer
return "mediabrowser/" + path;
}
- private string DoubleNormalizeEmbyRoutePath(string path)
+ private static string DoubleNormalizeEmbyRoutePath(string path)
{
if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase))
{
diff --git a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
index 73b2afe64..e6dbcf65d 100644
--- a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Extensions;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Net;
using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
@@ -207,7 +207,7 @@ namespace Emby.Server.Implementations.HttpServer
{
if (result == null)
{
- throw new ArgumentNullException("result");
+ throw new ArgumentNullException(nameof(result));
}
if (responseHeaders == null)
@@ -245,7 +245,7 @@ namespace Emby.Server.Implementations.HttpServer
return GetCompressionType(request);
}
- private string GetCompressionType(IRequest request)
+ private static string GetCompressionType(IRequest request)
{
var acceptEncoding = request.Headers["Accept-Encoding"];
@@ -265,7 +265,7 @@ namespace Emby.Server.Implementations.HttpServer
}
/// <summary>
- /// Returns the optimized result for the IRequestContext.
+ /// Returns the optimized result for the IRequestContext.
/// Does not use or store results in any cache.
/// </summary>
/// <param name="request"></param>
@@ -365,7 +365,7 @@ namespace Emby.Server.Implementations.HttpServer
return _brotliCompressor.Compress(bytes);
}
- private byte[] Deflate(byte[] bytes)
+ private static byte[] Deflate(byte[] bytes)
{
// In .NET FX incompat-ville, you can't access compressed bytes without closing DeflateStream
// Which means we must use MemoryStream since you have to use ToArray() on a closed Stream
@@ -379,7 +379,7 @@ namespace Emby.Server.Implementations.HttpServer
}
}
- private byte[] GZip(byte[] buffer)
+ private static byte[] GZip(byte[] buffer)
{
using (var ms = new MemoryStream())
using (var zipStream = new GZipStream(ms, CompressionMode.Compress))
@@ -398,7 +398,7 @@ namespace Emby.Server.Implementations.HttpServer
: contentType.Split(';')[0].ToLower().Trim();
}
- private string SerializeToXmlString(object from)
+ private static string SerializeToXmlString(object from)
{
using (var ms = new MemoryStream())
{
@@ -453,7 +453,7 @@ namespace Emby.Server.Implementations.HttpServer
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
return GetStaticFileResult(requestContext, new StaticFileResultOptions
@@ -471,7 +471,7 @@ namespace Emby.Server.Implementations.HttpServer
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
if (fileShare != FileShareMode.Read && fileShare != FileShareMode.ReadWrite)
@@ -661,7 +661,7 @@ namespace Emby.Server.Implementations.HttpServer
/// <summary>
/// Adds the expires header.
/// </summary>
- private void AddExpiresHeader(IDictionary<string, string> responseHeaders, string cacheKey, TimeSpan? cacheDuration)
+ private static void AddExpiresHeader(IDictionary<string, string> responseHeaders, string cacheKey, TimeSpan? cacheDuration)
{
if (cacheDuration.HasValue)
{
@@ -678,7 +678,7 @@ namespace Emby.Server.Implementations.HttpServer
/// </summary>
/// <param name="responseHeaders">The responseHeaders.</param>
/// <param name="lastDateModified">The last date modified.</param>
- private void AddAgeHeader(IDictionary<string, string> responseHeaders, DateTime? lastDateModified)
+ private static void AddAgeHeader(IDictionary<string, string> responseHeaders, DateTime? lastDateModified)
{
if (lastDateModified.HasValue)
{
@@ -771,7 +771,7 @@ namespace Emby.Server.Implementations.HttpServer
/// </summary>
/// <param name="date">The date.</param>
/// <returns>DateTime.</returns>
- private DateTime NormalizeDateForComparison(DateTime date)
+ private static DateTime NormalizeDateForComparison(DateTime date)
{
return new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, date.Kind);
}
@@ -781,7 +781,7 @@ namespace Emby.Server.Implementations.HttpServer
/// </summary>
/// <param name="hasHeaders">The has options.</param>
/// <param name="responseHeaders">The response headers.</param>
- private void AddResponseHeaders(IHasHeaders hasHeaders, IEnumerable<KeyValuePair<string, string>> responseHeaders)
+ private static void AddResponseHeaders(IHasHeaders hasHeaders, IEnumerable<KeyValuePair<string, string>> responseHeaders)
{
foreach (var item in responseHeaders)
{
diff --git a/Emby.Server.Implementations/HttpServer/IHttpListener.cs b/Emby.Server.Implementations/HttpServer/IHttpListener.cs
index e21607ebd..d50d7df6b 100644
--- a/Emby.Server.Implementations/HttpServer/IHttpListener.cs
+++ b/Emby.Server.Implementations/HttpServer/IHttpListener.cs
@@ -33,7 +33,7 @@ namespace Emby.Server.Implementations.HttpServer
/// </summary>
/// <value>The web socket connecting.</value>
Action<WebSocketConnectingEventArgs> WebSocketConnecting { get; set; }
-
+
/// <summary>
/// Starts this instance.
/// </summary>
diff --git a/Emby.Server.Implementations/HttpServer/RangeRequestWriter.cs b/Emby.Server.Implementations/HttpServer/RangeRequestWriter.cs
index dc20ee1a2..f08112f9c 100644
--- a/Emby.Server.Implementations/HttpServer/RangeRequestWriter.cs
+++ b/Emby.Server.Implementations/HttpServer/RangeRequestWriter.cs
@@ -1,4 +1,4 @@
-using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -46,10 +46,7 @@ namespace Emby.Server.Implementations.HttpServer
/// Additional HTTP Headers
/// </summary>
/// <value>The headers.</value>
- public IDictionary<string, string> Headers
- {
- get { return _options; }
- }
+ public IDictionary<string, string> Headers => _options;
/// <summary>
/// Initializes a new instance of the <see cref="StreamWriter" /> class.
@@ -62,7 +59,7 @@ namespace Emby.Server.Implementations.HttpServer
{
if (string.IsNullOrEmpty(contentType))
{
- throw new ArgumentNullException("contentType");
+ throw new ArgumentNullException(nameof(contentType));
}
RangeHeader = rangeHeader;
@@ -186,7 +183,7 @@ namespace Emby.Server.Implementations.HttpServer
}
}
- private async Task CopyToInternalAsync(Stream source, Stream destination, long copyLength)
+ private static async Task CopyToInternalAsync(Stream source, Stream destination, long copyLength)
{
var array = new byte[BufferSize];
int bytesRead;
@@ -220,8 +217,8 @@ namespace Emby.Server.Implementations.HttpServer
public HttpStatusCode StatusCode
{
- get { return (HttpStatusCode)Status; }
- set { Status = (int)value; }
+ get => (HttpStatusCode)Status;
+ set => Status = (int)value;
}
public string StatusDescription { get; set; }
diff --git a/Emby.Server.Implementations/HttpServer/Security/AuthService.cs b/Emby.Server.Implementations/HttpServer/Security/AuthService.cs
index e153d6f71..fb5bfa601 100644
--- a/Emby.Server.Implementations/HttpServer/Security/AuthService.cs
+++ b/Emby.Server.Implementations/HttpServer/Security/AuthService.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Configuration;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Connect;
using MediaBrowser.Controller.Devices;
using MediaBrowser.Controller.Entities;
@@ -173,7 +173,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
return false;
}
- private void ValidateRoles(string[] roles, User user)
+ private static void ValidateRoles(string[] roles, User user)
{
if (roles.Contains("admin", StringComparer.OrdinalIgnoreCase))
{
@@ -207,7 +207,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
}
}
- private AuthenticationInfo GetTokenInfo(IRequest request)
+ private static AuthenticationInfo GetTokenInfo(IRequest request)
{
object info;
request.Items.TryGetValue("OriginalAuthenticationInfo", out info);
diff --git a/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs b/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
index c3e2d3170..f561c3d60 100644
--- a/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
+++ b/Emby.Server.Implementations/HttpServer/Security/AuthorizationContext.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Connect;
+using MediaBrowser.Controller.Connect;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Security;
using System;
@@ -115,7 +115,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
{
info.Device = tokenInfo.DeviceName;
}
-
+
else if (!string.Equals(info.Device, tokenInfo.DeviceName, StringComparison.OrdinalIgnoreCase))
{
if (allowTokenInfoUpdate)
@@ -227,7 +227,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
return result;
}
- private string NormalizeValue(string value)
+ private static string NormalizeValue(string value)
{
if (string.IsNullOrEmpty(value))
{
diff --git a/Emby.Server.Implementations/HttpServer/StreamWriter.cs b/Emby.Server.Implementations/HttpServer/StreamWriter.cs
index 0a44a5fe5..df0d74685 100644
--- a/Emby.Server.Implementations/HttpServer/StreamWriter.cs
+++ b/Emby.Server.Implementations/HttpServer/StreamWriter.cs
@@ -35,10 +35,7 @@ namespace Emby.Server.Implementations.HttpServer
/// Gets the options.
/// </summary>
/// <value>The options.</value>
- public IDictionary<string, string> Headers
- {
- get { return _options; }
- }
+ public IDictionary<string, string> Headers => _options;
public Action OnComplete { get; set; }
public Action OnError { get; set; }
@@ -53,7 +50,7 @@ namespace Emby.Server.Implementations.HttpServer
{
if (string.IsNullOrEmpty(contentType))
{
- throw new ArgumentNullException("contentType");
+ throw new ArgumentNullException(nameof(contentType));
}
SourceStream = source;
@@ -77,7 +74,7 @@ namespace Emby.Server.Implementations.HttpServer
{
if (string.IsNullOrEmpty(contentType))
{
- throw new ArgumentNullException("contentType");
+ throw new ArgumentNullException(nameof(contentType));
}
SourceBytes = source;
diff --git a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs
index 914fa9dbc..5426114f6 100644
--- a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs
+++ b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs
@@ -82,19 +82,19 @@ namespace Emby.Server.Implementations.HttpServer
{
if (socket == null)
{
- throw new ArgumentNullException("socket");
+ throw new ArgumentNullException(nameof(socket));
}
if (string.IsNullOrEmpty(remoteEndPoint))
{
- throw new ArgumentNullException("remoteEndPoint");
+ throw new ArgumentNullException(nameof(remoteEndPoint));
}
if (jsonSerializer == null)
{
- throw new ArgumentNullException("jsonSerializer");
+ throw new ArgumentNullException(nameof(jsonSerializer));
}
if (logger == null)
{
- throw new ArgumentNullException("logger");
+ throw new ArgumentNullException(nameof(logger));
}
Id = Guid.NewGuid();
@@ -148,7 +148,8 @@ namespace Emby.Server.Implementations.HttpServer
/// <summary>
/// Called when [receive].
/// </summary>
- /// <param name="bytes">The bytes.</param>
+ /// <param name="memory">The memory block.</param>
+ /// <param name="length">The length of the memory block.</param>
private void OnReceiveInternal(Memory<byte> memory, int length)
{
LastActivityDate = DateTime.UtcNow;
@@ -219,7 +220,7 @@ namespace Emby.Server.Implementations.HttpServer
{
if (message == null)
{
- throw new ArgumentNullException("message");
+ throw new ArgumentNullException(nameof(message));
}
var json = _jsonSerializer.SerializeToString(message);
@@ -237,7 +238,7 @@ namespace Emby.Server.Implementations.HttpServer
{
if (buffer == null)
{
- throw new ArgumentNullException("buffer");
+ throw new ArgumentNullException(nameof(buffer));
}
cancellationToken.ThrowIfCancellationRequested();
@@ -249,7 +250,7 @@ namespace Emby.Server.Implementations.HttpServer
{
if (string.IsNullOrEmpty(text))
{
- throw new ArgumentNullException("text");
+ throw new ArgumentNullException(nameof(text));
}
cancellationToken.ThrowIfCancellationRequested();
@@ -261,10 +262,7 @@ namespace Emby.Server.Implementations.HttpServer
/// Gets the state.
/// </summary>
/// <value>The state.</value>
- public WebSocketState State
- {
- get { return _socket.State; }
- }
+ public WebSocketState State => _socket.State;
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
diff --git a/Emby.Server.Implementations/IO/FileRefresher.cs b/Emby.Server.Implementations/IO/FileRefresher.cs
index 34c711324..c2def33db 100644
--- a/Emby.Server.Implementations/IO/FileRefresher.cs
+++ b/Emby.Server.Implementations/IO/FileRefresher.cs
@@ -51,7 +51,7 @@ namespace Emby.Server.Implementations.IO
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
if (!_affectedPaths.Contains(path, StringComparer.Ordinal))
@@ -64,7 +64,7 @@ namespace Emby.Server.Implementations.IO
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
lock (_timerLock)
@@ -156,7 +156,7 @@ namespace Emby.Server.Implementations.IO
continue;
}
- Logger.LogInformation("{name} ({path}}) will be refreshed.", item.Name, item.Path);
+ Logger.LogInformation("{name} ({path}) will be refreshed.", item.Name, item.Path);
try
{
@@ -164,7 +164,7 @@ namespace Emby.Server.Implementations.IO
}
catch (IOException ex)
{
- // For now swallow and log.
+ // For now swallow and log.
// Research item: If an IOException occurs, the item may be in a disconnected state (media unavailable)
// Should we remove it from it's parent?
Logger.LogError(ex, "Error refreshing {name}", item.Name);
diff --git a/Emby.Server.Implementations/IO/IsoManager.cs b/Emby.Server.Implementations/IO/IsoManager.cs
index 903d5f301..e0cf32868 100644
--- a/Emby.Server.Implementations/IO/IsoManager.cs
+++ b/Emby.Server.Implementations/IO/IsoManager.cs
@@ -29,7 +29,7 @@ namespace Emby.Server.Implementations.IO
{
if (string.IsNullOrEmpty(isoPath))
{
- throw new ArgumentNullException("isoPath");
+ throw new ArgumentNullException(nameof(isoPath));
}
var mounter = _mounters.FirstOrDefault(i => i.CanMount(isoPath));
diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.cs
index ca5810fd6..9a224bd0e 100644
--- a/Emby.Server.Implementations/IO/LibraryMonitor.cs
+++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs
@@ -77,7 +77,7 @@ namespace Emby.Server.Implementations.IO
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
TemporarilyIgnore(path);
@@ -95,7 +95,7 @@ namespace Emby.Server.Implementations.IO
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
// This is an arbitraty amount of time, but delay it because file system writes often trigger events long after the file was actually written to.
@@ -145,7 +145,7 @@ namespace Emby.Server.Implementations.IO
{
if (taskManager == null)
{
- throw new ArgumentNullException("taskManager");
+ throw new ArgumentNullException(nameof(taskManager));
}
LibraryManager = libraryManager;
@@ -268,7 +268,7 @@ namespace Emby.Server.Implementations.IO
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
path = path.TrimEnd(Path.DirectorySeparatorChar);
@@ -469,7 +469,7 @@ namespace Emby.Server.Implementations.IO
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
var filename = Path.GetFileName(path);
diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs
index 0f85e0642..bee96c785 100644
--- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs
+++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
@@ -85,17 +85,11 @@ namespace Emby.Server.Implementations.IO
{
// Be consistent across platforms because the windows server will fail to query network shares that don't follow windows conventions
// https://referencesource.microsoft.com/#mscorlib/system/io/path.cs
- _invalidFileNameChars = new char[] { '\"', '<', '>', '|', '\0', (Char)1, (Char)2, (Char)3, (Char)4, (Char)5, (Char)6, (Char)7, (Char)8, (Char)9, (Char)10, (Char)11, (Char)12, (Char)13, (Char)14, (Char)15, (Char)16, (Char)17, (Char)18, (Char)19, (Char)20, (Char)21, (Char)22, (Char)23, (Char)24, (Char)25, (Char)26, (Char)27, (Char)28, (Char)29, (Char)30, (Char)31, ':', '*', '?', '\\', '/' };
+ _invalidFileNameChars = new char[] { '\"', '<', '>', '|', '\0', (char)1, (char)2, (char)3, (char)4, (char)5, (char)6, (char)7, (char)8, (char)9, (char)10, (char)11, (char)12, (char)13, (char)14, (char)15, (char)16, (char)17, (char)18, (char)19, (char)20, (char)21, (char)22, (char)23, (char)24, (char)25, (char)26, (char)27, (char)28, (char)29, (char)30, (char)31, ':', '*', '?', '\\', '/' };
}
}
- public char DirectorySeparatorChar
- {
- get
- {
- return Path.DirectorySeparatorChar;
- }
- }
+ public char DirectorySeparatorChar => Path.DirectorySeparatorChar;
public string GetFullPath(string path)
{
@@ -112,7 +106,7 @@ namespace Emby.Server.Implementations.IO
{
if (string.IsNullOrEmpty(filename))
{
- throw new ArgumentNullException("filename");
+ throw new ArgumentNullException(nameof(filename));
}
var extension = Path.GetExtension(filename);
@@ -129,7 +123,7 @@ namespace Emby.Server.Implementations.IO
{
if (string.IsNullOrEmpty(filename))
{
- throw new ArgumentNullException("filename");
+ throw new ArgumentNullException(nameof(filename));
}
var extension = Path.GetExtension(filename);
@@ -145,7 +139,7 @@ namespace Emby.Server.Implementations.IO
public string MakeAbsolutePath(string folderPath, string filePath)
{
- if (String.IsNullOrWhiteSpace(filePath)) return filePath;
+ if (string.IsNullOrWhiteSpace(filePath)) return filePath;
if (filePath.Contains(@"://")) return filePath; //stream
if (filePath.Length > 3 && filePath[1] == ':' && filePath[2] == '/') return filePath; //absolute local path
@@ -159,7 +153,7 @@ namespace Emby.Server.Implementations.IO
var firstChar = filePath[0];
if (firstChar == '/')
{
- // For this we don't really know.
+ // For this we don't really know.
return filePath;
}
if (firstChar == '\\') //relative path
@@ -200,12 +194,12 @@ namespace Emby.Server.Implementations.IO
{
if (string.IsNullOrEmpty(shortcutPath))
{
- throw new ArgumentNullException("shortcutPath");
+ throw new ArgumentNullException(nameof(shortcutPath));
}
if (string.IsNullOrEmpty(target))
{
- throw new ArgumentNullException("target");
+ throw new ArgumentNullException(nameof(target));
}
var extension = Path.GetExtension(shortcutPath);
@@ -321,7 +315,7 @@ namespace Emby.Server.Implementations.IO
return result;
}
- private ExtendedFileSystemInfo GetExtendedFileSystemInfo(string path)
+ private static ExtendedFileSystemInfo GetExtendedFileSystemInfo(string path)
{
var result = new ExtendedFileSystemInfo();
@@ -456,13 +450,13 @@ namespace Emby.Server.Implementations.IO
return new FileStream(path, GetFileMode(mode), GetFileAccess(access), GetFileShare(share), defaultBufferSize, GetFileOptions(fileOpenOptions));
}
- private FileOptions GetFileOptions(FileOpenOptions mode)
+ private static FileOptions GetFileOptions(FileOpenOptions mode)
{
var val = (int)mode;
return (FileOptions)val;
}
- private FileMode GetFileMode(FileOpenMode mode)
+ private static FileMode GetFileMode(FileOpenMode mode)
{
switch (mode)
{
@@ -483,7 +477,7 @@ namespace Emby.Server.Implementations.IO
}
}
- private FileAccess GetFileAccess(FileAccessMode mode)
+ private static FileAccess GetFileAccess(FileAccessMode mode)
{
switch (mode)
{
@@ -498,7 +492,7 @@ namespace Emby.Server.Implementations.IO
}
}
- private FileShare GetFileShare(FileShareMode mode)
+ private static FileShare GetFileShare(FileShareMode mode)
{
switch (mode)
{
@@ -619,12 +613,12 @@ namespace Emby.Server.Implementations.IO
{
if (string.IsNullOrEmpty(file1))
{
- throw new ArgumentNullException("file1");
+ throw new ArgumentNullException(nameof(file1));
}
if (string.IsNullOrEmpty(file2))
{
- throw new ArgumentNullException("file2");
+ throw new ArgumentNullException(nameof(file2));
}
var temp1 = Path.Combine(_tempPath, Guid.NewGuid().ToString("N"));
@@ -640,7 +634,7 @@ namespace Emby.Server.Implementations.IO
CopyFile(temp1, file2, true);
}
- private char GetDirectorySeparatorChar(string path)
+ private static char GetDirectorySeparatorChar(string path)
{
return Path.DirectorySeparatorChar;
}
@@ -649,12 +643,12 @@ namespace Emby.Server.Implementations.IO
{
if (string.IsNullOrEmpty(parentPath))
{
- throw new ArgumentNullException("parentPath");
+ throw new ArgumentNullException(nameof(parentPath));
}
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
var separatorChar = GetDirectorySeparatorChar(parentPath);
@@ -666,7 +660,7 @@ namespace Emby.Server.Implementations.IO
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
var parent = GetDirectoryName(path);
@@ -688,7 +682,7 @@ namespace Emby.Server.Implementations.IO
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
if (path.EndsWith(":\\", StringComparison.OrdinalIgnoreCase))
@@ -772,7 +766,7 @@ namespace Emby.Server.Implementations.IO
}).ToList();
}
- private string GetName(DriveInfo drive)
+ private static string GetName(DriveInfo drive)
{
return drive.Name;
}
@@ -972,7 +966,7 @@ namespace Emby.Server.Implementations.IO
}
}
- private void RunProcess(string path, string args, string workingDirectory)
+ private static void RunProcess(string path, string args, string workingDirectory)
{
using (var process = Process.Start(new ProcessStartInfo
{
diff --git a/Emby.Server.Implementations/IO/MbLinkShortcutHandler.cs b/Emby.Server.Implementations/IO/MbLinkShortcutHandler.cs
index aef53751e..8ac662f78 100644
--- a/Emby.Server.Implementations/IO/MbLinkShortcutHandler.cs
+++ b/Emby.Server.Implementations/IO/MbLinkShortcutHandler.cs
@@ -15,16 +15,13 @@ namespace Emby.Server.Implementations.IO
_fileSystem = fileSystem;
}
- public string Extension
- {
- get { return ".mblink"; }
- }
+ public string Extension => ".mblink";
public string Resolve(string shortcutPath)
{
if (string.IsNullOrEmpty(shortcutPath))
{
- throw new ArgumentNullException("filenshortcutPathame");
+ throw new ArgumentException("Shortcut path is empty or null.", nameof(shortcutPath));
}
if (string.Equals(Path.GetExtension(shortcutPath), ".mblink", StringComparison.OrdinalIgnoreCase))
@@ -41,12 +38,12 @@ namespace Emby.Server.Implementations.IO
{
if (string.IsNullOrEmpty(shortcutPath))
{
- throw new ArgumentNullException("shortcutPath");
+ throw new ArgumentNullException(nameof(shortcutPath));
}
if (string.IsNullOrEmpty(targetPath))
{
- throw new ArgumentNullException("targetPath");
+ throw new ArgumentNullException(nameof(targetPath));
}
_fileSystem.WriteAllText(shortcutPath, targetPath);
diff --git a/Emby.Server.Implementations/IO/ThrottledStream.cs b/Emby.Server.Implementations/IO/ThrottledStream.cs
index 81760b639..3635ee1db 100644
--- a/Emby.Server.Implementations/IO/ThrottledStream.cs
+++ b/Emby.Server.Implementations/IO/ThrottledStream.cs
@@ -42,13 +42,7 @@ namespace Emby.Server.Implementations.IO
/// Gets the current milliseconds.
/// </summary>
/// <value>The current milliseconds.</value>
- protected long CurrentMilliseconds
- {
- get
- {
- return Environment.TickCount;
- }
- }
+ protected long CurrentMilliseconds => Environment.TickCount;
/// <summary>
/// Gets or sets the maximum bytes per second that can be transferred through the base stream.
@@ -56,10 +50,7 @@ namespace Emby.Server.Implementations.IO
/// <value>The maximum bytes per second.</value>
public long MaximumBytesPerSecond
{
- get
- {
- return _maximumBytesPerSecond;
- }
+ get => _maximumBytesPerSecond;
set
{
if (MaximumBytesPerSecond != value)
@@ -74,39 +65,21 @@ namespace Emby.Server.Implementations.IO
/// Gets a value indicating whether the current stream supports reading.
/// </summary>
/// <returns>true if the stream supports reading; otherwise, false.</returns>
- public override bool CanRead
- {
- get
- {
- return _baseStream.CanRead;
- }
- }
+ public override bool CanRead => _baseStream.CanRead;
/// <summary>
/// Gets a value indicating whether the current stream supports seeking.
/// </summary>
/// <value></value>
/// <returns>true if the stream supports seeking; otherwise, false.</returns>
- public override bool CanSeek
- {
- get
- {
- return _baseStream.CanSeek;
- }
- }
+ public override bool CanSeek => _baseStream.CanSeek;
/// <summary>
/// Gets a value indicating whether the current stream supports writing.
/// </summary>
/// <value></value>
/// <returns>true if the stream supports writing; otherwise, false.</returns>
- public override bool CanWrite
- {
- get
- {
- return _baseStream.CanWrite;
- }
- }
+ public override bool CanWrite => _baseStream.CanWrite;
/// <summary>
/// Gets the length in bytes of the stream.
@@ -115,13 +88,7 @@ namespace Emby.Server.Implementations.IO
/// <returns>A long value representing the length of the stream in bytes.</returns>
/// <exception cref="T:System.NotSupportedException">The base stream does not support seeking. </exception>
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
- public override long Length
- {
- get
- {
- return _baseStream.Length;
- }
- }
+ public override long Length => _baseStream.Length;
/// <summary>
/// Gets or sets the position within the current stream.
@@ -133,14 +100,8 @@ namespace Emby.Server.Implementations.IO
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
public override long Position
{
- get
- {
- return _baseStream.Position;
- }
- set
- {
- _baseStream.Position = value;
- }
+ get => _baseStream.Position;
+ set => _baseStream.Position = value;
}
#endregion
@@ -158,12 +119,12 @@ namespace Emby.Server.Implementations.IO
{
if (baseStream == null)
{
- throw new ArgumentNullException("baseStream");
+ throw new ArgumentNullException(nameof(baseStream));
}
if (maximumBytesPerSecond < 0)
{
- throw new ArgumentOutOfRangeException("maximumBytesPerSecond",
+ throw new ArgumentOutOfRangeException(nameof(maximumBytesPerSecond),
maximumBytesPerSecond, "The maximum number of bytes per second can't be negative.");
}
diff --git a/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs b/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs
index be17893d8..964e38962 100644
--- a/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs
+++ b/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs
@@ -193,10 +193,7 @@ namespace Emby.Server.Implementations.Images
return outputPath;
}
- public string Name
- {
- get { return "Dynamic Image Provider"; }
- }
+ public string Name => "Dynamic Image Provider";
protected virtual string CreateImage(BaseItem item,
List<BaseItem> itemsWithImages,
@@ -232,10 +229,7 @@ namespace Emby.Server.Implementations.Images
throw new ArgumentException("Unexpected image type");
}
- protected virtual int MaxImageAgeDays
- {
- get { return 7; }
- }
+ protected virtual int MaxImageAgeDays => 7;
public bool HasChanged(BaseItem item, IDirectoryService directoryServicee)
{
@@ -293,14 +287,7 @@ namespace Emby.Server.Implementations.Images
return true;
}
- public int Order
- {
- get
- {
- // Run before the default image provider which will download placeholders
- return 0;
- }
- }
+ public int Order => 0;
protected string CreateSingleImage(List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType)
{
diff --git a/Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs b/Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs
index 7c79a7c69..775b5d283 100644
--- a/Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs
+++ b/Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs
@@ -67,7 +67,7 @@ namespace Emby.Server.Implementations.Library
if (string.IsNullOrWhiteSpace(newPasswordHash))
{
- throw new ArgumentNullException("newPasswordHash");
+ throw new ArgumentNullException(nameof(newPasswordHash));
}
user.Password = newPasswordHash;
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs
index 451f16bef..d901381cd 100644
--- a/Emby.Server.Implementations/Library/LibraryManager.cs
+++ b/Emby.Server.Implementations/Library/LibraryManager.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Extensions;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Progress;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
@@ -147,13 +147,7 @@ namespace Emby.Server.Implementations.Library
/// Gets the library items cache.
/// </summary>
/// <value>The library items cache.</value>
- private ConcurrentDictionary<Guid, BaseItem> LibraryItemsCache
- {
- get
- {
- return _libraryItemsCache;
- }
- }
+ private ConcurrentDictionary<Guid, BaseItem> LibraryItemsCache => _libraryItemsCache;
private readonly IFileSystem _fileSystem;
@@ -188,7 +182,6 @@ namespace Emby.Server.Implementations.Library
/// Adds the parts.
/// </summary>
/// <param name="rules">The rules.</param>
- /// <param name="pluginFolders">The plugin folders.</param>
/// <param name="resolvers">The resolvers.</param>
/// <param name="introProviders">The intro providers.</param>
/// <param name="itemComparers">The item comparers.</param>
@@ -277,7 +270,7 @@ namespace Emby.Server.Implementations.Library
{
if (item == null)
{
- throw new ArgumentNullException("item");
+ throw new ArgumentNullException(nameof(item));
}
if (item is IItemByName)
{
@@ -317,7 +310,7 @@ namespace Emby.Server.Implementations.Library
{
if (item == null)
{
- throw new ArgumentNullException("item");
+ throw new ArgumentNullException(nameof(item));
}
var parent = item.GetOwner() ?? item.GetParent();
@@ -329,7 +322,7 @@ namespace Emby.Server.Implementations.Library
{
if (item == null)
{
- throw new ArgumentNullException("item");
+ throw new ArgumentNullException(nameof(item));
}
if (item.SourceType == SourceType.Channel)
@@ -449,7 +442,7 @@ namespace Emby.Server.Implementations.Library
ReportItemRemoved(item, parent);
}
- private IEnumerable<string> GetMetadataPaths(BaseItem item, IEnumerable<BaseItem> children)
+ private static IEnumerable<string> GetMetadataPaths(BaseItem item, IEnumerable<BaseItem> children)
{
var list = new List<string>
{
@@ -502,11 +495,11 @@ namespace Emby.Server.Implementations.Library
{
if (string.IsNullOrEmpty(key))
{
- throw new ArgumentNullException("key");
+ throw new ArgumentNullException(nameof(key));
}
if (type == null)
{
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
}
if (key.StartsWith(ConfigurationManager.ApplicationPaths.ProgramDataPath))
@@ -542,7 +535,7 @@ namespace Emby.Server.Implementations.Library
{
if (fileInfo == null)
{
- throw new ArgumentNullException("fileInfo");
+ throw new ArgumentNullException(nameof(fileInfo));
}
var fullPath = fileInfo.FullName;
@@ -818,12 +811,12 @@ namespace Emby.Server.Implementations.Library
public BaseItem FindByPath(string path, bool? isFolder)
{
- // If this returns multiple items it could be tricky figuring out which one is correct.
+ // If this returns multiple items it could be tricky figuring out which one is correct.
// In most cases, the newest one will be and the others obsolete but not yet cleaned up
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
//_logger.LogInformation("FindByPath {0}", path);
@@ -921,7 +914,7 @@ namespace Emby.Server.Implementations.Library
{
if (value <= 0)
{
- throw new ArgumentOutOfRangeException("Years less than or equal to 0 are invalid.");
+ throw new ArgumentOutOfRangeException(nameof(value),"Years less than or equal to 0 are invalid.");
}
var name = value.ToString(CultureInfo.InvariantCulture);
@@ -1249,7 +1242,7 @@ namespace Emby.Server.Implementations.Library
{
if (id.Equals(Guid.Empty))
{
- throw new ArgumentNullException("id");
+ throw new ArgumentNullException(nameof(id));
}
BaseItem item;
@@ -1699,7 +1692,7 @@ namespace Emby.Server.Implementations.Library
{
try
{
- // Try to resolve the path into a video
+ // Try to resolve the path into a video
video = ResolvePath(_fileSystem.GetFileSystemInfo(info.Path)) as Video;
if (video == null)
@@ -1828,7 +1821,7 @@ namespace Emby.Server.Implementations.Library
/// Creates the item.
/// </summary>
/// <param name="item">The item.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
+ /// <param name="parent">The parent item.</param>
/// <returns>Task.</returns>
public void CreateItem(BaseItem item, BaseItem parent)
{
@@ -2023,7 +2016,7 @@ namespace Emby.Server.Implementations.Library
return GetCollectionFoldersInternal(item, allUserRootChildren);
}
- private List<Folder> GetCollectionFoldersInternal(BaseItem item, List<Folder> allUserRootChildren)
+ private static List<Folder> GetCollectionFoldersInternal(BaseItem item, List<Folder> allUserRootChildren)
{
return allUserRootChildren
.Where(i => string.Equals(i.Path, item.Path, StringComparison.OrdinalIgnoreCase) || i.PhysicalLocations.Contains(item.Path, StringComparer.OrdinalIgnoreCase))
@@ -2247,7 +2240,7 @@ namespace Emby.Server.Implementations.Library
{
if (parent == null)
{
- throw new ArgumentNullException("parent");
+ throw new ArgumentNullException(nameof(parent));
}
var name = parent.Name;
@@ -2313,7 +2306,7 @@ namespace Emby.Server.Implementations.Library
{
if (string.IsNullOrEmpty(name))
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
var parentIdString = parentId.Equals(Guid.Empty) ? null : parentId.ToString("N");
@@ -2708,15 +2701,15 @@ namespace Emby.Server.Implementations.Library
{
if (string.IsNullOrWhiteSpace(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
if (string.IsNullOrWhiteSpace(from))
{
- throw new ArgumentNullException("from");
+ throw new ArgumentNullException(nameof(from));
}
if (string.IsNullOrWhiteSpace(to))
{
- throw new ArgumentNullException("to");
+ throw new ArgumentNullException(nameof(to));
}
from = from.Trim();
@@ -2864,7 +2857,7 @@ namespace Emby.Server.Implementations.Library
{
if (string.IsNullOrWhiteSpace(name))
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
name = _fileSystem.GetValidFilename(name);
@@ -2937,7 +2930,7 @@ namespace Emby.Server.Implementations.Library
});
}
- private bool ValidateNetworkPath(string path)
+ private static bool ValidateNetworkPath(string path)
{
//if (Environment.OSVersion.Platform == PlatformID.Win32NT)
//{
@@ -2962,14 +2955,14 @@ namespace Emby.Server.Implementations.Library
{
if (pathInfo == null)
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(pathInfo));
}
var path = pathInfo.Path;
if (string.IsNullOrWhiteSpace(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
if (!_fileSystem.DirectoryExists(path))
@@ -3017,7 +3010,7 @@ namespace Emby.Server.Implementations.Library
{
if (pathInfo == null)
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(pathInfo));
}
if (!string.IsNullOrWhiteSpace(pathInfo.NetworkPath) && !ValidateNetworkPath(pathInfo.NetworkPath))
@@ -3075,7 +3068,7 @@ namespace Emby.Server.Implementations.Library
{
if (string.IsNullOrWhiteSpace(name))
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
var rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
@@ -3116,7 +3109,7 @@ namespace Emby.Server.Implementations.Library
{
if (string.IsNullOrWhiteSpace(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
var removeList = new List<NameValuePair>();
@@ -3148,7 +3141,7 @@ namespace Emby.Server.Implementations.Library
{
if (string.IsNullOrEmpty(mediaPath))
{
- throw new ArgumentNullException("mediaPath");
+ throw new ArgumentNullException(nameof(mediaPath));
}
var rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.cs
index ddda4b2c3..3578d8763 100644
--- a/Emby.Server.Implementations/Library/MediaSourceManager.cs
+++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Extensions;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
@@ -74,7 +74,7 @@ namespace Emby.Server.Implementations.Library
return list;
}
- private bool StreamSupportsExternalStream(MediaStream stream)
+ private static bool StreamSupportsExternalStream(MediaStream stream)
{
if (stream.IsExternal)
{
@@ -261,7 +261,7 @@ namespace Emby.Server.Implementations.Library
}
}
- private void SetKeyProperties(IMediaSourceProvider provider, MediaSourceInfo mediaSource)
+ private static void SetKeyProperties(IMediaSourceProvider provider, MediaSourceInfo mediaSource)
{
var prefix = provider.GetType().FullName.GetMD5().ToString("N") + LiveStreamIdDelimeter;
@@ -292,7 +292,7 @@ namespace Emby.Server.Implementations.Library
{
if (item == null)
{
- throw new ArgumentNullException("item");
+ throw new ArgumentNullException(nameof(item));
}
var hasMediaSources = (IHasMediaSources)item;
@@ -401,7 +401,7 @@ namespace Emby.Server.Implementations.Library
}
}
- private IEnumerable<MediaSourceInfo> SortMediaSources(IEnumerable<MediaSourceInfo> sources)
+ private static IEnumerable<MediaSourceInfo> SortMediaSources(IEnumerable<MediaSourceInfo> sources)
{
return sources.OrderBy(i =>
{
@@ -501,7 +501,7 @@ namespace Emby.Server.Implementations.Library
}, liveStream as IDirectStreamProvider);
}
- private void AddMediaInfo(MediaSourceInfo mediaSource, bool isAudio)
+ private static void AddMediaInfo(MediaSourceInfo mediaSource, bool isAudio)
{
mediaSource.DefaultSubtitleStreamIndex = null;
@@ -629,6 +629,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
+ _logger.LogDebug(ex, "_jsonSerializer.DeserializeFromFile threw an exception.");
}
}
@@ -759,7 +760,7 @@ namespace Emby.Server.Implementations.Library
{
if (string.IsNullOrEmpty(id))
{
- throw new ArgumentNullException("id");
+ throw new ArgumentNullException(nameof(id));
}
var info = await GetLiveStreamInfo(id, cancellationToken).ConfigureAwait(false);
@@ -770,7 +771,7 @@ namespace Emby.Server.Implementations.Library
{
if (string.IsNullOrEmpty(id))
{
- throw new ArgumentNullException("id");
+ throw new ArgumentNullException(nameof(id));
}
await _liveStreamSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
@@ -803,7 +804,7 @@ namespace Emby.Server.Implementations.Library
{
if (string.IsNullOrEmpty(id))
{
- throw new ArgumentNullException("id");
+ throw new ArgumentNullException(nameof(id));
}
await _liveStreamSemaphore.WaitAsync().ConfigureAwait(false);
diff --git a/Emby.Server.Implementations/Library/PathExtensions.cs b/Emby.Server.Implementations/Library/PathExtensions.cs
index 28ed2f53c..2d3019d17 100644
--- a/Emby.Server.Implementations/Library/PathExtensions.cs
+++ b/Emby.Server.Implementations/Library/PathExtensions.cs
@@ -16,12 +16,12 @@ namespace Emby.Server.Implementations.Library
{
if (string.IsNullOrEmpty(str))
{
- throw new ArgumentNullException("str");
+ throw new ArgumentNullException(nameof(str));
}
if (string.IsNullOrEmpty(attrib))
{
- throw new ArgumentNullException("attrib");
+ throw new ArgumentNullException(nameof(attrib));
}
string srch = "[" + attrib + "=";
diff --git a/Emby.Server.Implementations/Library/ResolverHelper.cs b/Emby.Server.Implementations/Library/ResolverHelper.cs
index 14b28966a..027d82c58 100644
--- a/Emby.Server.Implementations/Library/ResolverHelper.cs
+++ b/Emby.Server.Implementations/Library/ResolverHelper.cs
@@ -117,15 +117,15 @@ namespace Emby.Server.Implementations.Library
{
if (fileSystem == null)
{
- throw new ArgumentNullException("fileSystem");
+ throw new ArgumentNullException(nameof(fileSystem));
}
if (item == null)
{
- throw new ArgumentNullException("item");
+ throw new ArgumentNullException(nameof(item));
}
if (args == null)
{
- throw new ArgumentNullException("args");
+ throw new ArgumentNullException(nameof(args));
}
// See if a different path came out of the resolver than what went in
diff --git a/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs
index 8872bd641..bac39122b 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Audio/AudioResolver.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Library;
+using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Model.Entities;
using System;
@@ -30,10 +30,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
/// Gets the priority.
/// </summary>
/// <value>The priority.</value>
- public override ResolverPriority Priority
- {
- get { return ResolverPriority.Fourth; }
- }
+ public override ResolverPriority Priority => ResolverPriority.Fourth;
public MultiItemResolverResult ResolveMultiple(Folder parent,
List<FileSystemMetadata> files,
@@ -231,7 +228,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
}
var firstMedia = resolvedItem.Files.First();
-
+
var libraryItem = new T
{
Path = firstMedia.Path,
@@ -264,12 +261,12 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
result.Extras.Any(i => ContainsFile(i, file));
}
- private bool ContainsFile(AudioBookFileInfo result, FileSystemMetadata file)
+ private static bool ContainsFile(AudioBookFileInfo result, FileSystemMetadata file)
{
return string.Equals(result.Path, file.FullName, StringComparison.OrdinalIgnoreCase);
}
- private bool IsIgnored(string filename)
+ private static bool IsIgnored(string filename)
{
return false;
}
diff --git a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
index dbfcf41e8..da5fe48cd 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
@@ -36,14 +36,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
/// Gets the priority.
/// </summary>
/// <value>The priority.</value>
- public override ResolverPriority Priority
- {
- get
- {
- // Behind special folder resolver
- return ResolverPriority.Second;
- }
- }
+ public override ResolverPriority Priority => ResolverPriority.Second;
/// <summary>
/// Resolves the specified args.
diff --git a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
index 71ccd7da8..b3a5c27c8 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
@@ -35,14 +35,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
/// Gets the priority.
/// </summary>
/// <value>The priority.</value>
- public override ResolverPriority Priority
- {
- get
- {
- // Behind special folder resolver
- return ResolverPriority.Second;
- }
- }
+ public override ResolverPriority Priority => ResolverPriority.Second;
/// <summary>
/// Resolves the specified args.
diff --git a/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs b/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs
index 143af4076..b9ac2056f 100644
--- a/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs
@@ -48,7 +48,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
where TVideoType : Video, new()
{
var namingOptions = ((LibraryManager)LibraryManager).GetNamingOptions();
-
+
// If the path is a file check for a matching extensions
var parser = new Emby.Naming.Video.VideoResolver(namingOptions);
@@ -120,7 +120,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
if (video != null)
{
- video.Name = parseName ?
+ video.Name = parseName ?
videoInfo.Name :
Path.GetFileName(args.Path);
@@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
};
SetVideoType(video, videoInfo);
-
+
video.Name = parseName ?
videoInfo.Name :
Path.GetFileNameWithoutExtension(args.Path);
@@ -281,7 +281,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
{
return string.Equals(name, "video_ts.ifo", StringComparison.OrdinalIgnoreCase);
}
-
+
/// <summary>
/// Determines whether [is blu ray directory] [the specified directory name].
/// </summary>
diff --git a/Emby.Server.Implementations/Library/Resolvers/Books/BookResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Books/BookResolver.cs
index 7aa4c299f..d7f80b3f4 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Books/BookResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Books/BookResolver.cs
@@ -8,14 +8,14 @@ using MediaBrowser.Model.Entities;
namespace Emby.Server.Implementations.Library.Resolvers.Books
{
/// <summary>
- ///
+ ///
/// </summary>
public class BookResolver : MediaBrowser.Controller.Resolvers.ItemResolver<Book>
{
private readonly string[] _validExtensions = { ".pdf", ".epub", ".mobi", ".cbr", ".cbz", ".azw3" };
/// <summary>
- ///
+ ///
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
@@ -48,7 +48,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Books
}
/// <summary>
- ///
+ ///
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
diff --git a/Emby.Server.Implementations/Library/Resolvers/FolderResolver.cs b/Emby.Server.Implementations/Library/Resolvers/FolderResolver.cs
index 5e73baa5c..47e7f7344 100644
--- a/Emby.Server.Implementations/Library/Resolvers/FolderResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/FolderResolver.cs
@@ -13,10 +13,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
/// Gets the priority.
/// </summary>
/// <value>The priority.</value>
- public override ResolverPriority Priority
- {
- get { return ResolverPriority.Last; }
- }
+ public override ResolverPriority Priority => ResolverPriority.Last;
/// <summary>
/// Resolves the specified args.
diff --git a/Emby.Server.Implementations/Library/Resolvers/ItemResolver.cs b/Emby.Server.Implementations/Library/Resolvers/ItemResolver.cs
index b4a37be5f..529916619 100644
--- a/Emby.Server.Implementations/Library/Resolvers/ItemResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/ItemResolver.cs
@@ -25,13 +25,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
/// Gets the priority.
/// </summary>
/// <value>The priority.</value>
- public virtual ResolverPriority Priority
- {
- get
- {
- return ResolverPriority.First;
- }
- }
+ public virtual ResolverPriority Priority => ResolverPriority.First;
/// <summary>
/// Sets initial values on the newly resolved item
diff --git a/Emby.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs
index b9aca1417..d3ab4dd37 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities;
@@ -61,7 +61,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
/// Sets the provider id from path.
/// </summary>
/// <param name="item">The item.</param>
- private void SetProviderIdFromPath(BaseItem item)
+ private static void SetProviderIdFromPath(BaseItem item)
{
//we need to only look at the name of this actual item (not parents)
var justName = Path.GetFileName(item.Path);
diff --git a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
index 68b6c57ae..0a45317a4 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
@@ -27,17 +27,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
/// Gets the priority.
/// </summary>
/// <value>The priority.</value>
- public override ResolverPriority Priority
- {
- get
- {
- // Give plugins a chance to catch iso's first
- // Also since we have to loop through child files looking for videos,
- // see if we can avoid some of that by letting other resolvers claim folders first
- // Also run after series resolver
- return ResolverPriority.Third;
- }
- }
+ public override ResolverPriority Priority => ResolverPriority.Third;
public MultiItemResolverResult ResolveMultiple(Folder parent,
List<FileSystemMetadata> files,
@@ -176,7 +166,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
return result;
}
- private bool IsIgnored(string filename)
+ private static bool IsIgnored(string filename)
{
// Ignore samples
var sampleFilename = " " + filename.Replace(".", " ", StringComparison.OrdinalIgnoreCase)
@@ -204,7 +194,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
result.Extras.Any(i => ContainsFile(i, file));
}
- private bool ContainsFile(VideoFileInfo result, FileSystemMetadata file)
+ private static bool ContainsFile(VideoFileInfo result, FileSystemMetadata file)
{
return string.Equals(result.Path, file.FullName, StringComparison.OrdinalIgnoreCase);
}
@@ -330,7 +320,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
/// Sets the provider id from path.
/// </summary>
/// <param name="item">The item.</param>
- private void SetProviderIdsFromPath(Video item)
+ private static void SetProviderIdsFromPath(Video item)
{
if (item is Movie || item is MusicVideo)
{
diff --git a/Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs b/Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs
index 311abf14e..a073e0bd5 100644
--- a/Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs
@@ -79,13 +79,6 @@ namespace Emby.Server.Implementations.Library.Resolvers
return false;
}
- public override ResolverPriority Priority
- {
- get
- {
- // Behind special folder resolver
- return ResolverPriority.Second;
- }
- }
+ public override ResolverPriority Priority => ResolverPriority.Second;
}
}
diff --git a/Emby.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs b/Emby.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs
index 6a1f8ec6f..5cf5cd3ad 100644
--- a/Emby.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs
@@ -26,10 +26,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
/// Gets the priority.
/// </summary>
/// <value>The priority.</value>
- public override ResolverPriority Priority
- {
- get { return ResolverPriority.First; }
- }
+ public override ResolverPriority Priority => ResolverPriority.First;
/// <summary>
/// Resolves the specified args.
diff --git a/Emby.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs b/Emby.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs
index 7d1c4d65a..4e5ac959c 100644
--- a/Emby.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs
@@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
}
var season = parent as Season;
- // Just in case the user decided to nest episodes.
+ // Just in case the user decided to nest episodes.
// Not officially supported but in some cases we can handle it.
if (season == null)
{
@@ -36,8 +36,8 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
// If the parent is a Season or Series, then this is an Episode if the VideoResolver returns something
// Also handle flat tv folders
- if (season != null ||
- string.Equals(args.GetCollectionType(), CollectionType.TvShows, StringComparison.OrdinalIgnoreCase) ||
+ if (season != null ||
+ string.Equals(args.GetCollectionType(), CollectionType.TvShows, StringComparison.OrdinalIgnoreCase) ||
args.HasParent<Series>())
{
var episode = ResolveVideo<Episode>(args, false);
diff --git a/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs b/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs
index 0fe42fa73..4bfedf3c6 100644
--- a/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs
@@ -1,4 +1,4 @@
-using System.Globalization;
+using System.Globalization;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
@@ -28,6 +28,9 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
/// Initializes a new instance of the <see cref="SeasonResolver"/> class.
/// </summary>
/// <param name="config">The config.</param>
+ /// <param name="libraryManager">The library manager.</param>
+ /// <param name="localization">The localization</param>
+ /// <param name="logger">The logger</param>
public SeasonResolver(IServerConfigurationManager config, ILibraryManager libraryManager, ILocalizationManager localization, ILogger logger)
{
_config = config;
diff --git a/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs b/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs
index 32e8b6120..7d2865f0d 100644
--- a/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities.TV;
+using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Controller.Resolvers;
@@ -38,13 +38,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
/// Gets the priority.
/// </summary>
/// <value>The priority.</value>
- public override ResolverPriority Priority
- {
- get
- {
- return ResolverPriority.Second;
- }
- }
+ public override ResolverPriority Priority => ResolverPriority.Second;
/// <summary>
/// Resolves the specified args.
@@ -195,7 +189,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
var extension = Path.GetExtension(path);
@@ -236,7 +230,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
/// </summary>
/// <param name="item">The item.</param>
/// <param name="path">The path.</param>
- private void SetProviderIdFromPath(Series item, string path)
+ private static void SetProviderIdFromPath(Series item, string path)
{
var justName = Path.GetFileName(path);
diff --git a/Emby.Server.Implementations/Library/SearchEngine.cs b/Emby.Server.Implementations/Library/SearchEngine.cs
index 1212ba549..bbb139439 100644
--- a/Emby.Server.Implementations/Library/SearchEngine.cs
+++ b/Emby.Server.Implementations/Library/SearchEngine.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using Microsoft.Extensions.Logging;
@@ -64,7 +64,7 @@ namespace Emby.Server.Implementations.Library
};
}
- private void AddIfMissing(List<string> list, string value)
+ private static void AddIfMissing(List<string> list, string value)
{
if (!list.Contains(value, StringComparer.OrdinalIgnoreCase))
{
@@ -85,7 +85,7 @@ namespace Emby.Server.Implementations.Library
if (string.IsNullOrEmpty(searchTerm))
{
- throw new ArgumentNullException("searchTerm");
+ throw new ArgumentNullException(nameof(searchTerm));
}
searchTerm = searchTerm.Trim().RemoveDiacritics();
diff --git a/Emby.Server.Implementations/Library/UserDataManager.cs b/Emby.Server.Implementations/Library/UserDataManager.cs
index 27ba32c0c..3ca4b6b10 100644
--- a/Emby.Server.Implementations/Library/UserDataManager.cs
+++ b/Emby.Server.Implementations/Library/UserDataManager.cs
@@ -53,11 +53,11 @@ namespace Emby.Server.Implementations.Library
{
if (userData == null)
{
- throw new ArgumentNullException("userData");
+ throw new ArgumentNullException(nameof(userData));
}
if (item == null)
{
- throw new ArgumentNullException("item");
+ throw new ArgumentNullException(nameof(item));
}
cancellationToken.ThrowIfCancellationRequested();
@@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.Library
/// Gets the internal key.
/// </summary>
/// <returns>System.String.</returns>
- private string GetCacheKey(long internalUserId, Guid itemId)
+ private static string GetCacheKey(long internalUserId, Guid itemId)
{
return internalUserId.ToString(CultureInfo.InvariantCulture) + "-" + itemId.ToString("N");
}
@@ -198,7 +198,7 @@ namespace Emby.Server.Implementations.Library
{
if (data == null)
{
- throw new ArgumentNullException("data");
+ throw new ArgumentNullException(nameof(data));
}
return new UserItemDataDto
@@ -226,7 +226,7 @@ namespace Emby.Server.Implementations.Library
// If a position has been reported, and if we know the duration
if (positionTicks > 0 && hasRuntime)
{
- var pctIn = Decimal.Divide(positionTicks, runtimeTicks) * 100;
+ var pctIn = decimal.Divide(positionTicks, runtimeTicks) * 100;
// Don't track in very beginning
if (pctIn < _config.Configuration.MinResumePct)
diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs
index 679116fc0..c059cbc75 100644
--- a/Emby.Server.Implementations/Library/UserManager.cs
+++ b/Emby.Server.Implementations/Library/UserManager.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Events;
+using MediaBrowser.Common.Events;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
@@ -44,7 +44,7 @@ namespace Emby.Server.Implementations.Library
/// Gets the users.
/// </summary>
/// <value>The users.</value>
- public IEnumerable<User> Users { get { return _users; } }
+ public IEnumerable<User> Users => _users;
private User[] _users;
@@ -163,7 +163,7 @@ namespace Emby.Server.Implementations.Library
{
if (id.Equals(Guid.Empty))
{
- throw new ArgumentNullException("id");
+ throw new ArgumentNullException(nameof(id));
}
return Users.FirstOrDefault(u => u.Id == id);
@@ -183,7 +183,7 @@ namespace Emby.Server.Implementations.Library
{
if (string.IsNullOrWhiteSpace(name))
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
return Users.FirstOrDefault(u => string.Equals(u.Name, name, StringComparison.OrdinalIgnoreCase));
@@ -222,7 +222,7 @@ namespace Emby.Server.Implementations.Library
return true;
}
- private bool IsValidUsernameCharacter(char i)
+ private static bool IsValidUsernameCharacter(char i)
{
return !char.Equals(i, '<') && !char.Equals(i, '>');
}
@@ -251,7 +251,7 @@ namespace Emby.Server.Implementations.Library
{
if (string.IsNullOrWhiteSpace(username))
{
- throw new ArgumentNullException("username");
+ throw new ArgumentNullException(nameof(username));
}
var user = Users
@@ -344,7 +344,7 @@ namespace Emby.Server.Implementations.Library
return success ? user : null;
}
- private string GetAuthenticationProviderId(IAuthenticationProvider provider)
+ private static string GetAuthenticationProviderId(IAuthenticationProvider provider)
{
return provider.GetType().FullName;
}
@@ -526,7 +526,7 @@ namespace Emby.Server.Implementations.Library
{
if (user == null)
{
- throw new ArgumentNullException("user");
+ throw new ArgumentNullException(nameof(user));
}
var hasConfiguredPassword = GetAuthenticationProvider(user).HasPassword(user).Result;
@@ -625,12 +625,12 @@ namespace Emby.Server.Implementations.Library
{
if (user == null)
{
- throw new ArgumentNullException("user");
+ throw new ArgumentNullException(nameof(user));
}
if (string.IsNullOrEmpty(newName))
{
- throw new ArgumentNullException("newName");
+ throw new ArgumentNullException(nameof(newName));
}
if (Users.Any(u => u.Id != user.Id && u.Name.Equals(newName, StringComparison.OrdinalIgnoreCase)))
@@ -658,7 +658,7 @@ namespace Emby.Server.Implementations.Library
{
if (user == null)
{
- throw new ArgumentNullException("user");
+ throw new ArgumentNullException(nameof(user));
}
if (user.Id.Equals(Guid.Empty) || !Users.Any(u => u.Id.Equals(user.Id)))
@@ -689,7 +689,7 @@ namespace Emby.Server.Implementations.Library
{
if (string.IsNullOrWhiteSpace(name))
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
if (!IsValidUsername(name))
@@ -737,7 +737,7 @@ namespace Emby.Server.Implementations.Library
{
if (user == null)
{
- throw new ArgumentNullException("user");
+ throw new ArgumentNullException(nameof(user));
}
var allUsers = Users.ToList();
@@ -804,7 +804,7 @@ namespace Emby.Server.Implementations.Library
{
if (user == null)
{
- throw new ArgumentNullException("user");
+ throw new ArgumentNullException(nameof(user));
}
if (user.ConnectLinkType.HasValue && user.ConnectLinkType.Value == UserLinkType.Guest)
@@ -823,7 +823,7 @@ namespace Emby.Server.Implementations.Library
{
if (user == null)
{
- throw new ArgumentNullException("user");
+ throw new ArgumentNullException(nameof(user));
}
if (newPassword != null)
@@ -833,7 +833,7 @@ namespace Emby.Server.Implementations.Library
if (string.IsNullOrWhiteSpace(newPasswordHash))
{
- throw new ArgumentNullException("newPasswordHash");
+ throw new ArgumentNullException(nameof(newPasswordHash));
}
user.EasyPassword = newPasswordHash;
@@ -848,7 +848,7 @@ namespace Emby.Server.Implementations.Library
/// </summary>
/// <param name="name">The name.</param>
/// <returns>User.</returns>
- private User InstantiateNewUser(string name)
+ private static User InstantiateNewUser(string name)
{
return new User
{
@@ -861,10 +861,7 @@ namespace Emby.Server.Implementations.Library
};
}
- private string PasswordResetFile
- {
- get { return Path.Combine(ConfigurationManager.ApplicationPaths.ProgramDataPath, "passwordreset.txt"); }
- }
+ private string PasswordResetFile => Path.Combine(ConfigurationManager.ApplicationPaths.ProgramDataPath, "passwordreset.txt");
private string _lastPin;
private PasswordPinCreationResult _lastPasswordPinCreationResult;
@@ -888,7 +885,7 @@ namespace Emby.Server.Implementations.Library
text.AppendLine("Use your web browser to visit:");
text.AppendLine(string.Empty);
- text.AppendLine(localAddress + "/web/forgotpasswordpin.html");
+ text.AppendLine(localAddress + "/web/index.html#!/forgotpasswordpin.html");
text.AppendLine(string.Empty);
text.AppendLine("Enter the following pin code:");
text.AppendLine(string.Empty);
@@ -1047,7 +1044,7 @@ namespace Emby.Server.Implementations.Library
}
}
- private UserPolicy GetDefaultPolicy(User user)
+ private static UserPolicy GetDefaultPolicy(User user)
{
return new UserPolicy
{
@@ -1109,12 +1106,12 @@ namespace Emby.Server.Implementations.Library
}
}
- private string GetPolicyFilePath(User user)
+ private static string GetPolicyFilePath(User user)
{
return Path.Combine(user.ConfigurationDirectoryPath, "policy.xml");
}
- private string GetConfigurationFilePath(User user)
+ private static string GetConfigurationFilePath(User user)
{
return Path.Combine(user.ConfigurationDirectoryPath, "config.xml");
}
diff --git a/Emby.Server.Implementations/Library/UserViewManager.cs b/Emby.Server.Implementations/Library/UserViewManager.cs
index aae5751de..d616e1209 100644
--- a/Emby.Server.Implementations/Library/UserViewManager.cs
+++ b/Emby.Server.Implementations/Library/UserViewManager.cs
@@ -282,7 +282,7 @@ namespace Emby.Server.Implementations.Library
if (includeItemTypes.Length == 0)
{
- // Handle situations with the grouping setting, e.g. movies showing up in tv, etc.
+ // Handle situations with the grouping setting, e.g. movies showing up in tv, etc.
// Thanks to mixed content libraries included in the UserView
var hasCollectionType = parents.OfType<UserView>().ToArray();
if (hasCollectionType.Length > 0)
diff --git a/Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs b/Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs
index 1686dc23c..278c0cc7a 100644
--- a/Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs
+++ b/Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs
@@ -94,7 +94,7 @@ namespace Emby.Server.Implementations.Library.Validators
{
continue;
}
-
+
_logger.LogInformation("Deleting dead {2} {0} {1}.", item.Id.ToString("N"), item.Name, item.GetType().Name);
_libraryManager.DeleteItem(item, new DeleteOptions
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index 81a47bfea..b787e8f0f 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Globalization;
@@ -254,27 +254,15 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (requiresRefresh)
{
- await _libraryManager.ValidateMediaLibrary(new SimpleProgress<Double>(), CancellationToken.None);
+ await _libraryManager.ValidateMediaLibrary(new SimpleProgress<double>(), CancellationToken.None);
}
}
- public string Name
- {
- get { return "Emby"; }
- }
+ public string Name => "Emby";
- public string DataPath
- {
- get { return Path.Combine(_config.CommonApplicationPaths.DataPath, "livetv"); }
- }
+ public string DataPath => Path.Combine(_config.CommonApplicationPaths.DataPath, "livetv");
- private string DefaultRecordingPath
- {
- get
- {
- return Path.Combine(DataPath, "recordings");
- }
- }
+ private string DefaultRecordingPath => Path.Combine(DataPath, "recordings");
private string RecordingPath
{
@@ -288,10 +276,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
}
- public string HomePageUrl
- {
- get { return "https://github.com/jellyfin/jellyfin"; }
- }
+ public string HomePageUrl => "https://github.com/jellyfin/jellyfin";
public async Task RefreshSeriesTimers(CancellationToken cancellationToken, IProgress<double> progress)
{
@@ -467,18 +452,14 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
public ChannelInfo GetChannelByNumber(string number)
{
- ChannelInfo result = null;
-
- ChannelsByNumber.TryGetValue(number, out result);
+ ChannelsByNumber.TryGetValue(number, out var result);
return result;
}
public ChannelInfo GetChannelByName(string name)
{
- ChannelInfo result = null;
-
- ChannelsByName.TryGetValue(name, out result);
+ ChannelsByName.TryGetValue(name, out var result);
return result;
}
@@ -491,7 +472,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
return GetEpgChannelFromTunerChannel(info, tunerChannel, epgChannels);
}
- private string GetMappedChannel(string channelId, NameValuePair[] mappings)
+ private static string GetMappedChannel(string channelId, NameValuePair[] mappings)
{
foreach (NameValuePair mapping in mappings)
{
@@ -850,7 +831,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
return Task.CompletedTask;
}
- private void UpdateExistingTimerWithNewMetadata(TimerInfo existingTimer, TimerInfo updatedTimer)
+ private static void UpdateExistingTimerWithNewMetadata(TimerInfo existingTimer, TimerInfo updatedTimer)
{
// Update the program info but retain the status
existingTimer.ChannelId = updatedTimer.ChannelId;
@@ -980,7 +961,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (string.IsNullOrWhiteSpace(tunerHostId))
{
- throw new ArgumentNullException("tunerHostId");
+ throw new ArgumentNullException(nameof(tunerHostId));
}
return info.EnabledTuners.Contains(tunerHostId, StringComparer.OrdinalIgnoreCase);
@@ -1055,7 +1036,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
_logger.LogInformation("Streaming Channel " + channelId);
- var result = string.IsNullOrEmpty(streamId) ?
+ var result = string.IsNullOrEmpty(streamId) ?
null :
currentLiveStreams.FirstOrDefault(i => string.Equals(i.OriginalStreamId, streamId, StringComparison.OrdinalIgnoreCase));
@@ -1114,7 +1095,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
if (string.IsNullOrWhiteSpace(channelId))
{
- throw new ArgumentNullException("channelId");
+ throw new ArgumentNullException(nameof(channelId));
}
foreach (var hostInstance in _liveTvManager.TunerHosts)
@@ -1198,14 +1179,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
return;
}
- var registration = await _liveTvManager.GetRegistrationInfo("dvr").ConfigureAwait(false);
- if (!registration.IsValid)
- {
- _logger.LogWarning("Emby Premiere required to use Emby DVR.");
- OnTimerOutOfDate(timer);
- return;
- }
-
var activeRecordingInfo = new ActiveRecordingInfo
{
CancellationTokenSource = new CancellationTokenSource(),
@@ -1342,7 +1315,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
if (timer == null)
{
- throw new ArgumentNullException("timer");
+ throw new ArgumentNullException(nameof(timer));
}
LiveTvProgram programInfo = null;
@@ -1795,7 +1768,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
}
- private string GetPostProcessArguments(string path, string arguments)
+ private static string GetPostProcessArguments(string path, string arguments)
{
return arguments.Replace("{path}", path, StringComparison.OrdinalIgnoreCase);
}
@@ -2394,80 +2367,68 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var allTimers = GetTimersForSeries(seriesTimer)
.ToList();
- var registration = await _liveTvManager.GetRegistrationInfo("seriesrecordings").ConfigureAwait(false);
var enabledTimersForSeries = new List<TimerInfo>();
-
- if (registration.IsValid)
+ foreach (var timer in allTimers)
{
- foreach (var timer in allTimers)
+ var existingTimer = _timerProvider.GetTimer(timer.Id);
+
+ if (existingTimer == null)
{
- var existingTimer = _timerProvider.GetTimer(timer.Id);
+ existingTimer = string.IsNullOrWhiteSpace(timer.ProgramId)
+ ? null
+ : _timerProvider.GetTimerByProgramId(timer.ProgramId);
+ }
- if (existingTimer == null)
+ if (existingTimer == null)
+ {
+ if (ShouldCancelTimerForSeriesTimer(seriesTimer, timer))
{
- existingTimer = string.IsNullOrWhiteSpace(timer.ProgramId)
- ? null
- : _timerProvider.GetTimerByProgramId(timer.ProgramId);
+ timer.Status = RecordingStatus.Cancelled;
}
+ else
+ {
+ enabledTimersForSeries.Add(timer);
+ }
+ _timerProvider.Add(timer);
+
+ TimerCreated?.Invoke(this, new GenericEventArgs<TimerInfo>(timer));
+ }
+ // Only update if not currently active - test both new timer and existing in case Id's are different
+ // Id's could be different if the timer was created manually prior to series timer creation
+ else if (!_activeRecordings.TryGetValue(timer.Id, out _) && !_activeRecordings.TryGetValue(existingTimer.Id, out _))
+ {
+ UpdateExistingTimerWithNewMetadata(existingTimer, timer);
- if (existingTimer == null)
+ // Needed by ShouldCancelTimerForSeriesTimer
+ timer.IsManual = existingTimer.IsManual;
+
+ if (ShouldCancelTimerForSeriesTimer(seriesTimer, timer))
{
- if (ShouldCancelTimerForSeriesTimer(seriesTimer, timer))
- {
- timer.Status = RecordingStatus.Cancelled;
- }
- else
- {
- enabledTimersForSeries.Add(timer);
- }
- _timerProvider.Add(timer);
+ existingTimer.Status = RecordingStatus.Cancelled;
+ }
+ else if (!existingTimer.IsManual)
+ {
+ existingTimer.Status = RecordingStatus.New;
+ }
- if (TimerCreated != null)
- {
- TimerCreated(this, new GenericEventArgs<TimerInfo>(timer));
- }
+ if (existingTimer.Status != RecordingStatus.Cancelled)
+ {
+ enabledTimersForSeries.Add(existingTimer);
}
- else
+
+ if (updateTimerSettings)
{
- // Only update if not currently active - test both new timer and existing in case Id's are different
- // Id's could be different if the timer was created manually prior to series timer creation
- ActiveRecordingInfo activeRecordingInfo;
- if (!_activeRecordings.TryGetValue(timer.Id, out activeRecordingInfo) && !_activeRecordings.TryGetValue(existingTimer.Id, out activeRecordingInfo))
- {
- UpdateExistingTimerWithNewMetadata(existingTimer, timer);
-
- // Needed by ShouldCancelTimerForSeriesTimer
- timer.IsManual = existingTimer.IsManual;
-
- if (ShouldCancelTimerForSeriesTimer(seriesTimer, timer))
- {
- existingTimer.Status = RecordingStatus.Cancelled;
- }
- else if (!existingTimer.IsManual)
- {
- existingTimer.Status = RecordingStatus.New;
- }
-
- if (existingTimer.Status != RecordingStatus.Cancelled)
- {
- enabledTimersForSeries.Add(existingTimer);
- }
-
- if (updateTimerSettings)
- {
- existingTimer.KeepUntil = seriesTimer.KeepUntil;
- existingTimer.IsPostPaddingRequired = seriesTimer.IsPostPaddingRequired;
- existingTimer.IsPrePaddingRequired = seriesTimer.IsPrePaddingRequired;
- existingTimer.PostPaddingSeconds = seriesTimer.PostPaddingSeconds;
- existingTimer.PrePaddingSeconds = seriesTimer.PrePaddingSeconds;
- existingTimer.Priority = seriesTimer.Priority;
- }
-
- existingTimer.SeriesTimerId = seriesTimer.Id;
- _timerProvider.Update(existingTimer);
- }
+ existingTimer.KeepUntil = seriesTimer.KeepUntil;
+ existingTimer.IsPostPaddingRequired = seriesTimer.IsPostPaddingRequired;
+ existingTimer.IsPrePaddingRequired = seriesTimer.IsPrePaddingRequired;
+ existingTimer.PostPaddingSeconds = seriesTimer.PostPaddingSeconds;
+ existingTimer.PrePaddingSeconds = seriesTimer.PrePaddingSeconds;
+ existingTimer.Priority = seriesTimer.Priority;
}
+
+ existingTimer.SeriesTimerId = seriesTimer.Id;
+ _timerProvider.Update(existingTimer);
}
}
@@ -2501,7 +2462,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
if (seriesTimer == null)
{
- throw new ArgumentNullException("seriesTimer");
+ throw new ArgumentNullException(nameof(seriesTimer));
}
var query = new InternalItemsQuery
@@ -2536,9 +2497,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (string.IsNullOrWhiteSpace(channelId) && !parent.ChannelId.Equals(Guid.Empty))
{
- LiveTvChannel channel;
-
- if (!tempChannelCache.TryGetValue(parent.ChannelId, out channel))
+ if (!tempChannelCache.TryGetValue(parent.ChannelId, out var channel))
{
channel = _libraryManager.GetItemList(new InternalItemsQuery
{
@@ -2597,9 +2556,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (!programInfo.ChannelId.Equals(Guid.Empty))
{
- LiveTvChannel channel;
-
- if (!tempChannelCache.TryGetValue(programInfo.ChannelId, out channel))
+ if (!tempChannelCache.TryGetValue(programInfo.ChannelId, out var channel))
{
channel = _libraryManager.GetItemList(new InternalItemsQuery
{
@@ -2797,15 +2754,12 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
var configuredDevice = configuredDevices.FirstOrDefault(i => string.Equals(i.DeviceId, device.DeviceId, StringComparison.OrdinalIgnoreCase));
- if (configuredDevice != null)
+ if (configuredDevice != null && !string.Equals(device.Url, configuredDevice.Url, StringComparison.OrdinalIgnoreCase))
{
- if (!string.Equals(device.Url, configuredDevice.Url, StringComparison.OrdinalIgnoreCase))
- {
- _logger.LogInformation("Tuner url has changed from {0} to {1}", configuredDevice.Url, device.Url);
+ _logger.LogInformation("Tuner url has changed from {PreviousUrl} to {NewUrl}", configuredDevice.Url, device.Url);
- configuredDevice.Url = device.Url;
- await _liveTvManager.SaveTunerHost(configuredDevice).ConfigureAwait(false);
- }
+ configuredDevice.Url = device.Url;
+ await _liveTvManager.SaveTunerHost(configuredDevice).ConfigureAwait(false);
}
}
}
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs
index 4ea83b7ac..292f3621d 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
@@ -55,14 +55,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
_assemblyInfo = assemblyInfo;
}
- private bool CopySubtitles
- {
- get
- {
- return false;
- //return string.Equals(OutputFormat, "mkv", StringComparison.OrdinalIgnoreCase);
- }
- }
+ private static bool CopySubtitles => false;
public string GetOutputPath(MediaSourceInfo mediaSource, string targetFile)
{
@@ -214,19 +207,19 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var outputParam = string.Empty;
- var commandLineArgs = string.Format("-i \"{0}\"{5} {2} -map_metadata -1 -threads 0 {3}{4}{6} -y \"{1}\"",
- inputTempFile,
- targetFile,
- videoArgs,
- GetAudioArgs(mediaSource),
- subtitleArgs,
- durationParam,
+ var commandLineArgs = string.Format("-i \"{0}\"{5} {2} -map_metadata -1 -threads 0 {3}{4}{6} -y \"{1}\"",
+ inputTempFile,
+ targetFile,
+ videoArgs,
+ GetAudioArgs(mediaSource),
+ subtitleArgs,
+ durationParam,
outputParam);
return inputModifier + " " + commandLineArgs;
}
- private string GetAudioArgs(MediaSourceInfo mediaSource)
+ private static string GetAudioArgs(MediaSourceInfo mediaSource)
{
var mediaStreams = mediaSource.MediaStreams ?? new List<MediaStream>();
var inputAudioCodec = mediaStreams.Where(i => i.Type == MediaStreamType.Audio).Select(i => i.Codec).FirstOrDefault() ?? string.Empty;
@@ -242,7 +235,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
//return "-codec:a:0 aac -strict experimental -ab 320000";
}
- private bool EncodeVideo(MediaSourceInfo mediaSource)
+ private static bool EncodeVideo(MediaSourceInfo mediaSource)
{
return false;
}
@@ -383,6 +376,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (ObjectDisposedException)
{
+ // TODO Investigate and properly fix.
// Don't spam the log. This doesn't seem to throw in windows, but sometimes under linux
}
catch (Exception ex)
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs
index 9f179dc2c..593f98881 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs
@@ -68,7 +68,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
if (newList == null)
{
- throw new ArgumentNullException("newList");
+ throw new ArgumentNullException(nameof(newList));
}
var file = _dataPath + ".json";
@@ -85,7 +85,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
if (item == null)
{
- throw new ArgumentNullException("item");
+ throw new ArgumentNullException(nameof(item));
}
var list = GetAll().ToList();
@@ -106,7 +106,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
if (item == null)
{
- throw new ArgumentNullException("item");
+ throw new ArgumentNullException(nameof(item));
}
var list = GetAll().ToList();
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
index e4ab34770..bdc6ae009 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Concurrent;
using System.Globalization;
using System.Linq;
@@ -90,7 +90,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
AddOrUpdateSystemTimer(item);
}
- private bool ShouldStartTimer(TimerInfo item)
+ private static bool ShouldStartTimer(TimerInfo item)
{
if (item.Status == RecordingStatus.Completed ||
item.Status == RecordingStatus.Cancelled)
diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
index e8ffd0caa..0ba8c8b42 100644
--- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
+++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
@@ -1,4 +1,4 @@
-using System.Net;
+using System.Net;
using MediaBrowser.Common;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.LiveTv;
@@ -38,12 +38,9 @@ namespace Emby.Server.Implementations.LiveTv.Listings
_appHost = appHost;
}
- private string UserAgent
- {
- get { return "Emby/" + _appHost.ApplicationVersion; }
- }
+ private string UserAgent => "Emby/" + _appHost.ApplicationVersion;
- private List<string> GetScheduleRequestDates(DateTime startDateUtc, DateTime endDateUtc)
+ private static List<string> GetScheduleRequestDates(DateTime startDateUtc, DateTime endDateUtc)
{
List<string> dates = new List<string>();
@@ -63,7 +60,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
{
if (string.IsNullOrEmpty(channelId))
{
- throw new ArgumentNullException("channelId");
+ throw new ArgumentNullException(nameof(channelId));
}
// Normalize incoming input
@@ -189,7 +186,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
}
}
- private int GetSizeOrder(ScheduleDirect.ImageData image)
+ private static int GetSizeOrder(ScheduleDirect.ImageData image)
{
if (!string.IsNullOrWhiteSpace(image.height))
{
@@ -202,7 +199,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
return 0;
}
- private string GetChannelNumber(ScheduleDirect.Map map)
+ private static string GetChannelNumber(ScheduleDirect.Map map)
{
var channelNumber = map.logicalChannelNumber;
@@ -218,7 +215,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
return channelNumber.TrimStart('0');
}
- private bool IsMovie(ScheduleDirect.ProgramDetails programInfo)
+ private static bool IsMovie(ScheduleDirect.ProgramDetails programInfo)
{
return string.Equals(programInfo.entityType, "movie", StringComparison.OrdinalIgnoreCase);
}
@@ -390,7 +387,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
return info;
}
- private DateTime GetDate(string value)
+ private static DateTime GetDate(string value)
{
var date = DateTime.ParseExact(value, "yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'", CultureInfo.InvariantCulture);
@@ -429,7 +426,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
}
}
- private double GetAspectRatio(ScheduleDirect.ImageData i)
+ private static double GetAspectRatio(ScheduleDirect.ImageData i)
{
int width = 0;
int height = 0;
@@ -664,7 +661,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
}
}
- options.RequestHeaders["token"] = await GetToken(providerInfo, options.CancellationToken).ConfigureAwait(false);;
+ options.RequestHeaders["token"] = await GetToken(providerInfo, options.CancellationToken).ConfigureAwait(false);
return await Post(options, false, providerInfo).ConfigureAwait(false);
}
@@ -765,16 +762,10 @@ namespace Emby.Server.Implementations.LiveTv.Listings
}
}
- public string Name
- {
- get { return "Schedules Direct"; }
- }
+ public string Name => "Schedules Direct";
public static string TypeName = "SchedulesDirect";
- public string Type
- {
- get { return TypeName; }
- }
+ public string Type => TypeName;
private async Task<bool> HasLineup(ListingsProviderInfo info, CancellationToken cancellationToken)
{
@@ -951,7 +942,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
return null;
}
- private string NormalizeName(string value)
+ private static string NormalizeName(string value)
{
return value.Replace(" ", string.Empty).Replace("-", string.Empty);
}
diff --git a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
index 4d7c7fef4..2b1ee84a8 100644
--- a/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
+++ b/Emby.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs
@@ -36,15 +36,9 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
_zipClient = zipClient;
}
- public string Name
- {
- get { return "XmlTV"; }
- }
+ public string Name => "XmlTV";
- public string Type
- {
- get { return "xmltv"; }
- }
+ public string Type => "xmltv";
private string GetLanguage(ListingsProviderInfo info)
{
@@ -78,7 +72,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
{
CancellationToken = cancellationToken,
Url = path,
- Progress = new SimpleProgress<Double>(),
+ Progress = new SimpleProgress<double>(),
DecompressionMethod = CompressionMethod.Gzip,
// It's going to come back gzipped regardless of this value
@@ -164,7 +158,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
{
if (string.IsNullOrWhiteSpace(channelId))
{
- throw new ArgumentNullException("channelId");
+ throw new ArgumentNullException(nameof(channelId));
}
/*
@@ -187,7 +181,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
.Select(p => GetProgramInfo(p, info));
}
- private ProgramInfo GetProgramInfo(XmlTvProgram program, ListingsProviderInfo info)
+ private static ProgramInfo GetProgramInfo(XmlTvProgram program, ListingsProviderInfo info)
{
string episodeTitle = program.Episode?.Title;
@@ -210,9 +204,9 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
IsMovie = program.Categories.Any(c => info.MovieCategories.Contains(c, StringComparer.OrdinalIgnoreCase)),
IsNews = program.Categories.Any(c => info.NewsCategories.Contains(c, StringComparer.OrdinalIgnoreCase)),
IsSports = program.Categories.Any(c => info.SportsCategories.Contains(c, StringComparer.OrdinalIgnoreCase)),
- ImageUrl = program.Icon != null && !String.IsNullOrEmpty(program.Icon.Source) ? program.Icon.Source : null,
- HasImage = program.Icon != null && !String.IsNullOrEmpty(program.Icon.Source),
- OfficialRating = program.Rating != null && !String.IsNullOrEmpty(program.Rating.Value) ? program.Rating.Value : null,
+ ImageUrl = program.Icon != null && !string.IsNullOrEmpty(program.Icon.Source) ? program.Icon.Source : null,
+ HasImage = program.Icon != null && !string.IsNullOrEmpty(program.Icon.Source),
+ OfficialRating = program.Rating != null && !string.IsNullOrEmpty(program.Rating.Value) ? program.Rating.Value : null,
CommunityRating = program.StarRating,
SeriesId = program.Episode == null ? null : program.Title.GetMD5().ToString("N")
};
@@ -246,7 +240,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
}
// Construct an id from the channel and start date
- programInfo.Id = String.Format("{0}_{1:O}", program.ChannelId, program.StartDate);
+ programInfo.Id = string.Format("{0}_{1:O}", program.ChannelId, program.StartDate);
if (programInfo.IsMovie)
{
@@ -294,7 +288,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
{
Id = c.Id,
Name = c.DisplayName,
- ImageUrl = c.Icon != null && !String.IsNullOrEmpty(c.Icon.Source) ? c.Icon.Source : null,
+ ImageUrl = c.Icon != null && !string.IsNullOrEmpty(c.Icon.Source) ? c.Icon.Source : null,
Number = string.IsNullOrWhiteSpace(c.Number) ? c.Id : c.Number
}).ToList();
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
index 6fe578715..7397d4b60 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common;
+using MediaBrowser.Common;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Dto;
@@ -321,6 +321,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
+ _logger.LogDebug(ex, "GetImageCacheTag raised an exception in LiveTvDtoService.FillImages.");
}
}
@@ -331,10 +332,10 @@ namespace Emby.Server.Implementations.LiveTv
{
try
{
- dto.ParentBackdropImageTags = new string[]
- {
- _imageProcessor.GetImageCacheTag(program, image)
- };
+ dto.ParentBackdropImageTags = new[]
+ {
+ _imageProcessor.GetImageCacheTag(program, image)
+ };
dto.ParentBackdropItemId = program.Id.ToString("N");
}
catch (Exception ex)
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
index a81a0bcbb..c360a6a82 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Configuration;
+using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Progress;
using MediaBrowser.Controller.Configuration;
@@ -22,7 +22,6 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.IO;
-using MediaBrowser.Common.Security;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Model.Events;
@@ -51,7 +50,6 @@ namespace Emby.Server.Implementations.LiveTv
private readonly ITaskManager _taskManager;
private readonly IJsonSerializer _jsonSerializer;
private readonly IProviderManager _providerManager;
- private readonly ISecurityManager _security;
private readonly Func<IChannelManager> _channelManager;
private readonly IDtoService _dtoService;
@@ -78,7 +76,23 @@ namespace Emby.Server.Implementations.LiveTv
private IServerApplicationHost _appHost;
private IHttpClient _httpClient;
- public LiveTvManager(IServerApplicationHost appHost, IHttpClient httpClient, IServerConfigurationManager config, ILogger logger, IItemRepository itemRepo, IImageProcessor imageProcessor, IUserDataManager userDataManager, IDtoService dtoService, IUserManager userManager, ILibraryManager libraryManager, ITaskManager taskManager, ILocalizationManager localization, IJsonSerializer jsonSerializer, IProviderManager providerManager, IFileSystem fileSystem, ISecurityManager security, Func<IChannelManager> channelManager)
+ public LiveTvManager(
+ IServerApplicationHost appHost,
+ IHttpClient httpClient,
+ IServerConfigurationManager config,
+ ILogger logger,
+ IItemRepository itemRepo,
+ IImageProcessor imageProcessor,
+ IUserDataManager userDataManager,
+ IDtoService dtoService,
+ IUserManager userManager,
+ ILibraryManager libraryManager,
+ ITaskManager taskManager,
+ ILocalizationManager localization,
+ IJsonSerializer jsonSerializer,
+ IProviderManager providerManager,
+ IFileSystem fileSystem,
+ Func<IChannelManager> channelManager)
{
_appHost = appHost;
_config = config;
@@ -91,7 +105,6 @@ namespace Emby.Server.Implementations.LiveTv
_jsonSerializer = jsonSerializer;
_providerManager = providerManager;
_fileSystem = fileSystem;
- _security = security;
_dtoService = dtoService;
_userDataManager = userDataManager;
_channelManager = channelManager;
@@ -104,10 +117,7 @@ namespace Emby.Server.Implementations.LiveTv
/// Gets the services.
/// </summary>
/// <value>The services.</value>
- public IReadOnlyList<ILiveTvService> Services
- {
- get { return _services; }
- }
+ public IReadOnlyList<ILiveTvService> Services => _services;
private LiveTvOptions GetConfiguration()
{
@@ -167,15 +177,9 @@ namespace Emby.Server.Implementations.LiveTv
});
}
- public ITunerHost[] TunerHosts
- {
- get { return _tunerHosts; }
- }
+ public ITunerHost[] TunerHosts => _tunerHosts;
- public IListingsProvider[] ListingProviders
- {
- get { return _listingProviders; }
- }
+ public IListingsProvider[] ListingProviders => _listingProviders;
public List<NameIdPair> GetTunerHostTypes()
{
@@ -323,7 +327,7 @@ namespace Emby.Server.Implementations.LiveTv
return _services.FirstOrDefault(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase));
}
- private void Normalize(MediaSourceInfo mediaSource, ILiveTvService service, bool isVideo)
+ private static void Normalize(MediaSourceInfo mediaSource, ILiveTvService service, bool isVideo)
{
// Not all of the plugins are setting this
mediaSource.IsInfiniteStream = true;
@@ -1418,6 +1422,7 @@ namespace Emby.Server.Implementations.LiveTv
if (query.IsInProgress ?? false)
{
+ //TODO Fix The co-variant conversion between Video[] and BaseItem[], this can generate runtime issues.
result.Items = result
.Items
.OfType<Video>()
@@ -1993,7 +1998,7 @@ namespace Emby.Server.Implementations.LiveTv
Name = program.Name,
OfficialRating = program.OfficialRating
};
- }
+ }
if (service == null)
{
@@ -2095,14 +2100,6 @@ namespace Emby.Server.Implementations.LiveTv
public async Task CreateSeriesTimer(SeriesTimerInfoDto timer, CancellationToken cancellationToken)
{
- var registration = await GetRegistrationInfo("seriesrecordings").ConfigureAwait(false);
-
- if (!registration.IsValid)
- {
- _logger.LogInformation("Creating series recordings requires an active Emby Premiere subscription.");
- return;
- }
-
var service = GetService(timer.ServiceName);
var info = await _tvDtoService.GetSeriesTimerInfo(timer, true, this, cancellationToken).ConfigureAwait(false);
@@ -2188,7 +2185,7 @@ namespace Emby.Server.Implementations.LiveTv
return Services.Select(GetServiceInfo).ToArray();
}
- private LiveTvServiceInfo GetServiceInfo(ILiveTvService service)
+ private static LiveTvServiceInfo GetServiceInfo(ILiveTvService service)
{
return new LiveTvServiceInfo
{
@@ -2245,7 +2242,7 @@ namespace Emby.Server.Implementations.LiveTv
return service.ResetTuner(parts[1], cancellationToken);
}
- private void RemoveFields(DtoOptions options)
+ private static void RemoveFields(DtoOptions options)
{
var fields = options.Fields.ToList();
@@ -2444,30 +2441,6 @@ namespace Emby.Server.Implementations.LiveTv
}
}
- public Task<MBRegistrationRecord> GetRegistrationInfo(string feature)
- {
- if (string.Equals(feature, "seriesrecordings", StringComparison.OrdinalIgnoreCase))
- {
- feature = "embytvseriesrecordings";
- }
-
- if (string.Equals(feature, "dvr-l", StringComparison.OrdinalIgnoreCase))
- {
- var config = GetConfiguration();
- if (config.TunerHosts.Length > 0 &&
- config.ListingProviders.Count(i => (i.EnableAllTuners || i.EnabledTuners.Length > 0) && string.Equals(i.Type, SchedulesDirect.TypeName, StringComparison.OrdinalIgnoreCase)) > 0)
- {
- return Task.FromResult(new MBRegistrationRecord
- {
- IsRegistered = true,
- IsValid = true
- });
- }
- }
-
- return _security.GetRegistrationStatus(feature);
- }
-
public Task<List<ChannelInfo>> GetChannelsForListingsProvider(string id, CancellationToken cancellationToken)
{
var info = GetConfiguration().ListingProviders.First(i => string.Equals(i.Id, id, StringComparison.OrdinalIgnoreCase));
diff --git a/Emby.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs b/Emby.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs
index 225360159..29196a068 100644
--- a/Emby.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs
+++ b/Emby.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs
@@ -20,20 +20,11 @@ namespace Emby.Server.Implementations.LiveTv
_config = config;
}
- public string Name
- {
- get { return "Refresh Guide"; }
- }
+ public string Name => "Refresh Guide";
- public string Description
- {
- get { return "Downloads channel information from live tv services."; }
- }
+ public string Description => "Downloads channel information from live tv services.";
- public string Category
- {
- get { return "Live TV"; }
- }
+ public string Category => "Live TV";
public Task Execute(System.Threading.CancellationToken cancellationToken, IProgress<double> progress)
{
@@ -48,8 +39,8 @@ namespace Emby.Server.Implementations.LiveTv
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{
- return new[] {
-
+ return new[] {
+
// Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
};
@@ -60,24 +51,12 @@ namespace Emby.Server.Implementations.LiveTv
return _config.GetConfiguration<LiveTvOptions>("livetv");
}
- public bool IsHidden
- {
- get { return _liveTvManager.Services.Count == 1 && GetConfiguration().TunerHosts.Length == 0; }
- }
+ public bool IsHidden => _liveTvManager.Services.Count == 1 && GetConfiguration().TunerHosts.Length == 0;
- public bool IsEnabled
- {
- get { return true; }
- }
+ public bool IsEnabled => true;
- public bool IsLogged
- {
- get { return true; }
- }
+ public bool IsLogged => true;
- public string Key
- {
- get { return "RefreshGuide"; }
- }
+ public string Key => "RefreshGuide";
}
}
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs
index ef2010ba6..78514c1d9 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs
@@ -40,13 +40,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
FileSystem = fileSystem;
}
- public virtual bool IsSupported
- {
- get
- {
- return true;
- }
- }
+ public virtual bool IsSupported => true;
protected abstract Task<List<ChannelInfo>> GetChannelsInternal(TunerHostInfo tuner, CancellationToken cancellationToken);
public abstract string Type { get; }
@@ -140,7 +134,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
{
if (string.IsNullOrEmpty(channelId))
{
- throw new ArgumentNullException("channelId");
+ throw new ArgumentNullException(nameof(channelId));
}
if (IsValidChannelId(channelId))
@@ -175,7 +169,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
{
if (string.IsNullOrEmpty(channelId))
{
- throw new ArgumentNullException("channelId");
+ throw new ArgumentNullException(nameof(channelId));
}
if (!IsValidChannelId(channelId))
@@ -228,18 +222,13 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
throw new LiveTvConflictException();
}
- protected virtual string ChannelIdPrefix
- {
- get
- {
- return Type + "_";
- }
- }
+ protected virtual string ChannelIdPrefix => Type + "_";
+
protected virtual bool IsValidChannelId(string channelId)
{
if (string.IsNullOrEmpty(channelId))
{
- throw new ArgumentNullException("channelId");
+ throw new ArgumentNullException(nameof(channelId));
}
return channelId.StartsWith(ChannelIdPrefix, StringComparison.OrdinalIgnoreCase);
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
index be090df0c..3ae47f3ab 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Configuration;
+using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Model.Dto;
@@ -42,28 +42,13 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
_environment = environment;
}
- public string Name
- {
- get { return "HD Homerun"; }
- }
+ public string Name => "HD Homerun";
- public override string Type
- {
- get { return DeviceType; }
- }
+ public override string Type => DeviceType;
- public static string DeviceType
- {
- get { return "hdhomerun"; }
- }
+ public static string DeviceType => "hdhomerun";
- protected override string ChannelIdPrefix
- {
- get
- {
- return "hdhr_";
- }
- }
+ protected override string ChannelIdPrefix => "hdhr_";
private string GetChannelId(TunerHostInfo info, Channels i)
{
@@ -274,7 +259,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
for (int i = 0; i < model.TunerCount; ++i)
{
- var name = String.Format("Tuner {0}", i + 1);
+ 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;
@@ -325,7 +310,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
return await GetTunerInfosHttp(info, cancellationToken).ConfigureAwait(false);
}
- private string GetApiUrl(TunerHostInfo info)
+ private static string GetApiUrl(TunerHostInfo info)
{
var url = info.Url;
@@ -359,7 +344,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
return Config.GetConfiguration<EncodingOptions>("encoding");
}
- private string GetHdHrIdFromChannelId(string channelId)
+ private static string GetHdHrIdFromChannelId(string channelId)
{
return channelId.Split('_')[1];
}
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs
index 0e84622bd..335fc4cb4 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs
@@ -37,10 +37,10 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{
var commands = new List<Tuple<string, string>>();
- if (!String.IsNullOrEmpty(_channel))
+ if (!string.IsNullOrEmpty(_channel))
commands.Add(Tuple.Create("channel", _channel));
- if (!String.IsNullOrEmpty(_program))
+ if (!string.IsNullOrEmpty(_program))
commands.Add(Tuple.Create("program", _program));
return commands;
}
@@ -61,11 +61,11 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{
var commands = new List<Tuple<string, string>>();
- if (!String.IsNullOrEmpty(_channel))
+ if (!string.IsNullOrEmpty(_channel))
{
if (!string.IsNullOrEmpty(_profile) && !string.Equals(_profile, "native", StringComparison.OrdinalIgnoreCase))
{
- commands.Add(Tuple.Create("vchannel", String.Format("{0} transcode={1}", _channel, _profile)));
+ commands.Add(Tuple.Create("vchannel", string.Format("{0} transcode={1}", _channel, _profile)));
}
else
{
@@ -123,7 +123,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
}
}
- private async Task<bool> CheckTunerAvailability(ISocket socket, IpAddressInfo remoteIp, int tuner, CancellationToken cancellationToken)
+ private static async Task<bool> CheckTunerAvailability(ISocket socket, IpAddressInfo remoteIp, int tuner, CancellationToken cancellationToken)
{
var ipEndPoint = new IpEndPointInfo(remoteIp, HdHomeRunPort);
@@ -164,7 +164,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
continue;
_activeTuner = i;
- var lockKeyString = String.Format("{0:d}", lockKeyValue);
+ var lockKeyString = string.Format("{0:d}", lockKeyValue);
var lockkeyMsg = CreateSetMessage(i, "lockkey", lockKeyString, null);
await tcpClient.SendToAsync(lockkeyMsg, 0, lockkeyMsg.Length, ipEndPoint, cancellationToken).ConfigureAwait(false);
var response = await tcpClient.ReceiveAsync(receiveBuffer, 0, receiveBuffer.Length, cancellationToken).ConfigureAwait(false);
@@ -188,7 +188,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
}
- var targetValue = String.Format("rtp://{0}:{1}", localIp, localPort);
+ var targetValue = string.Format("rtp://{0}:{1}", localIp, localPort);
var targetMsg = CreateSetMessage(i, "target", targetValue, lockKeyValue);
await tcpClient.SendToAsync(targetMsg, 0, targetMsg.Length, ipEndPoint, cancellationToken).ConfigureAwait(false);
@@ -262,7 +262,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
private static byte[] CreateGetMessage(int tuner, string name)
{
- var byteName = Encoding.UTF8.GetBytes(String.Format("/tuner{0}/{1}\0", tuner, name));
+ var byteName = Encoding.UTF8.GetBytes(string.Format("/tuner{0}/{1}\0", tuner, name));
int messageLength = byteName.Length + 10; // 4 bytes for header + 4 bytes for crc + 2 bytes for tag name and length
var message = new byte[messageLength];
@@ -280,10 +280,10 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
return message;
}
- private static byte[] CreateSetMessage(int tuner, String name, String value, uint? lockkey)
+ private static byte[] CreateSetMessage(int tuner, string name, string value, uint? lockkey)
{
- var byteName = Encoding.UTF8.GetBytes(String.Format("/tuner{0}/{1}\0", tuner, name));
- var byteValue = Encoding.UTF8.GetBytes(String.Format("{0}\0", value));
+ var byteName = Encoding.UTF8.GetBytes(string.Format("/tuner{0}/{1}\0", tuner, name));
+ var byteValue = Encoding.UTF8.GetBytes(string.Format("{0}\0", value));
int messageLength = byteName.Length + byteValue.Length + 12;
if (lockkey.HasValue)
@@ -360,7 +360,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
private static bool ParseReturnMessage(byte[] buf, int numBytes, out string returnVal)
{
- returnVal = String.Empty;
+ returnVal = string.Empty;
if (numBytes < 4)
return false;
@@ -411,7 +411,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
private class HdHomerunCrc
{
- private static UInt32[] crc_table = {
+ private static uint[] crc_table = {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
@@ -477,7 +477,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d };
- public static UInt32 GetCrc32(byte[] bytes, int numBytes)
+ public static uint GetCrc32(byte[] bytes, int numBytes)
{
var hash = 0xffffffff;
for (var i = 0; i < numBytes; i++)
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs
index c781bccbb..fd78dfa8e 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
@@ -38,7 +38,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
EnableStreamSharing = true;
}
- private Socket CreateSocket(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
+ private static Socket CreateSocket(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
{
var socket = new Socket(addressFamily, SocketType.Stream, ProtocolType.Tcp);
@@ -144,7 +144,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
});
}
- private void Resolve(TaskCompletionSource<bool> openTaskCompletionSource)
+ private static void Resolve(TaskCompletionSource<bool> openTaskCompletionSource)
{
Task.Run(() =>
{
@@ -204,16 +204,16 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
public override async Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
if (buffer == null)
- throw new ArgumentNullException("buffer");
+ throw new ArgumentNullException(nameof(buffer));
if (offset + count < 0)
- throw new ArgumentOutOfRangeException("offset + count must not be negative", "offset+count");
+ throw new ArgumentOutOfRangeException(nameof(offset), "offset + count must not be negative");
if (offset + count > buffer.Length)
- throw new ArgumentException("offset + count must not be greater than the length of buffer", "offset+count");
+ throw new ArgumentException("offset + count must not be greater than the length of buffer");
if (disposed)
- throw new ObjectDisposedException(typeof(UdpClientStream).ToString());
+ throw new ObjectDisposedException(nameof(UdpClientStream));
// This will always receive a 1328 packet size (PacketSize + RtpHeaderSize)
// The RTP header will be stripped so see how many reads we need to make to fill the buffer.
@@ -238,16 +238,16 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
public override int Read(byte[] buffer, int offset, int count)
{
if (buffer == null)
- throw new ArgumentNullException("buffer");
+ throw new ArgumentNullException(nameof(buffer));
if (offset + count < 0)
throw new ArgumentOutOfRangeException("offset + count must not be negative", "offset+count");
if (offset + count > buffer.Length)
- throw new ArgumentException("offset + count must not be greater than the length of buffer", "offset+count");
+ throw new ArgumentException("offset + count must not be greater than the length of buffer");
if (disposed)
- throw new ObjectDisposedException(typeof(UdpClientStream).ToString());
+ throw new ObjectDisposedException(nameof(UdpClientStream));
// This will always receive a 1328 packet size (PacketSize + RtpHeaderSize)
// The RTP header will be stripped so see how many reads we need to make to fill the buffer.
@@ -274,49 +274,19 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
disposed = true;
}
- public override bool CanRead
- {
- get
- {
- throw new NotImplementedException();
- }
- }
+ public override bool CanRead => throw new NotImplementedException();
- public override bool CanSeek
- {
- get
- {
- throw new NotImplementedException();
- }
- }
+ public override bool CanSeek => throw new NotImplementedException();
- public override bool CanWrite
- {
- get
- {
- throw new NotImplementedException();
- }
- }
+ public override bool CanWrite => throw new NotImplementedException();
- public override long Length
- {
- get
- {
- throw new NotImplementedException();
- }
- }
+ public override long Length => throw new NotImplementedException();
public override long Position
{
- get
- {
- throw new NotImplementedException();
- }
+ get => throw new NotImplementedException();
- set
- {
- throw new NotImplementedException();
- }
+ set => throw new NotImplementedException();
}
public override void Flush()
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs
index 4a2b4ebb2..b55b02ddc 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs
@@ -217,13 +217,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
}
- protected virtual int EmptyReadLimit
- {
- get
- {
- return 1000;
- }
- }
+ protected virtual int EmptyReadLimit => 1000;
private void TrySeek(FileStream stream, long offset)
{
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs
index a54bd1613..ab8731c39 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs
@@ -39,15 +39,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
_mediaSourceManager = mediaSourceManager;
}
- public override string Type
- {
- get { return "m3u"; }
- }
+ public override string Type => "m3u";
- public virtual string Name
- {
- get { return "M3U Tuner"; }
- }
+ public virtual string Name => "M3U Tuner";
private string GetFullChannelIdPrefix(TunerHostInfo info)
{
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
index 208225c1e..f83f95802 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
@@ -251,7 +251,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
return numberString;
}
- private bool IsValidChannelNumber(string numberString)
+ private static bool IsValidChannelNumber(string numberString)
{
if (string.IsNullOrWhiteSpace(numberString) ||
string.Equals(numberString, "-1", StringComparison.OrdinalIgnoreCase) ||
@@ -269,7 +269,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
return true;
}
- private string GetChannelName(string extInf, Dictionary<string, string> attributes)
+ private static string GetChannelName(string extInf, Dictionary<string, string> attributes)
{
var nameParts = extInf.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
var nameInExtInf = nameParts.Length > 1 ? nameParts.Last().Trim() : null;
@@ -314,7 +314,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
return name;
}
- private Dictionary<string, string> ParseExtInf(string line, out string remaining)
+ private static Dictionary<string, string> ParseExtInf(string line, out string remaining)
{
var dict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs
index c6de9d957..a2c47cd79 100644
--- a/Emby.Server.Implementations/Localization/LocalizationManager.cs
+++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Model.Extensions;
+using MediaBrowser.Model.Extensions;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Globalization;
@@ -165,13 +165,7 @@ namespace Emby.Server.Implementations.Localization
/// Gets the localization path.
/// </summary>
/// <value>The localization path.</value>
- public string LocalizationPath
- {
- get
- {
- return Path.Combine(_configurationManager.ApplicationPaths.ProgramDataPath, "localization");
- }
- }
+ public string LocalizationPath => Path.Combine(_configurationManager.ApplicationPaths.ProgramDataPath, "localization");
public string RemoveDiacritics(string text)
{
@@ -357,7 +351,7 @@ namespace Emby.Server.Implementations.Localization
{
if (string.IsNullOrEmpty(rating))
{
- throw new ArgumentNullException("rating");
+ throw new ArgumentNullException(nameof(rating));
}
if (_unratedValues.Contains(rating, StringComparer.OrdinalIgnoreCase))
@@ -452,7 +446,7 @@ namespace Emby.Server.Implementations.Localization
{
if (string.IsNullOrEmpty(culture))
{
- throw new ArgumentNullException("culture");
+ throw new ArgumentNullException(nameof(culture));
}
const string prefix = "Core";
@@ -465,7 +459,7 @@ namespace Emby.Server.Implementations.Localization
{
if (string.IsNullOrEmpty(culture))
{
- throw new ArgumentNullException("culture");
+ throw new ArgumentNullException(nameof(culture));
}
var dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
@@ -494,7 +488,7 @@ namespace Emby.Server.Implementations.Localization
}
}
- private string GetResourceFilename(string culture)
+ private static string GetResourceFilename(string culture)
{
var parts = culture.Split('-');
diff --git a/Emby.Server.Implementations/Localization/TextLocalizer.cs b/Emby.Server.Implementations/Localization/TextLocalizer.cs
index 5188a959e..09445d428 100644
--- a/Emby.Server.Implementations/Localization/TextLocalizer.cs
+++ b/Emby.Server.Implementations/Localization/TextLocalizer.cs
@@ -12,13 +12,13 @@ namespace Emby.Server.Implementations.Localization
{
if (text == null)
{
- throw new ArgumentNullException("text");
+ throw new ArgumentNullException(nameof(text));
}
var chars = Normalize(text, NormalizationForm.FormD)
.Where(ch => CharUnicodeInfo.GetUnicodeCategory(ch) != UnicodeCategory.NonSpacingMark);
- return Normalize(String.Concat(chars), NormalizationForm.FormC);
+ return Normalize(string.Concat(chars), NormalizationForm.FormC);
}
private static string Normalize(string text, NormalizationForm form, bool stripStringOnFailure = true)
@@ -32,7 +32,7 @@ namespace Emby.Server.Implementations.Localization
catch (ArgumentException)
{
// will throw if input contains invalid unicode chars
- // https://mnaoumov.wordpress.com/2014/06/14/stripping-invalid-characters-from-utf-16-strings/
+ // https://mnaoumov.wordpress.com/2014/06/14/stripping-invalid-characters-from-utf-16-strings/
text = StripInvalidUnicodeCharacters(text);
return Normalize(text, form, false);
}
diff --git a/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs b/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs
index 792ffb3c4..2db7b01db 100644
--- a/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs
+++ b/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Chapters;
+using MediaBrowser.Controller.Chapters;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
@@ -46,7 +46,7 @@ namespace Emby.Server.Implementations.MediaEncoder
/// Gets the chapter images data path.
/// </summary>
/// <value>The chapter images data path.</value>
- private string GetChapterImagesPath(BaseItem item)
+ private static string GetChapterImagesPath(BaseItem item)
{
return Path.Combine(item.GetInternalMetadataPath(), "chapters");
}
@@ -202,7 +202,7 @@ namespace Emby.Server.Implementations.MediaEncoder
return Path.Combine(GetChapterImagesPath(video), filename);
}
- private List<string> GetSavedChapterImages(Video video, IDirectoryService directoryService)
+ private static List<string> GetSavedChapterImages(Video video, IDirectoryService directoryService)
{
var path = GetChapterImagesPath(video);
diff --git a/Emby.Server.Implementations/Net/DisposableManagedObjectBase.cs b/Emby.Server.Implementations/Net/DisposableManagedObjectBase.cs
index b721e8a26..9d880b0c9 100644
--- a/Emby.Server.Implementations/Net/DisposableManagedObjectBase.cs
+++ b/Emby.Server.Implementations/Net/DisposableManagedObjectBase.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
namespace Emby.Server.Implementations.Net
{
@@ -16,15 +16,17 @@ namespace Emby.Server.Implementations.Net
/// <param name="disposing">True if managed objects should be disposed, if false, only unmanaged resources should be released.</param>
protected abstract void Dispose(bool disposing);
+
+ //TODO Remove and reimplement using the IsDisposed property directly.
/// <summary>
- /// Throws and <see cref="System.ObjectDisposedException"/> if the <see cref="IsDisposed"/> property is true.
+ /// Throws an <see cref="System.ObjectDisposedException"/> if the <see cref="IsDisposed"/> property is true.
/// </summary>
/// <seealso cref="IsDisposed"/>
/// <exception cref="System.ObjectDisposedException">Thrown if the <see cref="IsDisposed"/> property is true.</exception>
/// <seealso cref="Dispose()"/>
protected virtual void ThrowIfDisposed()
{
- if (this.IsDisposed) throw new ObjectDisposedException(this.GetType().FullName);
+ if (IsDisposed) throw new ObjectDisposedException(GetType().Name);
}
#endregion
diff --git a/Emby.Server.Implementations/Net/SocketFactory.cs b/Emby.Server.Implementations/Net/SocketFactory.cs
index 3f93e767f..51d08bd6f 100644
--- a/Emby.Server.Implementations/Net/SocketFactory.cs
+++ b/Emby.Server.Implementations/Net/SocketFactory.cs
@@ -10,11 +10,11 @@ namespace Emby.Server.Implementations.Net
{
public class SocketFactory : ISocketFactory
{
- // THIS IS A LINKED FILE - SHARED AMONGST MULTIPLE PLATFORMS
+ // THIS IS A LINKED FILE - SHARED AMONGST MULTIPLE PLATFORMS
// Be careful to check any changes compile and work for all platform projects it is shared in.
// Not entirely happy with this. Would have liked to have done something more generic/reusable,
- // but that wasn't really the point so kept to YAGNI principal for now, even if the
+ // but that wasn't really the point so kept to YAGNI principal for now, even if the
// interfaces are a bit ugly, specific and make assumptions.
private readonly ILogger _logger;
@@ -23,7 +23,7 @@ namespace Emby.Server.Implementations.Net
{
if (logger == null)
{
- throw new ArgumentNullException("logger");
+ throw new ArgumentNullException(nameof(logger));
}
_logger = logger;
@@ -31,7 +31,7 @@ namespace Emby.Server.Implementations.Net
public ISocket CreateTcpSocket(IpAddressInfo remoteAddress, int remotePort)
{
- if (remotePort < 0) throw new ArgumentException("remotePort cannot be less than zero.", "remotePort");
+ if (remotePort < 0) throw new ArgumentException("remotePort cannot be less than zero.", nameof(remotePort));
var addressFamily = remoteAddress.AddressFamily == IpAddressFamily.InterNetwork
? AddressFamily.InterNetwork
@@ -67,7 +67,7 @@ namespace Emby.Server.Implementations.Net
/// <param name="localPort">An integer specifying the local port to bind the acceptSocket to.</param>
public ISocket CreateUdpSocket(int localPort)
{
- if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", "localPort");
+ if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", nameof(localPort));
var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);
try
@@ -86,7 +86,7 @@ namespace Emby.Server.Implementations.Net
public ISocket CreateUdpBroadcastSocket(int localPort)
{
- if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", "localPort");
+ if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", nameof(localPort));
var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);
try
@@ -111,7 +111,7 @@ namespace Emby.Server.Implementations.Net
/// <returns>An implementation of the <see cref="ISocket"/> interface used by RSSDP components to perform acceptSocket operations.</returns>
public ISocket CreateSsdpUdpSocket(IpAddressInfo localIpAddress, int localPort)
{
- if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", "localPort");
+ if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", nameof(localPort));
var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);
try
@@ -142,10 +142,10 @@ namespace Emby.Server.Implementations.Net
/// <returns></returns>
public ISocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort)
{
- if (ipAddress == null) throw new ArgumentNullException("ipAddress");
- if (ipAddress.Length == 0) throw new ArgumentException("ipAddress cannot be an empty string.", "ipAddress");
- if (multicastTimeToLive <= 0) throw new ArgumentException("multicastTimeToLive cannot be zero or less.", "multicastTimeToLive");
- if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", "localPort");
+ if (ipAddress == null) throw new ArgumentNullException(nameof(ipAddress));
+ if (ipAddress.Length == 0) throw new ArgumentException("ipAddress cannot be an empty string.", nameof(ipAddress));
+ if (multicastTimeToLive <= 0) throw new ArgumentException("multicastTimeToLive cannot be zero or less.", nameof(multicastTimeToLive));
+ if (localPort < 0) throw new ArgumentException("localPort cannot be less than zero.", nameof(localPort));
var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Dgram, System.Net.Sockets.ProtocolType.Udp);
@@ -212,26 +212,18 @@ namespace Emby.Server.Implementations.Net
{
}
- public override bool CanRead
- {
- get { return true; }
- }
- public override bool CanSeek
- {
- get { return false; }
- }
- public override bool CanWrite
- {
- get { return true; }
- }
- public override long Length
- {
- get { throw new NotImplementedException(); }
- }
+ public override bool CanRead => true;
+
+ public override bool CanSeek => false;
+
+ public override bool CanWrite => true;
+
+ public override long Length => throw new NotImplementedException();
+
public override long Position
{
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
+ get => throw new NotImplementedException();
+ set => throw new NotImplementedException();
}
public override void Write(byte[] buffer, int offset, int count)
diff --git a/Emby.Server.Implementations/Net/UdpSocket.cs b/Emby.Server.Implementations/Net/UdpSocket.cs
index 523ca3752..39f25e024 100644
--- a/Emby.Server.Implementations/Net/UdpSocket.cs
+++ b/Emby.Server.Implementations/Net/UdpSocket.cs
@@ -8,7 +8,7 @@ using MediaBrowser.Model.Net;
namespace Emby.Server.Implementations.Net
{
- // THIS IS A LINKED FILE - SHARED AMONGST MULTIPLE PLATFORMS
+ // THIS IS A LINKED FILE - SHARED AMONGST MULTIPLE PLATFORMS
// Be careful to check any changes compile and work for all platform projects it is shared in.
public sealed class UdpSocket : DisposableManagedObjectBase, ISocket
@@ -16,10 +16,7 @@ namespace Emby.Server.Implementations.Net
private Socket _Socket;
private int _LocalPort;
- public Socket Socket
- {
- get { return _Socket; }
- }
+ public Socket Socket => _Socket;
private readonly SocketAsyncEventArgs _receiveSocketAsyncEventArgs = new SocketAsyncEventArgs()
{
@@ -36,7 +33,7 @@ namespace Emby.Server.Implementations.Net
public UdpSocket(Socket socket, int localPort, IPAddress ip)
{
- if (socket == null) throw new ArgumentNullException("socket");
+ if (socket == null) throw new ArgumentNullException(nameof(socket));
_Socket = socket;
_LocalPort = localPort;
@@ -102,7 +99,7 @@ namespace Emby.Server.Implementations.Net
public UdpSocket(Socket socket, IpEndPointInfo endPoint)
{
- if (socket == null) throw new ArgumentNullException("socket");
+ if (socket == null) throw new ArgumentNullException(nameof(socket));
_Socket = socket;
_Socket.Connect(NetworkManager.ToIPEndPoint(endPoint));
diff --git a/Emby.Server.Implementations/Networking/IPNetwork/BigIntegerExt.cs b/Emby.Server.Implementations/Networking/IPNetwork/BigIntegerExt.cs
index afb202fa3..4da9c08d0 100644
--- a/Emby.Server.Implementations/Networking/IPNetwork/BigIntegerExt.cs
+++ b/Emby.Server.Implementations/Networking/IPNetwork/BigIntegerExt.cs
@@ -122,28 +122,28 @@ namespace System.Net
}
/// <summary>
- ///
+ ///
/// Reverse a Positive BigInteger ONLY
/// Bitwise ~ operator
- ///
+ ///
/// Input : FF FF FF FF
/// Width : 4
- /// Result : 00 00 00 00
- ///
- ///
+ /// Result : 00 00 00 00
+ ///
+ ///
/// Input : 00 00 00 00
/// Width : 4
- /// Result : FF FF FF FF
- ///
+ /// Result : FF FF FF FF
+ ///
/// Input : FF FF FF FF
/// Width : 8
/// Result : FF FF FF FF 00 00 00 00
- ///
- ///
+ ///
+ ///
/// Input : 00 00 00 00
/// Width : 8
/// Result : FF FF FF FF FF FF FF FF
- ///
+ ///
/// </summary>
/// <param name="input"></param>
/// <param name="width"></param>
diff --git a/Emby.Server.Implementations/Networking/IPNetwork/IPAddressCollection.cs b/Emby.Server.Implementations/Networking/IPNetwork/IPAddressCollection.cs
index 2b31a0a32..7fe6a8d3d 100644
--- a/Emby.Server.Implementations/Networking/IPNetwork/IPAddressCollection.cs
+++ b/Emby.Server.Implementations/Networking/IPNetwork/IPAddressCollection.cs
@@ -19,13 +19,7 @@ namespace System.Net
#region Count, Array, Enumerator
- public BigInteger Count
- {
- get
- {
- return this._ipnetwork.Total;
- }
- }
+ public BigInteger Count => this._ipnetwork.Total;
public IPAddress this[BigInteger i]
{
@@ -33,7 +27,7 @@ namespace System.Net
{
if (i >= this.Count)
{
- throw new ArgumentOutOfRangeException("i");
+ throw new ArgumentOutOfRangeException(nameof(i));
}
byte width = this._ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetwork ? (byte)32 : (byte)128;
IPNetworkCollection ipn = this._ipnetwork.Subnet(width);
@@ -57,10 +51,7 @@ namespace System.Net
#region IEnumerator<IPNetwork> Members
- public IPAddress Current
- {
- get { return this[this._enumerator]; }
- }
+ public IPAddress Current => this[this._enumerator];
#endregion
@@ -76,10 +67,7 @@ namespace System.Net
#region IEnumerator Members
- object IEnumerator.Current
- {
- get { return this.Current; }
- }
+ object IEnumerator.Current => this.Current;
public bool MoveNext()
{
diff --git a/Emby.Server.Implementations/Networking/IPNetwork/IPNetwork.cs b/Emby.Server.Implementations/Networking/IPNetwork/IPNetwork.cs
index 8d0fb7997..9a0020de7 100644
--- a/Emby.Server.Implementations/Networking/IPNetwork/IPNetwork.cs
+++ b/Emby.Server.Implementations/Networking/IPNetwork/IPNetwork.cs
@@ -7,7 +7,7 @@ using System.Text.RegularExpressions;
namespace System.Net
{
/// <summary>
- /// IP Network utility class.
+ /// IP Network utility class.
/// Use IPNetwork.Parse to create instances.
/// </summary>
public class IPNetwork : IComparable<IPNetwork>
@@ -41,44 +41,19 @@ namespace System.Net
/// <summary>
/// Network address
/// </summary>
- public IPAddress Network
- {
- get
- {
-
- return IPNetwork.ToIPAddress(this._network, this._family);
- }
- }
+ public IPAddress Network => IPNetwork.ToIPAddress(this._network, this._family);
/// <summary>
/// Address Family
/// </summary>
- public AddressFamily AddressFamily
- {
- get
- {
- return this._family;
- }
- }
+ public AddressFamily AddressFamily => this._family;
- private BigInteger _netmask
- {
- get
- {
- return IPNetwork.ToUint(this._cidr, this._family);
- }
- }
+ private BigInteger _netmask => IPNetwork.ToUint(this._cidr, this._family);
/// <summary>
/// Netmask
/// </summary>
- public IPAddress Netmask
- {
- get
- {
- return IPNetwork.ToIPAddress(this._netmask, this._family);
- }
- }
+ public IPAddress Netmask => IPNetwork.ToIPAddress(this._netmask, this._family);
private BigInteger _broadcast
{
@@ -171,13 +146,7 @@ namespace System.Net
/// <summary>
/// The CIDR netmask notation
/// </summary>
- public byte Cidr
- {
- get
- {
- return this._cidr;
- }
- }
+ public byte Cidr => this._cidr;
#endregion
@@ -195,7 +164,7 @@ namespace System.Net
int maxCidr = family == Sockets.AddressFamily.InterNetwork ? 32 : 128;
if (cidr > maxCidr)
{
- throw new ArgumentOutOfRangeException("cidr");
+ throw new ArgumentOutOfRangeException(nameof(cidr));
}
this._ipaddress = ipaddress;
@@ -210,7 +179,7 @@ namespace System.Net
/// <summary>
/// 192.168.168.100 - 255.255.255.0
- ///
+ ///
/// Network : 192.168.168.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@@ -231,7 +200,7 @@ namespace System.Net
/// <summary>
/// 192.168.168.100/24
- ///
+ ///
/// Network : 192.168.168.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@@ -253,7 +222,7 @@ namespace System.Net
/// <summary>
/// 192.168.168.100 255.255.255.0
- ///
+ ///
/// Network : 192.168.168.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@@ -276,7 +245,7 @@ namespace System.Net
/// <summary>
/// 192.168.0.1/24
/// 192.168.0.1 255.255.255.0
- ///
+ ///
/// Network : 192.168.0.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@@ -303,7 +272,7 @@ namespace System.Net
/// <summary>
/// 192.168.168.100 - 255.255.255.0
- ///
+ ///
/// Network : 192.168.168.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@@ -329,7 +298,7 @@ namespace System.Net
/// <summary>
/// 192.168.168.100/24
- ///
+ ///
/// Network : 192.168.168.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@@ -354,7 +323,7 @@ namespace System.Net
/// <summary>
/// 192.168.0.1/24
/// 192.168.0.1 255.255.255.0
- ///
+ ///
/// Network : 192.168.0.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@@ -379,7 +348,7 @@ namespace System.Net
/// <summary>
/// 192.168.0.1/24
/// 192.168.0.1 255.255.255.0
- ///
+ ///
/// Network : 192.168.0.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@@ -409,7 +378,7 @@ namespace System.Net
/// <summary>
/// 192.168.168.100 - 255.255.255.0
- ///
+ ///
/// Network : 192.168.168.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@@ -427,7 +396,7 @@ namespace System.Net
{
if (tryParse == false)
{
- throw new ArgumentNullException("ipaddress");
+ throw new ArgumentNullException(nameof(ipaddress));
}
ipnetwork = null;
return;
@@ -437,7 +406,7 @@ namespace System.Net
{
if (tryParse == false)
{
- throw new ArgumentNullException("netmask");
+ throw new ArgumentNullException(nameof(netmask));
}
ipnetwork = null;
return;
@@ -477,7 +446,7 @@ namespace System.Net
{
if (tryParse == false)
{
- throw new ArgumentNullException("network");
+ throw new ArgumentNullException(nameof(network));
}
ipnetwork = null;
return;
@@ -520,7 +489,7 @@ namespace System.Net
/// <summary>
/// 192.168.168.100 255.255.255.0
- ///
+ ///
/// Network : 192.168.168.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@@ -538,7 +507,7 @@ namespace System.Net
{
if (tryParse == false)
{
- throw new ArgumentNullException("ipaddress");
+ throw new ArgumentNullException(nameof(ipaddress));
}
ipnetwork = null;
return;
@@ -548,7 +517,7 @@ namespace System.Net
{
if (tryParse == false)
{
- throw new ArgumentNullException("netmask");
+ throw new ArgumentNullException(nameof(netmask));
}
ipnetwork = null;
return;
@@ -578,7 +547,7 @@ namespace System.Net
/// <summary>
/// 192.168.168.100/24
- ///
+ ///
/// Network : 192.168.168.0
/// Netmask : 255.255.255.0
/// Cidr : 24
@@ -596,7 +565,7 @@ namespace System.Net
{
if (tryParse == false)
{
- throw new ArgumentNullException("ipaddress");
+ throw new ArgumentNullException(nameof(ipaddress));
}
ipnetwork = null;
return;
@@ -680,7 +649,7 @@ namespace System.Net
{
if (tryParse == false)
{
- throw new ArgumentNullException("ipaddress");
+ throw new ArgumentNullException(nameof(ipaddress));
}
uintIpAddress = null;
return;
@@ -751,7 +720,7 @@ namespace System.Net
{
if (tryParse == false)
{
- throw new ArgumentOutOfRangeException("cidr");
+ throw new ArgumentOutOfRangeException(nameof(cidr));
}
uintNetmask = null;
return;
@@ -761,7 +730,7 @@ namespace System.Net
{
if (tryParse == false)
{
- throw new ArgumentOutOfRangeException("cidr");
+ throw new ArgumentOutOfRangeException(nameof(cidr));
}
uintNetmask = null;
return;
@@ -872,7 +841,7 @@ namespace System.Net
{
if (tryParse == false)
{
- throw new ArgumentNullException("netmask");
+ throw new ArgumentNullException(nameof(netmask));
}
cidr = null;
return;
@@ -962,7 +931,7 @@ namespace System.Net
/// 20180217 lduchosal
/// impossible to reach code, byte cannot be negative :
- ///
+ ///
/// if (cidr < 0) {
/// if (tryParse == false) {
/// throw new ArgumentOutOfRangeException("cidr");
@@ -976,7 +945,7 @@ namespace System.Net
{
if (tryParse == false)
{
- throw new ArgumentOutOfRangeException("cidr");
+ throw new ArgumentOutOfRangeException(nameof(cidr));
}
netmask = null;
return;
@@ -1042,7 +1011,7 @@ namespace System.Net
if (netmask == null)
{
- throw new ArgumentNullException("netmask");
+ throw new ArgumentNullException(nameof(netmask));
}
BigInteger uintNetmask = IPNetwork.ToBigInteger(netmask);
bool valid = IPNetwork.InternalValidNetmask(uintNetmask, netmask.AddressFamily);
@@ -1145,7 +1114,7 @@ namespace System.Net
if (ipaddress == null)
{
- throw new ArgumentNullException("ipaddress");
+ throw new ArgumentNullException(nameof(ipaddress));
}
if (AddressFamily != ipaddress.AddressFamily)
@@ -1174,7 +1143,7 @@ namespace System.Net
if (network2 == null)
{
- throw new ArgumentNullException("network2");
+ throw new ArgumentNullException(nameof(network2));
}
BigInteger uintNetwork = _network;
@@ -1203,7 +1172,7 @@ namespace System.Net
if (network2 == null)
{
- throw new ArgumentNullException("network2");
+ throw new ArgumentNullException(nameof(network2));
}
BigInteger uintNetwork = _network;
@@ -1242,40 +1211,22 @@ namespace System.Net
/// 10.0.0.0/8
/// </summary>
/// <returns></returns>
- public static IPNetwork IANA_ABLK_RESERVED1
- {
- get
- {
- return _iana_ablock_reserved.Value;
- }
- }
+ public static IPNetwork IANA_ABLK_RESERVED1 => _iana_ablock_reserved.Value;
/// <summary>
/// 172.12.0.0/12
/// </summary>
/// <returns></returns>
- public static IPNetwork IANA_BBLK_RESERVED1
- {
- get
- {
- return _iana_bblock_reserved.Value;
- }
- }
+ public static IPNetwork IANA_BBLK_RESERVED1 => _iana_bblock_reserved.Value;
/// <summary>
/// 192.168.0.0/16
/// </summary>
/// <returns></returns>
- public static IPNetwork IANA_CBLK_RESERVED1
- {
- get
- {
- return _iana_cblock_reserved.Value;
- }
- }
+ public static IPNetwork IANA_CBLK_RESERVED1 => _iana_cblock_reserved.Value;
/// <summary>
- /// return true if ipaddress is contained in
+ /// return true if ipaddress is contained in
/// IANA_ABLK_RESERVED1, IANA_BBLK_RESERVED1, IANA_CBLK_RESERVED1
/// </summary>
/// <param name="ipaddress"></param>
@@ -1285,7 +1236,7 @@ namespace System.Net
if (ipaddress == null)
{
- throw new ArgumentNullException("ipaddress");
+ throw new ArgumentNullException(nameof(ipaddress));
}
return IPNetwork.IANA_ABLK_RESERVED1.Contains(ipaddress)
@@ -1294,7 +1245,7 @@ namespace System.Net
}
/// <summary>
- /// return true if ipnetwork is contained in
+ /// return true if ipnetwork is contained in
/// IANA_ABLK_RESERVED1, IANA_BBLK_RESERVED1, IANA_CBLK_RESERVED1
/// </summary>
/// <returns></returns>
@@ -1356,7 +1307,7 @@ namespace System.Net
{
if (trySubnet == false)
{
- throw new ArgumentNullException("network");
+ throw new ArgumentNullException(nameof(network));
}
ipnetworkCollection = null;
return;
@@ -1367,7 +1318,7 @@ namespace System.Net
{
if (trySubnet == false)
{
- throw new ArgumentOutOfRangeException("cidr");
+ throw new ArgumentOutOfRangeException(nameof(cidr));
}
ipnetworkCollection = null;
return;
@@ -1395,9 +1346,9 @@ namespace System.Net
/// <summary>
/// Supernet two consecutive cidr equal subnet into a single one
- /// 192.168.0.0/24 + 192.168.1.0/24 = 192.168.0.0/23
+ /// 192.168.0.0/24 + 192.168.1.0/24 = 192.168.0.0/23
/// 10.1.0.0/16 + 10.0.0.0/16 = 10.0.0.0/15
- /// 192.168.0.0/24 + 192.168.0.0/25 = 192.168.0.0/24
+ /// 192.168.0.0/24 + 192.168.0.0/25 = 192.168.0.0/24
/// </summary>
/// <param name="network2"></param>
/// <returns></returns>
@@ -1410,9 +1361,9 @@ namespace System.Net
/// <summary>
/// Try to supernet two consecutive cidr equal subnet into a single one
- /// 192.168.0.0/24 + 192.168.1.0/24 = 192.168.0.0/23
+ /// 192.168.0.0/24 + 192.168.1.0/24 = 192.168.0.0/23
/// 10.1.0.0/16 + 10.0.0.0/16 = 10.0.0.0/15
- /// 192.168.0.0/24 + 192.168.0.0/25 = 192.168.0.0/24
+ /// 192.168.0.0/24 + 192.168.0.0/25 = 192.168.0.0/24
/// </summary>
/// <param name="network2"></param>
/// <returns></returns>
@@ -1438,7 +1389,7 @@ namespace System.Net
{
if (trySupernet == false)
{
- throw new ArgumentNullException("network1");
+ throw new ArgumentNullException(nameof(network1));
}
supernet = null;
return;
@@ -1448,7 +1399,7 @@ namespace System.Net
{
if (trySupernet == false)
{
- throw new ArgumentNullException("network2");
+ throw new ArgumentNullException(nameof(network2));
}
supernet = null;
return;
@@ -1492,7 +1443,7 @@ namespace System.Net
{
if (trySupernet == false)
{
- throw new ArgumentOutOfRangeException("network");
+ throw new ArgumentOutOfRangeException(nameof(trySupernet), "TrySupernet was false while the first and last networks are not adjacent.");
}
supernet = null;
return;
@@ -1536,8 +1487,7 @@ namespace System.Net
/// 192.168.0.0/24 + 192.168.1.0/24 = 192.168.0.0/23
/// 192.168.0.0/24 + 192.168.1.0/24 + 192.168.2.0/24 + 192.168.3.0/24 = 192.168.0.0/22
/// </summary>
- /// <param name="ipnetworks"></param>
- /// <param name="supernet"></param>
+ /// <param name="ipnetworks">The IP networks</param>
/// <returns></returns>
public static IPNetwork[] Supernet(IPNetwork[] ipnetworks)
{
@@ -1573,7 +1523,7 @@ namespace System.Net
{
if (trySupernet == false)
{
- throw new ArgumentNullException("ipnetworks");
+ throw new ArgumentNullException(nameof(ipnetworks));
}
supernet = null;
return false;
@@ -1684,12 +1634,12 @@ namespace System.Net
if (string.IsNullOrEmpty(start))
{
- throw new ArgumentNullException("start");
+ throw new ArgumentNullException(nameof(start));
}
if (string.IsNullOrEmpty(end))
{
- throw new ArgumentNullException("end");
+ throw new ArgumentNullException(nameof(end));
}
IPAddress startIP;
@@ -1750,7 +1700,7 @@ namespace System.Net
{
if (tryWide == false)
{
- throw new ArgumentNullException("ipnetworks");
+ throw new ArgumentNullException(nameof(ipnetworks));
}
ipnetwork = null;
return;
@@ -1841,13 +1791,13 @@ namespace System.Net
#region TryGuessCidr
/// <summary>
- ///
- /// Class Leading bits Default netmask
- /// A (CIDR /8) 00 255.0.0.0
- /// A (CIDR /8) 01 255.0.0.0
- /// B (CIDR /16) 10 255.255.0.0
- /// C (CIDR /24) 11 255.255.255.0
- ///
+ ///
+ /// Class Leading bits Default netmask
+ /// A (CIDR /8) 00 255.0.0.0
+ /// A (CIDR /8) 01 255.0.0.0
+ /// B (CIDR /16) 10 255.255.0.0
+ /// C (CIDR /24) 11 255.255.255.0
+ ///
/// </summary>
/// <param name="ip"></param>
/// <param name="cidr"></param>
@@ -1931,7 +1881,7 @@ namespace System.Net
/**
* Need a better way to do it
- *
+ *
#region TrySubstractNetwork
public static bool TrySubstractNetwork(IPNetwork[] ipnetworks, IPNetwork substract, out IEnumerable<IPNetwork> result) {
@@ -1973,7 +1923,7 @@ namespace System.Net
#region IComparable<IPNetwork> Members
- public static Int32 Compare(IPNetwork left, IPNetwork right)
+ public static int Compare(IPNetwork left, IPNetwork right)
{
// two null IPNetworks are equal
if (ReferenceEquals(left, null) && ReferenceEquals(right, null)) return 0;
@@ -1994,12 +1944,12 @@ namespace System.Net
return result;
}
- public Int32 CompareTo(IPNetwork other)
+ public int CompareTo(IPNetwork other)
{
return Compare(this, other);
}
- public Int32 CompareTo(Object obj)
+ public int CompareTo(object obj)
{
// null is at less
if (obj == null) return 1;
@@ -2012,7 +1962,7 @@ namespace System.Net
{
throw new ArgumentException(
"The supplied parameter is an invalid type. Please supply an IPNetwork type.",
- "obj");
+ nameof(obj));
}
// perform the comparision
@@ -2023,17 +1973,17 @@ namespace System.Net
#region IEquatable<IPNetwork> Members
- public static Boolean Equals(IPNetwork left, IPNetwork right)
+ public static bool Equals(IPNetwork left, IPNetwork right)
{
return Compare(left, right) == 0;
}
- public Boolean Equals(IPNetwork other)
+ public bool Equals(IPNetwork other)
{
return Equals(this, other);
}
- public override Boolean Equals(Object obj)
+ public override bool Equals(object obj)
{
return Equals(this, obj as IPNetwork);
}
@@ -2042,22 +1992,22 @@ namespace System.Net
#region Operators
- public static Boolean operator ==(IPNetwork left, IPNetwork right)
+ public static bool operator ==(IPNetwork left, IPNetwork right)
{
return Equals(left, right);
}
- public static Boolean operator !=(IPNetwork left, IPNetwork right)
+ public static bool operator !=(IPNetwork left, IPNetwork right)
{
return !Equals(left, right);
}
- public static Boolean operator <(IPNetwork left, IPNetwork right)
+ public static bool operator <(IPNetwork left, IPNetwork right)
{
return Compare(left, right) < 0;
}
- public static Boolean operator >(IPNetwork left, IPNetwork right)
+ public static bool operator >(IPNetwork left, IPNetwork right)
{
return Compare(left, right) > 0;
}
diff --git a/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs b/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs
index 35cff88dc..48d404124 100644
--- a/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs
+++ b/Emby.Server.Implementations/Networking/IPNetwork/IPNetworkCollection.cs
@@ -11,22 +11,12 @@ namespace System.Net
private byte _cidrSubnet;
private IPNetwork _ipnetwork;
- private byte _cidr
- {
- get { return this._ipnetwork.Cidr; }
- }
- private BigInteger _broadcast
- {
- get { return IPNetwork.ToBigInteger(this._ipnetwork.Broadcast); }
- }
- private BigInteger _lastUsable
- {
- get { return IPNetwork.ToBigInteger(this._ipnetwork.LastUsable); }
- }
- private BigInteger _network
- {
- get { return IPNetwork.ToBigInteger(this._ipnetwork.Network); }
- }
+ private byte _cidr => this._ipnetwork.Cidr;
+
+ private BigInteger _broadcast => IPNetwork.ToBigInteger(this._ipnetwork.Broadcast);
+
+ private BigInteger _lastUsable => IPNetwork.ToBigInteger(this._ipnetwork.LastUsable);
+ private BigInteger _network => IPNetwork.ToBigInteger(this._ipnetwork.Network);
#if TRAVISCI
public
#else
@@ -38,7 +28,7 @@ namespace System.Net
int maxCidr = ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetwork ? 32 : 128;
if (cidrSubnet > maxCidr)
{
- throw new ArgumentOutOfRangeException("cidrSubnet");
+ throw new ArgumentOutOfRangeException(nameof(cidrSubnet));
}
if (cidrSubnet < ipnetwork.Cidr)
@@ -68,7 +58,7 @@ namespace System.Net
{
if (i >= this.Count)
{
- throw new ArgumentOutOfRangeException("i");
+ throw new ArgumentOutOfRangeException(nameof(i));
}
BigInteger last = this._ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetworkV6
@@ -96,10 +86,7 @@ namespace System.Net
#region IEnumerator<IPNetwork> Members
- public IPNetwork Current
- {
- get { return this[this._enumerator]; }
- }
+ public IPNetwork Current => this[this._enumerator];
#endregion
@@ -115,10 +102,7 @@ namespace System.Net
#region IEnumerator Members
- object IEnumerator.Current
- {
- get { return this.Current; }
- }
+ object IEnumerator.Current => this.Current;
public bool MoveNext()
{
diff --git a/Emby.Server.Implementations/Networking/NetworkManager.cs b/Emby.Server.Implementations/Networking/NetworkManager.cs
index 260d20e35..dbf89d7e1 100644
--- a/Emby.Server.Implementations/Networking/NetworkManager.cs
+++ b/Emby.Server.Implementations/Networking/NetworkManager.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
@@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.Networking
.ToList();
}
- private bool FilterIpAddress(IPAddress address)
+ private static bool FilterIpAddress(IPAddress address)
{
var addressString = address.ToString();
@@ -228,7 +228,7 @@ namespace Emby.Server.Implementations.Networking
subnet_Test++;
}
- var subnet_Match = String.Join(".", unicastIPAddressInformation.Address.ToString().Split('.').Take(subnet_Test).ToArray());
+ var subnet_Match = string.Join(".", unicastIPAddressInformation.Address.ToString().Split('.').Take(subnet_Test).ToArray());
// TODO: Is this check necessary?
if (adapter.OperationalStatus == OperationalStatus.Up)
@@ -245,7 +245,7 @@ namespace Emby.Server.Implementations.Networking
}
}
- private bool Is172AddressPrivate(string endpoint)
+ private static bool Is172AddressPrivate(string endpoint)
{
for (var i = 16; i <= 31; i++)
{
@@ -268,7 +268,7 @@ namespace Emby.Server.Implementations.Networking
return IsAddressInSubnets(IPAddress.Parse(addressString), addressString, subnets);
}
- private bool IsAddressInSubnets(IPAddress address, string addressString, string[] subnets)
+ private static bool IsAddressInSubnets(IPAddress address, string addressString, string[] subnets)
{
foreach (var subnet in subnets)
{
@@ -296,7 +296,7 @@ namespace Emby.Server.Implementations.Networking
{
if (string.IsNullOrEmpty(endpoint))
{
- throw new ArgumentNullException("endpoint");
+ throw new ArgumentNullException(nameof(endpoint));
}
IPAddress address;
@@ -380,7 +380,7 @@ namespace Emby.Server.Implementations.Networking
return false;
}
- private Task<IPAddress[]> GetIpAddresses(string hostName)
+ private static Task<IPAddress[]> GetIpAddresses(string hostName)
{
return Dns.GetHostAddressesAsync(hostName);
}
@@ -436,7 +436,7 @@ namespace Emby.Server.Implementations.Networking
.ToList();
}
- private async Task<IEnumerable<IPAddress>> GetLocalIpAddressesFallback()
+ private static async Task<IEnumerable<IPAddress>> GetLocalIpAddressesFallback()
{
var host = await Dns.GetHostEntryAsync(Dns.GetHostName()).ConfigureAwait(false);
@@ -480,7 +480,7 @@ namespace Emby.Server.Implementations.Networking
return _macAddresses;
}
- private List<string> GetMacAddressesInternal()
+ private static List<string> GetMacAddressesInternal()
{
return NetworkInterface.GetAllNetworkInterfaces()
.Where(i => i.NetworkInterfaceType != NetworkInterfaceType.Loopback)
@@ -497,8 +497,9 @@ namespace Emby.Server.Implementations.Networking
return physicalAddress.ToString();
}
- catch (Exception ex)
+ catch (Exception)
{
+ //TODO Log exception.
return null;
}
})
@@ -526,7 +527,7 @@ namespace Emby.Server.Implementations.Networking
/// <exception cref="System.FormatException"></exception>
private static async Task<IPEndPoint> Parse(string endpointstring, int defaultport)
{
- if (String.IsNullOrEmpty(endpointstring)
+ if (string.IsNullOrEmpty(endpointstring)
|| endpointstring.Trim().Length == 0)
{
throw new ArgumentException("Endpoint descriptor may not be empty.");
@@ -536,7 +537,7 @@ namespace Emby.Server.Implementations.Networking
(defaultport < IPEndPoint.MinPort
|| defaultport > IPEndPoint.MaxPort))
{
- throw new ArgumentException(String.Format("Invalid default port '{0}'", defaultport));
+ throw new ArgumentException(string.Format("Invalid default port '{0}'", defaultport));
}
string[] values = endpointstring.Split(new char[] { ':' });
@@ -557,7 +558,7 @@ namespace Emby.Server.Implementations.Networking
//could [a:b:c]:d
if (values[0].StartsWith("[") && values[values.Length - 2].EndsWith("]"))
{
- string ipaddressstring = String.Join(":", values.Take(values.Length - 1).ToArray());
+ string ipaddressstring = string.Join(":", values.Take(values.Length - 1).ToArray());
ipaddy = IPAddress.Parse(ipaddressstring);
port = GetPort(values[values.Length - 1]);
}
@@ -569,11 +570,11 @@ namespace Emby.Server.Implementations.Networking
}
else
{
- throw new FormatException(String.Format("Invalid endpoint ipaddress '{0}'", endpointstring));
+ throw new FormatException(string.Format("Invalid endpoint ipaddress '{0}'", endpointstring));
}
if (port == -1)
- throw new ArgumentException(String.Format("No port specified: '{0}'", endpointstring));
+ throw new ArgumentException(string.Format("No port specified: '{0}'", endpointstring));
return new IPEndPoint(ipaddy, port);
}
@@ -590,11 +591,11 @@ namespace Emby.Server.Implementations.Networking
{
int port;
- if (!Int32.TryParse(p, out port)
+ if (!int.TryParse(p, out port)
|| port < IPEndPoint.MinPort
|| port > IPEndPoint.MaxPort)
{
- throw new FormatException(String.Format("Invalid end point port '{0}'", p));
+ throw new FormatException(string.Format("Invalid end point port '{0}'", p));
}
return port;
@@ -611,7 +612,7 @@ namespace Emby.Server.Implementations.Networking
var hosts = await Dns.GetHostAddressesAsync(p).ConfigureAwait(false);
if (hosts == null || hosts.Length == 0)
- throw new ArgumentException(String.Format("Host not found: {0}", p));
+ throw new ArgumentException(string.Format("Host not found: {0}", p));
return hosts[0];
}
diff --git a/Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs b/Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs
index 908fa65de..f2bc4c07d 100644
--- a/Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs
+++ b/Emby.Server.Implementations/Playlists/ManualPlaylistsFolder.cs
@@ -25,28 +25,13 @@ namespace Emby.Server.Implementations.Playlists
}
[IgnoreDataMember]
- public override bool IsHidden
- {
- get
- {
- return true;
- }
- }
+ public override bool IsHidden => true;
[IgnoreDataMember]
- public override bool SupportsInheritedParentImages
- {
- get
- {
- return false;
- }
- }
+ public override bool SupportsInheritedParentImages => false;
[IgnoreDataMember]
- public override string CollectionType
- {
- get { return MediaBrowser.Model.Entities.CollectionType.Playlists; }
- }
+ public override string CollectionType => MediaBrowser.Model.Entities.CollectionType.Playlists;
protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query)
{
diff --git a/Emby.Server.Implementations/Playlists/PlaylistManager.cs b/Emby.Server.Implementations/Playlists/PlaylistManager.cs
index 470711b9e..38fbac030 100644
--- a/Emby.Server.Implementations/Playlists/PlaylistManager.cs
+++ b/Emby.Server.Implementations/Playlists/PlaylistManager.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Playlists;
@@ -455,10 +455,17 @@ namespace Emby.Server.Implementations.Playlists
return MakeRelativePath(_fileSystem.GetDirectoryName(playlistPath), itemPath);
}
- private static String MakeRelativePath(string folderPath, string fileAbsolutePath)
+ private static string MakeRelativePath(string folderPath, string fileAbsolutePath)
{
- if (String.IsNullOrEmpty(folderPath)) throw new ArgumentNullException("folderPath");
- if (String.IsNullOrEmpty(fileAbsolutePath)) throw new ArgumentNullException("filePath");
+ if (string.IsNullOrEmpty(folderPath))
+ {
+ throw new ArgumentException("Folder path was null or empty.", nameof(folderPath));
+ }
+
+ if (string.IsNullOrEmpty(fileAbsolutePath))
+ {
+ throw new ArgumentException("File absolute path was null or empty.", nameof(fileAbsolutePath));
+ }
if (!folderPath.EndsWith(Path.DirectorySeparatorChar.ToString()))
{
@@ -471,7 +478,7 @@ namespace Emby.Server.Implementations.Playlists
if (folderUri.Scheme != fileAbsoluteUri.Scheme) { return fileAbsolutePath; } // path can't be made relative.
Uri relativeUri = folderUri.MakeRelativeUri(fileAbsoluteUri);
- String relativePath = Uri.UnescapeDataString(relativeUri.ToString());
+ string relativePath = Uri.UnescapeDataString(relativeUri.ToString());
if (fileAbsoluteUri.Scheme.Equals("file", StringComparison.CurrentCultureIgnoreCase))
{
diff --git a/Emby.Server.Implementations/Properties/AssemblyInfo.cs b/Emby.Server.Implementations/Properties/AssemblyInfo.cs
index 28ffcbac6..9484e2d43 100644
--- a/Emby.Server.Implementations/Properties/AssemblyInfo.cs
+++ b/Emby.Server.Implementations/Properties/AssemblyInfo.cs
@@ -1,28 +1,21 @@
-using System.Resources;
using System.Reflection;
-using System.Runtime.CompilerServices;
+using System.Resources;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Emby.Server.Implementations")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Emby.Server.Implementations")]
-[assembly: AssemblyCopyright("Copyright © 2016")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")] \ No newline at end of file
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
diff --git a/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs b/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs
index 09dcc320a..904e93c56 100644
--- a/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs
@@ -70,10 +70,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
};
}
- public string Key
- {
- get { return "RefreshChapterImages"; }
- }
+ public string Key => "RefreshChapterImages";
/// <summary>
/// Returns the task to be executed
@@ -156,6 +153,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
}
catch (ObjectDisposedException)
{
+ //TODO Investigate and properly fix.
break;
}
}
@@ -165,33 +163,18 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// Gets the name of the task
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get
- {
- return "Chapter image extraction";
- }
- }
+ public string Name => "Chapter image extraction";
/// <summary>
/// Gets the description.
/// </summary>
/// <value>The description.</value>
- public string Description
- {
- get { return "Creates thumbnails for videos that have chapters."; }
- }
+ public string Description => "Creates thumbnails for videos that have chapters.";
/// <summary>
/// Gets the category.
/// </summary>
/// <value>The category.</value>
- public string Category
- {
- get
- {
- return "Library";
- }
- }
+ public string Category => "Library";
}
}
diff --git a/Emby.Server.Implementations/ScheduledTasks/PeopleValidationTask.cs b/Emby.Server.Implementations/ScheduledTasks/PeopleValidationTask.cs
index 02568fe3a..366ad889c 100644
--- a/Emby.Server.Implementations/ScheduledTasks/PeopleValidationTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/PeopleValidationTask.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Library;
+using MediaBrowser.Controller.Library;
using System;
using System.Collections.Generic;
using System.Threading;
@@ -24,6 +24,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// Initializes a new instance of the <see cref="PeopleValidationTask" /> class.
/// </summary>
/// <param name="libraryManager">The library manager.</param>
+ /// <param name="appHost">The server application host</param>
public PeopleValidationTask(ILibraryManager libraryManager, IServerApplicationHost appHost)
{
_libraryManager = libraryManager;
@@ -35,8 +36,8 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// </summary>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{
- return new[]
- {
+ return new[]
+ {
// Every so often
new TaskTriggerInfo
{
@@ -46,10 +47,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
};
}
- public string Key
- {
- get { return "RefreshPeople"; }
- }
+ public string Key => "RefreshPeople";
/// <summary>
/// Returns the task to be executed
@@ -66,30 +64,18 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// Gets the name of the task
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return "Refresh people"; }
- }
+ public string Name => "Refresh people";
/// <summary>
/// Gets the description.
/// </summary>
/// <value>The description.</value>
- public string Description
- {
- get { return "Updates metadata for actors and directors in your media library."; }
- }
+ public string Description => "Updates metadata for actors and directors in your media library.";
/// <summary>
/// Gets the category.
/// </summary>
/// <value>The category.</value>
- public string Category
- {
- get
- {
- return "Library";
- }
- }
+ public string Category => "Library";
}
}
diff --git a/Emby.Server.Implementations/ScheduledTasks/RefreshMediaLibraryTask.cs b/Emby.Server.Implementations/ScheduledTasks/RefreshMediaLibraryTask.cs
index fb07b8e99..bd49277ad 100644
--- a/Emby.Server.Implementations/ScheduledTasks/RefreshMediaLibraryTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/RefreshMediaLibraryTask.cs
@@ -36,8 +36,8 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{
- return new[] {
-
+ return new[] {
+
// Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(12).Ticks}
};
@@ -62,35 +62,20 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return "Scan media library"; }
- }
+ public string Name => "Scan media library";
/// <summary>
/// Gets the description.
/// </summary>
/// <value>The description.</value>
- public string Description
- {
- get { return "Scans your media library and refreshes metatata based on configuration."; }
- }
+ public string Description => "Scans your media library and refreshes metatata based on configuration.";
/// <summary>
/// Gets the category.
/// </summary>
/// <value>The category.</value>
- public string Category
- {
- get
- {
- return "Library";
- }
- }
+ public string Category => "Library";
- public string Key
- {
- get { return "RefreshLibrary"; }
- }
+ public string Key => "RefreshLibrary";
}
}
diff --git a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
index 0bebca8fc..ec54ce71a 100644
--- a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -78,23 +78,23 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
if (scheduledTask == null)
{
- throw new ArgumentNullException("scheduledTask");
+ throw new ArgumentNullException(nameof(scheduledTask));
}
if (applicationPaths == null)
{
- throw new ArgumentNullException("applicationPaths");
+ throw new ArgumentNullException(nameof(applicationPaths));
}
if (taskManager == null)
{
- throw new ArgumentNullException("taskManager");
+ throw new ArgumentNullException(nameof(taskManager));
}
if (jsonSerializer == null)
{
- throw new ArgumentNullException("jsonSerializer");
+ throw new ArgumentNullException(nameof(jsonSerializer));
}
if (logger == null)
{
- throw new ArgumentNullException("logger");
+ throw new ArgumentNullException(nameof(logger));
}
ScheduledTask = scheduledTask;
@@ -171,28 +171,19 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ScheduledTask.Name; }
- }
+ public string Name => ScheduledTask.Name;
/// <summary>
/// Gets the description.
/// </summary>
/// <value>The description.</value>
- public string Description
- {
- get { return ScheduledTask.Description; }
- }
+ public string Description => ScheduledTask.Description;
/// <summary>
/// Gets the category.
/// </summary>
/// <value>The category.</value>
- public string Category
- {
- get { return ScheduledTask.Category; }
- }
+ public string Category => ScheduledTask.Category;
/// <summary>
/// Gets the current cancellation token
@@ -241,15 +232,12 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// <value>The triggers.</value>
private Tuple<TaskTriggerInfo, ITaskTrigger>[] InternalTriggers
{
- get
- {
- return _triggers;
- }
+ get => _triggers;
set
{
if (value == null)
{
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
// Cleanup current triggers
@@ -280,7 +268,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
if (value == null)
{
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
// This null check is not great, but is needed to handle bad user input, or user mucking with the config file incorrectly
@@ -730,7 +718,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
if (!info.TimeOfDayTicks.HasValue)
{
- throw new ArgumentNullException();
+ throw new ArgumentException("Info did not contain a TimeOfDayTicks.",nameof(info));
}
return new DailyTrigger
@@ -744,12 +732,12 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
if (!info.TimeOfDayTicks.HasValue)
{
- throw new ArgumentNullException();
+ throw new ArgumentException("Info did not contain a TimeOfDayTicks.", nameof(info));
}
if (!info.DayOfWeek.HasValue)
{
- throw new ArgumentNullException();
+ throw new ArgumentException("Info did not contain a DayOfWeek.", nameof(info));
}
return new WeeklyTrigger
@@ -764,7 +752,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
if (!info.IntervalTicks.HasValue)
{
- throw new ArgumentNullException();
+ throw new ArgumentException("Info did not contain a IntervalTicks.", nameof(info));
}
return new IntervalTrigger
@@ -778,7 +766,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
if (!info.SystemEvent.HasValue)
{
- throw new ArgumentNullException();
+ throw new ArgumentException("Info did not contain a SystemEvent.", nameof(info));
}
return new SystemEventTrigger(_systemEvents)
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
index c60f59ce4..0716f8d30 100644
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
@@ -42,8 +42,8 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{
- return new[] {
-
+ return new[] {
+
// Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
};
@@ -162,54 +162,30 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
/// Gets the name of the task
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return "Cache file cleanup"; }
- }
+ public string Name => "Cache file cleanup";
- public string Key
- {
- get { return "DeleteCacheFiles"; }
- }
+ public string Key => "DeleteCacheFiles";
/// <summary>
/// Gets the description.
/// </summary>
/// <value>The description.</value>
- public string Description
- {
- get { return "Deletes cache files no longer needed by the system"; }
- }
+ public string Description => "Deletes cache files no longer needed by the system";
/// <summary>
/// Gets the category.
/// </summary>
/// <value>The category.</value>
- public string Category
- {
- get
- {
- return "Maintenance";
- }
- }
+ public string Category => "Maintenance";
/// <summary>
/// Gets a value indicating whether this instance is hidden.
/// </summary>
/// <value><c>true</c> if this instance is hidden; otherwise, <c>false</c>.</value>
- public bool IsHidden
- {
- get { return true; }
- }
+ public bool IsHidden => true;
- public bool IsEnabled
- {
- get { return true; }
- }
+ public bool IsEnabled => true;
- public bool IsLogged
- {
- get { return true; }
- }
+ public bool IsLogged => true;
}
}
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs
index 95395f96c..fea18d9f0 100644
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs
@@ -38,8 +38,8 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{
- return new[] {
-
+ return new[] {
+
// Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
};
@@ -81,58 +81,34 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
return Task.CompletedTask;
}
- public string Key
- {
- get { return "CleanLogFiles"; }
- }
+ public string Key => "CleanLogFiles";
/// <summary>
/// Gets the name of the task
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return "Log file cleanup"; }
- }
+ public string Name => "Log file cleanup";
/// <summary>
/// Gets the description.
/// </summary>
/// <value>The description.</value>
- public string Description
- {
- get { return string.Format("Deletes log files that are more than {0} days old.", ConfigurationManager.CommonConfiguration.LogFileRetentionDays); }
- }
+ public string Description => string.Format("Deletes log files that are more than {0} days old.", ConfigurationManager.CommonConfiguration.LogFileRetentionDays);
/// <summary>
/// Gets the category.
/// </summary>
/// <value>The category.</value>
- public string Category
- {
- get
- {
- return "Maintenance";
- }
- }
+ public string Category => "Maintenance";
/// <summary>
/// Gets a value indicating whether this instance is hidden.
/// </summary>
/// <value><c>true</c> if this instance is hidden; otherwise, <c>false</c>.</value>
- public bool IsHidden
- {
- get { return true; }
- }
+ public bool IsHidden => true;
- public bool IsEnabled
- {
- get { return true; }
- }
+ public bool IsEnabled => true;
- public bool IsLogged
- {
- get { return true; }
- }
+ public bool IsLogged => true;
}
}
diff --git a/Emby.Server.Implementations/Security/AuthenticationRepository.cs b/Emby.Server.Implementations/Security/AuthenticationRepository.cs
index 228d511ce..2a6406f25 100644
--- a/Emby.Server.Implementations/Security/AuthenticationRepository.cs
+++ b/Emby.Server.Implementations/Security/AuthenticationRepository.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
@@ -91,7 +91,7 @@ namespace Emby.Server.Implementations.Security
{
if (info == null)
{
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
}
using (WriteLock.Write())
@@ -126,7 +126,7 @@ namespace Emby.Server.Implementations.Security
{
if (info == null)
{
- throw new ArgumentNullException("entry");
+ throw new ArgumentNullException(nameof(info));
}
using (WriteLock.Write())
@@ -161,7 +161,7 @@ namespace Emby.Server.Implementations.Security
{
if (info == null)
{
- throw new ArgumentNullException("entry");
+ throw new ArgumentNullException(nameof(info));
}
using (WriteLock.Write())
@@ -183,7 +183,7 @@ namespace Emby.Server.Implementations.Security
private const string BaseSelectText = "select Tokens.Id, AccessToken, DeviceId, AppName, AppVersion, DeviceName, UserId, UserName, DateCreated, DateLastActivity, Devices.CustomName from Tokens left join Devices on Tokens.DeviceId=Devices.Id";
- private void BindAuthenticationQueryParams(AuthenticationInfoQuery query, IStatement statement)
+ private static void BindAuthenticationQueryParams(AuthenticationInfoQuery query, IStatement statement)
{
if (!string.IsNullOrEmpty(query.AccessToken))
{
@@ -205,7 +205,7 @@ namespace Emby.Server.Implementations.Security
{
if (query == null)
{
- throw new ArgumentNullException("query");
+ throw new ArgumentNullException(nameof(query));
}
var commandText = BaseSelectText;
@@ -306,7 +306,7 @@ namespace Emby.Server.Implementations.Security
}
}
- private AuthenticationInfo Get(IReadOnlyList<IResultSetValue> reader)
+ private static AuthenticationInfo Get(IReadOnlyList<IResultSetValue> reader)
{
var info = new AuthenticationInfo
{
@@ -397,7 +397,7 @@ namespace Emby.Server.Implementations.Security
{
if (options == null)
{
- throw new ArgumentNullException("options");
+ throw new ArgumentNullException(nameof(options));
}
using (WriteLock.Write())
diff --git a/Emby.Server.Implementations/Security/EncryptionManager.cs b/Emby.Server.Implementations/Security/EncryptionManager.cs
index 271b0bbdb..b99e00a67 100644
--- a/Emby.Server.Implementations/Security/EncryptionManager.cs
+++ b/Emby.Server.Implementations/Security/EncryptionManager.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Security;
+using MediaBrowser.Controller.Security;
using System;
using System.Text;
@@ -14,7 +14,10 @@ namespace Emby.Server.Implementations.Security
/// <exception cref="System.ArgumentNullException">value</exception>
public string EncryptString(string value)
{
- if (value == null) throw new ArgumentNullException("value");
+ if (value == null)
+ {
+ throw new ArgumentNullException(nameof(value));
+ }
return EncryptStringUniversal(value);
}
@@ -27,12 +30,15 @@ namespace Emby.Server.Implementations.Security
/// <exception cref="System.ArgumentNullException">value</exception>
public string DecryptString(string value)
{
- if (value == null) throw new ArgumentNullException("value");
+ if (value == null)
+ {
+ throw new ArgumentNullException(nameof(value));
+ }
return DecryptStringUniversal(value);
}
- private string EncryptStringUniversal(string value)
+ private static string EncryptStringUniversal(string value)
{
// Yes, this isn't good, but ProtectedData in mono is throwing exceptions, so use this for now
@@ -40,7 +46,7 @@ namespace Emby.Server.Implementations.Security
return Convert.ToBase64String(bytes);
}
- private string DecryptStringUniversal(string value)
+ private static string DecryptStringUniversal(string value)
{
// Yes, this isn't good, but ProtectedData in mono is throwing exceptions, so use this for now
diff --git a/Emby.Server.Implementations/Security/MBLicenseFile.cs b/Emby.Server.Implementations/Security/MBLicenseFile.cs
deleted file mode 100644
index 1810cbcd2..000000000
--- a/Emby.Server.Implementations/Security/MBLicenseFile.cs
+++ /dev/null
@@ -1,210 +0,0 @@
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Text;
-using MediaBrowser.Common.Configuration;
-using MediaBrowser.Model.Cryptography;
-using MediaBrowser.Model.IO;
-
-namespace Emby.Server.Implementations.Security
-{
- internal class MBLicenseFile
- {
- private readonly IApplicationPaths _appPaths;
- private readonly IFileSystem _fileSystem;
- private readonly ICryptoProvider _cryptographyProvider;
-
- public string RegKey
- {
- get { return _regKey; }
- set
- {
- _updateRecords.Clear();
- _regKey = value;
- }
- }
-
- private string Filename
- {
- get
- {
- return Path.Combine(_appPaths.ConfigurationDirectoryPath, "mb.lic");
- }
- }
-
- private readonly ConcurrentDictionary<Guid, FeatureRegInfo> _updateRecords = new ConcurrentDictionary<Guid, FeatureRegInfo>();
- private readonly object _fileLock = new object();
- private string _regKey;
-
- public MBLicenseFile(IApplicationPaths appPaths, IFileSystem fileSystem, ICryptoProvider cryptographyProvider)
- {
- _appPaths = appPaths;
- _fileSystem = fileSystem;
- _cryptographyProvider = cryptographyProvider;
-
- Load();
- }
-
- private void SetUpdateRecord(Guid key, FeatureRegInfo value)
- {
- _updateRecords.AddOrUpdate(key, value, (k, v) => value);
- }
-
- private Guid GetKey(string featureId)
- {
- return new Guid(_cryptographyProvider.ComputeMD5(Encoding.Unicode.GetBytes(featureId)));
- }
-
- public void AddRegCheck(string featureId, DateTime expirationDate)
- {
- var key = GetKey(featureId);
- var value = new FeatureRegInfo
- {
- ExpirationDate = expirationDate,
- LastChecked = DateTime.UtcNow
- };
-
- SetUpdateRecord(key, value);
- Save();
- }
-
- public void RemoveRegCheck(string featureId)
- {
- var key = GetKey(featureId);
- FeatureRegInfo val;
-
- _updateRecords.TryRemove(key, out val);
-
- Save();
- }
-
- public FeatureRegInfo GetRegInfo(string featureId)
- {
- var key = GetKey(featureId);
- FeatureRegInfo info = null;
- _updateRecords.TryGetValue(key, out info);
-
- if (info == null)
- {
- return null;
- }
-
- // guard agains people just putting a large number in the file
- return info.LastChecked < DateTime.UtcNow ? info : null;
- }
-
- private void Load()
- {
- string[] contents = null;
- var licenseFile = Filename;
- lock (_fileLock)
- {
- try
- {
- contents = _fileSystem.ReadAllLines(licenseFile);
- }
- catch (FileNotFoundException)
- {
- lock (_fileLock)
- {
- _fileSystem.WriteAllBytes(licenseFile, Array.Empty<byte>());
- }
- }
- catch (IOException)
- {
- lock (_fileLock)
- {
- _fileSystem.WriteAllBytes(licenseFile, Array.Empty<byte>());
- }
- }
- }
- if (contents != null && contents.Length > 0)
- {
- //first line is reg key
- RegKey = contents[0];
-
- //next is legacy key
- if (contents.Length > 1)
- {
- // Don't need this anymore
- }
-
- //the rest of the lines should be pairs of features and timestamps
- for (var i = 2; i < contents.Length; i = i + 2)
- {
- var line = contents[i];
- if (string.IsNullOrWhiteSpace(line))
- {
- continue;
- }
-
- Guid feat;
- if (Guid.TryParse(line, out feat))
- {
- var lineParts = contents[i + 1].Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
-
- long ticks;
- if (long.TryParse(lineParts[0], out ticks))
- {
- var info = new FeatureRegInfo
- {
- LastChecked = new DateTime(ticks)
- };
-
- if (lineParts.Length > 1 && long.TryParse(lineParts[1], out ticks))
- {
- info.ExpirationDate = new DateTime(ticks);
- }
-
- SetUpdateRecord(feat, info);
- }
- }
- }
- }
- }
-
- public void Save()
- {
- //build our array
- var lines = new List<string>
- {
- RegKey,
-
- // Legacy key
- string.Empty
- };
-
- foreach (var pair in _updateRecords
- .ToList())
- {
- lines.Add(pair.Key.ToString());
-
- var dateLine = pair.Value.LastChecked.Ticks.ToString(CultureInfo.InvariantCulture) + "|" +
- pair.Value.ExpirationDate.Ticks.ToString(CultureInfo.InvariantCulture);
-
- lines.Add(dateLine);
- }
-
- var licenseFile = Filename;
- _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(licenseFile));
- lock (_fileLock)
- {
- _fileSystem.WriteAllLines(licenseFile, lines);
- }
- }
- }
-
- internal class FeatureRegInfo
- {
- public DateTime ExpirationDate { get; set; }
- public DateTime LastChecked { get; set; }
-
- public FeatureRegInfo()
- {
- ExpirationDate = DateTime.MinValue;
- }
- }
-}
diff --git a/Emby.Server.Implementations/Security/PluginSecurityManager.cs b/Emby.Server.Implementations/Security/PluginSecurityManager.cs
deleted file mode 100644
index 2b1494c39..000000000
--- a/Emby.Server.Implementations/Security/PluginSecurityManager.cs
+++ /dev/null
@@ -1,221 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Threading;
-using System.Threading.Tasks;
-using MediaBrowser.Common.Configuration;
-using MediaBrowser.Common.Net;
-using MediaBrowser.Common.Security;
-using MediaBrowser.Controller;
-using MediaBrowser.Model.Cryptography;
-using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.IO;
-using Microsoft.Extensions.Logging;
-using MediaBrowser.Model.Net;
-using MediaBrowser.Model.Serialization;
-
-namespace Emby.Server.Implementations.Security
-{
- /// <summary>
- /// Class PluginSecurityManager
- /// </summary>
- public class PluginSecurityManager : ISecurityManager
- {
- private const string MBValidateUrl = "https://mb3admin.local/admin/service/registration/validate";
- private const string AppstoreRegUrl = /*MbAdmin.HttpsUrl*/ "https://mb3admin.local/admin/service/appstore/register";
-
- public async Task<bool> IsSupporter()
- {
- var result = await GetRegistrationStatusInternal("MBSupporter", false, _appHost.ApplicationVersion.ToString(), CancellationToken.None).ConfigureAwait(false);
-
- return result.IsRegistered;
- }
-
- private MBLicenseFile _licenseFile;
- private MBLicenseFile LicenseFile
- {
- get { return _licenseFile ?? (_licenseFile = new MBLicenseFile(_appPaths, _fileSystem, _cryptographyProvider)); }
- }
-
- private readonly IHttpClient _httpClient;
- private readonly IJsonSerializer _jsonSerializer;
- private readonly IServerApplicationHost _appHost;
- private readonly ILogger _logger;
- private readonly IApplicationPaths _appPaths;
- private readonly IFileSystem _fileSystem;
- private readonly ICryptoProvider _cryptographyProvider;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="PluginSecurityManager" /> class.
- /// </summary>
- public PluginSecurityManager(IServerApplicationHost appHost, IHttpClient httpClient, IJsonSerializer jsonSerializer,
- IApplicationPaths appPaths, ILoggerFactory loggerFactory, IFileSystem fileSystem, ICryptoProvider cryptographyProvider)
- {
- if (httpClient == null)
- {
- throw new ArgumentNullException("httpClient");
- }
-
- _appHost = appHost;
- _httpClient = httpClient;
- _jsonSerializer = jsonSerializer;
- _appPaths = appPaths;
- _fileSystem = fileSystem;
- _cryptographyProvider = cryptographyProvider;
- _logger = loggerFactory.CreateLogger("SecurityManager");
- }
-
- /// <summary>
- /// Gets the registration status.
- /// This overload supports existing plug-ins.
- /// </summary>
- public Task<MBRegistrationRecord> GetRegistrationStatus(string feature)
- {
- return GetRegistrationStatusInternal(feature, false, null, CancellationToken.None);
- }
-
- /// <summary>
- /// Gets or sets the supporter key.
- /// </summary>
- /// <value>The supporter key.</value>
- public string SupporterKey
- {
- get
- {
- return LicenseFile.RegKey;
- }
- set
- {
- throw new Exception("Please call UpdateSupporterKey");
- }
- }
-
- public async Task UpdateSupporterKey(string newValue)
- {
- if (newValue != null)
- {
- newValue = newValue.Trim();
- }
-
- if (!string.Equals(newValue, LicenseFile.RegKey, StringComparison.Ordinal))
- {
- LicenseFile.RegKey = newValue;
- LicenseFile.Save();
-
- // Reset this
- await GetRegistrationStatusInternal("MBSupporter", true, _appHost.ApplicationVersion.ToString(), CancellationToken.None).ConfigureAwait(false);
- }
- }
-
- /// <summary>
- /// Register an app store sale with our back-end. It will validate the transaction with the store
- /// and then register the proper feature and then fill in the supporter key on success.
- /// </summary>
- /// <param name="parameters">Json parameters to send to admin server</param>
- public async Task RegisterAppStoreSale(string parameters)
- {
- var options = new HttpRequestOptions()
- {
- Url = AppstoreRegUrl,
- CancellationToken = CancellationToken.None,
- BufferContent = false
- };
- options.RequestHeaders.Add("X-Emby-Token", _appHost.SystemId);
- options.RequestContent = parameters;
- options.RequestContentType = "application/json";
-
- try
- {
- using (var response = await _httpClient.Post(options).ConfigureAwait(false))
- {
- var reg = await _jsonSerializer.DeserializeFromStreamAsync<RegRecord>(response.Content).ConfigureAwait(false);
-
- if (reg == null)
- {
- var msg = "Result from appstore registration was null.";
- _logger.LogError(msg);
- throw new ArgumentException(msg);
- }
- if (!String.IsNullOrEmpty(reg.key))
- {
- await UpdateSupporterKey(reg.key).ConfigureAwait(false);
- }
- }
-
- }
- catch (ArgumentException)
- {
- SaveAppStoreInfo(parameters);
- throw;
- }
- catch (HttpException ex)
- {
- _logger.LogError(ex, "Error registering appstore purchase {parameters}", parameters ?? "NO PARMS SENT");
-
- throw new Exception("Error registering store sale");
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Error registering appstore purchase {parameters}", parameters ?? "NO PARMS SENT");
- SaveAppStoreInfo(parameters);
- //TODO - could create a re-try routine on start-up if this file is there. For now we can handle manually.
- throw new Exception("Error registering store sale");
- }
-
- }
-
- private void SaveAppStoreInfo(string info)
- {
- // Save all transaction information to a file
-
- try
- {
- _fileSystem.WriteAllText(Path.Combine(_appPaths.ProgramDataPath, "apptrans-error.txt"), info);
- }
- catch (IOException)
- {
-
- }
- }
-
- private SemaphoreSlim _regCheckLock = new SemaphoreSlim(1, 1);
-
- private async Task<MBRegistrationRecord> GetRegistrationStatusInternal(string feature, bool forceCallToServer, string version, CancellationToken cancellationToken)
- {
- await _regCheckLock.WaitAsync(cancellationToken).ConfigureAwait(false);
-
- try
- {
- var record = new MBRegistrationRecord
- {
- IsRegistered = true,
- RegChecked = true,
- TrialVersion = false,
- IsValid = true,
- RegError = false
- };
-
- return record;
- }
- finally
- {
- _regCheckLock.Release();
- }
- }
-
- private bool IsInTrial(DateTime expirationDate, bool regChecked, bool isRegistered)
- {
- //don't set this until we've successfully obtained exp date
- if (!regChecked)
- {
- return false;
- }
-
- var isInTrial = expirationDate > DateTime.UtcNow;
-
- return isInTrial && !isRegistered;
- }
- }
-}
diff --git a/Emby.Server.Implementations/Security/RegRecord.cs b/Emby.Server.Implementations/Security/RegRecord.cs
deleted file mode 100644
index d484085d3..000000000
--- a/Emby.Server.Implementations/Security/RegRecord.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-
-namespace Emby.Server.Implementations.Security
-{
- class RegRecord
- {
- public string featId { get; set; }
- public bool registered { get; set; }
- public DateTime expDate { get; set; }
- public string key { get; set; }
- }
-} \ No newline at end of file
diff --git a/Emby.Server.Implementations/Serialization/JsonSerializer.cs b/Emby.Server.Implementations/Serialization/JsonSerializer.cs
index e28acd769..d4b6b2f43 100644
--- a/Emby.Server.Implementations/Serialization/JsonSerializer.cs
+++ b/Emby.Server.Implementations/Serialization/JsonSerializer.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.IO;
using MediaBrowser.Model.IO;
using Microsoft.Extensions.Logging;
@@ -32,12 +32,12 @@ namespace Emby.Common.Implementations.Serialization
{
if (obj == null)
{
- throw new ArgumentNullException("obj");
+ throw new ArgumentNullException(nameof(obj));
}
if (stream == null)
{
- throw new ArgumentNullException("stream");
+ throw new ArgumentNullException(nameof(stream));
}
ServiceStack.Text.JsonSerializer.SerializeToStream(obj, obj.GetType(), stream);
@@ -53,12 +53,12 @@ namespace Emby.Common.Implementations.Serialization
{
if (obj == null)
{
- throw new ArgumentNullException("obj");
+ throw new ArgumentNullException(nameof(obj));
}
if (string.IsNullOrEmpty(file))
{
- throw new ArgumentNullException("file");
+ throw new ArgumentNullException(nameof(file));
}
using (Stream stream = _fileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
@@ -67,7 +67,7 @@ namespace Emby.Common.Implementations.Serialization
}
}
- private Stream OpenFile(string path)
+ private static Stream OpenFile(string path)
{
//_logger.LogDebug("Deserializing file {0}", path);
return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 131072);
@@ -84,12 +84,12 @@ namespace Emby.Common.Implementations.Serialization
{
if (type == null)
{
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
}
if (string.IsNullOrEmpty(file))
{
- throw new ArgumentNullException("file");
+ throw new ArgumentNullException(nameof(file));
}
using (Stream stream = OpenFile(file))
@@ -110,7 +110,7 @@ namespace Emby.Common.Implementations.Serialization
{
if (string.IsNullOrEmpty(file))
{
- throw new ArgumentNullException("file");
+ throw new ArgumentNullException(nameof(file));
}
using (Stream stream = OpenFile(file))
@@ -130,7 +130,7 @@ namespace Emby.Common.Implementations.Serialization
{
if (stream == null)
{
- throw new ArgumentNullException("stream");
+ throw new ArgumentNullException(nameof(stream));
}
return ServiceStack.Text.JsonSerializer.DeserializeFromStream<T>(stream);
@@ -140,7 +140,7 @@ namespace Emby.Common.Implementations.Serialization
{
if (stream == null)
{
- throw new ArgumentNullException("stream");
+ throw new ArgumentNullException(nameof(stream));
}
@@ -158,7 +158,7 @@ namespace Emby.Common.Implementations.Serialization
{
if (string.IsNullOrEmpty(text))
{
- throw new ArgumentNullException("text");
+ throw new ArgumentNullException(nameof(text));
}
return ServiceStack.Text.JsonSerializer.DeserializeFromString<T>(text);
@@ -175,12 +175,12 @@ namespace Emby.Common.Implementations.Serialization
{
if (stream == null)
{
- throw new ArgumentNullException("stream");
+ throw new ArgumentNullException(nameof(stream));
}
if (type == null)
{
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
}
return ServiceStack.Text.JsonSerializer.DeserializeFromStream(type, stream);
@@ -190,12 +190,12 @@ namespace Emby.Common.Implementations.Serialization
{
if (stream == null)
{
- throw new ArgumentNullException("stream");
+ throw new ArgumentNullException(nameof(stream));
}
if (type == null)
{
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
}
using (var reader = new StreamReader(stream))
@@ -220,7 +220,7 @@ namespace Emby.Common.Implementations.Serialization
ServiceStack.Text.JsConfig<Guid>.SerializeFn = SerializeGuid;
}
- private string SerializeGuid(Guid guid)
+ private static string SerializeGuid(Guid guid)
{
if (guid.Equals(Guid.Empty))
{
@@ -241,12 +241,12 @@ namespace Emby.Common.Implementations.Serialization
{
if (string.IsNullOrEmpty(json))
{
- throw new ArgumentNullException("json");
+ throw new ArgumentNullException(nameof(json));
}
if (type == null)
{
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
}
return ServiceStack.Text.JsonSerializer.DeserializeFromString(json, type);
@@ -262,7 +262,7 @@ namespace Emby.Common.Implementations.Serialization
{
if (obj == null)
{
- throw new ArgumentNullException("obj");
+ throw new ArgumentNullException(nameof(obj));
}
return ServiceStack.Text.JsonSerializer.SerializeToString(obj, obj.GetType());
diff --git a/Emby.Server.Implementations/ServerApplicationPaths.cs b/Emby.Server.Implementations/ServerApplicationPaths.cs
index 8a0f2671a..933b67291 100644
--- a/Emby.Server.Implementations/ServerApplicationPaths.cs
+++ b/Emby.Server.Implementations/ServerApplicationPaths.cs
@@ -30,174 +30,84 @@ namespace Emby.Server.Implementations
/// Gets the path to the base root media directory
/// </summary>
/// <value>The root folder path.</value>
- public string RootFolderPath
- {
- get
- {
- return Path.Combine(ProgramDataPath, "root");
- }
- }
+ public string RootFolderPath => Path.Combine(ProgramDataPath, "root");
/// <summary>
/// Gets the path to the default user view directory. Used if no specific user view is defined.
/// </summary>
/// <value>The default user views path.</value>
- public string DefaultUserViewsPath
- {
- get
- {
- return Path.Combine(RootFolderPath, "default");
- }
- }
+ public string DefaultUserViewsPath => Path.Combine(RootFolderPath, "default");
/// <summary>
/// Gets the path to localization data.
/// </summary>
/// <value>The localization path.</value>
- public string LocalizationPath
- {
- get
- {
- return Path.Combine(ProgramDataPath, "localization");
- }
- }
+ public string LocalizationPath => Path.Combine(ProgramDataPath, "localization");
/// <summary>
/// Gets the path to the People directory
/// </summary>
/// <value>The people path.</value>
- public string PeoplePath
- {
- get
- {
- return Path.Combine(InternalMetadataPath, "People");
- }
- }
+ public string PeoplePath => Path.Combine(InternalMetadataPath, "People");
- public string ArtistsPath
- {
- get
- {
- return Path.Combine(InternalMetadataPath, "artists");
- }
- }
+ public string ArtistsPath => Path.Combine(InternalMetadataPath, "artists");
/// <summary>
/// Gets the path to the Genre directory
/// </summary>
/// <value>The genre path.</value>
- public string GenrePath
- {
- get
- {
- return Path.Combine(InternalMetadataPath, "Genre");
- }
- }
+ public string GenrePath => Path.Combine(InternalMetadataPath, "Genre");
/// <summary>
/// Gets the path to the Genre directory
/// </summary>
/// <value>The genre path.</value>
- public string MusicGenrePath
- {
- get
- {
- return Path.Combine(InternalMetadataPath, "MusicGenre");
- }
- }
+ public string MusicGenrePath => Path.Combine(InternalMetadataPath, "MusicGenre");
/// <summary>
/// Gets the path to the Studio directory
/// </summary>
/// <value>The studio path.</value>
- public string StudioPath
- {
- get
- {
- return Path.Combine(InternalMetadataPath, "Studio");
- }
- }
+ public string StudioPath => Path.Combine(InternalMetadataPath, "Studio");
/// <summary>
/// Gets the path to the Year directory
/// </summary>
/// <value>The year path.</value>
- public string YearPath
- {
- get
- {
- return Path.Combine(InternalMetadataPath, "Year");
- }
- }
+ public string YearPath => Path.Combine(InternalMetadataPath, "Year");
/// <summary>
/// Gets the path to the General IBN directory
/// </summary>
/// <value>The general path.</value>
- public string GeneralPath
- {
- get
- {
- return Path.Combine(InternalMetadataPath, "general");
- }
- }
+ public string GeneralPath => Path.Combine(InternalMetadataPath, "general");
/// <summary>
/// Gets the path to the Ratings IBN directory
/// </summary>
/// <value>The ratings path.</value>
- public string RatingsPath
- {
- get
- {
- return Path.Combine(InternalMetadataPath, "ratings");
- }
- }
+ public string RatingsPath => Path.Combine(InternalMetadataPath, "ratings");
/// <summary>
/// Gets the media info images path.
/// </summary>
/// <value>The media info images path.</value>
- public string MediaInfoImagesPath
- {
- get
- {
- return Path.Combine(InternalMetadataPath, "mediainfo");
- }
- }
+ public string MediaInfoImagesPath => Path.Combine(InternalMetadataPath, "mediainfo");
/// <summary>
/// Gets the path to the user configuration directory
/// </summary>
/// <value>The user configuration directory path.</value>
- public string UserConfigurationDirectoryPath
- {
- get
- {
- return Path.Combine(ConfigurationDirectoryPath, "users");
- }
- }
+ public string UserConfigurationDirectoryPath => Path.Combine(ConfigurationDirectoryPath, "users");
private string _defaultTranscodingTempPath;
- public string DefaultTranscodingTempPath
- {
- get
- {
- return _defaultTranscodingTempPath ?? (_defaultTranscodingTempPath = Path.Combine(ProgramDataPath, "transcoding-temp"));
- }
- }
+ public string DefaultTranscodingTempPath => _defaultTranscodingTempPath ?? (_defaultTranscodingTempPath = Path.Combine(ProgramDataPath, "transcoding-temp"));
private string _transcodingTempPath;
public string TranscodingTempPath
{
- get
- {
- return _transcodingTempPath ?? (_transcodingTempPath = DefaultTranscodingTempPath);
- }
- set
- {
- _transcodingTempPath = value;
- }
+ get => _transcodingTempPath ?? (_transcodingTempPath = DefaultTranscodingTempPath);
+ set => _transcodingTempPath = value;
}
public string GetTranscodingTempPath()
@@ -230,35 +140,16 @@ namespace Emby.Server.Implementations
/// Gets the game genre path.
/// </summary>
/// <value>The game genre path.</value>
- public string GameGenrePath
- {
- get
- {
- return Path.Combine(InternalMetadataPath, "GameGenre");
- }
- }
+ public string GameGenrePath => Path.Combine(InternalMetadataPath, "GameGenre");
private string _internalMetadataPath;
public string InternalMetadataPath
{
- get
- {
- return _internalMetadataPath ?? (_internalMetadataPath = Path.Combine(DataPath, "metadata"));
- }
- set
- {
- _internalMetadataPath = value;
- }
+ get => _internalMetadataPath ?? (_internalMetadataPath = Path.Combine(DataPath, "metadata"));
+ set => _internalMetadataPath = value;
}
private const string _virtualInternalMetadataPath = "%MetadataPath%";
- public string VirtualInternalMetadataPath
- {
- get
- {
- return _virtualInternalMetadataPath;
- }
- }
-
+ public string VirtualInternalMetadataPath => _virtualInternalMetadataPath;
}
}
diff --git a/Emby.Server.Implementations/Services/HttpResult.cs b/Emby.Server.Implementations/Services/HttpResult.cs
index 91314c15a..7ce41a368 100644
--- a/Emby.Server.Implementations/Services/HttpResult.cs
+++ b/Emby.Server.Implementations/Services/HttpResult.cs
@@ -32,8 +32,8 @@ namespace Emby.Server.Implementations.Services
public HttpStatusCode StatusCode
{
- get { return (HttpStatusCode)Status; }
- set { Status = (int)value; }
+ get => (HttpStatusCode)Status;
+ set => Status = (int)value;
}
public IRequest RequestContext { get; set; }
diff --git a/Emby.Server.Implementations/Services/ServiceHandler.cs b/Emby.Server.Implementations/Services/ServiceHandler.cs
index f5fcb5fe6..5590c51b6 100644
--- a/Emby.Server.Implementations/Services/ServiceHandler.cs
+++ b/Emby.Server.Implementations/Services/ServiceHandler.cs
@@ -21,7 +21,7 @@ namespace Emby.Server.Implementations.Services
return deserializer(requestType, httpReq.InputStream);
}
}
- return Task.FromResult(host.CreateInstance(requestType));
+ return Task.FromResult(host.CreateInstance(requestType));
}
public static RestPath FindMatchingRestPath(string httpMethod, string pathInfo, out string contentType)
diff --git a/Emby.Server.Implementations/Services/ServicePath.cs b/Emby.Server.Implementations/Services/ServicePath.cs
index ac2af3eaf..0222b3782 100644
--- a/Emby.Server.Implementations/Services/ServicePath.cs
+++ b/Emby.Server.Implementations/Services/ServicePath.cs
@@ -39,7 +39,7 @@ namespace Emby.Server.Implementations.Services
public int PathComponentsCount { get; set; }
/// <summary>
- /// The total number of segments after subparts have been exploded ('.')
+ /// The total number of segments after subparts have been exploded ('.')
/// e.g. /path/to/here.ext == 4
/// </summary>
public int TotalComponentsCount { get; set; }
@@ -50,7 +50,7 @@ namespace Emby.Server.Implementations.Services
public Type ServiceType { get; private set; }
- public string Path { get { return this.restPath; } }
+ public string Path => this.restPath;
public string Summary { get; private set; }
public string Description { get; private set; }
@@ -58,10 +58,7 @@ namespace Emby.Server.Implementations.Services
public int Priority { get; set; } //passed back to RouteAttribute
- public IEnumerable<string> PathVariables
- {
- get { return this.variablesNames.Where(e => !string.IsNullOrWhiteSpace(e)); }
- }
+ public IEnumerable<string> PathVariables => this.variablesNames.Where(e => !string.IsNullOrWhiteSpace(e));
public static string[] GetPathPartsForMatching(string pathInfo)
{
@@ -117,7 +114,7 @@ namespace Emby.Server.Implementations.Services
var hasSeparators = new List<bool>();
foreach (var component in this.restPath.Split(PathSeperatorChar))
{
- if (String.IsNullOrEmpty(component)) continue;
+ if (string.IsNullOrEmpty(component)) continue;
if (StringContains(component, VariablePrefix)
&& component.IndexOf(ComponentSeperator) != -1)
@@ -354,7 +351,7 @@ namespace Emby.Server.Implementations.Services
if (withPathInfoParts.Length != this.PathComponentsCount && !this.IsWildCardPath)
{
- return false;
+ return false;
}
if (!Verbs.Contains(httpMethod, StringComparer.OrdinalIgnoreCase))
@@ -420,10 +417,10 @@ namespace Emby.Server.Implementations.Services
return pathIx == withPathInfoParts.Length;
}
- private bool LiteralsEqual(string str1, string str2)
+ private static bool LiteralsEqual(string str1, string str2)
{
// Most cases
- if (String.Equals(str1, str2, StringComparison.OrdinalIgnoreCase))
+ if (string.Equals(str1, str2, StringComparison.OrdinalIgnoreCase))
{
return true;
}
@@ -433,7 +430,7 @@ namespace Emby.Server.Implementations.Services
str2 = str2.ToUpperInvariant();
// Invariant IgnoreCase would probably be better but it's not available in PCL
- return String.Equals(str1, str2, StringComparison.CurrentCultureIgnoreCase);
+ return string.Equals(str1, str2, StringComparison.CurrentCultureIgnoreCase);
}
private bool ExplodeComponents(ref string[] withPathInfoParts)
@@ -442,7 +439,7 @@ namespace Emby.Server.Implementations.Services
for (var i = 0; i < withPathInfoParts.Length; i++)
{
var component = withPathInfoParts[i];
- if (String.IsNullOrEmpty(component)) continue;
+ if (string.IsNullOrEmpty(component)) continue;
if (this.PathComponentsCount != this.TotalComponentsCount
&& this.componentsWithSeparators[i])
@@ -473,7 +470,7 @@ namespace Emby.Server.Implementations.Services
&& requestComponents.Length >= this.TotalComponentsCount - this.wildcardCount;
if (!isValidWildCardPath)
- throw new ArgumentException(String.Format(
+ throw new ArgumentException(string.Format(
"Path Mismatch: Request Path '{0}' has invalid number of components compared to: '{1}'",
pathInfo, this.restPath));
}
@@ -492,7 +489,7 @@ namespace Emby.Server.Implementations.Services
string propertyNameOnRequest;
if (!this.propertyNamesMap.TryGetValue(variableName.ToLower(), out propertyNameOnRequest))
{
- if (String.Equals("ignore", variableName, StringComparison.OrdinalIgnoreCase))
+ if (string.Equals("ignore", variableName, StringComparison.OrdinalIgnoreCase))
{
pathIx++;
continue;
@@ -522,12 +519,12 @@ namespace Emby.Server.Implementations.Services
// hits a match for the next element in the definition (which must be a literal)
// It may consume 0 or more path parts
var stopLiteral = i == this.TotalComponentsCount - 1 ? null : this.literalsToMatch[i + 1];
- if (!String.Equals(requestComponents[pathIx], stopLiteral, StringComparison.OrdinalIgnoreCase))
+ if (!string.Equals(requestComponents[pathIx], stopLiteral, StringComparison.OrdinalIgnoreCase))
{
var sb = new StringBuilder();
sb.Append(value);
pathIx++;
- while (!String.Equals(requestComponents[pathIx], stopLiteral, StringComparison.OrdinalIgnoreCase))
+ while (!string.Equals(requestComponents[pathIx], stopLiteral, StringComparison.OrdinalIgnoreCase))
{
sb.Append(PathSeperatorChar + requestComponents[pathIx++]);
}
diff --git a/Emby.Server.Implementations/Services/UrlExtensions.cs b/Emby.Server.Implementations/Services/UrlExtensions.cs
index ba9889c41..898dcac3e 100644
--- a/Emby.Server.Implementations/Services/UrlExtensions.cs
+++ b/Emby.Server.Implementations/Services/UrlExtensions.cs
@@ -5,7 +5,7 @@ namespace Emby.Server.Implementations.Services
/// <summary>
/// Donated by Ivan Korneliuk from his post:
/// http://korneliuk.blogspot.com/2012/08/servicestack-reusing-dtos.html
- ///
+ ///
/// Modified to only allow using routes matching the supplied HTTP Verb
/// </summary>
public static class UrlExtensions
diff --git a/Emby.Server.Implementations/Session/HttpSessionController.cs b/Emby.Server.Implementations/Session/HttpSessionController.cs
index ff9b3fefc..c61e2aff4 100644
--- a/Emby.Server.Implementations/Session/HttpSessionController.cs
+++ b/Emby.Server.Implementations/Session/HttpSessionController.cs
@@ -36,26 +36,11 @@ namespace Emby.Server.Implementations.Session
_sessionManager = sessionManager;
}
- private string PostUrl
- {
- get
- {
- return string.Format("http://{0}{1}", Session.RemoteEndPoint, _postUrl);
- }
- }
+ private string PostUrl => string.Format("http://{0}{1}", Session.RemoteEndPoint, _postUrl);
- public bool IsSessionActive
- {
- get
- {
- return (DateTime.UtcNow - Session.LastActivityDate).TotalMinutes <= 5;
- }
- }
+ public bool IsSessionActive => (DateTime.UtcNow - Session.LastActivityDate).TotalMinutes <= 5;
- public bool SupportsMediaControl
- {
- get { return true; }
- }
+ public bool SupportsMediaControl => true;
private Task SendMessage(string name, string messageId, CancellationToken cancellationToken)
{
@@ -164,7 +149,7 @@ namespace Emby.Server.Implementations.Session
{
if (typeof(T) == typeof(string))
{
- var str = data as String;
+ var str = data as string;
if (!string.IsNullOrEmpty(str))
{
options.RequestContent = str;
@@ -189,7 +174,7 @@ namespace Emby.Server.Implementations.Session
}
}
- private string ToQueryString(Dictionary<string, string> nvc)
+ private static string ToQueryString(Dictionary<string, string> nvc)
{
var array = (from item in nvc
select string.Format("{0}={1}", WebUtility.UrlEncode(item.Key), WebUtility.UrlEncode(item.Value)))
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs
index 7321e9f86..4e444ac01 100644
--- a/Emby.Server.Implementations/Session/SessionManager.cs
+++ b/Emby.Server.Implementations/Session/SessionManager.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Events;
+using MediaBrowser.Common.Events;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
@@ -148,10 +148,7 @@ namespace Emby.Server.Implementations.Session
/// Gets all connections.
/// </summary>
/// <value>All connections.</value>
- public IEnumerable<SessionInfo> Sessions
- {
- get { return _activeConnections.Values.OrderByDescending(c => c.LastActivityDate).ToList(); }
- }
+ public IEnumerable<SessionInfo> Sessions => _activeConnections.Values.OrderByDescending(c => c.LastActivityDate).ToList();
private void OnSessionStarted(SessionInfo info)
{
@@ -218,15 +215,15 @@ namespace Emby.Server.Implementations.Session
if (string.IsNullOrEmpty(appName))
{
- throw new ArgumentNullException("appName");
+ throw new ArgumentNullException(nameof(appName));
}
if (string.IsNullOrEmpty(appVersion))
{
- throw new ArgumentNullException("appVersion");
+ throw new ArgumentNullException(nameof(appVersion));
}
if (string.IsNullOrEmpty(deviceId))
{
- throw new ArgumentNullException("deviceId");
+ throw new ArgumentNullException(nameof(deviceId));
}
var activityDate = DateTime.UtcNow;
@@ -381,7 +378,7 @@ namespace Emby.Server.Implementations.Session
}
}
- private string GetSessionKey(string appName, string deviceId)
+ private static string GetSessionKey(string appName, string deviceId)
{
return appName + deviceId;
}
@@ -402,7 +399,7 @@ namespace Emby.Server.Implementations.Session
if (string.IsNullOrEmpty(deviceId))
{
- throw new ArgumentNullException("deviceId");
+ throw new ArgumentNullException(nameof(deviceId));
}
var key = GetSessionKey(appName, deviceId);
@@ -582,7 +579,7 @@ namespace Emby.Server.Implementations.Session
if (info == null)
{
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
}
var session = GetSession(info.SessionId);
@@ -631,7 +628,7 @@ namespace Emby.Server.Implementations.Session
/// <summary>
/// Called when [playback start].
/// </summary>
- /// <param name="userId">The user identifier.</param>
+ /// <param name="user">The user object.</param>
/// <param name="item">The item.</param>
private void OnPlaybackStart(User user, BaseItem item)
{
@@ -669,7 +666,7 @@ namespace Emby.Server.Implementations.Session
if (info == null)
{
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
}
var session = GetSession(info.SessionId);
@@ -742,7 +739,7 @@ namespace Emby.Server.Implementations.Session
}
- private bool UpdatePlaybackSettings(User user, PlaybackProgressInfo info, UserItemData data)
+ private static bool UpdatePlaybackSettings(User user, PlaybackProgressInfo info, UserItemData data)
{
var changed = false;
@@ -796,12 +793,12 @@ namespace Emby.Server.Implementations.Session
if (info == null)
{
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
}
if (info.PositionTicks.HasValue && info.PositionTicks.Value < 0)
{
- throw new ArgumentOutOfRangeException("positionTicks");
+ throw new ArgumentOutOfRangeException(nameof(info),"The PlaybackStopInfo's PositionTicks was negative.");
}
var session = GetSession(info.SessionId);
@@ -993,7 +990,7 @@ namespace Emby.Server.Implementations.Session
return SendMessageToSession(session, "GeneralCommand", command, cancellationToken);
}
- private async Task SendMessageToSession<T>(SessionInfo session, string name, T data, CancellationToken cancellationToken)
+ private static async Task SendMessageToSession<T>(SessionInfo session, string name, T data, CancellationToken cancellationToken)
{
var controllers = session.SessionControllers.ToArray();
var messageId = Guid.NewGuid().ToString("N");
@@ -1192,11 +1189,11 @@ namespace Emby.Server.Implementations.Session
{
if (session == null)
{
- throw new ArgumentNullException("session");
+ throw new ArgumentNullException(nameof(session));
}
if (controllingSession == null)
{
- throw new ArgumentNullException("controllingSession");
+ throw new ArgumentNullException(nameof(controllingSession));
}
}
@@ -1490,7 +1487,7 @@ namespace Emby.Server.Implementations.Session
if (string.IsNullOrEmpty(accessToken))
{
- throw new ArgumentNullException("accessToken");
+ throw new ArgumentNullException(nameof(accessToken));
}
var existing = _authRepo.Get(new AuthenticationInfoQuery
@@ -1611,7 +1608,7 @@ namespace Emby.Server.Implementations.Session
{
if (item == null)
{
- throw new ArgumentNullException("item");
+ throw new ArgumentNullException(nameof(item));
}
var dtoOptions = _itemInfoDtoOptions;
@@ -1684,7 +1681,7 @@ namespace Emby.Server.Implementations.Session
{
if (string.IsNullOrEmpty(itemId))
{
- throw new ArgumentNullException("itemId");
+ throw new ArgumentNullException(nameof(itemId));
}
//var item = _libraryManager.GetItemById(new Guid(itemId));
@@ -1726,7 +1723,7 @@ namespace Emby.Server.Implementations.Session
{
if (info == null)
{
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
}
var user = info.UserId.Equals(Guid.Empty)
diff --git a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs
index 3bb022b32..116e455cf 100644
--- a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs
+++ b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Net;
+using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Events;
using Microsoft.Extensions.Logging;
@@ -43,7 +43,6 @@ namespace Emby.Server.Implementations.Session
/// <param name="loggerFactory">The logger factory.</param>
/// <param name="json">The json.</param>
/// <param name="httpServer">The HTTP server.</param>
- /// <param name="serverManager">The server manager.</param>
public SessionWebSocketListener(ISessionManager sessionManager, ILoggerFactory loggerFactory, IJsonSerializer json, IHttpServer httpServer)
{
_sessionManager = sessionManager;
@@ -71,7 +70,7 @@ namespace Emby.Server.Implementations.Session
{
if (queryString == null)
{
- throw new ArgumentNullException("queryString");
+ throw new ArgumentNullException(nameof(queryString));
}
var token = queryString["api_key"];
diff --git a/Emby.Server.Implementations/Session/WebSocketController.cs b/Emby.Server.Implementations/Session/WebSocketController.cs
index bdae5cf8f..ed34f8721 100644
--- a/Emby.Server.Implementations/Session/WebSocketController.cs
+++ b/Emby.Server.Implementations/Session/WebSocketController.cs
@@ -31,23 +31,11 @@ namespace Emby.Server.Implementations.Session
Sockets = new List<IWebSocketConnection>();
}
- private bool HasOpenSockets
- {
- get { return GetActiveSockets().Any(); }
- }
+ private bool HasOpenSockets => GetActiveSockets().Any();
- public bool SupportsMediaControl
- {
- get { return HasOpenSockets; }
- }
+ public bool SupportsMediaControl => HasOpenSockets;
- public bool IsSessionActive
- {
- get
- {
- return HasOpenSockets;
- }
- }
+ public bool IsSessionActive => HasOpenSockets;
private IEnumerable<IWebSocketConnection> GetActiveSockets()
{
diff --git a/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs b/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs
index 494668cb9..1b2974c27 100644
--- a/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs
+++ b/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
@@ -16,6 +16,16 @@ namespace Emby.Server.Implementations.Sorting
/// <returns>System.Int32.</returns>
public int Compare(BaseItem x, BaseItem y)
{
+ if (x == null)
+ {
+ throw new ArgumentNullException(nameof(x));
+ }
+
+ if (y == null)
+ {
+ throw new ArgumentNullException(nameof(y));
+ }
+
if (x.PremiereDate.HasValue && y.PremiereDate.HasValue)
{
var val = DateTime.Compare(x.PremiereDate.Value, y.PremiereDate.Value);
@@ -70,7 +80,7 @@ namespace Emby.Server.Implementations.Sorting
return CompareEpisodeToSpecial(y, x) * -1;
}
- private int CompareEpisodeToSpecial(Episode x, Episode y)
+ private static int CompareEpisodeToSpecial(Episode x, Episode y)
{
// http://thetvdb.com/wiki/index.php?title=Special_Episodes
@@ -119,7 +129,7 @@ namespace Emby.Server.Implementations.Sorting
return GetSpecialCompareValue(x).CompareTo(GetSpecialCompareValue(y));
}
- private int GetSpecialCompareValue(Episode item)
+ private static int GetSpecialCompareValue(Episode item)
{
// First sort by season number
// Since there are three sort orders, pad with 9 digits (3 for each, figure 1000 episode buffer should be enough)
@@ -140,7 +150,7 @@ namespace Emby.Server.Implementations.Sorting
return val;
}
- private int CompareEpisodes(Episode x, Episode y)
+ private static int CompareEpisodes(Episode x, Episode y)
{
var xValue = (x.ParentIndexNumber ?? -1) * 1000 + (x.IndexNumber ?? -1);
var yValue = (y.ParentIndexNumber ?? -1) * 1000 + (y.IndexNumber ?? -1);
@@ -152,9 +162,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.AiredEpisodeOrder; }
- }
+ public string Name => ItemSortBy.AiredEpisodeOrder;
}
}
diff --git a/Emby.Server.Implementations/Sorting/AlbumArtistComparer.cs b/Emby.Server.Implementations/Sorting/AlbumArtistComparer.cs
index cd3834080..df64d816f 100644
--- a/Emby.Server.Implementations/Sorting/AlbumArtistComparer.cs
+++ b/Emby.Server.Implementations/Sorting/AlbumArtistComparer.cs
@@ -1,4 +1,4 @@
-using System.Linq;
+using System.Linq;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Sorting;
@@ -28,7 +28,7 @@ namespace Emby.Server.Implementations.Sorting
/// </summary>
/// <param name="x">The x.</param>
/// <returns>System.String.</returns>
- private string GetValue(BaseItem x)
+ private static string GetValue(BaseItem x)
{
var audio = x as IHasAlbumArtist;
@@ -39,9 +39,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.AlbumArtist; }
- }
+ public string Name => ItemSortBy.AlbumArtist;
}
}
diff --git a/Emby.Server.Implementations/Sorting/AlbumComparer.cs b/Emby.Server.Implementations/Sorting/AlbumComparer.cs
index 68f5f173e..dda1c5478 100644
--- a/Emby.Server.Implementations/Sorting/AlbumComparer.cs
+++ b/Emby.Server.Implementations/Sorting/AlbumComparer.cs
@@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.Sorting
/// </summary>
/// <param name="x">The x.</param>
/// <returns>System.String.</returns>
- private string GetValue(BaseItem x)
+ private static string GetValue(BaseItem x)
{
var audio = x as Audio;
@@ -38,9 +38,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.Album; }
- }
+ public string Name => ItemSortBy.Album;
}
}
diff --git a/Emby.Server.Implementations/Sorting/ArtistComparer.cs b/Emby.Server.Implementations/Sorting/ArtistComparer.cs
index 616aff673..b0f0549e3 100644
--- a/Emby.Server.Implementations/Sorting/ArtistComparer.cs
+++ b/Emby.Server.Implementations/Sorting/ArtistComparer.cs
@@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.Sorting
/// </summary>
/// <param name="x">The x.</param>
/// <returns>System.String.</returns>
- private string GetValue(BaseItem x)
+ private static string GetValue(BaseItem x)
{
var audio = x as Audio;
@@ -43,9 +43,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.Artist; }
- }
+ public string Name => ItemSortBy.Artist;
}
}
diff --git a/Emby.Server.Implementations/Sorting/CommunityRatingComparer.cs b/Emby.Server.Implementations/Sorting/CommunityRatingComparer.cs
index 396bbbdb9..994759171 100644
--- a/Emby.Server.Implementations/Sorting/CommunityRatingComparer.cs
+++ b/Emby.Server.Implementations/Sorting/CommunityRatingComparer.cs
@@ -1,6 +1,7 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
+using System;
namespace Emby.Server.Implementations.Sorting
{
@@ -14,6 +15,12 @@ namespace Emby.Server.Implementations.Sorting
/// <returns>System.Int32.</returns>
public int Compare(BaseItem x, BaseItem y)
{
+ if (x == null)
+ throw new ArgumentNullException(nameof(x));
+
+ if (y == null)
+ throw new ArgumentNullException(nameof(y));
+
return (x.CommunityRating ?? 0).CompareTo(y.CommunityRating ?? 0);
}
@@ -21,9 +28,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.CommunityRating; }
- }
+ public string Name => ItemSortBy.CommunityRating;
}
}
diff --git a/Emby.Server.Implementations/Sorting/CriticRatingComparer.cs b/Emby.Server.Implementations/Sorting/CriticRatingComparer.cs
index 877dbfcc1..5c4aeaf86 100644
--- a/Emby.Server.Implementations/Sorting/CriticRatingComparer.cs
+++ b/Emby.Server.Implementations/Sorting/CriticRatingComparer.cs
@@ -20,7 +20,7 @@ namespace Emby.Server.Implementations.Sorting
return GetValue(x).CompareTo(GetValue(y));
}
- private float GetValue(BaseItem x)
+ private static float GetValue(BaseItem x)
{
return x.CriticRating ?? 0;
}
@@ -29,9 +29,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.CriticRating; }
- }
+ public string Name => ItemSortBy.CriticRating;
}
}
diff --git a/Emby.Server.Implementations/Sorting/DateCreatedComparer.cs b/Emby.Server.Implementations/Sorting/DateCreatedComparer.cs
index c436fcb4a..1c5149517 100644
--- a/Emby.Server.Implementations/Sorting/DateCreatedComparer.cs
+++ b/Emby.Server.Implementations/Sorting/DateCreatedComparer.cs
@@ -18,6 +18,12 @@ namespace Emby.Server.Implementations.Sorting
/// <returns>System.Int32.</returns>
public int Compare(BaseItem x, BaseItem y)
{
+ if (x == null)
+ throw new ArgumentNullException(nameof(x));
+
+ if (y == null)
+ throw new ArgumentNullException(nameof(y));
+
return DateTime.Compare(x.DateCreated, y.DateCreated);
}
@@ -25,9 +31,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.DateCreated; }
- }
+ public string Name => ItemSortBy.DateCreated;
}
}
diff --git a/Emby.Server.Implementations/Sorting/DateLastMediaAddedComparer.cs b/Emby.Server.Implementations/Sorting/DateLastMediaAddedComparer.cs
index fc92505ac..ffe7fbaec 100644
--- a/Emby.Server.Implementations/Sorting/DateLastMediaAddedComparer.cs
+++ b/Emby.Server.Implementations/Sorting/DateLastMediaAddedComparer.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
@@ -42,7 +42,7 @@ namespace Emby.Server.Implementations.Sorting
/// </summary>
/// <param name="x">The x.</param>
/// <returns>DateTime.</returns>
- private DateTime GetDate(BaseItem x)
+ private static DateTime GetDate(BaseItem x)
{
var folder = x as Folder;
@@ -61,9 +61,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.DateLastContentAdded; }
- }
+ public string Name => ItemSortBy.DateLastContentAdded;
}
}
diff --git a/Emby.Server.Implementations/Sorting/DatePlayedComparer.cs b/Emby.Server.Implementations/Sorting/DatePlayedComparer.cs
index 388d2772e..c11c1986c 100644
--- a/Emby.Server.Implementations/Sorting/DatePlayedComparer.cs
+++ b/Emby.Server.Implementations/Sorting/DatePlayedComparer.cs
@@ -28,7 +28,7 @@ namespace Emby.Server.Implementations.Sorting
/// </summary>
/// <value>The user data repository.</value>
public IUserDataManager UserDataRepository { get; set; }
-
+
/// <summary>
/// Compares the specified x.
/// </summary>
@@ -61,9 +61,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.DatePlayed; }
- }
+ public string Name => ItemSortBy.DatePlayed;
}
}
diff --git a/Emby.Server.Implementations/Sorting/GameSystemComparer.cs b/Emby.Server.Implementations/Sorting/GameSystemComparer.cs
index 4ee30397d..0b534b3cb 100644
--- a/Emby.Server.Implementations/Sorting/GameSystemComparer.cs
+++ b/Emby.Server.Implementations/Sorting/GameSystemComparer.cs
@@ -23,7 +23,7 @@ namespace Emby.Server.Implementations.Sorting
/// </summary>
/// <param name="x">The x.</param>
/// <returns>System.String.</returns>
- private string GetValue(BaseItem x)
+ private static string GetValue(BaseItem x)
{
var game = x as Game;
@@ -46,9 +46,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.GameSystem; }
- }
+ public string Name => ItemSortBy.GameSystem;
}
}
diff --git a/Emby.Server.Implementations/Sorting/IsFavoriteOrLikeComparer.cs b/Emby.Server.Implementations/Sorting/IsFavoriteOrLikeComparer.cs
index 27485f09e..48e3172ce 100644
--- a/Emby.Server.Implementations/Sorting/IsFavoriteOrLikeComparer.cs
+++ b/Emby.Server.Implementations/Sorting/IsFavoriteOrLikeComparer.cs
@@ -38,10 +38,7 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.IsFavoriteOrLiked; }
- }
+ public string Name => ItemSortBy.IsFavoriteOrLiked;
/// <summary>
/// Gets or sets the user data repository.
diff --git a/Emby.Server.Implementations/Sorting/IsFolderComparer.cs b/Emby.Server.Implementations/Sorting/IsFolderComparer.cs
index 756d13bd8..8b6cbb2db 100644
--- a/Emby.Server.Implementations/Sorting/IsFolderComparer.cs
+++ b/Emby.Server.Implementations/Sorting/IsFolderComparer.cs
@@ -22,7 +22,7 @@ namespace Emby.Server.Implementations.Sorting
/// </summary>
/// <param name="x">The x.</param>
/// <returns>System.String.</returns>
- private int GetValue(BaseItem x)
+ private static int GetValue(BaseItem x)
{
return x.IsFolder ? 0 : 1;
}
@@ -31,9 +31,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.IsFolder; }
- }
+ public string Name => ItemSortBy.IsFolder;
}
}
diff --git a/Emby.Server.Implementations/Sorting/IsPlayedComparer.cs b/Emby.Server.Implementations/Sorting/IsPlayedComparer.cs
index 987dc54a5..9f4fc2c06 100644
--- a/Emby.Server.Implementations/Sorting/IsPlayedComparer.cs
+++ b/Emby.Server.Implementations/Sorting/IsPlayedComparer.cs
@@ -38,10 +38,7 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.IsUnplayed; }
- }
+ public string Name => ItemSortBy.IsUnplayed;
/// <summary>
/// Gets or sets the user data repository.
diff --git a/Emby.Server.Implementations/Sorting/IsUnplayedComparer.cs b/Emby.Server.Implementations/Sorting/IsUnplayedComparer.cs
index 0f4e4c37e..d145aa8dd 100644
--- a/Emby.Server.Implementations/Sorting/IsUnplayedComparer.cs
+++ b/Emby.Server.Implementations/Sorting/IsUnplayedComparer.cs
@@ -38,10 +38,7 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.IsUnplayed; }
- }
+ public string Name => ItemSortBy.IsUnplayed;
/// <summary>
/// Gets or sets the user data repository.
diff --git a/Emby.Server.Implementations/Sorting/NameComparer.cs b/Emby.Server.Implementations/Sorting/NameComparer.cs
index 8ab5e5172..cfd810a6b 100644
--- a/Emby.Server.Implementations/Sorting/NameComparer.cs
+++ b/Emby.Server.Implementations/Sorting/NameComparer.cs
@@ -18,6 +18,12 @@ namespace Emby.Server.Implementations.Sorting
/// <returns>System.Int32.</returns>
public int Compare(BaseItem x, BaseItem y)
{
+ if (x == null)
+ throw new ArgumentNullException(nameof(x));
+
+ if (y == null)
+ throw new ArgumentNullException(nameof(y));
+
return string.Compare(x.Name, y.Name, StringComparison.CurrentCultureIgnoreCase);
}
@@ -25,9 +31,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.Name; }
- }
+ public string Name => ItemSortBy.Name;
}
}
diff --git a/Emby.Server.Implementations/Sorting/OfficialRatingComparer.cs b/Emby.Server.Implementations/Sorting/OfficialRatingComparer.cs
index 3eab4fccc..cd48e3048 100644
--- a/Emby.Server.Implementations/Sorting/OfficialRatingComparer.cs
+++ b/Emby.Server.Implementations/Sorting/OfficialRatingComparer.cs
@@ -2,6 +2,7 @@
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Querying;
+using System;
namespace Emby.Server.Implementations.Sorting
{
@@ -22,6 +23,12 @@ namespace Emby.Server.Implementations.Sorting
/// <returns>System.Int32.</returns>
public int Compare(BaseItem x, BaseItem y)
{
+ if (x == null)
+ throw new ArgumentNullException(nameof(x));
+
+ if (y == null)
+ throw new ArgumentNullException(nameof(y));
+
var levelX = string.IsNullOrEmpty(x.OfficialRating) ? 0 : _localization.GetRatingLevel(x.OfficialRating) ?? 0;
var levelY = string.IsNullOrEmpty(y.OfficialRating) ? 0 : _localization.GetRatingLevel(y.OfficialRating) ?? 0;
@@ -32,9 +39,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.OfficialRating; }
- }
+ public string Name => ItemSortBy.OfficialRating;
}
}
diff --git a/Emby.Server.Implementations/Sorting/PlayCountComparer.cs b/Emby.Server.Implementations/Sorting/PlayCountComparer.cs
index aecad7c58..b7165ab8c 100644
--- a/Emby.Server.Implementations/Sorting/PlayCountComparer.cs
+++ b/Emby.Server.Implementations/Sorting/PlayCountComparer.cs
@@ -43,17 +43,14 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.PlayCount; }
- }
+ public string Name => ItemSortBy.PlayCount;
/// <summary>
/// Gets or sets the user data repository.
/// </summary>
/// <value>The user data repository.</value>
public IUserDataManager UserDataRepository { get; set; }
-
+
/// <summary>
/// Gets or sets the user manager.
/// </summary>
diff --git a/Emby.Server.Implementations/Sorting/PlayersComparer.cs b/Emby.Server.Implementations/Sorting/PlayersComparer.cs
index 3b54517c3..5b50ea48a 100644
--- a/Emby.Server.Implementations/Sorting/PlayersComparer.cs
+++ b/Emby.Server.Implementations/Sorting/PlayersComparer.cs
@@ -22,7 +22,7 @@ namespace Emby.Server.Implementations.Sorting
/// </summary>
/// <param name="x">The x.</param>
/// <returns>System.String.</returns>
- private int GetValue(BaseItem x)
+ private static int GetValue(BaseItem x)
{
var game = x as Game;
@@ -38,9 +38,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.Players; }
- }
+ public string Name => ItemSortBy.Players;
}
}
diff --git a/Emby.Server.Implementations/Sorting/PremiereDateComparer.cs b/Emby.Server.Implementations/Sorting/PremiereDateComparer.cs
index d7219c86f..26c6badaa 100644
--- a/Emby.Server.Implementations/Sorting/PremiereDateComparer.cs
+++ b/Emby.Server.Implementations/Sorting/PremiereDateComparer.cs
@@ -26,13 +26,13 @@ namespace Emby.Server.Implementations.Sorting
/// </summary>
/// <param name="x">The x.</param>
/// <returns>DateTime.</returns>
- private DateTime GetDate(BaseItem x)
+ private static DateTime GetDate(BaseItem x)
{
if (x.PremiereDate.HasValue)
{
return x.PremiereDate.Value;
}
-
+
if (x.ProductionYear.HasValue)
{
try
@@ -51,9 +51,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.PremiereDate; }
- }
+ public string Name => ItemSortBy.PremiereDate;
}
}
diff --git a/Emby.Server.Implementations/Sorting/ProductionYearComparer.cs b/Emby.Server.Implementations/Sorting/ProductionYearComparer.cs
index ea479419a..0aa5e833b 100644
--- a/Emby.Server.Implementations/Sorting/ProductionYearComparer.cs
+++ b/Emby.Server.Implementations/Sorting/ProductionYearComparer.cs
@@ -25,7 +25,7 @@ namespace Emby.Server.Implementations.Sorting
/// </summary>
/// <param name="x">The x.</param>
/// <returns>DateTime.</returns>
- private int GetValue(BaseItem x)
+ private static int GetValue(BaseItem x)
{
if (x.ProductionYear.HasValue)
{
@@ -44,9 +44,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.ProductionYear; }
- }
+ public string Name => ItemSortBy.ProductionYear;
}
}
diff --git a/Emby.Server.Implementations/Sorting/RandomComparer.cs b/Emby.Server.Implementations/Sorting/RandomComparer.cs
index 1fbecde56..c69ebe41a 100644
--- a/Emby.Server.Implementations/Sorting/RandomComparer.cs
+++ b/Emby.Server.Implementations/Sorting/RandomComparer.cs
@@ -25,9 +25,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.Random; }
- }
+ public string Name => ItemSortBy.Random;
}
}
diff --git a/Emby.Server.Implementations/Sorting/RuntimeComparer.cs b/Emby.Server.Implementations/Sorting/RuntimeComparer.cs
index 63c4758cb..77851d702 100644
--- a/Emby.Server.Implementations/Sorting/RuntimeComparer.cs
+++ b/Emby.Server.Implementations/Sorting/RuntimeComparer.cs
@@ -1,6 +1,7 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
+using System;
namespace Emby.Server.Implementations.Sorting
{
@@ -17,6 +18,12 @@ namespace Emby.Server.Implementations.Sorting
/// <returns>System.Int32.</returns>
public int Compare(BaseItem x, BaseItem y)
{
+ if (x == null)
+ throw new ArgumentNullException(nameof(x));
+
+ if (y == null)
+ throw new ArgumentNullException(nameof(y));
+
return (x.RunTimeTicks ?? 0).CompareTo(y.RunTimeTicks ?? 0);
}
@@ -24,9 +31,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.Runtime; }
- }
+ public string Name => ItemSortBy.Runtime;
}
}
diff --git a/Emby.Server.Implementations/Sorting/SeriesSortNameComparer.cs b/Emby.Server.Implementations/Sorting/SeriesSortNameComparer.cs
index b441a29c1..1bbe30b95 100644
--- a/Emby.Server.Implementations/Sorting/SeriesSortNameComparer.cs
+++ b/Emby.Server.Implementations/Sorting/SeriesSortNameComparer.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
using System;
@@ -18,7 +18,7 @@ namespace Emby.Server.Implementations.Sorting
return string.Compare(GetValue(x), GetValue(y), StringComparison.CurrentCultureIgnoreCase);
}
- private string GetValue(BaseItem item)
+ private static string GetValue(BaseItem item)
{
var hasSeries = item as IHasSeries;
@@ -29,9 +29,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.SeriesSortName; }
- }
+ public string Name => ItemSortBy.SeriesSortName;
}
}
diff --git a/Emby.Server.Implementations/Sorting/SortNameComparer.cs b/Emby.Server.Implementations/Sorting/SortNameComparer.cs
index f2a764840..6c42ed988 100644
--- a/Emby.Server.Implementations/Sorting/SortNameComparer.cs
+++ b/Emby.Server.Implementations/Sorting/SortNameComparer.cs
@@ -18,6 +18,12 @@ namespace Emby.Server.Implementations.Sorting
/// <returns>System.Int32.</returns>
public int Compare(BaseItem x, BaseItem y)
{
+ if (x == null)
+ throw new ArgumentNullException(nameof(x));
+
+ if (y == null)
+ throw new ArgumentNullException(nameof(y));
+
return string.Compare(x.SortName, y.SortName, StringComparison.CurrentCultureIgnoreCase);
}
@@ -25,9 +31,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.SortName; }
- }
+ public string Name => ItemSortBy.SortName;
}
}
diff --git a/Emby.Server.Implementations/Sorting/StartDateComparer.cs b/Emby.Server.Implementations/Sorting/StartDateComparer.cs
index 6be5f4883..7ae8037d9 100644
--- a/Emby.Server.Implementations/Sorting/StartDateComparer.cs
+++ b/Emby.Server.Implementations/Sorting/StartDateComparer.cs
@@ -24,7 +24,7 @@ namespace Emby.Server.Implementations.Sorting
/// </summary>
/// <param name="x">The x.</param>
/// <returns>DateTime.</returns>
- private DateTime GetDate(BaseItem x)
+ private static DateTime GetDate(BaseItem x)
{
var hasStartDate = x as LiveTvProgram;
@@ -39,9 +39,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.StartDate; }
- }
+ public string Name => ItemSortBy.StartDate;
}
}
diff --git a/Emby.Server.Implementations/Sorting/StudioComparer.cs b/Emby.Server.Implementations/Sorting/StudioComparer.cs
index 6735022af..605d65154 100644
--- a/Emby.Server.Implementations/Sorting/StudioComparer.cs
+++ b/Emby.Server.Implementations/Sorting/StudioComparer.cs
@@ -1,6 +1,7 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Querying;
+using System;
using System.Linq;
namespace Emby.Server.Implementations.Sorting
@@ -15,6 +16,11 @@ namespace Emby.Server.Implementations.Sorting
/// <returns>System.Int32.</returns>
public int Compare(BaseItem x, BaseItem y)
{
+ if (x == null)
+ throw new ArgumentNullException(nameof(x));
+
+ if (y == null)
+ throw new ArgumentNullException(nameof(y));
return AlphanumComparator.CompareValues(x.Studios.FirstOrDefault() ?? string.Empty, y.Studios.FirstOrDefault() ?? string.Empty);
}
@@ -22,9 +28,6 @@ namespace Emby.Server.Implementations.Sorting
/// Gets the name.
/// </summary>
/// <value>The name.</value>
- public string Name
- {
- get { return ItemSortBy.Studio; }
- }
+ public string Name => ItemSortBy.Studio;
}
}
diff --git a/Emby.Server.Implementations/TV/TVSeriesManager.cs b/Emby.Server.Implementations/TV/TVSeriesManager.cs
index 1f9cb9164..652557466 100644
--- a/Emby.Server.Implementations/TV/TVSeriesManager.cs
+++ b/Emby.Server.Implementations/TV/TVSeriesManager.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.TV;
@@ -171,12 +171,12 @@ namespace Emby.Server.Implementations.TV
.Where(i => i != null);
}
- private string GetUniqueSeriesKey(Episode episode)
+ private static string GetUniqueSeriesKey(Episode episode)
{
return episode.SeriesPresentationUniqueKey;
}
- private string GetUniqueSeriesKey(Series series)
+ private static string GetUniqueSeriesKey(Series series)
{
return series.GetPresentationUniqueKey();
}
@@ -238,7 +238,7 @@ namespace Emby.Server.Implementations.TV
return new Tuple<DateTime, Func<Episode>>(DateTime.MinValue, getEpisode);
}
- private QueryResult<BaseItem> GetResult(IEnumerable<BaseItem> items, NextUpQuery query)
+ private static QueryResult<BaseItem> GetResult(IEnumerable<BaseItem> items, NextUpQuery query)
{
int totalCount = 0;
diff --git a/Emby.Server.Implementations/TextEncoding/NLangDetect/Extensions/CharExtensions.cs b/Emby.Server.Implementations/TextEncoding/NLangDetect/Extensions/CharExtensions.cs
index 59076bd66..cd77a30eb 100644
--- a/Emby.Server.Implementations/TextEncoding/NLangDetect/Extensions/CharExtensions.cs
+++ b/Emby.Server.Implementations/TextEncoding/NLangDetect/Extensions/CharExtensions.cs
@@ -333,7 +333,7 @@ namespace NLangDetect.Core.Extensions
if (!IsValidCodePoint(codePoint))
{
- throw new ArgumentException("Argument is not a valid code point.", "ch");
+ throw new ArgumentException("Argument is not a valid code point.", nameof(ch));
}
int top, bottom, current;
diff --git a/Emby.Server.Implementations/TextEncoding/NLangDetect/Extensions/StringExtensions.cs b/Emby.Server.Implementations/TextEncoding/NLangDetect/Extensions/StringExtensions.cs
index fc6c58a95..5db68bbf1 100644
--- a/Emby.Server.Implementations/TextEncoding/NLangDetect/Extensions/StringExtensions.cs
+++ b/Emby.Server.Implementations/TextEncoding/NLangDetect/Extensions/StringExtensions.cs
@@ -1,25 +1,25 @@
-using System;
+using System;
namespace NLangDetect.Core.Extensions
{
- public static class StringExtensions
- {
- /// <summary>
- /// Returns a new character sequence that is a subsequence of this sequence. The subsequence starts with the character at the specified index and ends with the character at index end - 1. The length of the returned sequence is end - start, so if start == end then an empty sequence is returned.
- /// </summary>
- /// <param name="s"></param>
- /// <param name="start">the start index, inclusive</param>
- /// <param name="end">the end index, exclusive</param>
- /// <returns>the specified subsequence</returns>
- /// <exception cref="IndexOutOfRangeException"> if start or end are negative, if end is greater than length(), or if start is greater than end</exception>
- public static string SubSequence(this string s, int start, int end)
+ public static class StringExtensions
{
- if (start < 0) throw new ArgumentOutOfRangeException("start", "Argument must not be negative.");
- if (end < 0) throw new ArgumentOutOfRangeException("end", "Argument must not be negative.");
- if (end > s.Length) throw new ArgumentOutOfRangeException("end", "Argument must not be greater than the input string's length.");
- if (start > end) throw new ArgumentOutOfRangeException("start", "Argument must not be greater than the 'end' argument.");
-
- return s.Substring(start, end - start);
+ /// <summary>
+ /// Returns a new character sequence that is a subsequence of this sequence. The subsequence starts with the character at the specified index and ends with the character at index end - 1. The length of the returned sequence is end - start, so if start == end then an empty sequence is returned.
+ /// </summary>
+ /// <param name="s"></param>
+ /// <param name="start">the start index, inclusive</param>
+ /// <param name="end">the end index, exclusive</param>
+ /// <returns>the specified subsequence</returns>
+ /// <exception cref="IndexOutOfRangeException"> if start or end are negative, if end is greater than length(), or if start is greater than end</exception>
+ public static string SubSequence(this string s, int start, int end)
+ {
+ if (start < 0) throw new ArgumentOutOfRangeException(nameof(start), "Argument must not be negative.");
+ if (end < 0) throw new ArgumentOutOfRangeException(nameof(end), "Argument must not be negative.");
+ if (end > s.Length) throw new ArgumentOutOfRangeException(nameof(end), "Argument must not be greater than the input string's length.");
+ if (start > end) throw new ArgumentOutOfRangeException(nameof(start), "Argument must not be greater than the 'end' argument.");
+
+ return s.Substring(start, end - start);
+ }
}
- }
}
diff --git a/Emby.Server.Implementations/TextEncoding/NLangDetect/LanguageDetector.cs b/Emby.Server.Implementations/TextEncoding/NLangDetect/LanguageDetector.cs
index fc7d420a9..044c7e759 100644
--- a/Emby.Server.Implementations/TextEncoding/NLangDetect/LanguageDetector.cs
+++ b/Emby.Server.Implementations/TextEncoding/NLangDetect/LanguageDetector.cs
@@ -23,7 +23,7 @@ namespace NLangDetect.Core
public static string DetectLanguage(string plainText)
{
- if (string.IsNullOrEmpty(plainText)) { throw new ArgumentException("Argument can't be null nor empty.", "plainText"); }
+ if (string.IsNullOrEmpty(plainText)) { throw new ArgumentException("Argument can't be null nor empty.", nameof(plainText)); }
Detector detector = DetectorFactory.Create(_DefaultAlpha);
diff --git a/Emby.Server.Implementations/TextEncoding/TextEncoding.cs b/Emby.Server.Implementations/TextEncoding/TextEncoding.cs
index f30c181a0..8f15d5a7b 100644
--- a/Emby.Server.Implementations/TextEncoding/TextEncoding.cs
+++ b/Emby.Server.Implementations/TextEncoding/TextEncoding.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Text;
using MediaBrowser.Model.IO;
using Microsoft.Extensions.Logging;
@@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.TextEncoding
return Encoding.ASCII;
}
- private Encoding GetInitialEncoding(byte[] buffer, int count)
+ private static Encoding GetInitialEncoding(byte[] buffer, int count)
{
if (count >= 3)
{
@@ -137,6 +137,7 @@ namespace Emby.Server.Implementations.TextEncoding
}
catch (NLangDetectException ex)
{
+ _logger.LogDebug(ex, "LanguageDetector.DetectLanguage threw a NLangDetectException.");
}
try
@@ -145,6 +146,7 @@ namespace Emby.Server.Implementations.TextEncoding
}
catch (NLangDetectException ex)
{
+ _logger.LogDebug(ex, "LanguageDetector.DetectLanguage threw a NLangDetectException.");
}
try
@@ -153,6 +155,7 @@ namespace Emby.Server.Implementations.TextEncoding
}
catch (NLangDetectException ex)
{
+ _logger.LogDebug(ex, "LanguageDetector.DetectLanguage threw a NLangDetectException.");
}
return null;
@@ -162,7 +165,7 @@ namespace Emby.Server.Implementations.TextEncoding
{
if (string.IsNullOrWhiteSpace(charset))
{
- throw new ArgumentNullException("charset");
+ throw new ArgumentNullException(nameof(charset));
}
_logger.LogDebug("Getting encoding object for character set: {0}", charset);
@@ -187,7 +190,7 @@ namespace Emby.Server.Implementations.TextEncoding
return GetEncodingFromCharset(charset);
}
- private string GetFileCharacterSetFromLanguage(string language)
+ private static string GetFileCharacterSetFromLanguage(string language)
{
// https://developer.xamarin.com/api/type/System.Text.Encoding/
@@ -245,7 +248,7 @@ namespace Emby.Server.Implementations.TextEncoding
}
}
- private string DetectCharset(byte[] bytes, int index, int count, string language)
+ private static string DetectCharset(byte[] bytes, int index, int count, string language)
{
var detector = new CharsetDetector();
detector.Feed(bytes, index, count);
diff --git a/Emby.Server.Implementations/TextEncoding/TextEncodingDetect.cs b/Emby.Server.Implementations/TextEncoding/TextEncodingDetect.cs
index a0395a21b..15f1ce91e 100644
--- a/Emby.Server.Implementations/TextEncoding/TextEncodingDetect.cs
+++ b/Emby.Server.Implementations/TextEncoding/TextEncodingDetect.cs
@@ -1,15 +1,15 @@
namespace Emby.Server.Implementations.TextEncoding
{
// Copyright 2015-2016 Jonathan Bennett <jon@autoitscript.com>
- //
- // https://www.autoitscript.com
+ //
+ // https://www.autoitscript.com
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
- //
+ //
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -61,10 +61,7 @@
/// </summary>
public bool NullSuggestsBinary
{
- set
- {
- _nullSuggestsBinary = value;
- }
+ set => _nullSuggestsBinary = value;
}
public double Utf16ExpectedNullPercent
@@ -166,7 +163,7 @@
return encoding;
}
- // Now try UTF16
+ // Now try UTF16
encoding = CheckUtf16NewlineChars(buffer, size);
if (encoding != CharacterEncoding.None)
{
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/CharsetDetector.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/CharsetDetector.cs
index 942fda8d1..922239c54 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/CharsetDetector.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/CharsetDetector.cs
@@ -41,7 +41,7 @@ using System.IO;
namespace UniversalDetector
{
/// <summary>
- /// Default implementation of charset detection interface.
+ /// Default implementation of charset detection interface.
/// The detector can be fed by a System.IO.Stream:
/// <example>
/// <code>
@@ -52,9 +52,9 @@ namespace UniversalDetector
/// Console.WriteLine("{0}, {1}", cdet.Charset, cdet.Confidence);
/// </code>
/// </example>
- ///
+ ///
/// or by a byte a array:
- ///
+ ///
/// <example>
/// <code>
/// byte[] buff = new byte[1024];
@@ -64,23 +64,23 @@ namespace UniversalDetector
/// cdet.DataEnd();
/// Console.WriteLine("{0}, {1}", cdet.Charset, cdet.Confidence);
/// </code>
- /// </example>
- /// </summary>
+ /// </example>
+ /// </summary>
public class CharsetDetector : Core.UniversalDetector, ICharsetDetector
{
private string charset;
-
+
private float confidence;
-
+
//public event DetectorFinished Finished;
-
+
public CharsetDetector() : base(FILTER_ALL)
{
-
+
}
public void Feed(Stream stream)
- {
+ {
byte[] buff = new byte[1024];
int read;
while ((read = stream.Read(buff, 0, buff.Length)) > 0 && !done)
@@ -88,12 +88,12 @@ namespace UniversalDetector
Feed(buff, 0, read);
}
}
-
- public bool IsDone()
+
+ public bool IsDone()
{
return done;
}
-
+
public override void Reset()
{
this.charset = null;
@@ -101,14 +101,10 @@ namespace UniversalDetector
base.Reset();
}
- public string Charset {
- get { return charset; }
- }
+ public string Charset => charset;
+
+ public float Confidence => confidence;
- public float Confidence {
- get { return confidence; }
- }
-
protected override void Report(string charset, float confidence)
{
this.charset = charset;
@@ -118,7 +114,7 @@ namespace UniversalDetector
// }
}
}
-
+
//public delegate void DetectorFinished(string charset, float confidence);
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Big5Prober.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Big5Prober.cs
index 760fca9bd..19152a7ac 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Big5Prober.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Big5Prober.cs
@@ -44,12 +44,12 @@ namespace UniversalDetector.Core
private CodingStateMachine codingSM;
private BIG5DistributionAnalyser distributionAnalyser;
private byte[] lastChar = new byte[2];
-
+
public Big5Prober()
{
this.codingSM = new CodingStateMachine(new BIG5SMModel());
this.distributionAnalyser = new BIG5DistributionAnalyser();
- this.Reset();
+ this.Reset();
}
public override ProbingState HandleData(byte[] buf, int offset, int len)
@@ -73,7 +73,7 @@ namespace UniversalDetector.Core
lastChar[1] = buf[offset];
distributionAnalyser.HandleOneChar(lastChar, 0, charLen);
} else {
- distributionAnalyser.HandleOneChar(buf, i-1, charLen);
+ distributionAnalyser.HandleOneChar(buf, i-1, charLen);
}
}
}
@@ -84,23 +84,23 @@ namespace UniversalDetector.Core
state = ProbingState.FoundIt;
return state;
}
-
+
public override void Reset()
{
- codingSM.Reset();
+ codingSM.Reset();
state = ProbingState.Detecting;
distributionAnalyser.Reset();
}
-
+
public override string GetCharsetName()
{
- return "Big-5";
+ return "Big-5";
}
-
+
public override float GetConfidence()
{
return distributionAnalyser.GetConfidence();
}
-
+
}
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/BitPackage.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/BitPackage.cs
index 16483e661..19bcdc779 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/BitPackage.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/BitPackage.cs
@@ -43,15 +43,15 @@ namespace UniversalDetector.Core
public static int INDEX_SHIFT_4BITS = 3;
public static int INDEX_SHIFT_8BITS = 2;
public static int INDEX_SHIFT_16BITS = 1;
-
+
public static int SHIFT_MASK_4BITS = 7;
public static int SHIFT_MASK_8BITS = 3;
public static int SHIFT_MASK_16BITS = 1;
-
+
public static int BIT_SHIFT_4BITS = 2;
public static int BIT_SHIFT_8BITS = 3;
public static int BIT_SHIFT_16BITS = 4;
-
+
public static int UNIT_MASK_4BITS = 0x0000000F;
public static int UNIT_MASK_8BITS = 0x000000FF;
public static int UNIT_MASK_16BITS = 0x0000FFFF;
@@ -61,7 +61,7 @@ namespace UniversalDetector.Core
private int bitShift;
private int unitMask;
private int[] data;
-
+
public BitPackage(int indexShift, int shiftMask,
int bitShift, int unitMask, int[] data)
{
@@ -71,27 +71,27 @@ namespace UniversalDetector.Core
this.unitMask = unitMask;
this.data = data;
}
-
+
public static int Pack16bits(int a, int b)
{
return ((b << 16) | a);
}
-
+
public static int Pack8bits(int a, int b, int c, int d)
{
return Pack16bits((b << 8) | a, (d << 8) | c);
}
-
- public static int Pack4bits(int a, int b, int c, int d,
+
+ public static int Pack4bits(int a, int b, int c, int d,
int e, int f, int g, int h)
{
return Pack8bits((b << 4) | a, (d << 4) | c,
(f << 4) | e, (h << 4) | g);
}
-
+
public int Unpack(int i)
{
- return (data[i >> indexShift] >>
+ return (data[i >> indexShift] >>
((i & shiftMask) << bitShift)) & unitMask;
}
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CharDistributionAnalyser.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CharDistributionAnalyser.cs
index 8b5bc37d3..da5995932 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CharDistributionAnalyser.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CharDistributionAnalyser.cs
@@ -38,12 +38,11 @@
namespace UniversalDetector.Core
{
/// <summary>
- /// Base class for the Character Distribution Method, used for
+ /// Base class for the Character Distribution Method, used for
/// the CJK encodings
/// </summary>
public abstract class CharDistributionAnalyser
{
-
protected const float SURE_YES = 0.99f;
protected const float SURE_NO = 0.01f;
protected const int MINIMUM_DATA_THRESHOLD = 4;
@@ -57,19 +56,19 @@ namespace UniversalDetector.Core
//Total character encounted.
protected int totalChars;
-
+
// Mapping table to get frequency order from char order (get from GetOrder())
protected int[] charToFreqOrder;
// Size of above table
protected int tableSize;
- //This is a constant value varies from language to language, it is used
- // in calculating confidence.
- protected float typicalDistributionRatio;
+ //This is a constant value varies from language to language, it is used
+ // in calculating confidence.
+ protected float typicalDistributionRatio;
public CharDistributionAnalyser()
- {
+ {
Reset();
}
@@ -77,10 +76,10 @@ namespace UniversalDetector.Core
/// Feed a block of data and do distribution analysis
/// </summary>
/// </param>
- //public abstract void HandleData(byte[] buf, int offset, int len);
-
+ //public abstract void HandleData(byte[] buf, int offset, int len);
+
/// <summary>
- /// we do not handle character base on its original encoding string, but
+ /// we do not handle character base on its original encoding string, but
/// convert this encoding string to a number, here called order.
/// This allow multiple encoding of a language to share one frequency table
/// </summary>
@@ -88,9 +87,9 @@ namespace UniversalDetector.Core
/// <param name="offset"></param>
/// <returns></returns>
public abstract int GetOrder(byte[] buf, int offset);
-
+
/// <summary>
- /// Feed a character with known length
+ /// Feed a character with known length
/// </summary>
/// <param name="buf">A <see cref="System.Byte"/></param>
/// <param name="offset">buf offset</param>
@@ -107,13 +106,13 @@ namespace UniversalDetector.Core
}
}
- public virtual void Reset()
+ public virtual void Reset()
{
done = false;
totalChars = 0;
freqChars = 0;
}
-
+
/// <summary>
/// return confidence base on received data
/// </summary>
@@ -133,16 +132,16 @@ namespace UniversalDetector.Core
//normalize confidence, (we don't want to be 100% sure)
return SURE_YES;
}
-
+
//It is not necessary to receive all data to draw conclusion. For charset detection,
// certain amount of data is enough
- public bool GotEnoughData()
+ public bool GotEnoughData()
{
return totalChars > ENOUGH_DATA_THRESHOLD;
}
}
-
+
public class GB18030DistributionAnalyser : CharDistributionAnalyser
{
// GB2312 most frequently used character table
@@ -155,7 +154,7 @@ namespace UniversalDetector.Core
*
* Idea Distribution Ratio = 0.79135/(1-0.79135) = 3.79
* Random Distribution Ration = 512 / (3755 - 512) = 0.157
- *
+ *
* Typical Distribution Ratio about 25% of Ideal one, still much higher that RDR
*****************************************************************************/
@@ -400,8 +399,8 @@ namespace UniversalDetector.Core
381,1638,4592,1020, 516,3214, 458, 947,4575,1432, 211,1514,2926,1865,2142, 189,
852,1221,1400,1486, 882,2299,4036, 351, 28,1122, 700,6479,6480,6481,6482,6483, //last 512
- /***************************************************************************************
- *Everything below is of no interest for detection purpose *
+ /***************************************************************************************
+ *Everything below is of no interest for detection purpose *
***************************************************************************************
5508,6484,3900,3414,3974,4441,4024,3537,4037,5628,5099,3633,6485,3148,6486,3636,
@@ -601,7 +600,7 @@ namespace UniversalDetector.Core
tableSize = GB2312_TABLE_SIZE;
typicalDistributionRatio = GB2312_TYPICAL_DISTRIBUTION_RATIO;
}
-
+
/// <summary>
/// for GB2312 encoding, we are interested
/// first byte range: 0xb0 -- 0xfe
@@ -609,20 +608,20 @@ namespace UniversalDetector.Core
/// no validation needed here. State machine has done that
/// </summary>
/// <returns></returns>
- public override int GetOrder(byte[] buf, int offset)
- {
- if (buf[offset] >= 0xB0 && buf[offset+1] >= 0xA1)
+ public override int GetOrder(byte[] buf, int offset)
+ {
+ if (buf[offset] >= 0xB0 && buf[offset+1] >= 0xA1)
return 94 * (buf[offset] - 0xb0) + buf[offset+1] - 0xA1;
else
return -1;
}
}
-
+
public class EUCTWDistributionAnalyser : CharDistributionAnalyser
{
// EUCTW frequency table
- // Converted from big5 work
- // by Taiwan's Mandarin Promotion Council
+ // Converted from big5 work
+ // by Taiwan's Mandarin Promotion Council
// <http://www.edu.tw:81/mandr/>
/******************************************************************************
* 128 --> 0.42261
@@ -633,7 +632,7 @@ namespace UniversalDetector.Core
*
* Idea Distribution Ratio = 0.74851/(1-0.74851) =2.98
* Random Distribution Ration = 512/(5401-512)=0.105
- *
+ *
* Typical Distribution Ratio about 25% of Ideal one, still much higher than RDR
*****************************************************************************/
@@ -979,8 +978,8 @@ namespace UniversalDetector.Core
890,3614,3864,8110,1877,3732,3402,8111,2183,2353,3403,1652,8112,8113,8114, 941, // 8086
2294, 208,3499,4057,2019, 330,4294,3865,2892,2492,3733,4295,8115,8116,8117,8118, // 8102
- /***************************************************************************************
- *Everything below is of no interest for detection purpose *
+ /***************************************************************************************
+ *Everything below is of no interest for detection purpose *
***************************************************************************************
2515,1613,4582,8119,3312,3866,2516,8120,4058,8121,1637,4059,2466,4583,3867,8122, // 8118
@@ -1022,7 +1021,7 @@ namespace UniversalDetector.Core
8678,8679,8680,8681,8682,8683,8684,8685,8686,8687,8688,8689,8690,8691,8692,8693, // 8694
8694,8695,8696,8697,8698,8699,8700,8701,8702,8703,8704,8705,8706,8707,8708,8709, // 8710
8710,8711,8712,8713,8714,8715,8716,8717,8718,8719,8720,8721,8722,8723,8724,8725, // 8726
- 8726,8727,8728,8729,8730,8731,8732,8733,8734,8735,8736,8737,8738,8739,8740,8741, // 8742 //13973
+ 8726,8727,8728,8729,8730,8731,8732,8733,8734,8735,8736,8737,8738,8739,8740,8741, // 8742 //13973
****************************************************************************************/
};
@@ -1038,15 +1037,15 @@ namespace UniversalDetector.Core
/// second byte range: 0xa1 -- 0xfe
/// no validation needed here. State machine has done that
/// </summary>
- public override int GetOrder(byte[] buf, int offset)
- {
- if (buf[offset] >= 0xC4)
+ public override int GetOrder(byte[] buf, int offset)
+ {
+ if (buf[offset] >= 0xC4)
return 94 * (buf[offset] - 0xC4) + buf[offset+1] - 0xA1;
else
return -1;
}
}
-
+
public class EUCKRDistributionAnalyser : CharDistributionAnalyser
{
// Sampling from about 20M text materials include literature and computer technology
@@ -1215,8 +1214,8 @@ namespace UniversalDetector.Core
2629,2630,2631, 924, 648, 863, 603,2632,2633, 934,1540, 864, 865,2634, 642,1042,
670,1190,2635,2636,2637,2638, 168,2639, 652, 873, 542,1054,1541,2640,2641,2642, //512, 256
- /***************************************************************************************
- * Everything below is of no interest for detection purpose
+ /***************************************************************************************
+ * Everything below is of no interest for detection purpose *
***************************************************************************************
2643,2644,2645,2646,2647,2648,2649,2650,2651,2652,2653,2654,2655,2656,2657,2658,
@@ -1619,32 +1618,32 @@ namespace UniversalDetector.Core
8704,8705,8706,8707,8708,8709,8710,8711,8712,8713,8714,8715,8716,8717,8718,8719,
8720,8721,8722,8723,8724,8725,8726,8727,8728,8729,8730,8731,8732,8733,8734,8735,
8736,8737,8738,8739,8740,8741 */ };
-
+
public EUCKRDistributionAnalyser()
{
charToFreqOrder = EUCKR_CHAR2FREQ_ORDER;
tableSize = EUCKR_TABLE_SIZE;
- typicalDistributionRatio = EUCKR_TYPICAL_DISTRIBUTION_RATIO;
+ typicalDistributionRatio = EUCKR_TYPICAL_DISTRIBUTION_RATIO;
}
-
+
/// <summary>
/// first byte range: 0xb0 -- 0xfe
/// second byte range: 0xa1 -- 0xfe
/// no validation needed here. State machine has done that
/// </summary>
- public override int GetOrder(byte[] buf, int offset)
- {
- if (buf[offset] >= 0xB0)
+ public override int GetOrder(byte[] buf, int offset)
+ {
+ if (buf[offset] >= 0xB0)
return 94 * (buf[offset] - 0xB0) + buf[offset+1] - 0xA1;
else
return -1;
}
}
-
+
public class BIG5DistributionAnalyser : CharDistributionAnalyser
{
// Big5 frequency table
- // by Taiwan's Mandarin Promotion Council
+ // by Taiwan's Mandarin Promotion Council
// <http://www.edu.tw:81/mandr/>
/******************************************************************************
* 128 --> 0.42261
@@ -1655,7 +1654,7 @@ namespace UniversalDetector.Core
*
* Idea Distribution Ratio = 0.74851/(1-0.74851) =2.98
* Random Distribution Ration = 512/(5401-512)=0.105
- *
+ *
* Typical Distribution Ratio about 25% of Ideal one, still much higher than RDR
*****************************************************************************/
@@ -2001,8 +2000,8 @@ namespace UniversalDetector.Core
890,3669,3943,5791,1878,3798,3439,5792,2186,2358,3440,1652,5793,5794,5795, 941, // 5360
2299, 208,3546,4161,2020, 330,4438,3944,2906,2499,3799,4439,4811,5796,5797,5798, // 5376 //last 512
- /***************************************************************************************
- *Everything below is of no interest for detection purpose *
+ /***************************************************************************************
+ *Everything below is of no interest for detection purpose *
***************************************************************************************
2522,1613,4812,5799,3345,3945,2523,5800,4162,5801,1637,4163,2471,4813,3946,5802, // 5392
@@ -2545,29 +2544,29 @@ namespace UniversalDetector.Core
13968,13969,13970,13971,13972, //13973
****************************************************************************************/
};
-
+
public BIG5DistributionAnalyser()
{
charToFreqOrder = BIG5_CHAR2FREQ_ORDER;
tableSize = BIG5_TABLE_SIZE;
- typicalDistributionRatio = BIG5_TYPICAL_DISTRIBUTION_RATIO;
+ typicalDistributionRatio = BIG5_TYPICAL_DISTRIBUTION_RATIO;
}
-
+
/// <summary>
/// first byte range: 0xa4 -- 0xfe
/// second byte range: 0x40 -- 0x7e , 0xa1 -- 0xfe
/// no validation needed here. State machine has done that
/// </summary>
- public override int GetOrder(byte[] buf, int offset)
- {
+ public override int GetOrder(byte[] buf, int offset)
+ {
if (buf[offset] >= 0xA4) {
if (buf[offset+1] >= 0xA1)
return 157 * (buf[offset] - 0xA4) + buf[offset+1] - 0xA1 + 63;
else
return 157 * (buf[offset] - 0xA4) + buf[offset+1] - 0x40;
} else {
- return -1;
- }
+ return -1;
+ }
}
}
@@ -2575,7 +2574,7 @@ namespace UniversalDetector.Core
{
//Sampling from about 20M text materials include literature and computer technology
// Japanese frequency table, applied to both S-JIS and EUC-JP
- //They are sorted in order.
+ //They are sorted in order.
/******************************************************************************
* 128 --> 0.77094
@@ -2586,8 +2585,8 @@ namespace UniversalDetector.Core
*
* Idea Distribution Ratio = 0.92635 / (1-0.92635) = 12.58
* Random Distribution Ration = 512 / (2965+62+83+86-512) = 0.191
- *
- * Typical Distribution Ratio, 25% of IDR
+ *
+ * Typical Distribution Ratio, 25% of IDR
*****************************************************************************/
protected static float SJIS_TYPICAL_DISTRIBUTION_RATIO = 3.0f;
@@ -2869,8 +2868,8 @@ namespace UniversalDetector.Core
1444,1698,2385,2251,3729,1365,2281,2235,1717,6188, 864,3841,2515, 444, 527,2767, // 4352
2922,3625, 544, 461,6189, 566, 209,2437,3398,2098,1065,2068,3331,3626,3257,2137, // 4368 //last 512
- /***************************************************************************************
- *Everything below is of no interest for detection purpose *
+ /***************************************************************************************
+ *Everything below is of no interest for detection purpose *
***************************************************************************************
2138,2122,3730,2888,1995,1820,1044,6190,6191,6192,6193,6194,6195,6196,6197,6198, // 4384
@@ -3118,31 +3117,31 @@ namespace UniversalDetector.Core
8240,8241,8242,8243,8244,8245,8246,8247,8248,8249,8250,8251,8252,8253,8254,8255, // 8256
8256,8257,8258,8259,8260,8261,8262,8263,8264,8265,8266,8267,8268,8269,8270,8271, // 8272
****************************************************************************************/
- };
+ };
public SJISDistributionAnalyser()
{
charToFreqOrder = SJIS_CHAR2FREQ_ORDER;
tableSize = SJIS_TABLE_SIZE;
- typicalDistributionRatio = SJIS_TYPICAL_DISTRIBUTION_RATIO;
+ typicalDistributionRatio = SJIS_TYPICAL_DISTRIBUTION_RATIO;
}
-
+
/// <summary>
/// first byte range: 0x81 -- 0x9f , 0xe0 -- 0xfe
/// second byte range: 0x40 -- 0x7e, 0x81 -- oxfe
/// no validation needed here. State machine has done that
/// </summary>
- public override int GetOrder(byte[] buf, int offset)
- {
+ public override int GetOrder(byte[] buf, int offset)
+ {
int order = 0;
-
- if (buf[offset] >= 0x81 && buf[offset] <= 0x9F)
+
+ if (buf[offset] >= 0x81 && buf[offset] <= 0x9F)
order = 188 * (buf[offset] - 0x81);
- else if (buf[offset] >= 0xE0 && buf[offset] <= 0xEF)
+ else if (buf[offset] >= 0xE0 && buf[offset] <= 0xEF)
order = 188 * (buf[offset] - 0xE0 + 31);
else
return -1;
order += buf[offset+1] - 0x40;
-
+
if (buf[offset+1] > 0x7F)
order--;
return order;
@@ -3154,20 +3153,18 @@ namespace UniversalDetector.Core
public EUCJPDistributionAnalyser() : base()
{
}
-
+
/// <summary>
/// first byte range: 0xa0 -- 0xfe
/// second byte range: 0xa1 -- 0xfe
/// no validation needed here. State machine has done that
/// </summary>
- public override int GetOrder(byte[] buf, int offset)
- {
- if (buf[offset] >= 0xA0)
+ public override int GetOrder(byte[] buf, int offset)
+ {
+ if (buf[offset] >= 0xA0)
return 94 * (buf[offset] - 0xA1) + buf[offset+1] - 0xA1;
else
return -1;
}
}
-
-
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CharsetProber.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CharsetProber.cs
index 3369dd430..cc4539058 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CharsetProber.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CharsetProber.cs
@@ -21,7 +21,7 @@
* Contributor(s):
* Shy Shalom <shooshX@gmail.com>
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
- *
+ *
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -40,10 +40,10 @@ using System.IO;
namespace UniversalDetector.Core
{
- public enum ProbingState {
+ public enum ProbingState {
Detecting = 0, // no sure answer yet, but caller can ask for confidence
FoundIt = 1, // positive answer
- NotMe = 2 // negative answer
+ NotMe = 2 // negative answer
};
public abstract class CharsetProber
@@ -51,16 +51,16 @@ namespace UniversalDetector.Core
protected const float SHORTCUT_THRESHOLD = 0.95F;
protected ProbingState state;
-
+
// ASCII codes
private const byte SPACE = 0x20;
private const byte CAPITAL_A = 0x41;
private const byte CAPITAL_Z = 0x5A;
private const byte SMALL_A = 0x61;
private const byte SMALL_Z = 0x7A;
- private const byte LESS_THAN = 0x3C;
+ private const byte LESS_THAN = 0x3C;
private const byte GREATER_THAN = 0x3E;
-
+
/// <summary>
/// Feed data to the prober
/// </summary>
@@ -71,44 +71,44 @@ namespace UniversalDetector.Core
/// A <see cref="ProbingState"/>
/// </returns>
public abstract ProbingState HandleData(byte[] buf, int offset, int len);
-
+
/// <summary>
/// Reset prober state
/// </summary>
public abstract void Reset();
public abstract string GetCharsetName();
-
+
public abstract float GetConfidence();
-
+
public virtual ProbingState GetState()
{
return state;
}
public virtual void SetOption()
- {
-
+ {
+
}
public virtual void DumpStatus()
- {
-
+ {
+
}
//
// Helper functions used in the Latin1 and Group probers
//
/// <summary>
- ///
+ ///
/// </summary>
/// <returns>filtered buffer</returns>
- protected static byte[] FilterWithoutEnglishLetters(byte[] buf, int offset, int len)
+ protected static byte[] FilterWithoutEnglishLetters(byte[] buf, int offset, int len)
{
byte[] result = null;
using (MemoryStream ms = new MemoryStream(buf.Length)) {
-
+
bool meetMSB = false;
int max = offset + len;
int prev = offset;
@@ -140,8 +140,8 @@ namespace UniversalDetector.Core
}
/// <summary>
- /// Do filtering to reduce load to probers (Remove ASCII symbols,
- /// collapse spaces). This filter applies to all scripts which contain
+ /// Do filtering to reduce load to probers (Remove ASCII symbols,
+ /// collapse spaces). This filter applies to all scripts which contain
/// both English characters and upper ASCII characters.
/// </summary>
/// <returns>a filtered copy of the input buffer</returns>
@@ -150,16 +150,16 @@ namespace UniversalDetector.Core
byte[] result = null;
using (MemoryStream ms = new MemoryStream(buf.Length)) {
-
+
bool inTag = false;
int max = offset + len;
int prev = offset;
int cur = offset;
while (cur < max) {
-
+
byte b = buf[cur];
-
+
if (b == GREATER_THAN)
inTag = false;
else if (b == LESS_THAN)
@@ -177,7 +177,7 @@ namespace UniversalDetector.Core
cur++;
}
- // If the current segment contains more than just a symbol
+ // If the current segment contains more than just a symbol
// and it is not inside a tag then keep it.
if (!inTag && cur > prev)
ms.Write(buf, prev, cur - prev);
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Charsets.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Charsets.cs
index a7c1be92a..00cd8826f 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Charsets.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Charsets.cs
@@ -20,7 +20,7 @@
*
* Contributor(s):
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
- *
+ *
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -40,47 +40,47 @@ namespace UniversalDetector.Core
public static class Charsets
{
public const string ASCII = "ASCII";
-
+
public const string UTF8 = "UTF-8";
-
+
public const string UTF16_LE = "UTF-16LE";
-
+
public const string UTF16_BE = "UTF-16BE";
-
+
public const string UTF32_BE = "UTF-32BE";
-
+
public const string UTF32_LE = "UTF-32LE";
/// <summary>
/// Unusual BOM (3412 order)
/// </summary>
public const string UCS4_3412 = "X-ISO-10646-UCS-4-3412";
-
+
/// <summary>
/// Unusual BOM (2413 order)
/// </summary>
public const string UCS4_2413 = "X-ISO-10646-UCS-4-2413";
-
+
/// <summary>
/// Cyrillic (based on bulgarian and russian data)
/// </summary>
public const string WIN1251 = "windows-1251";
-
+
/// <summary>
/// Latin-1, almost identical to ISO-8859-1
/// </summary>
public const string WIN1252 = "windows-1252";
-
+
/// <summary>
/// Greek
/// </summary>
public const string WIN1253 = "windows-1253";
-
+
/// <summary>
/// Logical hebrew (includes ISO-8859-8-I and most of x-mac-hebrew)
/// </summary>
public const string WIN1255 = "windows-1255";
-
+
/// <summary>
/// Traditional chinese
/// </summary>
@@ -89,7 +89,7 @@ namespace UniversalDetector.Core
public const string EUCKR = "EUC-KR";
public const string EUCJP = "EUC-JP";
-
+
public const string EUCTW = "EUC-TW";
/// <summary>
@@ -98,11 +98,11 @@ namespace UniversalDetector.Core
public const string GB18030 = "gb18030";
public const string ISO2022_JP = "ISO-2022-JP";
-
+
public const string ISO2022_CN = "ISO-2022-CN";
-
+
public const string ISO2022_KR = "ISO-2022-KR";
-
+
/// <summary>
/// Simplified chinese
/// </summary>
@@ -111,15 +111,15 @@ namespace UniversalDetector.Core
public const string SHIFT_JIS = "Shift-JIS";
public const string MAC_CYRILLIC = "x-mac-cyrillic";
-
+
public const string KOI8R = "KOI8-R";
-
+
public const string IBM855 = "IBM855";
-
+
public const string IBM866 = "IBM866";
/// <summary>
- /// East-Europe. Disabled because too similar to windows-1252
+ /// East-Europe. Disabled because too similar to windows-1252
/// (latin-1). Should use tri-grams models to discriminate between
/// these two charsets.
/// </summary>
@@ -141,9 +141,9 @@ namespace UniversalDetector.Core
public const string ISO8859_8 = "ISO-8859-8";
/// <summary>
- /// Thai. This recognizer is not enabled yet.
+ /// Thai. This recognizer is not enabled yet.
/// </summary>
public const string TIS620 = "TIS620";
-
+
}
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CodingStateMachine.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CodingStateMachine.cs
index f837dd966..34f24161d 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CodingStateMachine.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/CodingStateMachine.cs
@@ -22,7 +22,7 @@
* Shy Shalom <shooshX@gmail.com>
* Kohei TAKETA <k-tak@void.in> (Java port)
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
- *
+ *
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -48,8 +48,8 @@ namespace UniversalDetector.Core
private SMModel model;
private int currentCharLen;
private int currentBytePos;
-
- public CodingStateMachine(SMModel model)
+
+ public CodingStateMachine(SMModel model)
{
this.currentState = SMModel.START;
this.model = model;
@@ -57,34 +57,28 @@ namespace UniversalDetector.Core
public int NextState(byte b)
{
- // for each byte we get its class, if it is first byte,
+ // for each byte we get its class, if it is first byte,
// we also get byte length
int byteCls = model.GetClass(b);
- if (currentState == SMModel.START) {
+ if (currentState == SMModel.START) {
currentBytePos = 0;
currentCharLen = model.charLenTable[byteCls];
}
-
- // from byte's class and stateTable, we get its next state
+
+ // from byte's class and stateTable, we get its next state
currentState = model.stateTable.Unpack(
currentState * model.ClassFactor + byteCls);
currentBytePos++;
return currentState;
}
-
- public void Reset()
- {
- currentState = SMModel.START;
- }
- public int CurrentCharLen
- {
- get { return currentCharLen; }
+ public void Reset()
+ {
+ currentState = SMModel.START;
}
- public string ModelName
- {
- get { return model.Name; }
- }
+ public int CurrentCharLen => currentCharLen;
+
+ public string ModelName => model.Name;
}
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EUCJPProber.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EUCJPProber.cs
index 050a9d9ce..eac67fe95 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EUCJPProber.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EUCJPProber.cs
@@ -43,25 +43,25 @@ namespace UniversalDetector.Core
private EUCJPContextAnalyser contextAnalyser;
private EUCJPDistributionAnalyser distributionAnalyser;
private byte[] lastChar = new byte[2];
-
+
public EUCJPProber()
{
codingSM = new CodingStateMachine(new EUCJPSMModel());
distributionAnalyser = new EUCJPDistributionAnalyser();
- contextAnalyser = new EUCJPContextAnalyser();
+ contextAnalyser = new EUCJPContextAnalyser();
Reset();
}
- public override string GetCharsetName()
+ public override string GetCharsetName()
{
return "EUC-JP";
}
-
+
public override ProbingState HandleData(byte[] buf, int offset, int len)
{
int codingState;
int max = offset + len;
-
+
for (int i = offset; i < max; i++) {
codingState = codingSM.NextState(buf[i]);
if (codingState == SMModel.ERROR) {
@@ -83,7 +83,7 @@ namespace UniversalDetector.Core
distributionAnalyser.HandleOneChar(buf, i-1, charLen);
}
}
- }
+ }
lastChar[0] = buf[max-1];
if (state == ProbingState.Detecting)
if (contextAnalyser.GotEnoughData() && GetConfidence() > SHORTCUT_THRESHOLD)
@@ -93,18 +93,18 @@ namespace UniversalDetector.Core
public override void Reset()
{
- codingSM.Reset();
+ codingSM.Reset();
state = ProbingState.Detecting;
contextAnalyser.Reset();
distributionAnalyser.Reset();
}
-
+
public override float GetConfidence()
{
float contxtCf = contextAnalyser.GetConfidence();
float distribCf = distributionAnalyser.GetConfidence();
return (contxtCf > distribCf ? contxtCf : distribCf);
}
-
+
}
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EUCKRProber.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EUCKRProber.cs
index 67d4b0a72..b1543dae1 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EUCKRProber.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EUCKRProber.cs
@@ -46,15 +46,15 @@ namespace UniversalDetector.Core
public EUCKRProber()
{
codingSM = new CodingStateMachine(new EUCKRSMModel());
- distributionAnalyser = new EUCKRDistributionAnalyser();
+ distributionAnalyser = new EUCKRDistributionAnalyser();
Reset();
}
-
+
public override string GetCharsetName()
{
- return "EUC-KR";
+ return "EUC-KR";
}
-
+
public override ProbingState HandleData(byte[] buf, int offset, int len)
{
int codingState;
@@ -81,12 +81,12 @@ namespace UniversalDetector.Core
}
}
lastChar[0] = buf[max-1];
-
+
if (state == ProbingState.Detecting)
if (distributionAnalyser.GotEnoughData() && GetConfidence() > SHORTCUT_THRESHOLD)
state = ProbingState.FoundIt;
return state;
-
+
}
public override float GetConfidence()
@@ -96,7 +96,7 @@ namespace UniversalDetector.Core
public override void Reset()
{
- codingSM.Reset();
+ codingSM.Reset();
state = ProbingState.Detecting;
distributionAnalyser.Reset();
//mContextAnalyser.Reset();
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EUCTWProber.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EUCTWProber.cs
index a4e0b486e..65a521760 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EUCTWProber.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EUCTWProber.cs
@@ -21,7 +21,7 @@
* Contributor(s):
* Shy Shalom <shooshX@gmail.com>
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
- *
+ *
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -50,7 +50,7 @@ namespace UniversalDetector.Core
this.distributionAnalyser = new EUCTWDistributionAnalyser();
this.Reset();
}
-
+
public override ProbingState HandleData(byte[] buf, int offset, int len)
{
int codingState;
@@ -77,21 +77,21 @@ namespace UniversalDetector.Core
}
}
lastChar[0] = buf[max-1];
-
+
if (state == ProbingState.Detecting)
if (distributionAnalyser.GotEnoughData() && GetConfidence() > SHORTCUT_THRESHOLD)
state = ProbingState.FoundIt;
return state;
}
-
+
public override string GetCharsetName()
{
- return "x-euc-tw";
+ return "x-euc-tw";
}
-
+
public override void Reset()
{
- codingSM.Reset();
+ codingSM.Reset();
state = ProbingState.Detecting;
distributionAnalyser.Reset();
}
@@ -100,7 +100,7 @@ namespace UniversalDetector.Core
{
return distributionAnalyser.GetConfidence();
}
-
-
+
+
}
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EscCharsetProber.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EscCharsetProber.cs
index e9cefa9bc..f457bf490 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EscCharsetProber.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EscCharsetProber.cs
@@ -41,19 +41,19 @@ namespace UniversalDetector.Core
{
private const int CHARSETS_NUM = 4;
private string detectedCharset;
- private CodingStateMachine[] codingSM;
+ private CodingStateMachine[] codingSM;
int activeSM;
public EscCharsetProber()
{
- codingSM = new CodingStateMachine[CHARSETS_NUM];
+ codingSM = new CodingStateMachine[CHARSETS_NUM];
codingSM[0] = new CodingStateMachine(new HZSMModel());
codingSM[1] = new CodingStateMachine(new ISO2022CNSMModel());
codingSM[2] = new CodingStateMachine(new ISO2022JPSMModel());
codingSM[3] = new CodingStateMachine(new ISO2022KRSMModel());
Reset();
}
-
+
public override void Reset()
{
state = ProbingState.Detecting;
@@ -66,7 +66,7 @@ namespace UniversalDetector.Core
public override ProbingState HandleData(byte[] buf, int offset, int len)
{
int max = offset + len;
-
+
for (int i = offset; i < max && state == ProbingState.Detecting; i++) {
for (int j = activeSM - 1; j >= 0; j--) {
// byte is feed to all active state machine
@@ -94,12 +94,12 @@ namespace UniversalDetector.Core
public override string GetCharsetName()
{
- return detectedCharset;
+ return detectedCharset;
}
-
+
public override float GetConfidence()
{
return 0.99f;
- }
+ }
}
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EscSM.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EscSM.cs
index 61ac5545f..6ebfa8a4c 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EscSM.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/EscSM.cs
@@ -44,59 +44,59 @@ namespace UniversalDetector.Core
public class HZSMModel : SMModel
{
private readonly static int[] HZ_cls = {
- BitPackage.Pack4bits(1,0,0,0,0,0,0,0), // 00 - 07
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 08 - 0f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 10 - 17
- BitPackage.Pack4bits(0,0,0,1,0,0,0,0), // 18 - 1f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 20 - 27
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 28 - 2f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 30 - 37
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 38 - 3f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 40 - 47
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 48 - 4f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 50 - 57
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 58 - 5f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 60 - 67
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 68 - 6f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 70 - 77
- BitPackage.Pack4bits(0,0,0,4,0,5,2,0), // 78 - 7f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 80 - 87
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 88 - 8f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 90 - 97
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 98 - 9f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // a0 - a7
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // a8 - af
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // b0 - b7
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // b8 - bf
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // c0 - c7
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // c8 - cf
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // d0 - d7
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // d8 - df
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // e0 - e7
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // e8 - ef
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // f0 - f7
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1) // f8 - ff
+ BitPackage.Pack4bits(1,0,0,0,0,0,0,0), // 00 - 07
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 08 - 0f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 10 - 17
+ BitPackage.Pack4bits(0,0,0,1,0,0,0,0), // 18 - 1f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 20 - 27
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 28 - 2f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 30 - 37
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 38 - 3f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 40 - 47
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 48 - 4f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 50 - 57
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 58 - 5f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 60 - 67
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 68 - 6f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 70 - 77
+ BitPackage.Pack4bits(0,0,0,4,0,5,2,0), // 78 - 7f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 80 - 87
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 88 - 8f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 90 - 97
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 98 - 9f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // a0 - a7
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // a8 - af
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // b0 - b7
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // b8 - bf
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // c0 - c7
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // c8 - cf
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // d0 - d7
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // d8 - df
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // e0 - e7
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // e8 - ef
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // f0 - f7
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1) // f8 - ff
};
private readonly static int[] HZ_st = {
- BitPackage.Pack4bits(START, ERROR, 3, START, START, START, ERROR, ERROR),//00-07
- BitPackage.Pack4bits(ERROR, ERROR, ERROR, ERROR, ITSME, ITSME, ITSME, ITSME),//08-0f
- BitPackage.Pack4bits(ITSME, ITSME, ERROR, ERROR, START, START, 4, ERROR),//10-17
- BitPackage.Pack4bits( 5, ERROR, 6, ERROR, 5, 5, 4, ERROR),//18-1f
- BitPackage.Pack4bits( 4, ERROR, 4, 4, 4, ERROR, 4, ERROR),//20-27
- BitPackage.Pack4bits( 4, ITSME, START, START, START, START, START, START) //28-2f
+ BitPackage.Pack4bits(START, ERROR, 3, START, START, START, ERROR, ERROR),//00-07
+ BitPackage.Pack4bits(ERROR, ERROR, ERROR, ERROR, ITSME, ITSME, ITSME, ITSME),//08-0f
+ BitPackage.Pack4bits(ITSME, ITSME, ERROR, ERROR, START, START, 4, ERROR),//10-17
+ BitPackage.Pack4bits( 5, ERROR, 6, ERROR, 5, 5, 4, ERROR),//18-1f
+ BitPackage.Pack4bits( 4, ERROR, 4, 4, 4, ERROR, 4, ERROR),//20-27
+ BitPackage.Pack4bits( 4, ITSME, START, START, START, START, START, START) //28-2f
};
private readonly static int[] HZCharLenTable = {0, 0, 0, 0, 0, 0};
-
+
public HZSMModel() : base(
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, HZ_cls),
6,
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, HZ_st),
HZCharLenTable, "HZ-GB-2312")
@@ -104,65 +104,65 @@ namespace UniversalDetector.Core
}
}
-
+
public class ISO2022CNSMModel : SMModel
{
private readonly static int[] ISO2022CN_cls = {
- BitPackage.Pack4bits(2,0,0,0,0,0,0,0), // 00 - 07
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 08 - 0f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 10 - 17
- BitPackage.Pack4bits(0,0,0,1,0,0,0,0), // 18 - 1f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 20 - 27
- BitPackage.Pack4bits(0,3,0,0,0,0,0,0), // 28 - 2f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 30 - 37
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 38 - 3f
- BitPackage.Pack4bits(0,0,0,4,0,0,0,0), // 40 - 47
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 48 - 4f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 50 - 57
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 58 - 5f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 60 - 67
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 68 - 6f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 70 - 77
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 78 - 7f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 80 - 87
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 88 - 8f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 90 - 97
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 98 - 9f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a0 - a7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a8 - af
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b0 - b7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b8 - bf
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c0 - c7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c8 - cf
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d0 - d7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d8 - df
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // e0 - e7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // e8 - ef
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // f0 - f7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2) // f8 - ff
+ BitPackage.Pack4bits(2,0,0,0,0,0,0,0), // 00 - 07
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 08 - 0f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 10 - 17
+ BitPackage.Pack4bits(0,0,0,1,0,0,0,0), // 18 - 1f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 20 - 27
+ BitPackage.Pack4bits(0,3,0,0,0,0,0,0), // 28 - 2f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 30 - 37
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 38 - 3f
+ BitPackage.Pack4bits(0,0,0,4,0,0,0,0), // 40 - 47
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 48 - 4f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 50 - 57
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 58 - 5f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 60 - 67
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 68 - 6f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 70 - 77
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 78 - 7f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 80 - 87
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 88 - 8f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 90 - 97
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 98 - 9f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a0 - a7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a8 - af
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b0 - b7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b8 - bf
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c0 - c7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c8 - cf
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d0 - d7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d8 - df
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // e0 - e7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // e8 - ef
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // f0 - f7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2) // f8 - ff
};
private readonly static int[] ISO2022CN_st = {
- BitPackage.Pack4bits(START, 3,ERROR,START,START,START,START,START),//00-07
- BitPackage.Pack4bits(START,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//08-0f
- BitPackage.Pack4bits(ERROR,ERROR,ITSME,ITSME,ITSME,ITSME,ITSME,ITSME),//10-17
- BitPackage.Pack4bits(ITSME,ITSME,ITSME,ERROR,ERROR,ERROR, 4,ERROR),//18-1f
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ITSME,ERROR,ERROR,ERROR,ERROR),//20-27
- BitPackage.Pack4bits( 5, 6,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//28-2f
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ITSME,ERROR,ERROR,ERROR,ERROR),//30-37
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ITSME,ERROR,START) //38-3f
+ BitPackage.Pack4bits(START, 3,ERROR,START,START,START,START,START),//00-07
+ BitPackage.Pack4bits(START,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//08-0f
+ BitPackage.Pack4bits(ERROR,ERROR,ITSME,ITSME,ITSME,ITSME,ITSME,ITSME),//10-17
+ BitPackage.Pack4bits(ITSME,ITSME,ITSME,ERROR,ERROR,ERROR, 4,ERROR),//18-1f
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ITSME,ERROR,ERROR,ERROR,ERROR),//20-27
+ BitPackage.Pack4bits( 5, 6,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//28-2f
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ITSME,ERROR,ERROR,ERROR,ERROR),//30-37
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ITSME,ERROR,START) //38-3f
};
private readonly static int[] ISO2022CNCharLenTable = {0, 0, 0, 0, 0, 0, 0, 0, 0};
public ISO2022CNSMModel() : base(
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, ISO2022CN_cls),
9,
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, ISO2022CN_st),
ISO2022CNCharLenTable, "ISO-2022-CN")
@@ -170,130 +170,130 @@ namespace UniversalDetector.Core
}
}
-
+
public class ISO2022JPSMModel : SMModel
{
private readonly static int[] ISO2022JP_cls = {
- BitPackage.Pack4bits(2,0,0,0,0,0,0,0), // 00 - 07
- BitPackage.Pack4bits(0,0,0,0,0,0,2,2), // 08 - 0f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 10 - 17
- BitPackage.Pack4bits(0,0,0,1,0,0,0,0), // 18 - 1f
- BitPackage.Pack4bits(0,0,0,0,7,0,0,0), // 20 - 27
- BitPackage.Pack4bits(3,0,0,0,0,0,0,0), // 28 - 2f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 30 - 37
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 38 - 3f
- BitPackage.Pack4bits(6,0,4,0,8,0,0,0), // 40 - 47
- BitPackage.Pack4bits(0,9,5,0,0,0,0,0), // 48 - 4f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 50 - 57
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 58 - 5f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 60 - 67
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 68 - 6f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 70 - 77
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 78 - 7f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 80 - 87
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 88 - 8f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 90 - 97
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 98 - 9f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a0 - a7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a8 - af
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b0 - b7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b8 - bf
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c0 - c7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c8 - cf
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d0 - d7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d8 - df
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // e0 - e7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // e8 - ef
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // f0 - f7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2) // f8 - ff
+ BitPackage.Pack4bits(2,0,0,0,0,0,0,0), // 00 - 07
+ BitPackage.Pack4bits(0,0,0,0,0,0,2,2), // 08 - 0f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 10 - 17
+ BitPackage.Pack4bits(0,0,0,1,0,0,0,0), // 18 - 1f
+ BitPackage.Pack4bits(0,0,0,0,7,0,0,0), // 20 - 27
+ BitPackage.Pack4bits(3,0,0,0,0,0,0,0), // 28 - 2f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 30 - 37
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 38 - 3f
+ BitPackage.Pack4bits(6,0,4,0,8,0,0,0), // 40 - 47
+ BitPackage.Pack4bits(0,9,5,0,0,0,0,0), // 48 - 4f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 50 - 57
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 58 - 5f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 60 - 67
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 68 - 6f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 70 - 77
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 78 - 7f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 80 - 87
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 88 - 8f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 90 - 97
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 98 - 9f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a0 - a7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a8 - af
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b0 - b7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b8 - bf
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c0 - c7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c8 - cf
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d0 - d7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d8 - df
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // e0 - e7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // e8 - ef
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // f0 - f7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2) // f8 - ff
};
private readonly static int[] ISO2022JP_st = {
- BitPackage.Pack4bits(START, 3, ERROR,START,START,START,START,START),//00-07
- BitPackage.Pack4bits(START, START, ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//08-0f
- BitPackage.Pack4bits(ERROR, ERROR, ERROR,ERROR,ITSME,ITSME,ITSME,ITSME),//10-17
- BitPackage.Pack4bits(ITSME, ITSME, ITSME,ITSME,ITSME,ITSME,ERROR,ERROR),//18-1f
- BitPackage.Pack4bits(ERROR, 5, ERROR,ERROR,ERROR, 4,ERROR,ERROR),//20-27
- BitPackage.Pack4bits(ERROR, ERROR, ERROR, 6,ITSME,ERROR,ITSME,ERROR),//28-2f
- BitPackage.Pack4bits(ERROR, ERROR, ERROR,ERROR,ERROR,ERROR,ITSME,ITSME),//30-37
- BitPackage.Pack4bits(ERROR, ERROR, ERROR,ITSME,ERROR,ERROR,ERROR,ERROR),//38-3f
- BitPackage.Pack4bits(ERROR, ERROR, ERROR,ERROR,ITSME,ERROR,START,START) //40-47
+ BitPackage.Pack4bits(START, 3, ERROR,START,START,START,START,START),//00-07
+ BitPackage.Pack4bits(START, START, ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//08-0f
+ BitPackage.Pack4bits(ERROR, ERROR, ERROR,ERROR,ITSME,ITSME,ITSME,ITSME),//10-17
+ BitPackage.Pack4bits(ITSME, ITSME, ITSME,ITSME,ITSME,ITSME,ERROR,ERROR),//18-1f
+ BitPackage.Pack4bits(ERROR, 5, ERROR,ERROR,ERROR, 4,ERROR,ERROR),//20-27
+ BitPackage.Pack4bits(ERROR, ERROR, ERROR, 6,ITSME,ERROR,ITSME,ERROR),//28-2f
+ BitPackage.Pack4bits(ERROR, ERROR, ERROR,ERROR,ERROR,ERROR,ITSME,ITSME),//30-37
+ BitPackage.Pack4bits(ERROR, ERROR, ERROR,ITSME,ERROR,ERROR,ERROR,ERROR),//38-3f
+ BitPackage.Pack4bits(ERROR, ERROR, ERROR,ERROR,ITSME,ERROR,START,START) //40-47
};
private readonly static int[] ISO2022JPCharLenTable = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
public ISO2022JPSMModel() : base(
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, ISO2022JP_cls),
10,
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, ISO2022JP_st),
ISO2022JPCharLenTable, "ISO-2022-JP")
{
}
-
+
}
-
+
public class ISO2022KRSMModel : SMModel
- {
+ {
private readonly static int[] ISO2022KR_cls = {
- BitPackage.Pack4bits(2,0,0,0,0,0,0,0), // 00 - 07
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 08 - 0f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 10 - 17
- BitPackage.Pack4bits(0,0,0,1,0,0,0,0), // 18 - 1f
- BitPackage.Pack4bits(0,0,0,0,3,0,0,0), // 20 - 27
- BitPackage.Pack4bits(0,4,0,0,0,0,0,0), // 28 - 2f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 30 - 37
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 38 - 3f
- BitPackage.Pack4bits(0,0,0,5,0,0,0,0), // 40 - 47
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 48 - 4f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 50 - 57
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 58 - 5f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 60 - 67
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 68 - 6f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 70 - 77
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 78 - 7f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 80 - 87
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 88 - 8f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 90 - 97
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 98 - 9f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a0 - a7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a8 - af
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b0 - b7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b8 - bf
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c0 - c7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c8 - cf
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d0 - d7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d8 - df
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // e0 - e7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // e8 - ef
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // f0 - f7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2) // f8 - ff
+ BitPackage.Pack4bits(2,0,0,0,0,0,0,0), // 00 - 07
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 08 - 0f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 10 - 17
+ BitPackage.Pack4bits(0,0,0,1,0,0,0,0), // 18 - 1f
+ BitPackage.Pack4bits(0,0,0,0,3,0,0,0), // 20 - 27
+ BitPackage.Pack4bits(0,4,0,0,0,0,0,0), // 28 - 2f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 30 - 37
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 38 - 3f
+ BitPackage.Pack4bits(0,0,0,5,0,0,0,0), // 40 - 47
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 48 - 4f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 50 - 57
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 58 - 5f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 60 - 67
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 68 - 6f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 70 - 77
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 78 - 7f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 80 - 87
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 88 - 8f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 90 - 97
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 98 - 9f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a0 - a7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a8 - af
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b0 - b7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b8 - bf
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c0 - c7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c8 - cf
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d0 - d7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d8 - df
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // e0 - e7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // e8 - ef
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // f0 - f7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2) // f8 - ff
};
private readonly static int[] ISO2022KR_st = {
- BitPackage.Pack4bits(START, 3,ERROR,START,START,START,ERROR,ERROR),//00-07
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ITSME,ITSME,ITSME,ITSME),//08-0f
- BitPackage.Pack4bits(ITSME,ITSME,ERROR,ERROR,ERROR, 4,ERROR,ERROR),//10-17
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR, 5,ERROR,ERROR,ERROR),//18-1f
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ITSME,START,START,START,START) //20-27
+ BitPackage.Pack4bits(START, 3,ERROR,START,START,START,ERROR,ERROR),//00-07
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ITSME,ITSME,ITSME,ITSME),//08-0f
+ BitPackage.Pack4bits(ITSME,ITSME,ERROR,ERROR,ERROR, 4,ERROR,ERROR),//10-17
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR, 5,ERROR,ERROR,ERROR),//18-1f
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ITSME,START,START,START,START) //20-27
};
private readonly static int[] ISO2022KRCharLenTable = {0, 0, 0, 0, 0, 0};
public ISO2022KRSMModel() : base(
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, ISO2022KR_cls),
6,
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, ISO2022KR_st),
ISO2022KRCharLenTable, "ISO-2022-KR")
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/GB18030Prober.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/GB18030Prober.cs
index ac237c5cd..0d2ebd8c7 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/GB18030Prober.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/GB18030Prober.cs
@@ -21,7 +21,7 @@
* Contributor(s):
* Shy Shalom <shooshX@gmail.com>
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
- *
+ *
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -38,7 +38,7 @@
namespace UniversalDetector.Core
{
- // We use gb18030 to replace gb2312, because 18030 is a superset.
+ // We use gb18030 to replace gb2312, because 18030 is a superset.
public class GB18030Prober : CharsetProber
{
private CodingStateMachine codingSM;
@@ -52,18 +52,18 @@ namespace UniversalDetector.Core
analyser = new GB18030DistributionAnalyser();
Reset();
}
-
+
public override string GetCharsetName()
{
- return "gb18030";
+ return "gb18030";
}
-
+
public override ProbingState HandleData(byte[] buf, int offset, int len)
{
int codingState = SMModel.START;
int max = offset + len;
-
+
for (int i = offset; i < max; i++) {
codingState = codingSM.NextState(buf[i]);
if (codingState == SMModel.ERROR) {
@@ -91,18 +91,18 @@ namespace UniversalDetector.Core
if (analyser.GotEnoughData() && GetConfidence() > SHORTCUT_THRESHOLD)
state = ProbingState.FoundIt;
}
-
+
return state;
}
-
+
public override float GetConfidence()
{
return analyser.GetConfidence();
}
-
+
public override void Reset()
{
- codingSM.Reset();
+ codingSM.Reset();
state = ProbingState.Detecting;
analyser.Reset();
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/HebrewProber.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/HebrewProber.cs
index 92974d3a8..2cbf33075 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/HebrewProber.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/HebrewProber.cs
@@ -21,7 +21,7 @@
* Contributor(s):
* Shy Shalom <shooshX@gmail.com>
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
- *
+ *
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -43,40 +43,40 @@ using System;
*
* Four main charsets exist in Hebrew:
* "ISO-8859-8" - Visual Hebrew
- * "windows-1255" - Logical Hebrew
+ * "windows-1255" - Logical Hebrew
* "ISO-8859-8-I" - Logical Hebrew
* "x-mac-hebrew" - ?? Logical Hebrew ??
*
* Both "ISO" charsets use a completely identical set of code points, whereas
- * "windows-1255" and "x-mac-hebrew" are two different proper supersets of
+ * "windows-1255" and "x-mac-hebrew" are two different proper supersets of
* these code points. windows-1255 defines additional characters in the range
- * 0x80-0x9F as some misc punctuation marks as well as some Hebrew-specific
+ * 0x80-0x9F as some misc punctuation marks as well as some Hebrew-specific
* diacritics and additional 'Yiddish' ligature letters in the range 0xc0-0xd6.
- * x-mac-hebrew defines similar additional code points but with a different
+ * x-mac-hebrew defines similar additional code points but with a different
* mapping.
*
- * As far as an average Hebrew text with no diacritics is concerned, all four
- * charsets are identical with respect to code points. Meaning that for the
- * main Hebrew alphabet, all four map the same values to all 27 Hebrew letters
+ * As far as an average Hebrew text with no diacritics is concerned, all four
+ * charsets are identical with respect to code points. Meaning that for the
+ * main Hebrew alphabet, all four map the same values to all 27 Hebrew letters
* (including final letters).
*
* The dominant difference between these charsets is their directionality.
* "Visual" directionality means that the text is ordered as if the renderer is
- * not aware of a BIDI rendering algorithm. The renderer sees the text and
- * draws it from left to right. The text itself when ordered naturally is read
+ * not aware of a BIDI rendering algorithm. The renderer sees the text and
+ * draws it from left to right. The text itself when ordered naturally is read
* backwards. A buffer of Visual Hebrew generally looks like so:
* "[last word of first line spelled backwards] [whole line ordered backwards
- * and spelled backwards] [first word of first line spelled backwards]
+ * and spelled backwards] [first word of first line spelled backwards]
* [end of line] [last word of second line] ... etc' "
* adding punctuation marks, numbers and English text to visual text is
* naturally also "visual" and from left to right.
- *
+ *
* "Logical" directionality means the text is ordered "naturally" according to
- * the order it is read. It is the responsibility of the renderer to display
- * the text from right to left. A BIDI algorithm is used to place general
+ * the order it is read. It is the responsibility of the renderer to display
+ * the text from right to left. A BIDI algorithm is used to place general
* punctuation marks, numbers and English text in the text.
*
- * Texts in x-mac-hebrew are almost impossible to find on the Internet. From
+ * Texts in x-mac-hebrew are almost impossible to find on the Internet. From
* what little evidence I could find, it seems that its general directionality
* is Logical.
*
@@ -84,17 +84,17 @@ using System;
* charsets:
* Visual Hebrew - "ISO-8859-8" - backwards text - Words and sentences are
* backwards while line order is natural. For charset recognition purposes
- * the line order is unimportant (In fact, for this implementation, even
+ * the line order is unimportant (In fact, for this implementation, even
* word order is unimportant).
* Logical Hebrew - "windows-1255" - normal, naturally ordered text.
*
- * "ISO-8859-8-I" is a subset of windows-1255 and doesn't need to be
+ * "ISO-8859-8-I" is a subset of windows-1255 and doesn't need to be
* specifically identified.
* "x-mac-hebrew" is also identified as windows-1255. A text in x-mac-hebrew
* that contain special punctuation marks or diacritics is displayed with
* some unconverted characters showing as question marks. This problem might
* be corrected using another model prober for x-mac-hebrew. Due to the fact
- * that x-mac-hebrew texts are so rare, writing another model prober isn't
+ * that x-mac-hebrew texts are so rare, writing another model prober isn't
* worth the effort and performance hit.
*
* *** The Prober ***
@@ -136,7 +136,7 @@ using System;
*/
namespace UniversalDetector.Core
{
-
+
/// <summary>
/// This prober doesn't actually recognize a language or a charset.
/// It is a helper prober for the use of the Hebrew model probers
@@ -165,49 +165,49 @@ namespace UniversalDetector.Core
protected const string VISUAL_HEBREW_NAME = "ISO-8859-8";
protected const string LOGICAL_HEBREW_NAME = "windows-1255";
-
+
// owned by the group prober.
protected CharsetProber logicalProber, visualProber;
- protected int finalCharLogicalScore, finalCharVisualScore;
-
+ protected int finalCharLogicalScore, finalCharVisualScore;
+
// The two last bytes seen in the previous buffer.
protected byte prev, beforePrev;
-
+
public HebrewProber()
{
Reset();
}
-
- public void SetModelProbers(CharsetProber logical, CharsetProber visual)
- {
- logicalProber = logical;
- visualProber = visual;
+
+ public void SetModelProbers(CharsetProber logical, CharsetProber visual)
+ {
+ logicalProber = logical;
+ visualProber = visual;
}
-
- /**
+
+ /**
* Final letter analysis for logical-visual decision.
- * Look for evidence that the received buffer is either logical Hebrew or
+ * Look for evidence that the received buffer is either logical Hebrew or
* visual Hebrew.
* The following cases are checked:
- * 1) A word longer than 1 letter, ending with a final letter. This is an
- * indication that the text is laid out "naturally" since the final letter
+ * 1) A word longer than 1 letter, ending with a final letter. This is an
+ * indication that the text is laid out "naturally" since the final letter
* really appears at the end. +1 for logical score.
* 2) A word longer than 1 letter, ending with a Non-Final letter. In normal
* Hebrew, words ending with Kaf, Mem, Nun, Pe or Tsadi, should not end with
* the Non-Final form of that letter. Exceptions to this rule are mentioned
* above in isNonFinal(). This is an indication that the text is laid out
* backwards. +1 for visual score
- * 3) A word longer than 1 letter, starting with a final letter. Final letters
- * should not appear at the beginning of a word. This is an indication that
+ * 3) A word longer than 1 letter, starting with a final letter. Final letters
+ * should not appear at the beginning of a word. This is an indication that
* the text is laid out backwards. +1 for visual score.
*
- * The visual score and logical score are accumulated throughout the text and
+ * The visual score and logical score are accumulated throughout the text and
* are finally checked against each other in GetCharSetName().
* No checking for final letters in the middle of words is done since that case
* is not an indication for either Logical or Visual text.
*
* The input buffer should not contain any white spaces that are not (' ')
- * or any low-ascii punctuation marks.
+ * or any low-ascii punctuation marks.
*/
public override ProbingState HandleData(byte[] buf, int offset, int len)
{
@@ -218,31 +218,31 @@ namespace UniversalDetector.Core
int max = offset + len;
for (int i = offset; i < max; i++) {
-
+
byte b = buf[i];
-
+
// a word just ended
if (b == 0x20) {
// *(curPtr-2) was not a space so prev is not a 1 letter word
if (beforePrev != 0x20) {
// case (1) [-2:not space][-1:final letter][cur:space]
- if (IsFinal(prev))
+ if (IsFinal(prev))
finalCharLogicalScore++;
- // case (2) [-2:not space][-1:Non-Final letter][cur:space]
+ // case (2) [-2:not space][-1:Non-Final letter][cur:space]
else if (IsNonFinal(prev))
finalCharVisualScore++;
}
-
+
} else {
// case (3) [-2:space][-1:final letter][cur:not space]
- if ((beforePrev == 0x20) && (IsFinal(prev)) && (b != ' '))
+ if ((beforePrev == 0x20) && (IsFinal(prev)) && (b != ' '))
++finalCharVisualScore;
}
beforePrev = prev;
prev = b;
}
- // Forever detecting, till the end or until both model probers
+ // Forever detecting, till the end or until both model probers
// return NotMe (handled above).
return ProbingState.Detecting;
}
@@ -252,7 +252,7 @@ namespace UniversalDetector.Core
{
// If the final letter score distance is dominant enough, rely on it.
int finalsub = finalCharLogicalScore - finalCharVisualScore;
- if (finalsub >= MIN_FINAL_CHAR_DISTANCE)
+ if (finalsub >= MIN_FINAL_CHAR_DISTANCE)
return LOGICAL_HEBREW_NAME;
if (finalsub <= -(MIN_FINAL_CHAR_DISTANCE))
return VISUAL_HEBREW_NAME;
@@ -263,9 +263,9 @@ namespace UniversalDetector.Core
return LOGICAL_HEBREW_NAME;
if (modelsub < -(MIN_MODEL_DISTANCE))
return VISUAL_HEBREW_NAME;
-
+
// Still no good, back to final letter distance, maybe it'll save the day.
- if (finalsub < 0)
+ if (finalsub < 0)
return VISUAL_HEBREW_NAME;
// (finalsub > 0 - Logical) or (don't know what to do) default to Logical.
@@ -280,10 +280,10 @@ namespace UniversalDetector.Core
beforePrev = 0x20;
}
- public override ProbingState GetState()
+ public override ProbingState GetState()
{
// Remain active as long as any of the model probers are active.
- if (logicalProber.GetState() == ProbingState.NotMe &&
+ if (logicalProber.GetState() == ProbingState.NotMe &&
visualProber.GetState() == ProbingState.NotMe)
return ProbingState.NotMe;
return ProbingState.Detecting;
@@ -293,31 +293,31 @@ namespace UniversalDetector.Core
{
//Console.WriteLine(" HEB: {0} - {1} [Logical-Visual score]", finalCharLogicalScore, finalCharVisualScore);
}
-
+
public override float GetConfidence()
- {
+ {
return 0.0f;
}
-
+
protected static bool IsFinal(byte b)
{
- return (b == FINAL_KAF || b == FINAL_MEM || b == FINAL_NUN
- || b == FINAL_PE || b == FINAL_TSADI);
+ return (b == FINAL_KAF || b == FINAL_MEM || b == FINAL_NUN
+ || b == FINAL_PE || b == FINAL_TSADI);
}
-
+
protected static bool IsNonFinal(byte b)
{
- // The normal Tsadi is not a good Non-Final letter due to words like
- // 'lechotet' (to chat) containing an apostrophe after the tsadi. This
- // apostrophe is converted to a space in FilterWithoutEnglishLetters causing
- // the Non-Final tsadi to appear at an end of a word even though this is not
+ // The normal Tsadi is not a good Non-Final letter due to words like
+ // 'lechotet' (to chat) containing an apostrophe after the tsadi. This
+ // apostrophe is converted to a space in FilterWithoutEnglishLetters causing
+ // the Non-Final tsadi to appear at an end of a word even though this is not
// the case in the original text.
- // The letters Pe and Kaf rarely display a related behavior of not being a
- // good Non-Final letter. Words like 'Pop', 'Winamp' and 'Mubarak' for
- // example legally end with a Non-Final Pe or Kaf. However, the benefit of
- // these letters as Non-Final letters outweighs the damage since these words
- // are quite rare.
- return (b == NORMAL_KAF || b == NORMAL_MEM || b == NORMAL_NUN
+ // The letters Pe and Kaf rarely display a related behavior of not being a
+ // good Non-Final letter. Words like 'Pop', 'Winamp' and 'Mubarak' for
+ // example legally end with a Non-Final Pe or Kaf. However, the benefit of
+ // these letters as Non-Final letters outweighs the damage since these words
+ // are quite rare.
+ return (b == NORMAL_KAF || b == NORMAL_MEM || b == NORMAL_NUN
|| b == NORMAL_PE);
}
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/JapaneseContextAnalyser.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/JapaneseContextAnalyser.cs
index 93b9d7580..7d28224c5 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/JapaneseContextAnalyser.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/JapaneseContextAnalyser.cs
@@ -21,7 +21,7 @@
* Contributor(s):
* Shy Shalom <shooshX@gmail.com>
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
- *
+ *
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -48,7 +48,7 @@ namespace UniversalDetector.Core
// hiragana frequency category table
// This is hiragana 2-char sequence table, the number in each cell represents its frequency category
- protected static byte[,] jp2CharContext = {
+ protected static byte[,] jp2CharContext = {
{ 0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,},
{ 2,4,0,4,0,3,0,4,0,3,4,4,4,2,4,3,3,4,3,2,3,3,4,2,3,3,3,2,4,1,4,3,3,1,5,4,3,4,3,4,3,5,3,0,3,5,4,2,0,3,1,0,3,3,0,3,3,0,1,1,0,4,3,0,3,3,0,4,0,2,0,3,5,5,5,5,4,0,4,1,0,3,4,},
{ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,},
@@ -133,35 +133,35 @@ namespace UniversalDetector.Core
{ 0,4,0,4,0,4,0,3,0,4,4,3,4,2,4,3,2,0,4,4,4,3,5,3,5,3,3,2,4,2,4,3,4,3,1,4,0,2,3,4,4,4,3,3,3,4,4,4,3,4,1,3,4,3,2,1,2,1,3,3,3,4,4,3,3,5,0,4,0,3,0,4,3,3,3,2,1,0,3,0,0,3,3,},
{ 0,4,0,3,0,3,0,3,0,3,5,5,3,3,3,3,4,3,4,3,3,3,4,4,4,3,3,3,3,4,3,5,3,3,1,3,2,4,5,5,5,5,4,3,4,5,5,3,2,2,3,3,3,3,2,3,3,1,2,3,2,4,3,3,3,4,0,4,0,2,0,4,3,2,2,1,2,0,3,0,0,4,1,},
};
-
+
// category counters, each integer counts sequence in its category
int[] relSample = new int[CATEGORIES_NUM];
// total sequence received
int totalRel;
-
+
// The order of previous char
int lastCharOrder;
- // if last byte in current buffer is not the last byte of a character,
+ // if last byte in current buffer is not the last byte of a character,
// we need to know how many byte to skip in next buffer.
int needToSkipCharNum;
- // If this flag is set to true, detection is done and conclusion has
+ // If this flag is set to true, detection is done and conclusion has
// been made
bool done;
-
+
public JapaneseContextAnalyser()
{
- Reset();
+ Reset();
}
-
+
public float GetConfidence()
{
// This is just one way to calculate confidence. It works well for me.
if (totalRel > MINIMUM_DATA_THRESHOLD)
return ((float)(totalRel - relSample[0]))/totalRel;
- else
+ else
return DONT_KNOW;
}
@@ -170,15 +170,15 @@ namespace UniversalDetector.Core
int charLen = 0;
int max = offset + len;
-
+
if (done)
return;
- // The buffer we got is byte oriented, and a character may span
+ // The buffer we got is byte oriented, and a character may span
// more than one buffer. In case the last one or two byte in last
- // buffer is not complete, we record how many byte needed to
+ // buffer is not complete, we record how many byte needed to
// complete that character and skip these bytes here. We can choose
- // to record those bytes as well and analyse the character once it
+ // to record those bytes as well and analyse the character once it
// is complete, but since a character will not make much difference,
// skipping it will simplify our logic and improve performance.
for (int i = needToSkipCharNum+offset; i < max; ) {
@@ -200,14 +200,14 @@ namespace UniversalDetector.Core
}
}
}
-
+
public void HandleOneChar(byte[] buf, int offset, int charLen)
{
- if (totalRel > MAX_REL_THRESHOLD)
+ if (totalRel > MAX_REL_THRESHOLD)
done = true;
- if (done)
+ if (done)
return;
-
+
// Only 2-bytes characters are of our interest
int order = (charLen == 2) ? GetOrder(buf, offset) : -1;
if (order != -1 && lastCharOrder != -1) {
@@ -217,7 +217,7 @@ namespace UniversalDetector.Core
}
lastCharOrder = order;
}
-
+
public void Reset()
{
totalRel = 0;
@@ -228,18 +228,18 @@ namespace UniversalDetector.Core
done = false;
}
}
-
+
protected abstract int GetOrder(byte[] buf, int offset, out int charLen);
-
+
protected abstract int GetOrder(byte[] buf, int offset);
-
- public bool GotEnoughData()
+
+ public bool GotEnoughData()
{
return totalRel > ENOUGH_REL_THRESHOLD;
}
-
+
}
-
+
public class SJISContextAnalyser : JapaneseContextAnalyser
{
private const byte HIRAGANA_FIRST_BYTE = 0x82;
@@ -247,10 +247,10 @@ namespace UniversalDetector.Core
protected override int GetOrder(byte[] buf, int offset, out int charLen)
{
//find out current char's byte length
- if (buf[offset] >= 0x81 && buf[offset] <= 0x9F
+ if (buf[offset] >= 0x81 && buf[offset] <= 0x9F
|| buf[offset] >= 0xe0 && buf[offset] <= 0xFC)
charLen = 2;
- else
+ else
charLen = 1;
// return its order if it is hiragana
@@ -259,7 +259,7 @@ namespace UniversalDetector.Core
if (low >= 0x9F && low <= 0xF1)
return low - 0x9F;
}
- return -1;
+ return -1;
}
protected override int GetOrder(byte[] buf, int offset)
@@ -274,15 +274,15 @@ namespace UniversalDetector.Core
}
}
-
+
public class EUCJPContextAnalyser : JapaneseContextAnalyser
{
private const byte HIRAGANA_FIRST_BYTE = 0xA4;
-
+
protected override int GetOrder(byte[] buf, int offset, out int charLen)
{
byte high = buf[offset];
-
+
//find out current char's byte length
if (high == 0x8E || high >= 0xA1 && high <= 0xFE)
charLen = 2;
@@ -297,9 +297,9 @@ namespace UniversalDetector.Core
if (low >= 0xA1 && low <= 0xF3)
return low - 0xA1;
}
- return -1;
+ return -1;
}
-
+
protected override int GetOrder(byte[] buf, int offset)
{
// We are only interested in Hiragana
@@ -309,7 +309,7 @@ namespace UniversalDetector.Core
return low - 0xA1;
}
return -1;
- }
+ }
}
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangBulgarianModel.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangBulgarianModel.cs
index 4b6729ed3..5b18480d2 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangBulgarianModel.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangBulgarianModel.cs
@@ -21,7 +21,7 @@
* Contributor(s):
* Shy Shalom <shooshX@gmail.com>
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
- *
+ *
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -37,15 +37,15 @@
* ***** END LICENSE BLOCK ***** */
namespace UniversalDetector.Core
-{
+{
public abstract class BulgarianModel : SequenceModel
{
- //Model Table:
+ //Model Table:
//total sequences: 100%
//first 512 sequences: 96.9392%
//first 1024 sequences:3.0618%
//rest sequences: 0.2992%
- //negative sequences: 0.0020%
+ //negative sequences: 0.0020%
private static byte[] BULGARIAN_LANG_MODEL = {
0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,3,3,3,3,3,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,2,2,3,2,2,1,2,2,
@@ -175,15 +175,15 @@ namespace UniversalDetector.Core
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,1,1,1,1,0,1,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
-
+
};
- public BulgarianModel(byte[] charToOrderMap, string name)
+ public BulgarianModel(byte[] charToOrderMap, string name)
: base(charToOrderMap, BULGARIAN_LANG_MODEL, 0.969392f, false, name)
{
- }
+ }
}
-
+
public class Latin5BulgarianModel : BulgarianModel
{
//255: Control characters that usually does not exist in any text
@@ -191,7 +191,7 @@ namespace UniversalDetector.Core
//253: symbol (punctuation) that does not belong to word
//252: 0 - 9
// Character Mapping Table:
- // this table is modified base on win1251BulgarianCharToOrderMap, so
+ // this table is modified base on win1251BulgarianCharToOrderMap, so
// only number <64 is sure valid
private static byte[] LATIN5_CHAR_TO_ORDER_MAP = {
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, //00
@@ -209,14 +209,14 @@ namespace UniversalDetector.Core
39, 28, 34, 51, 48, 49, 53, 50, 54, 57, 61,239, 67,240, 60, 56, //c0
1, 18, 9, 20, 11, 3, 23, 15, 2, 26, 12, 10, 14, 6, 4, 13, //d0
7, 8, 5, 19, 29, 25, 22, 21, 27, 24, 17, 75, 52,241, 42, 16, //e0
- 62,242,243,244, 58,245, 98,246,247,248,249,250,251, 91,252,253, //f0
+ 62,242,243,244, 58,245, 98,246,247,248,249,250,251, 91,252,253, //f0
};
-
+
public Latin5BulgarianModel() : base(LATIN5_CHAR_TO_ORDER_MAP, "ISO-8859-5")
{
}
}
-
+
public class Win1251BulgarianModel : BulgarianModel
{
private static byte[] WIN1251__CHAR_TO_ORDER_MAP = {
@@ -236,8 +236,8 @@ namespace UniversalDetector.Core
39, 28, 34, 51, 48, 49, 53, 50, 54, 57, 61,251, 67,252, 60, 56, //d0
1, 18, 9, 20, 11, 3, 23, 15, 2, 26, 12, 10, 14, 6, 4, 13, //e0
7, 8, 5, 19, 29, 25, 22, 21, 27, 24, 17, 75, 52,253, 42, 16, //f0
- };
-
+ };
+
public Win1251BulgarianModel() : base(WIN1251__CHAR_TO_ORDER_MAP, "windows-1251")
{
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangCyrillicModel.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangCyrillicModel.cs
index 5e55a4839..1210b6d5d 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangCyrillicModel.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangCyrillicModel.cs
@@ -21,7 +21,7 @@
* Contributor(s):
* Shy Shalom <shooshX@gmail.com>
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
- *
+ *
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -40,12 +40,12 @@ namespace UniversalDetector.Core
{
public abstract class CyrillicModel : SequenceModel
{
- // Model Table:
+ // Model Table:
// total sequences: 100%
// first 512 sequences: 97.6601%
// first 1024 sequences: 2.3389%
// rest sequences: 0.1237%
- // negative sequences: 0.0009%
+ // negative sequences: 0.0009%
protected readonly static byte[] RUSSIAN_LANG_MODEL = {
0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,3,3,3,3,1,3,3,3,2,3,2,3,3,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,2,2,2,2,2,0,0,2,
@@ -176,13 +176,13 @@ namespace UniversalDetector.Core
0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,
};
-
- public CyrillicModel(byte[] charToOrderMap, string name)
+
+ public CyrillicModel(byte[] charToOrderMap, string name)
: base(charToOrderMap, RUSSIAN_LANG_MODEL, 0.976601f, false, name)
{
}
}
-
+
public class Koi8rModel : CyrillicModel
{
private readonly static byte[] KOI8R_CHAR_TO_ORDER_MAP = {
@@ -203,12 +203,12 @@ namespace UniversalDetector.Core
59, 37, 44, 58, 41, 48, 53, 46, 55, 42, 60, 36, 49, 38, 31, 34, //e0
35, 43, 45, 32, 40, 52, 56, 33, 61, 62, 51, 57, 47, 63, 50, 70, //f0
};
-
+
public Koi8rModel() : base(KOI8R_CHAR_TO_ORDER_MAP, "KOI8-R")
{
}
}
-
+
public class Win1251Model : CyrillicModel
{
private readonly static byte[] WIN1251_CHAR_TO_ORDER_MAP = {
@@ -229,12 +229,12 @@ namespace UniversalDetector.Core
3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15,
9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16,
};
-
+
public Win1251Model() : base(WIN1251_CHAR_TO_ORDER_MAP, "windows-1251")
{
}
}
-
+
public class Latin5Model : CyrillicModel
{
private readonly static byte[] LATIN5_CHAR_TO_ORDER_MAP = {
@@ -254,13 +254,13 @@ namespace UniversalDetector.Core
3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15,
9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16,
239, 68,240,241,242,243,244,245,246,247,248,249,250,251,252,255,
- };
-
+ };
+
public Latin5Model() : base(LATIN5_CHAR_TO_ORDER_MAP, "ISO-8859-5")
{
}
}
-
+
public class MacCyrillicModel : CyrillicModel
{
private readonly static byte[] MACCYRILLIC_CHAR_TO_ORDER_MAP = {
@@ -281,7 +281,7 @@ namespace UniversalDetector.Core
3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15,
9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27,255,
};
-
+
public MacCyrillicModel() : base(MACCYRILLIC_CHAR_TO_ORDER_MAP,
"x-mac-cyrillic")
{
@@ -308,7 +308,7 @@ namespace UniversalDetector.Core
43, 9, 45, 7, 32, 6, 40, 14, 52, 24, 56, 10, 33, 17, 61,249,
250, 18, 62, 20, 51, 25, 57, 30, 47, 29, 63, 22, 50,251,252,255,
};
-
+
public Ibm855Model() : base(IBM855_BYTE_TO_ORDER_MAP, "IBM855")
{
}
@@ -334,12 +334,12 @@ namespace UniversalDetector.Core
9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16,
239, 68,240,241,242,243,244,245,246,247,248,249,250,251,252,255,
};
-
+
public Ibm866Model() : base(IBM866_CHAR_TO_ORDER_MAP, "IBM866")
{
}
}
-
-
+
+
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangGreekModel.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangGreekModel.cs
index 563ba52c2..2fe1e97c0 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangGreekModel.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangGreekModel.cs
@@ -21,7 +21,7 @@
* Contributor(s):
* Shy Shalom <shooshX@gmail.com>
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
- *
+ *
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -37,15 +37,15 @@
* ***** END LICENSE BLOCK ***** */
namespace UniversalDetector.Core
-{
+{
public abstract class GreekModel : SequenceModel
{
- // Model Table:
+ // Model Table:
// total sequences: 100%
// first 512 sequences: 98.2851%
// first 1024 sequences:1.7001%
// rest sequences: 0.0359%
- // negative sequences: 0.0148%
+ // negative sequences: 0.0148%
private readonly static byte[] GREEK_LANG_MODEL = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -177,12 +177,12 @@ namespace UniversalDetector.Core
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
- public GreekModel(byte[] charToOrderMap, string name)
+ public GreekModel(byte[] charToOrderMap, string name)
: base(charToOrderMap, GREEK_LANG_MODEL, 0.982851f, false, name)
{
- }
+ }
}
-
+
public class Latin7Model : GreekModel
{
/****************************************************************
@@ -210,12 +210,12 @@ namespace UniversalDetector.Core
124, 1, 29, 20, 21, 3, 32, 13, 25, 5, 11, 16, 10, 6, 30, 4, //e0
9, 8, 14, 7, 2, 12, 28, 23, 42, 24, 64, 75, 19, 26, 27,253, //f0
};
-
+
public Latin7Model() : base(LATIN7_CHAR_TO_ORDER_MAP, "ISO-8859-7")
{
}
}
-
+
public class Win1253Model : GreekModel
{
private readonly static byte[] WIN1253__CHAR_TO_ORDER_MAP = {
@@ -235,8 +235,8 @@ namespace UniversalDetector.Core
35, 48,250, 37, 33, 45, 56, 50, 84, 57,120,121, 17, 18, 22, 15, //d0
124, 1, 29, 20, 21, 3, 32, 13, 25, 5, 11, 16, 10, 6, 30, 4, //e0
9, 8, 14, 7, 2, 12, 28, 23, 42, 24, 64, 75, 19, 26, 27,253, //f0
- };
-
+ };
+
public Win1253Model() : base(WIN1253__CHAR_TO_ORDER_MAP, "windows-1253")
{
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangHebrewModel.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangHebrewModel.cs
index 030fcc598..180ab8a63 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangHebrewModel.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangHebrewModel.cs
@@ -37,15 +37,15 @@
* ***** END LICENSE BLOCK ***** */
namespace UniversalDetector.Core
-{
+{
public abstract class HebrewModel : SequenceModel
{
- //Model Table:
+ //Model Table:
//total sequences: 100%
//first 512 sequences: 98.4004%
//first 1024 sequences: 1.5981%
//rest sequences: 0.087%
- //negative sequences: 0.0015%
+ //negative sequences: 0.0015%
private readonly static byte[] HEBREW_LANG_MODEL = {
0,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,2,3,2,1,2,0,1,0,0,
3,0,3,1,0,0,1,3,2,0,1,1,2,0,2,2,2,1,1,1,1,2,1,1,1,2,0,0,2,2,0,1,
@@ -177,12 +177,12 @@ namespace UniversalDetector.Core
0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,1,1,1,1,1,0,1,0,0,0,1,1,0,0,
};
- public HebrewModel(byte[] charToOrderMap, string name)
+ public HebrewModel(byte[] charToOrderMap, string name)
: base(charToOrderMap, HEBREW_LANG_MODEL, 0.984004f, false, name)
{
- }
+ }
}
-
+
public class Win1255Model : HebrewModel
{
/*
@@ -192,7 +192,7 @@ namespace UniversalDetector.Core
252: 0 - 9
*/
//Windows-1255 language model
- //Character Mapping Table:
+ //Character Mapping Table:
private readonly static byte[] WIN1255_CHAR_TO_ORDER_MAP = {
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, //00
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, //10
@@ -211,7 +211,7 @@ namespace UniversalDetector.Core
9, 8, 20, 16, 3, 2, 24, 14, 22, 1, 25, 15, 4, 11, 6, 23,
12, 19, 13, 26, 18, 27, 21, 17, 7, 10, 5,251,252,128, 96,253,
};
-
+
public Win1255Model() : base(WIN1255_CHAR_TO_ORDER_MAP, "windows-1255")
{
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangHungarianModel.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangHungarianModel.cs
index d7eee2251..d95ec4c8e 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangHungarianModel.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangHungarianModel.cs
@@ -36,15 +36,15 @@
* ***** END LICENSE BLOCK ***** */
namespace UniversalDetector.Core
-{
+{
public abstract class HungarianModel : SequenceModel
{
- //Model Table:
+ //Model Table:
//total sequences: 100%
//first 512 sequences: 94.7368%
//first 1024 sequences:5.2623%
//rest sequences: 0.8894%
- //negative sequences: 0.0009%
+ //negative sequences: 0.0009%
private readonly static byte[] HUNGARIAN_LANG_MODEL = {
0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,2,3,3,1,1,2,2,2,2,2,1,2,
@@ -176,13 +176,13 @@ namespace UniversalDetector.Core
0,1,1,1,1,1,1,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,
};
- public HungarianModel(byte[] charToOrderMap, string name)
- : base(charToOrderMap, HUNGARIAN_LANG_MODEL, 0.947368f,
+ public HungarianModel(byte[] charToOrderMap, string name)
+ : base(charToOrderMap, HUNGARIAN_LANG_MODEL, 0.947368f,
false, name)
{
- }
+ }
}
-
+
public class Latin2HungarianModel : HungarianModel
{
private readonly static byte[] LATIN2_CHAR_TO_ORDER_MAP = {
@@ -203,12 +203,12 @@ namespace UniversalDetector.Core
82, 14, 74,242, 70, 80,243, 72,244, 15, 83, 77, 84, 30, 76, 85,
245,246,247, 25, 73, 42, 24,248,249,250, 31, 56, 29,251,252,253,
};
-
+
public Latin2HungarianModel() : base(LATIN2_CHAR_TO_ORDER_MAP, "ISO-8859-2")
{
}
}
-
+
public class Win1250HungarianModel : HungarianModel
{
private readonly static byte[] WIN1250_CHAR_TO_ORDER_MAP = {
@@ -229,7 +229,7 @@ namespace UniversalDetector.Core
84, 14, 75,242, 71, 82,243, 73,244, 15, 85, 79, 86, 30, 77, 87,
245,246,247, 25, 74, 42, 24,248,249,250, 31, 56, 29,251,252,253,
};
-
+
public Win1250HungarianModel() : base(WIN1250_CHAR_TO_ORDER_MAP, "windows-1250")
{
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangThaiModel.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangThaiModel.cs
index bdda20f14..b5dae7a34 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangThaiModel.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/LangThaiModel.cs
@@ -21,7 +21,7 @@
* Contributor(s):
* Shy Shalom <shooshX@gmail.com>
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
- *
+ *
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -37,7 +37,7 @@
* ***** END LICENSE BLOCK ***** */
namespace UniversalDetector.Core
-{
+{
public class ThaiModel : SequenceModel
{
/****************************************************************
@@ -46,7 +46,7 @@ namespace UniversalDetector.Core
253: symbol (punctuation) that does not belong to word
252: 0 - 9
*****************************************************************/
- // The following result for thai was collected from a limited sample (1M)
+ // The following result for thai was collected from a limited sample (1M)
private readonly static byte[] TIS620_CHAR_TO_ORDER_MAP = {
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, //00
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, //10
@@ -66,12 +66,12 @@ namespace UniversalDetector.Core
68, 56, 59, 65, 69, 60, 70, 80, 71, 87,248,249,250,251,252,253,
};
- //Model Table:
+ //Model Table:
//total sequences: 100%
//first 512 sequences: 92.6386%
//first 1024 sequences:7.3177%
//rest sequences: 1.0230%
- //negative sequences: 0.0436%
+ //negative sequences: 0.0436%
private readonly static byte[] THAI_LANG_MODEL = {
0,1,3,3,3,3,0,0,3,3,0,3,3,0,3,3,3,3,3,3,3,3,0,0,3,3,3,0,3,3,3,3,
0,3,3,0,0,0,1,3,0,3,3,2,3,3,0,1,2,3,3,3,3,0,2,0,2,0,0,3,2,1,2,2,
@@ -203,11 +203,11 @@ namespace UniversalDetector.Core
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
- public ThaiModel(byte[] charToOrderMap, string name)
- : base(TIS620_CHAR_TO_ORDER_MAP, THAI_LANG_MODEL,
+ public ThaiModel(byte[] charToOrderMap, string name)
+ : base(TIS620_CHAR_TO_ORDER_MAP, THAI_LANG_MODEL,
0.926386f, false, "TIS-620")
{
- }
+ }
}
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Latin1Prober.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Latin1Prober.cs
index c79a10aa7..5d57e30e1 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Latin1Prober.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/Latin1Prober.cs
@@ -21,7 +21,7 @@
* Contributor(s):
* Shy Shalom <shooshX@gmail.com>
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
- *
+ *
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -40,7 +40,7 @@ using System;
namespace UniversalDetector.Core
{
- // TODO: Using trigrams the detector should be able to discriminate between
+ // TODO: Using trigrams the detector should be able to discriminate between
// latin-1 and iso8859-2
public class Latin1Prober : CharsetProber
{
@@ -54,9 +54,9 @@ namespace UniversalDetector.Core
private const int ACO = 5; // accent capital other
private const int ASV = 6; // accent small vowel
private const int ASO = 7; // accent small other
-
+
private const int CLASS_NUM = 8; // total classes
-
+
private readonly static byte[] Latin1_CharToClass = {
OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 00 - 07
OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 08 - 0F
@@ -92,36 +92,36 @@ namespace UniversalDetector.Core
ASV, ASV, ASV, ASV, ASV, ASO, ASO, ASO, // F8 - FF
};
- /* 0 : illegal
- 1 : very unlikely
- 2 : normal
+ /* 0 : illegal
+ 1 : very unlikely
+ 2 : normal
3 : very likely
*/
private readonly static byte[] Latin1ClassModel = {
/* UDF OTH ASC ASS ACV ACO ASV ASO */
/*UDF*/ 0, 0, 0, 0, 0, 0, 0, 0,
/*OTH*/ 0, 3, 3, 3, 3, 3, 3, 3,
- /*ASC*/ 0, 3, 3, 3, 3, 3, 3, 3,
+ /*ASC*/ 0, 3, 3, 3, 3, 3, 3, 3,
/*ASS*/ 0, 3, 3, 3, 1, 1, 3, 3,
/*ACV*/ 0, 3, 3, 3, 1, 2, 1, 2,
- /*ACO*/ 0, 3, 3, 3, 3, 3, 3, 3,
- /*ASV*/ 0, 3, 1, 3, 1, 1, 1, 3,
+ /*ACO*/ 0, 3, 3, 3, 3, 3, 3, 3,
+ /*ASV*/ 0, 3, 1, 3, 1, 1, 1, 3,
/*ASO*/ 0, 3, 1, 3, 1, 1, 3, 3,
};
private byte lastCharClass;
private int[] freqCounter = new int[FREQ_CAT_NUM];
-
+
public Latin1Prober()
{
Reset();
}
- public override string GetCharsetName()
+ public override string GetCharsetName()
{
return "windows-1252";
}
-
+
public override void Reset()
{
state = ProbingState.Detecting;
@@ -129,12 +129,12 @@ namespace UniversalDetector.Core
for (int i = 0; i < FREQ_CAT_NUM; i++)
freqCounter[i] = 0;
}
-
+
public override ProbingState HandleData(byte[] buf, int offset, int len)
{
byte[] newbuf = FilterWithEnglishLetters(buf, offset, len);
byte charClass, freq;
-
+
for (int i = 0; i < newbuf.Length; i++) {
charClass = Latin1_CharToClass[newbuf[i]];
freq = Latin1ClassModel[lastCharClass * CLASS_NUM + charClass];
@@ -152,21 +152,21 @@ namespace UniversalDetector.Core
{
if (state == ProbingState.NotMe)
return 0.01f;
-
+
float confidence = 0.0f;
int total = 0;
for (int i = 0; i < FREQ_CAT_NUM; i++) {
total += freqCounter[i];
}
-
+
if (total <= 0) {
confidence = 0.0f;
} else {
confidence = freqCounter[3] * 1.0f / total;
confidence -= freqCounter[1] * 20.0f / total;
}
-
- // lower the confidence of latin1 so that other more accurate detector
+
+ // lower the confidence of latin1 so that other more accurate detector
// can take priority.
return confidence < 0.0f ? 0.0f : confidence * 0.5f;
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/MBCSGroupProber.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/MBCSGroupProber.cs
index abf49aacd..b4f6928a4 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/MBCSGroupProber.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/MBCSGroupProber.cs
@@ -21,7 +21,7 @@
* Contributor(s):
* Shy Shalom <shooshX@gmail.com>
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
- *
+ *
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -46,13 +46,13 @@ namespace UniversalDetector.Core
public class MBCSGroupProber : CharsetProber
{
private const int PROBERS_NUM = 7;
- private readonly static string[] ProberName =
+ private readonly static string[] ProberName =
{ "UTF8", "SJIS", "EUCJP", "GB18030", "EUCKR", "Big5", "EUCTW" };
private CharsetProber[] probers = new CharsetProber[PROBERS_NUM];
private bool[] isActive = new bool[PROBERS_NUM];
private int bestGuess;
private int activeNum;
-
+
public MBCSGroupProber()
{
probers[0] = new UTF8Prober();
@@ -62,7 +62,7 @@ namespace UniversalDetector.Core
probers[4] = new EUCKRProber();
probers[5] = new Big5Prober();
probers[6] = new EUCTWProber();
- Reset();
+ Reset();
}
public override string GetCharsetName()
@@ -99,7 +99,7 @@ namespace UniversalDetector.Core
//assume previous is not ascii, it will do no harm except add some noise
bool keepNext = true;
int max = offset + len;
-
+
for (int i = offset; i < max; i++) {
if ((buf[i] & 0x80) != 0) {
highbyteBuf[hptr++] = buf[i];
@@ -112,9 +112,9 @@ namespace UniversalDetector.Core
}
}
}
-
+
ProbingState st = ProbingState.NotMe;
-
+
for (int i = 0; i < probers.Length; i++) {
if (!isActive[i])
continue;
@@ -139,7 +139,7 @@ namespace UniversalDetector.Core
{
float bestConf = 0.0f;
float cf = 0.0f;
-
+
if (state == ProbingState.FoundIt) {
return 0.99f;
} else if (state == ProbingState.NotMe) {
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/MBCSSM.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/MBCSSM.cs
index 7aa8581bc..65e04292a 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/MBCSSM.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/MBCSSM.cs
@@ -42,79 +42,79 @@ namespace UniversalDetector.Core
{
private readonly static int[] UTF8_cls = {
BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 00 - 07
- BitPackage.Pack4bits(1,1,1,1,1,1,0,0), // 08 - 0f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 10 - 17
- BitPackage.Pack4bits(1,1,1,0,1,1,1,1), // 18 - 1f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 20 - 27
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 28 - 2f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 30 - 37
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 38 - 3f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 40 - 47
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 48 - 4f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 50 - 57
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 58 - 5f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 60 - 67
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 68 - 6f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 70 - 77
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 78 - 7f
- BitPackage.Pack4bits(2,2,2,2,3,3,3,3), // 80 - 87
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 88 - 8f
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 90 - 97
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 98 - 9f
- BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // a0 - a7
- BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // a8 - af
- BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // b0 - b7
- BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // b8 - bf
- BitPackage.Pack4bits(0,0,6,6,6,6,6,6), // c0 - c7
- BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // c8 - cf
- BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // d0 - d7
- BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // d8 - df
- BitPackage.Pack4bits(7,8,8,8,8,8,8,8), // e0 - e7
- BitPackage.Pack4bits(8,8,8,8,8,9,8,8), // e8 - ef
- BitPackage.Pack4bits(10,11,11,11,11,11,11,11), // f0 - f7
- BitPackage.Pack4bits(12,13,13,13,14,15,0,0) // f8 - ff
+ BitPackage.Pack4bits(1,1,1,1,1,1,0,0), // 08 - 0f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 10 - 17
+ BitPackage.Pack4bits(1,1,1,0,1,1,1,1), // 18 - 1f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 20 - 27
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 28 - 2f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 30 - 37
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 38 - 3f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 40 - 47
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 48 - 4f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 50 - 57
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 58 - 5f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 60 - 67
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 68 - 6f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 70 - 77
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 78 - 7f
+ BitPackage.Pack4bits(2,2,2,2,3,3,3,3), // 80 - 87
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 88 - 8f
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 90 - 97
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 98 - 9f
+ BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // a0 - a7
+ BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // a8 - af
+ BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // b0 - b7
+ BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // b8 - bf
+ BitPackage.Pack4bits(0,0,6,6,6,6,6,6), // c0 - c7
+ BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // c8 - cf
+ BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // d0 - d7
+ BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // d8 - df
+ BitPackage.Pack4bits(7,8,8,8,8,8,8,8), // e0 - e7
+ BitPackage.Pack4bits(8,8,8,8,8,9,8,8), // e8 - ef
+ BitPackage.Pack4bits(10,11,11,11,11,11,11,11), // f0 - f7
+ BitPackage.Pack4bits(12,13,13,13,14,15,0,0) // f8 - ff
};
private readonly static int[] UTF8_st = {
- BitPackage.Pack4bits(ERROR,START,ERROR,ERROR,ERROR,ERROR, 12, 10),//00-07
- BitPackage.Pack4bits( 9, 11, 8, 7, 6, 5, 4, 3),//08-0f
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//10-17
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//18-1f
- BitPackage.Pack4bits(ITSME,ITSME,ITSME,ITSME,ITSME,ITSME,ITSME,ITSME),//20-27
- BitPackage.Pack4bits(ITSME,ITSME,ITSME,ITSME,ITSME,ITSME,ITSME,ITSME),//28-2f
- BitPackage.Pack4bits(ERROR,ERROR, 5, 5, 5, 5,ERROR,ERROR),//30-37
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//38-3f
- BitPackage.Pack4bits(ERROR,ERROR,ERROR, 5, 5, 5,ERROR,ERROR),//40-47
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//48-4f
- BitPackage.Pack4bits(ERROR,ERROR, 7, 7, 7, 7,ERROR,ERROR),//50-57
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//58-5f
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR, 7, 7,ERROR,ERROR),//60-67
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//68-6f
- BitPackage.Pack4bits(ERROR,ERROR, 9, 9, 9, 9,ERROR,ERROR),//70-77
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//78-7f
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR, 9,ERROR,ERROR),//80-87
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//88-8f
- BitPackage.Pack4bits(ERROR,ERROR, 12, 12, 12, 12,ERROR,ERROR),//90-97
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//98-9f
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR, 12,ERROR,ERROR),//a0-a7
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//a8-af
- BitPackage.Pack4bits(ERROR,ERROR, 12, 12, 12,ERROR,ERROR,ERROR),//b0-b7
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//b8-bf
- BitPackage.Pack4bits(ERROR,ERROR,START,START,START,START,ERROR,ERROR),//c0-c7
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR) //c8-cf
+ BitPackage.Pack4bits(ERROR,START,ERROR,ERROR,ERROR,ERROR, 12, 10),//00-07
+ BitPackage.Pack4bits( 9, 11, 8, 7, 6, 5, 4, 3),//08-0f
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//10-17
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//18-1f
+ BitPackage.Pack4bits(ITSME,ITSME,ITSME,ITSME,ITSME,ITSME,ITSME,ITSME),//20-27
+ BitPackage.Pack4bits(ITSME,ITSME,ITSME,ITSME,ITSME,ITSME,ITSME,ITSME),//28-2f
+ BitPackage.Pack4bits(ERROR,ERROR, 5, 5, 5, 5,ERROR,ERROR),//30-37
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//38-3f
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR, 5, 5, 5,ERROR,ERROR),//40-47
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//48-4f
+ BitPackage.Pack4bits(ERROR,ERROR, 7, 7, 7, 7,ERROR,ERROR),//50-57
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//58-5f
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR, 7, 7,ERROR,ERROR),//60-67
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//68-6f
+ BitPackage.Pack4bits(ERROR,ERROR, 9, 9, 9, 9,ERROR,ERROR),//70-77
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//78-7f
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR, 9,ERROR,ERROR),//80-87
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//88-8f
+ BitPackage.Pack4bits(ERROR,ERROR, 12, 12, 12, 12,ERROR,ERROR),//90-97
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//98-9f
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR, 12,ERROR,ERROR),//a0-a7
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//a8-af
+ BitPackage.Pack4bits(ERROR,ERROR, 12, 12, 12,ERROR,ERROR,ERROR),//b0-b7
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//b8-bf
+ BitPackage.Pack4bits(ERROR,ERROR,START,START,START,START,ERROR,ERROR),//c0-c7
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR) //c8-cf
};
- private readonly static int[] UTF8CharLenTable =
+ private readonly static int[] UTF8CharLenTable =
{0, 1, 0, 0, 0, 0, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6 };
-
+
public UTF8SMModel() : base(
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, UTF8_cls),
16,
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, UTF8_st),
UTF8CharLenTable, "UTF-8")
@@ -122,68 +122,68 @@ namespace UniversalDetector.Core
}
}
-
+
public class GB18030SMModel : SMModel
{
private readonly static int[] GB18030_cls = {
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 00 - 07
- BitPackage.Pack4bits(1,1,1,1,1,1,0,0), // 08 - 0f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 10 - 17
- BitPackage.Pack4bits(1,1,1,0,1,1,1,1), // 18 - 1f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 20 - 27
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 28 - 2f
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // 30 - 37
- BitPackage.Pack4bits(3,3,1,1,1,1,1,1), // 38 - 3f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 40 - 47
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 48 - 4f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 50 - 57
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 58 - 5f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 60 - 67
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 68 - 6f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 70 - 77
- BitPackage.Pack4bits(2,2,2,2,2,2,2,4), // 78 - 7f
- BitPackage.Pack4bits(5,6,6,6,6,6,6,6), // 80 - 87
- BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // 88 - 8f
- BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // 90 - 97
- BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // 98 - 9f
- BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // a0 - a7
- BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // a8 - af
- BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // b0 - b7
- BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // b8 - bf
- BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // c0 - c7
- BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // c8 - cf
- BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // d0 - d7
- BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // d8 - df
- BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // e0 - e7
- BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // e8 - ef
- BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // f0 - f7
- BitPackage.Pack4bits(6,6,6,6,6,6,6,0) // f8 - ff
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 00 - 07
+ BitPackage.Pack4bits(1,1,1,1,1,1,0,0), // 08 - 0f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 10 - 17
+ BitPackage.Pack4bits(1,1,1,0,1,1,1,1), // 18 - 1f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 20 - 27
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 28 - 2f
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // 30 - 37
+ BitPackage.Pack4bits(3,3,1,1,1,1,1,1), // 38 - 3f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 40 - 47
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 48 - 4f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 50 - 57
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 58 - 5f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 60 - 67
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 68 - 6f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 70 - 77
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,4), // 78 - 7f
+ BitPackage.Pack4bits(5,6,6,6,6,6,6,6), // 80 - 87
+ BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // 88 - 8f
+ BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // 90 - 97
+ BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // 98 - 9f
+ BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // a0 - a7
+ BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // a8 - af
+ BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // b0 - b7
+ BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // b8 - bf
+ BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // c0 - c7
+ BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // c8 - cf
+ BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // d0 - d7
+ BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // d8 - df
+ BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // e0 - e7
+ BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // e8 - ef
+ BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // f0 - f7
+ BitPackage.Pack4bits(6,6,6,6,6,6,6,0) // f8 - ff
};
private readonly static int[] GB18030_st = {
- BitPackage.Pack4bits(ERROR,START,START,START,START,START, 3,ERROR),//00-07
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ITSME,ITSME),//08-0f
- BitPackage.Pack4bits(ITSME,ITSME,ITSME,ITSME,ITSME,ERROR,ERROR,START),//10-17
- BitPackage.Pack4bits( 4,ERROR,START,START,ERROR,ERROR,ERROR,ERROR),//18-1f
- BitPackage.Pack4bits(ERROR,ERROR, 5,ERROR,ERROR,ERROR,ITSME,ERROR),//20-27
- BitPackage.Pack4bits(ERROR,ERROR,START,START,START,START,START,START) //28-2f
+ BitPackage.Pack4bits(ERROR,START,START,START,START,START, 3,ERROR),//00-07
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ITSME,ITSME),//08-0f
+ BitPackage.Pack4bits(ITSME,ITSME,ITSME,ITSME,ITSME,ERROR,ERROR,START),//10-17
+ BitPackage.Pack4bits( 4,ERROR,START,START,ERROR,ERROR,ERROR,ERROR),//18-1f
+ BitPackage.Pack4bits(ERROR,ERROR, 5,ERROR,ERROR,ERROR,ITSME,ERROR),//20-27
+ BitPackage.Pack4bits(ERROR,ERROR,START,START,START,START,START,START) //28-2f
};
- // To be accurate, the length of class 6 can be either 2 or 4.
- // But it is not necessary to discriminate between the two since
- // it is used for frequency analysis only, and we are validating
- // each code range there as well. So it is safe to set it to be
- // 2 here.
+ // To be accurate, the length of class 6 can be either 2 or 4.
+ // But it is not necessary to discriminate between the two since
+ // it is used for frequency analysis only, and we are validating
+ // each code range there as well. So it is safe to set it to be
+ // 2 here.
private readonly static int[] GB18030CharLenTable = {0, 1, 1, 1, 1, 1, 2};
-
+
public GB18030SMModel() : base(
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, GB18030_cls),
7,
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, GB18030_st),
GB18030CharLenTable, "GB18030")
@@ -191,60 +191,60 @@ namespace UniversalDetector.Core
}
}
-
+
public class BIG5SMModel : SMModel
{
private readonly static int[] BIG5_cls = {
BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 00 - 07
- BitPackage.Pack4bits(1,1,1,1,1,1,0,0), // 08 - 0f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 10 - 17
- BitPackage.Pack4bits(1,1,1,0,1,1,1,1), // 18 - 1f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 20 - 27
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 28 - 2f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 30 - 37
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 38 - 3f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 40 - 47
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 48 - 4f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 50 - 57
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 58 - 5f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 60 - 67
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 68 - 6f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 70 - 77
- BitPackage.Pack4bits(2,2,2,2,2,2,2,1), // 78 - 7f
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 80 - 87
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 88 - 8f
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 90 - 97
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 98 - 9f
- BitPackage.Pack4bits(4,3,3,3,3,3,3,3), // a0 - a7
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // a8 - af
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // b0 - b7
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // b8 - bf
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // c0 - c7
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // c8 - cf
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // d0 - d7
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // d8 - df
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // e0 - e7
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // e8 - ef
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // f0 - f7
- BitPackage.Pack4bits(3,3,3,3,3,3,3,0) // f8 - ff
+ BitPackage.Pack4bits(1,1,1,1,1,1,0,0), // 08 - 0f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 10 - 17
+ BitPackage.Pack4bits(1,1,1,0,1,1,1,1), // 18 - 1f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 20 - 27
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 28 - 2f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 30 - 37
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 38 - 3f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 40 - 47
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 48 - 4f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 50 - 57
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 58 - 5f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 60 - 67
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 68 - 6f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 70 - 77
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,1), // 78 - 7f
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 80 - 87
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 88 - 8f
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 90 - 97
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 98 - 9f
+ BitPackage.Pack4bits(4,3,3,3,3,3,3,3), // a0 - a7
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // a8 - af
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // b0 - b7
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // b8 - bf
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // c0 - c7
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // c8 - cf
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // d0 - d7
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // d8 - df
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // e0 - e7
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // e8 - ef
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // f0 - f7
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,0) // f8 - ff
};
private readonly static int[] BIG5_st = {
- BitPackage.Pack4bits(ERROR,START,START, 3,ERROR,ERROR,ERROR,ERROR),//00-07
- BitPackage.Pack4bits(ERROR,ERROR,ITSME,ITSME,ITSME,ITSME,ITSME,ERROR),//08-0f
- BitPackage.Pack4bits(ERROR,START,START,START,START,START,START,START) //10-17
+ BitPackage.Pack4bits(ERROR,START,START, 3,ERROR,ERROR,ERROR,ERROR),//00-07
+ BitPackage.Pack4bits(ERROR,ERROR,ITSME,ITSME,ITSME,ITSME,ITSME,ERROR),//08-0f
+ BitPackage.Pack4bits(ERROR,START,START,START,START,START,START,START) //10-17
};
private readonly static int[] BIG5CharLenTable = {0, 1, 1, 2, 0};
-
+
public BIG5SMModel() : base(
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, BIG5_cls),
5,
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, BIG5_st),
BIG5CharLenTable, "Big5")
@@ -252,63 +252,63 @@ namespace UniversalDetector.Core
}
}
-
+
public class EUCJPSMModel : SMModel
{
private readonly static int[] EUCJP_cls = {
- //BitPacket.Pack4bits(5,4,4,4,4,4,4,4), // 00 - 07
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 00 - 07
- BitPackage.Pack4bits(4,4,4,4,4,4,5,5), // 08 - 0f
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 10 - 17
- BitPackage.Pack4bits(4,4,4,5,4,4,4,4), // 18 - 1f
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 20 - 27
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 28 - 2f
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 30 - 37
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 38 - 3f
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 40 - 47
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 48 - 4f
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 50 - 57
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 58 - 5f
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 60 - 67
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 68 - 6f
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 70 - 77
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 78 - 7f
- BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // 80 - 87
- BitPackage.Pack4bits(5,5,5,5,5,5,1,3), // 88 - 8f
- BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // 90 - 97
- BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // 98 - 9f
- BitPackage.Pack4bits(5,2,2,2,2,2,2,2), // a0 - a7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a8 - af
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b0 - b7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b8 - bf
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c0 - c7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c8 - cf
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d0 - d7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d8 - df
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // e0 - e7
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // e8 - ef
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // f0 - f7
- BitPackage.Pack4bits(0,0,0,0,0,0,0,5) // f8 - ff
+ //BitPacket.Pack4bits(5,4,4,4,4,4,4,4), // 00 - 07
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 00 - 07
+ BitPackage.Pack4bits(4,4,4,4,4,4,5,5), // 08 - 0f
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 10 - 17
+ BitPackage.Pack4bits(4,4,4,5,4,4,4,4), // 18 - 1f
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 20 - 27
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 28 - 2f
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 30 - 37
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 38 - 3f
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 40 - 47
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 48 - 4f
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 50 - 57
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 58 - 5f
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 60 - 67
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 68 - 6f
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 70 - 77
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 78 - 7f
+ BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // 80 - 87
+ BitPackage.Pack4bits(5,5,5,5,5,5,1,3), // 88 - 8f
+ BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // 90 - 97
+ BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // 98 - 9f
+ BitPackage.Pack4bits(5,2,2,2,2,2,2,2), // a0 - a7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a8 - af
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b0 - b7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b8 - bf
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c0 - c7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c8 - cf
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d0 - d7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d8 - df
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // e0 - e7
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // e8 - ef
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // f0 - f7
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,5) // f8 - ff
};
private readonly static int[] EUCJP_st = {
- BitPackage.Pack4bits( 3, 4, 3, 5,START,ERROR,ERROR,ERROR),//00-07
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ITSME,ITSME,ITSME,ITSME),//08-0f
- BitPackage.Pack4bits(ITSME,ITSME,START,ERROR,START,ERROR,ERROR,ERROR),//10-17
- BitPackage.Pack4bits(ERROR,ERROR,START,ERROR,ERROR,ERROR, 3,ERROR),//18-1f
- BitPackage.Pack4bits( 3,ERROR,ERROR,ERROR,START,START,START,START) //20-27
+ BitPackage.Pack4bits( 3, 4, 3, 5,START,ERROR,ERROR,ERROR),//00-07
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ITSME,ITSME,ITSME,ITSME),//08-0f
+ BitPackage.Pack4bits(ITSME,ITSME,START,ERROR,START,ERROR,ERROR,ERROR),//10-17
+ BitPackage.Pack4bits(ERROR,ERROR,START,ERROR,ERROR,ERROR, 3,ERROR),//18-1f
+ BitPackage.Pack4bits( 3,ERROR,ERROR,ERROR,START,START,START,START) //20-27
};
private readonly static int[] EUCJPCharLenTable = { 2, 2, 2, 3, 1, 0 };
-
+
public EUCJPSMModel() : base(
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, EUCJP_cls),
6,
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, EUCJP_st),
EUCJPCharLenTable, "EUC-JP")
@@ -316,60 +316,60 @@ namespace UniversalDetector.Core
}
}
-
+
public class EUCKRSMModel : SMModel
{
private readonly static int[] EUCKR_cls = {
- //BitPacket.Pack4bits(0,1,1,1,1,1,1,1), // 00 - 07
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 00 - 07
- BitPackage.Pack4bits(1,1,1,1,1,1,0,0), // 08 - 0f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 10 - 17
- BitPackage.Pack4bits(1,1,1,0,1,1,1,1), // 18 - 1f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 20 - 27
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 28 - 2f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 30 - 37
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 38 - 3f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 40 - 47
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 48 - 4f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 50 - 57
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 58 - 5f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 60 - 67
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 68 - 6f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 70 - 77
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 78 - 7f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 80 - 87
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 88 - 8f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 90 - 97
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 98 - 9f
- BitPackage.Pack4bits(0,2,2,2,2,2,2,2), // a0 - a7
- BitPackage.Pack4bits(2,2,2,2,2,3,3,3), // a8 - af
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b0 - b7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b8 - bf
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c0 - c7
- BitPackage.Pack4bits(2,3,2,2,2,2,2,2), // c8 - cf
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d0 - d7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d8 - df
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // e0 - e7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // e8 - ef
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // f0 - f7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,0) // f8 - ff
+ //BitPacket.Pack4bits(0,1,1,1,1,1,1,1), // 00 - 07
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 00 - 07
+ BitPackage.Pack4bits(1,1,1,1,1,1,0,0), // 08 - 0f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 10 - 17
+ BitPackage.Pack4bits(1,1,1,0,1,1,1,1), // 18 - 1f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 20 - 27
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 28 - 2f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 30 - 37
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 38 - 3f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 40 - 47
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 48 - 4f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 50 - 57
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 58 - 5f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 60 - 67
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 68 - 6f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 70 - 77
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 78 - 7f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 80 - 87
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 88 - 8f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 90 - 97
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 98 - 9f
+ BitPackage.Pack4bits(0,2,2,2,2,2,2,2), // a0 - a7
+ BitPackage.Pack4bits(2,2,2,2,2,3,3,3), // a8 - af
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b0 - b7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b8 - bf
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c0 - c7
+ BitPackage.Pack4bits(2,3,2,2,2,2,2,2), // c8 - cf
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d0 - d7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d8 - df
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // e0 - e7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // e8 - ef
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // f0 - f7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,0) // f8 - ff
};
private readonly static int[] EUCKR_st = {
- BitPackage.Pack4bits(ERROR,START, 3,ERROR,ERROR,ERROR,ERROR,ERROR),//00-07
- BitPackage.Pack4bits(ITSME,ITSME,ITSME,ITSME,ERROR,ERROR,START,START) //08-0f
+ BitPackage.Pack4bits(ERROR,START, 3,ERROR,ERROR,ERROR,ERROR,ERROR),//00-07
+ BitPackage.Pack4bits(ITSME,ITSME,ITSME,ITSME,ERROR,ERROR,START,START) //08-0f
};
private readonly static int[] EUCKRCharLenTable = { 0, 1, 2, 0 };
-
+
public EUCKRSMModel() : base(
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, EUCKR_cls),
4,
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, EUCKR_st),
EUCKRCharLenTable, "EUC-KR")
@@ -377,127 +377,127 @@ namespace UniversalDetector.Core
}
}
-
+
public class EUCTWSMModel : SMModel
{
private readonly static int[] EUCTW_cls = {
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 00 - 07
- BitPackage.Pack4bits(2,2,2,2,2,2,0,0), // 08 - 0f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 10 - 17
- BitPackage.Pack4bits(2,2,2,0,2,2,2,2), // 18 - 1f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 20 - 27
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 28 - 2f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 30 - 37
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 38 - 3f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 40 - 47
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 48 - 4f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 50 - 57
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 58 - 5f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 60 - 67
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 68 - 6f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 70 - 77
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 78 - 7f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 80 - 87
- BitPackage.Pack4bits(0,0,0,0,0,0,6,0), // 88 - 8f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 90 - 97
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 98 - 9f
- BitPackage.Pack4bits(0,3,4,4,4,4,4,4), // a0 - a7
- BitPackage.Pack4bits(5,5,1,1,1,1,1,1), // a8 - af
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // b0 - b7
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // b8 - bf
- BitPackage.Pack4bits(1,1,3,1,3,3,3,3), // c0 - c7
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // c8 - cf
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // d0 - d7
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // d8 - df
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // e0 - e7
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // e8 - ef
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // f0 - f7
- BitPackage.Pack4bits(3,3,3,3,3,3,3,0) // f8 - ff
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 00 - 07
+ BitPackage.Pack4bits(2,2,2,2,2,2,0,0), // 08 - 0f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 10 - 17
+ BitPackage.Pack4bits(2,2,2,0,2,2,2,2), // 18 - 1f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 20 - 27
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 28 - 2f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 30 - 37
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 38 - 3f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 40 - 47
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 48 - 4f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 50 - 57
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 58 - 5f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 60 - 67
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 68 - 6f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 70 - 77
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 78 - 7f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 80 - 87
+ BitPackage.Pack4bits(0,0,0,0,0,0,6,0), // 88 - 8f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 90 - 97
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 98 - 9f
+ BitPackage.Pack4bits(0,3,4,4,4,4,4,4), // a0 - a7
+ BitPackage.Pack4bits(5,5,1,1,1,1,1,1), // a8 - af
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // b0 - b7
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // b8 - bf
+ BitPackage.Pack4bits(1,1,3,1,3,3,3,3), // c0 - c7
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // c8 - cf
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // d0 - d7
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // d8 - df
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // e0 - e7
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // e8 - ef
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // f0 - f7
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,0) // f8 - ff
};
private readonly static int[] EUCTW_st = {
- BitPackage.Pack4bits(ERROR,ERROR,START, 3, 3, 3, 4,ERROR),//00-07
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ITSME,ITSME),//08-0f
- BitPackage.Pack4bits(ITSME,ITSME,ITSME,ITSME,ITSME,ERROR,START,ERROR),//10-17
- BitPackage.Pack4bits(START,START,START,ERROR,ERROR,ERROR,ERROR,ERROR),//18-1f
- BitPackage.Pack4bits( 5,ERROR,ERROR,ERROR,START,ERROR,START,START),//20-27
- BitPackage.Pack4bits(START,ERROR,START,START,START,START,START,START) //28-2f
+ BitPackage.Pack4bits(ERROR,ERROR,START, 3, 3, 3, 4,ERROR),//00-07
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ITSME,ITSME),//08-0f
+ BitPackage.Pack4bits(ITSME,ITSME,ITSME,ITSME,ITSME,ERROR,START,ERROR),//10-17
+ BitPackage.Pack4bits(START,START,START,ERROR,ERROR,ERROR,ERROR,ERROR),//18-1f
+ BitPackage.Pack4bits( 5,ERROR,ERROR,ERROR,START,ERROR,START,START),//20-27
+ BitPackage.Pack4bits(START,ERROR,START,START,START,START,START,START) //28-2f
};
private readonly static int[] EUCTWCharLenTable = { 0, 0, 1, 2, 2, 2, 3 };
-
+
public EUCTWSMModel() : base(
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, EUCTW_cls),
7,
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, EUCTW_st),
EUCTWCharLenTable, "EUC-TW")
{
}
- }
-
+ }
+
public class SJISSMModel : SMModel
{
private readonly static int[] SJIS_cls = {
- //BitPacket.Pack4bits(0,1,1,1,1,1,1,1), // 00 - 07
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 00 - 07
- BitPackage.Pack4bits(1,1,1,1,1,1,0,0), // 08 - 0f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 10 - 17
- BitPackage.Pack4bits(1,1,1,0,1,1,1,1), // 18 - 1f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 20 - 27
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 28 - 2f
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 30 - 37
- BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 38 - 3f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 40 - 47
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 48 - 4f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 50 - 57
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 58 - 5f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 60 - 67
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 68 - 6f
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 70 - 77
- BitPackage.Pack4bits(2,2,2,2,2,2,2,1), // 78 - 7f
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // 80 - 87
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // 88 - 8f
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // 90 - 97
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // 98 - 9f
- //0xa0 is illegal in sjis encoding, but some pages does
+ //BitPacket.Pack4bits(0,1,1,1,1,1,1,1), // 00 - 07
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 00 - 07
+ BitPackage.Pack4bits(1,1,1,1,1,1,0,0), // 08 - 0f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 10 - 17
+ BitPackage.Pack4bits(1,1,1,0,1,1,1,1), // 18 - 1f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 20 - 27
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 28 - 2f
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 30 - 37
+ BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 38 - 3f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 40 - 47
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 48 - 4f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 50 - 57
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 58 - 5f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 60 - 67
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 68 - 6f
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 70 - 77
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,1), // 78 - 7f
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // 80 - 87
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // 88 - 8f
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // 90 - 97
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // 98 - 9f
+ //0xa0 is illegal in sjis encoding, but some pages does
//contain such byte. We need to be more error forgiven.
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a0 - a7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a8 - af
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b0 - b7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b8 - bf
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c0 - c7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c8 - cf
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d0 - d7
- BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d8 - df
- BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // e0 - e7
- BitPackage.Pack4bits(3,3,3,3,3,4,4,4), // e8 - ef
- BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // f0 - f7
- BitPackage.Pack4bits(4,4,4,4,4,0,0,0) // f8 - ff
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a0 - a7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a8 - af
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b0 - b7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b8 - bf
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c0 - c7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c8 - cf
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d0 - d7
+ BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d8 - df
+ BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // e0 - e7
+ BitPackage.Pack4bits(3,3,3,3,3,4,4,4), // e8 - ef
+ BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // f0 - f7
+ BitPackage.Pack4bits(4,4,4,4,4,0,0,0) // f8 - ff
};
private readonly static int[] SJIS_st = {
- BitPackage.Pack4bits(ERROR,START,START, 3,ERROR,ERROR,ERROR,ERROR),//00-07
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ITSME,ITSME,ITSME,ITSME),//08-0f
- BitPackage.Pack4bits(ITSME,ITSME,ERROR,ERROR,START,START,START,START) //10-17
+ BitPackage.Pack4bits(ERROR,START,START, 3,ERROR,ERROR,ERROR,ERROR),//00-07
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ITSME,ITSME,ITSME,ITSME),//08-0f
+ BitPackage.Pack4bits(ITSME,ITSME,ERROR,ERROR,START,START,START,START) //10-17
};
private readonly static int[] SJISCharLenTable = { 0, 1, 1, 2, 0, 0 };
-
+
public SJISSMModel() : base(
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, SJIS_cls),
6,
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, SJIS_st),
SJISCharLenTable, "Shift_JIS")
@@ -505,64 +505,64 @@ namespace UniversalDetector.Core
}
}
-
+
public class UCS2BESMModel : SMModel
{
private readonly static int[] UCS2BE_cls = {
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 00 - 07
- BitPackage.Pack4bits(0,0,1,0,0,2,0,0), // 08 - 0f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 10 - 17
- BitPackage.Pack4bits(0,0,0,3,0,0,0,0), // 18 - 1f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 20 - 27
- BitPackage.Pack4bits(0,3,3,3,3,3,0,0), // 28 - 2f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 30 - 37
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 38 - 3f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 40 - 47
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 48 - 4f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 50 - 57
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 58 - 5f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 60 - 67
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 68 - 6f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 70 - 77
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 78 - 7f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 80 - 87
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 88 - 8f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 90 - 97
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 98 - 9f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // a0 - a7
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // a8 - af
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // b0 - b7
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // b8 - bf
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // c0 - c7
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // c8 - cf
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // d0 - d7
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // d8 - df
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // e0 - e7
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // e8 - ef
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // f0 - f7
- BitPackage.Pack4bits(0,0,0,0,0,0,4,5) // f8 - ff
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 00 - 07
+ BitPackage.Pack4bits(0,0,1,0,0,2,0,0), // 08 - 0f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 10 - 17
+ BitPackage.Pack4bits(0,0,0,3,0,0,0,0), // 18 - 1f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 20 - 27
+ BitPackage.Pack4bits(0,3,3,3,3,3,0,0), // 28 - 2f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 30 - 37
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 38 - 3f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 40 - 47
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 48 - 4f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 50 - 57
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 58 - 5f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 60 - 67
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 68 - 6f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 70 - 77
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 78 - 7f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 80 - 87
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 88 - 8f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 90 - 97
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 98 - 9f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // a0 - a7
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // a8 - af
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // b0 - b7
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // b8 - bf
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // c0 - c7
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // c8 - cf
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // d0 - d7
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // d8 - df
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // e0 - e7
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // e8 - ef
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // f0 - f7
+ BitPackage.Pack4bits(0,0,0,0,0,0,4,5) // f8 - ff
};
private readonly static int[] UCS2BE_st = {
- BitPackage.Pack4bits( 5, 7, 7,ERROR, 4, 3,ERROR,ERROR),//00-07
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ITSME,ITSME,ITSME,ITSME),//08-0f
- BitPackage.Pack4bits(ITSME,ITSME, 6, 6, 6, 6,ERROR,ERROR),//10-17
- BitPackage.Pack4bits( 6, 6, 6, 6, 6,ITSME, 6, 6),//18-1f
- BitPackage.Pack4bits( 6, 6, 6, 6, 5, 7, 7,ERROR),//20-27
- BitPackage.Pack4bits( 5, 8, 6, 6,ERROR, 6, 6, 6),//28-2f
- BitPackage.Pack4bits( 6, 6, 6, 6,ERROR,ERROR,START,START) //30-37
+ BitPackage.Pack4bits( 5, 7, 7,ERROR, 4, 3,ERROR,ERROR),//00-07
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ITSME,ITSME,ITSME,ITSME),//08-0f
+ BitPackage.Pack4bits(ITSME,ITSME, 6, 6, 6, 6,ERROR,ERROR),//10-17
+ BitPackage.Pack4bits( 6, 6, 6, 6, 6,ITSME, 6, 6),//18-1f
+ BitPackage.Pack4bits( 6, 6, 6, 6, 5, 7, 7,ERROR),//20-27
+ BitPackage.Pack4bits( 5, 8, 6, 6,ERROR, 6, 6, 6),//28-2f
+ BitPackage.Pack4bits( 6, 6, 6, 6,ERROR,ERROR,START,START) //30-37
};
private readonly static int[] UCS2BECharLenTable = { 2, 2, 2, 0, 2, 2 };
-
+
public UCS2BESMModel() : base(
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, UCS2BE_cls),
6,
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, UCS2BE_st),
UCS2BECharLenTable, "UTF-16BE")
@@ -570,64 +570,64 @@ namespace UniversalDetector.Core
}
}
-
+
public class UCS2LESMModel : SMModel
{
private readonly static int[] UCS2LE_cls = {
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 00 - 07
- BitPackage.Pack4bits(0,0,1,0,0,2,0,0), // 08 - 0f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 10 - 17
- BitPackage.Pack4bits(0,0,0,3,0,0,0,0), // 18 - 1f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 20 - 27
- BitPackage.Pack4bits(0,3,3,3,3,3,0,0), // 28 - 2f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 30 - 37
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 38 - 3f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 40 - 47
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 48 - 4f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 50 - 57
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 58 - 5f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 60 - 67
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 68 - 6f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 70 - 77
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 78 - 7f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 80 - 87
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 88 - 8f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 90 - 97
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 98 - 9f
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // a0 - a7
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // a8 - af
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // b0 - b7
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // b8 - bf
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // c0 - c7
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // c8 - cf
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // d0 - d7
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // d8 - df
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // e0 - e7
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // e8 - ef
- BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // f0 - f7
- BitPackage.Pack4bits(0,0,0,0,0,0,4,5) // f8 - ff
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 00 - 07
+ BitPackage.Pack4bits(0,0,1,0,0,2,0,0), // 08 - 0f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 10 - 17
+ BitPackage.Pack4bits(0,0,0,3,0,0,0,0), // 18 - 1f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 20 - 27
+ BitPackage.Pack4bits(0,3,3,3,3,3,0,0), // 28 - 2f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 30 - 37
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 38 - 3f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 40 - 47
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 48 - 4f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 50 - 57
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 58 - 5f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 60 - 67
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 68 - 6f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 70 - 77
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 78 - 7f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 80 - 87
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 88 - 8f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 90 - 97
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 98 - 9f
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // a0 - a7
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // a8 - af
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // b0 - b7
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // b8 - bf
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // c0 - c7
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // c8 - cf
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // d0 - d7
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // d8 - df
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // e0 - e7
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // e8 - ef
+ BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // f0 - f7
+ BitPackage.Pack4bits(0,0,0,0,0,0,4,5) // f8 - ff
};
private readonly static int[] UCS2LE_st = {
- BitPackage.Pack4bits( 6, 6, 7, 6, 4, 3,ERROR,ERROR),//00-07
- BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ITSME,ITSME,ITSME,ITSME),//08-0f
- BitPackage.Pack4bits(ITSME,ITSME, 5, 5, 5,ERROR,ITSME,ERROR),//10-17
- BitPackage.Pack4bits( 5, 5, 5,ERROR, 5,ERROR, 6, 6),//18-1f
- BitPackage.Pack4bits( 7, 6, 8, 8, 5, 5, 5,ERROR),//20-27
- BitPackage.Pack4bits( 5, 5, 5,ERROR,ERROR,ERROR, 5, 5),//28-2f
- BitPackage.Pack4bits( 5, 5, 5,ERROR, 5,ERROR,START,START) //30-37
+ BitPackage.Pack4bits( 6, 6, 7, 6, 4, 3,ERROR,ERROR),//00-07
+ BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ITSME,ITSME,ITSME,ITSME),//08-0f
+ BitPackage.Pack4bits(ITSME,ITSME, 5, 5, 5,ERROR,ITSME,ERROR),//10-17
+ BitPackage.Pack4bits( 5, 5, 5,ERROR, 5,ERROR, 6, 6),//18-1f
+ BitPackage.Pack4bits( 7, 6, 8, 8, 5, 5, 5,ERROR),//20-27
+ BitPackage.Pack4bits( 5, 5, 5,ERROR,ERROR,ERROR, 5, 5),//28-2f
+ BitPackage.Pack4bits( 5, 5, 5,ERROR, 5,ERROR,START,START) //30-37
};
private readonly static int[] UCS2LECharLenTable = { 2, 2, 2, 2, 2, 2 };
-
+
public UCS2LESMModel() : base(
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, UCS2LE_cls),
6,
- new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
- BitPackage.SHIFT_MASK_4BITS,
+ new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
+ BitPackage.SHIFT_MASK_4BITS,
BitPackage.BIT_SHIFT_4BITS,
BitPackage.UNIT_MASK_4BITS, UCS2LE_st),
UCS2LECharLenTable, "UTF-16LE")
@@ -635,6 +635,6 @@ namespace UniversalDetector.Core
}
}
-
-
+
+
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCSGroupProber.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCSGroupProber.cs
index d8f496474..640b19c4a 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCSGroupProber.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCSGroupProber.cs
@@ -21,7 +21,7 @@
* Contributor(s):
* Shy Shalom <shooshX@gmail.com>
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
- *
+ *
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -43,11 +43,11 @@ namespace UniversalDetector.Core
public class SBCSGroupProber : CharsetProber
{
private const int PROBERS_NUM = 13;
- private CharsetProber[] probers = new CharsetProber[PROBERS_NUM];
+ private CharsetProber[] probers = new CharsetProber[PROBERS_NUM];
private bool[] isActive = new bool[PROBERS_NUM];
private int bestGuess;
private int activeNum;
-
+
public SBCSGroupProber()
{
probers[0] = new SingleByteCharSetProber(new Win1251Model());
@@ -62,24 +62,24 @@ namespace UniversalDetector.Core
probers[9] = new SingleByteCharSetProber(new Win1251BulgarianModel());
HebrewProber hebprober = new HebrewProber();
probers[10] = hebprober;
- // Logical
- probers[11] = new SingleByteCharSetProber(new Win1255Model(), false, hebprober);
+ // Logical
+ probers[11] = new SingleByteCharSetProber(new Win1255Model(), false, hebprober);
// Visual
- probers[12] = new SingleByteCharSetProber(new Win1255Model(), true, hebprober);
+ probers[12] = new SingleByteCharSetProber(new Win1255Model(), true, hebprober);
hebprober.SetModelProbers(probers[11], probers[12]);
- // disable latin2 before latin1 is available, otherwise all latin1
+ // disable latin2 before latin1 is available, otherwise all latin1
// will be detected as latin2 because of their similarity.
//probers[13] = new SingleByteCharSetProber(new Latin2HungarianModel());
- //probers[14] = new SingleByteCharSetProber(new Win1250HungarianModel());
+ //probers[14] = new SingleByteCharSetProber(new Win1250HungarianModel());
Reset();
}
-
- public override ProbingState HandleData(byte[] buf, int offset, int len)
+
+ public override ProbingState HandleData(byte[] buf, int offset, int len)
{
ProbingState 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
+ //depend on what script it is, we will feed them the new buffer
//we got after applying proper filter
//this is done without any consideration to KeepEnglishLetters
//of each prober since as of now, there are no probers here which
@@ -87,12 +87,12 @@ namespace UniversalDetector.Core
byte[] newBuf = FilterWithoutEnglishLetters(buf, offset, len);
if (newBuf.Length == 0)
return state; // Nothing to see here, move on.
-
+
for (int i = 0; i < PROBERS_NUM; i++) {
if (!isActive[i])
continue;
st = probers[i].HandleData(newBuf, 0, newBuf.Length);
-
+
if (st == ProbingState.FoundIt) {
bestGuess = i;
state = ProbingState.FoundIt;
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCharsetProber.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCharsetProber.cs
index 5a3496075..65c0f8ca8 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCharsetProber.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SBCharsetProber.cs
@@ -20,7 +20,7 @@
*
* Contributor(s):
* Shy Shalom <shooshX@gmail.com>
- * Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
+ * Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -51,11 +51,11 @@ namespace UniversalDetector.Core
private const int NUMBER_OF_SEQ_CAT = 4;
private const int POSITIVE_CAT = NUMBER_OF_SEQ_CAT-1;
private const int NEGATIVE_CAT = 0;
-
+
protected SequenceModel model;
-
- // true if we need to reverse every pair in the model lookup
- bool reversed;
+
+ // true if we need to reverse every pair in the model lookup
+ bool reversed;
// char order of last character
byte lastOrder;
@@ -63,38 +63,38 @@ namespace UniversalDetector.Core
int totalSeqs;
int totalChar;
int[] seqCounters = new int[NUMBER_OF_SEQ_CAT];
-
+
// characters that fall in our sampling range
int freqChar;
-
+
// Optional auxiliary prober for name decision. created and destroyed by the GroupProber
- CharsetProber nameProber;
-
- public SingleByteCharSetProber(SequenceModel model)
+ CharsetProber nameProber;
+
+ public SingleByteCharSetProber(SequenceModel model)
: this(model, false, null)
{
-
+
}
-
- public SingleByteCharSetProber(SequenceModel model, bool reversed,
+
+ public SingleByteCharSetProber(SequenceModel model, bool reversed,
CharsetProber nameProber)
{
this.model = model;
this.reversed = reversed;
this.nameProber = nameProber;
- Reset();
+ Reset();
}
public override ProbingState HandleData(byte[] buf, int offset, int len)
{
int max = offset + len;
-
+
for (int i = offset; i < max; i++) {
byte order = model.GetOrder(buf[i]);
if (order < SYMBOL_CAT_ORDER)
totalChar++;
-
+
if (order < SAMPLE_SIZE) {
freqChar++;
@@ -120,7 +120,7 @@ namespace UniversalDetector.Core
}
return state;
}
-
+
public override void DumpStatus()
{
//Console.WriteLine(" SBCS: {0} [{1}]", GetConfidence(), GetCharsetName());
@@ -146,9 +146,9 @@ namespace UniversalDetector.Core
r = 0.99f;
return r;
}
- return 0.01f;
+ return 0.01f;
}
-
+
public override void Reset()
{
state = ProbingState.Detecting;
@@ -159,12 +159,12 @@ namespace UniversalDetector.Core
totalChar = 0;
freqChar = 0;
}
-
- public override string GetCharsetName()
+
+ public override string GetCharsetName()
{
return (nameProber == null) ? model.CharsetName
: nameProber.GetCharsetName();
}
-
+
}
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SJISProber.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SJISProber.cs
index 515cd2498..e1fbb873e 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SJISProber.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SJISProber.cs
@@ -21,7 +21,7 @@
* Contributor(s):
* Shy Shalom <shooshX@gmail.com>
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
- *
+ *
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -50,25 +50,25 @@ namespace UniversalDetector.Core
private SJISContextAnalyser contextAnalyser;
private SJISDistributionAnalyser distributionAnalyser;
private byte[] lastChar = new byte[2];
-
+
public SJISProber()
{
codingSM = new CodingStateMachine(new SJISSMModel());
distributionAnalyser = new SJISDistributionAnalyser();
- contextAnalyser = new SJISContextAnalyser();
+ contextAnalyser = new SJISContextAnalyser();
Reset();
}
-
+
public override string GetCharsetName()
{
- return "Shift-JIS";
+ return "Shift-JIS";
}
-
+
public override ProbingState HandleData(byte[] buf, int offset, int len)
{
int codingState;
int max = offset + len;
-
+
for (int i = offset; i < max; i++) {
codingState = codingSM.NextState(buf[i]);
if (codingState == SMModel.ERROR) {
@@ -90,7 +90,7 @@ namespace UniversalDetector.Core
distributionAnalyser.HandleOneChar(buf, i-1, charLen);
}
}
- }
+ }
lastChar[0] = buf[max-1];
if (state == ProbingState.Detecting)
if (contextAnalyser.GotEnoughData() && GetConfidence() > SHORTCUT_THRESHOLD)
@@ -100,12 +100,12 @@ namespace UniversalDetector.Core
public override void Reset()
{
- codingSM.Reset();
+ codingSM.Reset();
state = ProbingState.Detecting;
contextAnalyser.Reset();
distributionAnalyser.Reset();
}
-
+
public override float GetConfidence()
{
float contxtCf = contextAnalyser.GetConfidence();
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SMModel.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SMModel.cs
index 2321ecad2..cb2f201aa 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SMModel.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SMModel.cs
@@ -52,21 +52,17 @@ namespace UniversalDetector.Core
public BitPackage classTable;
public BitPackage stateTable;
public int[] charLenTable;
-
+
private string name;
- public string Name {
- get { return name; }
- }
+ public string Name => name;
private int classFactor;
- public int ClassFactor {
- get { return classFactor; }
- }
+ public int ClassFactor => classFactor;
public SMModel(BitPackage classTable, int classFactor,
- BitPackage stateTable, int[] charLenTable, String name)
+ BitPackage stateTable, int[] charLenTable, string name)
{
this.classTable = classTable;
this.classFactor = classFactor;
@@ -74,10 +70,10 @@ namespace UniversalDetector.Core
this.charLenTable = charLenTable;
this.name = name;
}
-
+
public int GetClass(byte b)
- {
- return classTable.Unpack((int)b);
+ {
+ return classTable.Unpack((int)b);
}
- }
+ }
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SequenceModel.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SequenceModel.cs
index 9048796b5..b813dda76 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SequenceModel.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/SequenceModel.cs
@@ -21,7 +21,7 @@
* Contributor(s):
* Shy Shalom <shooshX@gmail.com>
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
- *
+ *
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -39,42 +39,36 @@
using System;
namespace UniversalDetector.Core
-{
+{
public abstract class SequenceModel
{
// [256] table use to find a char's order
protected byte[] charToOrderMap;
-
- // [SAMPLE_SIZE][SAMPLE_SIZE] table to find a 2-char sequence's
- // frequency
+
+ // [SAMPLE_SIZE][SAMPLE_SIZE] table to find a 2-char sequence's
+ // frequency
protected byte[] precedenceMatrix;
-
+
// freqSeqs / totalSeqs
protected float typicalPositiveRatio;
- public float TypicalPositiveRatio {
- get { return typicalPositiveRatio; }
- }
-
+ public float TypicalPositiveRatio => typicalPositiveRatio;
+
// not used
protected bool keepEnglishLetter;
- public bool KeepEnglishLetter {
- get { return keepEnglishLetter; }
- }
-
- protected String charsetName;
+ public bool KeepEnglishLetter => keepEnglishLetter;
+
+ protected string charsetName;
+
+ public string CharsetName => charsetName;
- public string CharsetName {
- get { return charsetName; }
- }
-
public SequenceModel(
byte[] charToOrderMap,
byte[] precedenceMatrix,
float typicalPositiveRatio,
bool keepEnglishLetter,
- String charsetName)
+ string charsetName)
{
this.charToOrderMap = charToOrderMap;
this.precedenceMatrix = precedenceMatrix;
@@ -82,16 +76,16 @@ namespace UniversalDetector.Core
this.keepEnglishLetter = keepEnglishLetter;
this.charsetName = charsetName;
}
-
+
public byte GetOrder(byte b)
{
return charToOrderMap[b];
}
-
+
public byte GetPrecedence(int pos)
{
return precedenceMatrix[pos];
}
-
+
}
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/UTF8Prober.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/UTF8Prober.cs
index 084797c5e..a469e2a0c 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/UTF8Prober.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/UTF8Prober.cs
@@ -21,7 +21,7 @@
* Contributor(s):
* Shy Shalom <shooshX@gmail.com>
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
- *
+ *
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -46,11 +46,11 @@ namespace UniversalDetector.Core
public UTF8Prober()
{
- numOfMBChar = 0;
+ numOfMBChar = 0;
codingSM = new CodingStateMachine(new UTF8SMModel());
Reset();
}
-
+
public override string GetCharsetName() {
return "UTF-8";
}
@@ -66,7 +66,7 @@ namespace UniversalDetector.Core
{
int codingState = SMModel.START;
int max = offset + len;
-
+
for (int i = offset; i < max; i++) {
codingState = codingSM.NextState(buf[i]);
@@ -97,7 +97,7 @@ namespace UniversalDetector.Core
{
float unlike = 0.99f;
float confidence = 0.0f;
-
+
if (numOfMBChar < 6) {
for (int i = 0; i < numOfMBChar; i++)
unlike *= ONE_CHAR_PROB;
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/UniversalDetector.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/UniversalDetector.cs
index 0c9a4ee60..4dcb282cc 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/UniversalDetector.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/Core/UniversalDetector.cs
@@ -21,7 +21,7 @@
* Contributor(s):
* Shy Shalom <shooshX@gmail.com>
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
- *
+ *
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -41,7 +41,7 @@ namespace UniversalDetector.Core
enum InputState { PureASCII=0, EscASCII=1, Highbyte=2 };
- public abstract class UniversalDetector
+ public abstract class UniversalDetector
{
protected const int FILTER_CHINESE_SIMPLIFIED = 1;
protected const int FILTER_CHINESE_TRADITIONAL = 2;
@@ -49,12 +49,12 @@ namespace UniversalDetector.Core
protected const int FILTER_KOREAN = 8;
protected const int FILTER_NON_CJK = 16;
protected const int FILTER_ALL = 31;
- protected static int FILTER_CHINESE =
+ protected static int FILTER_CHINESE =
FILTER_CHINESE_SIMPLIFIED | FILTER_CHINESE_TRADITIONAL;
- protected static int FILTER_CJK =
- FILTER_JAPANESE | FILTER_KOREAN | FILTER_CHINESE_SIMPLIFIED
+ protected static int FILTER_CJK =
+ FILTER_JAPANESE | FILTER_KOREAN | FILTER_CHINESE_SIMPLIFIED
| FILTER_CHINESE_TRADITIONAL;
-
+
protected const float SHORTCUT_THRESHOLD = 0.95f;
protected const float MINIMUM_THRESHOLD = 0.20f;
@@ -70,16 +70,16 @@ namespace UniversalDetector.Core
protected CharsetProber escCharsetProber;
protected string detectedCharset;
- public UniversalDetector(int languageFilter) {
+ public UniversalDetector(int languageFilter) {
this.start = true;
this.inputState = InputState.PureASCII;
- this.lastChar = 0x00;
+ this.lastChar = 0x00;
this.bestGuess = -1;
this.languageFilter = languageFilter;
}
public virtual void Feed(byte[] buf, int offset, int len)
- {
+ {
if (done) {
return;
}
@@ -125,7 +125,7 @@ namespace UniversalDetector.Core
}
for (int i = 0; i < len; i++) {
-
+
// other than 0xa0, if every other character is ascii, the page is ascii
if ((buf[i] & 0x80) != 0 && buf[i] != 0xA0) {
// we got a non-ascii byte (high-byte)
@@ -143,9 +143,9 @@ namespace UniversalDetector.Core
if (charsetProbers[1] == null)
charsetProbers[1] = new SBCSGroupProber();
if (charsetProbers[2] == null)
- charsetProbers[2] = new Latin1Prober();
+ charsetProbers[2] = new Latin1Prober();
}
- } else {
+ } else {
if (inputState == InputState.PureASCII &&
(buf[i] == 0x33 || (buf[i] == 0x7B && lastChar == 0x7E))) {
// found escape character or HZ "~{"
@@ -154,9 +154,9 @@ namespace UniversalDetector.Core
lastChar = buf[i];
}
}
-
+
ProbingState st = ProbingState.NotMe;
-
+
switch (inputState) {
case InputState.EscASCII:
if (escCharsetProber == null) {
@@ -172,18 +172,18 @@ namespace UniversalDetector.Core
for (int i = 0; i < PROBERS_NUM; i++) {
if (charsetProbers[i] != null) {
st = charsetProbers[i].HandleData(buf, offset, len);
- #if DEBUG
+ #if DEBUG
charsetProbers[i].DumpStatus();
- #endif
+ #endif
if (st == ProbingState.FoundIt) {
done = true;
detectedCharset = charsetProbers[i].GetCharsetName();
return;
- }
+ }
}
}
break;
- default:
+ default:
// pure ascii
break;
}
@@ -191,13 +191,13 @@ namespace UniversalDetector.Core
}
/// <summary>
- /// Notify detector that no further data is available.
+ /// Notify detector that no further data is available.
/// </summary>
public virtual void DataEnd()
{
if (!gotData) {
- // we haven't got any data yet, return immediately
- // caller program sometimes call DataEnd before anything has
+ // we haven't got any data yet, return immediately
+ // caller program sometimes call DataEnd before anything has
// been sent to detector
return;
}
@@ -206,7 +206,7 @@ namespace UniversalDetector.Core
done = true;
Report(detectedCharset, 1.0f);
return;
- }
+ }
if (inputState == InputState.Highbyte) {
float proberConfidence = 0.0f;
@@ -221,22 +221,22 @@ namespace UniversalDetector.Core
}
}
}
-
+
if (maxProberConfidence > MINIMUM_THRESHOLD) {
Report(charsetProbers[maxProber].GetCharsetName(), maxProberConfidence);
- }
-
+ }
+
} else if (inputState == InputState.PureASCII) {
Report("ASCII", 1.0f);
- }
+ }
}
/// <summary>
/// Clear internal state of charset detector.
- /// In the original interface this method is protected.
+ /// In the original interface this method is protected.
/// </summary>
- public virtual void Reset()
- {
+ public virtual void Reset()
+ {
done = false;
start = true;
detectedCharset = null;
@@ -250,7 +250,7 @@ namespace UniversalDetector.Core
if (charsetProbers[i] != null)
charsetProbers[i].Reset();
}
-
+
protected abstract void Report(string charset, float confidence);
}
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/DetectionConfidence.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/DetectionConfidence.cs
index 6dfa55f6c..ea96c2803 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/DetectionConfidence.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/DetectionConfidence.cs
@@ -21,7 +21,7 @@
*
* Contributor(s):
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
- *
+ *
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@@ -40,26 +40,26 @@ namespace UniversalDetector
{
/// <summary>
/// Indicate how confident the detection module about the return result.
- ///
- /// NoAnswerYet: the detector have not find out a answer yet based on
+ ///
+ /// NoAnswerYet: the detector have not find out a answer yet based on
/// the data it received.
- ///
- /// BestAnswer: the answer the detector returned is the best one within
- /// the knowledge of the detector. In other words, the test to all
+ ///
+ /// BestAnswer: the answer the detector returned is the best one within
+ /// the knowledge of the detector. In other words, the test to all
/// other candidates fail.
/// For example, the (Shift_JIS/EUC-JP/ISO-2022-JP) detection
- /// module may return this with answer "Shift_JIS " if it receive
- /// bytes > 0x80 (which make ISO-2022-JP test failed) and byte
+ /// module may return this with answer "Shift_JIS " if it receive
+ /// bytes > 0x80 (which make ISO-2022-JP test failed) and byte
/// 0x82 (which may EUC-JP test failed)
///
/// SureAnswer: the detector is 100% sure about the answer.
- ///
+ ///
/// Example 1: the Shift_JIS/ISO-2022-JP/EUC-JP detector return
/// this w/ ISO-2022-JP when it hit one of the following ESC seq
/// ESC ( J
/// ESC $ @
/// ESC $ B
- ///
+ ///
/// Example 2: the detector which can detect UCS2 return w/ UCS2
/// when the first 2 byte are BOM mark.
/// Example 3: the Korean detector return ISO-2022-KR when it
diff --git a/Emby.Server.Implementations/TextEncoding/UniversalDetector/ICharsetDetector.cs b/Emby.Server.Implementations/TextEncoding/UniversalDetector/ICharsetDetector.cs
index c0c35a59e..fbf8376bd 100644
--- a/Emby.Server.Implementations/TextEncoding/UniversalDetector/ICharsetDetector.cs
+++ b/Emby.Server.Implementations/TextEncoding/UniversalDetector/ICharsetDetector.cs
@@ -47,31 +47,31 @@ namespace UniversalDetector
/// The detected charset. It can be null.
/// </summary>
string Charset { get; }
-
+
/// <summary>
- /// The confidence of the detected charset, if any
+ /// The confidence of the detected charset, if any
/// </summary>
float Confidence { get; }
-
+
/// <summary>
- /// Feed a block of bytes to the detector.
+ /// Feed a block of bytes to the detector.
/// </summary>
/// <param name="buf">input buffer</param>
/// <param name="offset">offset into buffer</param>
/// <param name="len">number of available bytes</param>
void Feed(byte[] buf, int offset, int len);
-
+
/// <summary>
- /// Feed a bytes stream to the detector.
+ /// Feed a bytes stream to the detector.
/// </summary>
/// <param name="stream">an input stream</param>
void Feed(Stream stream);
/// <summary>
- /// Resets the state of the detector.
- /// </summary>
+ /// Resets the state of the detector.
+ /// </summary>
void Reset();
-
+
/// <summary>
/// Returns true if the detector has found a result and it is sure about it.
/// </summary>
@@ -83,6 +83,6 @@ namespace UniversalDetector
/// decision.
/// </summary>
void DataEnd();
-
+
}
}
diff --git a/Emby.Server.Implementations/Udp/UdpServer.cs b/Emby.Server.Implementations/Udp/UdpServer.cs
index 275bd83ea..7a59d95bf 100644
--- a/Emby.Server.Implementations/Udp/UdpServer.cs
+++ b/Emby.Server.Implementations/Udp/UdpServer.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller;
+using MediaBrowser.Controller;
using MediaBrowser.Model.ApiClient;
using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
@@ -169,6 +169,7 @@ namespace Emby.Server.Implementations.Udp
}
catch (ObjectDisposedException)
{
+ //TODO Investigate and properly fix.
}
catch (Exception ex)
{
@@ -182,7 +183,7 @@ namespace Emby.Server.Implementations.Udp
{
return;
}
-
+
try
{
var socketResult = _udpClient.EndReceive(result);
@@ -191,6 +192,7 @@ namespace Emby.Server.Implementations.Udp
}
catch (ObjectDisposedException)
{
+ //TODO Investigate and properly fix.
}
catch (Exception ex)
{
@@ -263,12 +265,12 @@ namespace Emby.Server.Implementations.Udp
if (bytes == null)
{
- throw new ArgumentNullException("bytes");
+ throw new ArgumentNullException(nameof(bytes));
}
if (remoteEndPoint == null)
{
- throw new ArgumentNullException("remoteEndPoint");
+ throw new ArgumentNullException(nameof(remoteEndPoint));
}
try
diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs
index 82b61c15a..d4653281f 100644
--- a/Emby.Server.Implementations/Updates/InstallationManager.cs
+++ b/Emby.Server.Implementations/Updates/InstallationManager.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
@@ -10,7 +10,6 @@ using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Net;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Common.Progress;
-using MediaBrowser.Common.Security;
using MediaBrowser.Common.Updates;
using MediaBrowser.Model.Cryptography;
using MediaBrowser.Model.Events;
@@ -42,10 +41,7 @@ namespace Emby.Server.Implementations.Updates
/// </summary>
private ConcurrentBag<InstallationInfo> CompletedInstallationsInternal { get; set; }
- public IEnumerable<InstallationInfo> CompletedInstallations
- {
- get { return CompletedInstallationsInternal; }
- }
+ public IEnumerable<InstallationInfo> CompletedInstallations => CompletedInstallationsInternal;
#region PluginUninstalled Event
/// <summary>
@@ -110,7 +106,6 @@ namespace Emby.Server.Implementations.Updates
private readonly IApplicationPaths _appPaths;
private readonly IHttpClient _httpClient;
private readonly IJsonSerializer _jsonSerializer;
- private readonly ISecurityManager _securityManager;
private readonly IServerConfigurationManager _config;
private readonly IFileSystem _fileSystem;
@@ -125,11 +120,20 @@ namespace Emby.Server.Implementations.Updates
// netframework or netcore
private readonly string _packageRuntime;
- public InstallationManager(ILogger logger, IApplicationHost appHost, IApplicationPaths appPaths, IHttpClient httpClient, IJsonSerializer jsonSerializer, ISecurityManager securityManager, IServerConfigurationManager config, IFileSystem fileSystem, ICryptoProvider cryptographyProvider, string packageRuntime)
+ public InstallationManager(
+ ILogger logger,
+ IApplicationHost appHost,
+ IApplicationPaths appPaths,
+ IHttpClient httpClient,
+ IJsonSerializer jsonSerializer,
+ IServerConfigurationManager config,
+ IFileSystem fileSystem,
+ ICryptoProvider cryptographyProvider,
+ string packageRuntime)
{
if (logger == null)
{
- throw new ArgumentNullException("logger");
+ throw new ArgumentNullException(nameof(logger));
}
CurrentInstallations = new List<Tuple<InstallationInfo, CancellationTokenSource>>();
@@ -139,7 +143,6 @@ namespace Emby.Server.Implementations.Updates
_appPaths = appPaths;
_httpClient = httpClient;
_jsonSerializer = jsonSerializer;
- _securityManager = securityManager;
_config = config;
_fileSystem = fileSystem;
_cryptographyProvider = cryptographyProvider;
@@ -147,7 +150,7 @@ namespace Emby.Server.Implementations.Updates
_logger = logger;
}
- private Version GetPackageVersion(PackageVersionInfo version)
+ private static Version GetPackageVersion(PackageVersionInfo version)
{
return new Version(ValueOrDefault(version.versionStr, "0.0.0.1"));
}
@@ -166,41 +169,10 @@ namespace Emby.Server.Implementations.Updates
string packageType = null,
Version applicationVersion = null)
{
- if (withRegistration)
- {
- var data = new Dictionary<string, string>
- {
- { "key", _securityManager.SupporterKey },
- { "mac", _applicationHost.SystemId },
- { "systemid", _applicationHost.SystemId }
- };
+ // TODO cvium: when plugins get back this would need to be fixed
+ // var packages = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);
- var options = new HttpRequestOptions
- {
- Url = "https://www.mb3admin.local/admin/service/package/retrieveall?includeAllRuntimes=true",
- CancellationToken = cancellationToken
- };
-
- options.SetPostData(data);
-
- using (var response = await _httpClient.SendAsync(options, "POST").ConfigureAwait(false))
- {
- using (var json = response.Content)
- {
- cancellationToken.ThrowIfCancellationRequested();
-
- var packages = await _jsonSerializer.DeserializeFromStreamAsync<PackageInfo[]>(json).ConfigureAwait(false);
-
- return FilterPackages(packages, packageType, applicationVersion);
- }
- }
- }
- else
- {
- var packages = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);
-
- return FilterPackages(packages, packageType, applicationVersion);
- }
+ return new List<PackageInfo>(); //FilterPackages(packages, packageType, applicationVersion);
}
/// <summary>
@@ -214,7 +186,7 @@ namespace Emby.Server.Implementations.Updates
{
Url = "https://www.mb3admin.local/admin/service/EmbyPackages.json",
CancellationToken = cancellationToken,
- Progress = new SimpleProgress<Double>(),
+ Progress = new SimpleProgress<double>(),
CacheLength = GetCacheLength(),
CacheMode = CacheMode.Unconditional
@@ -232,7 +204,7 @@ namespace Emby.Server.Implementations.Updates
return _applicationHost.SystemUpdateLevel;
}
- private TimeSpan GetCacheLength()
+ private static TimeSpan GetCacheLength()
{
return TimeSpan.FromMinutes(3);
}
@@ -313,7 +285,7 @@ namespace Emby.Server.Implementations.Updates
/// <param name="packageVersionInfo">The package version info.</param>
/// <param name="currentServerVersion">The current server version.</param>
/// <returns><c>true</c> if [is package version up to date] [the specified package version info]; otherwise, <c>false</c>.</returns>
- private bool IsPackageVersionUpToDate(PackageVersionInfo packageVersionInfo, Version currentServerVersion)
+ private static bool IsPackageVersionUpToDate(PackageVersionInfo packageVersionInfo, Version currentServerVersion)
{
if (string.IsNullOrEmpty(packageVersionInfo.requiredVersionStr))
{
@@ -423,12 +395,12 @@ namespace Emby.Server.Implementations.Updates
{
if (package == null)
{
- throw new ArgumentNullException("package");
+ throw new ArgumentNullException(nameof(package));
}
if (progress == null)
{
- throw new ArgumentNullException("progress");
+ throw new ArgumentNullException(nameof(progress));
}
var installationInfo = new InstallationInfo
@@ -587,7 +559,7 @@ namespace Emby.Server.Implementations.Updates
{
using (var stream = _fileSystem.OpenRead(tempFile))
{
- var check = Guid.Parse(BitConverter.ToString(_cryptographyProvider.ComputeMD5(stream)).Replace("-", String.Empty));
+ var check = Guid.Parse(BitConverter.ToString(_cryptographyProvider.ComputeMD5(stream)).Replace("-", string.Empty));
if (check != packageChecksum)
{
throw new Exception(string.Format("Download validation failed for {0}. Probably corrupted during transfer.", package.name));
@@ -597,7 +569,7 @@ namespace Emby.Server.Implementations.Updates
cancellationToken.ThrowIfCancellationRequested();
- // Success - move it to the real target
+ // Success - move it to the real target
try
{
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(target));
diff --git a/Emby.Server.Implementations/UserViews/DynamicImageProvider.cs b/Emby.Server.Implementations/UserViews/DynamicImageProvider.cs
index c75033261..95b2e65be 100644
--- a/Emby.Server.Implementations/UserViews/DynamicImageProvider.cs
+++ b/Emby.Server.Implementations/UserViews/DynamicImageProvider.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Configuration;
+using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
@@ -112,7 +112,7 @@ namespace Emby.Server.Implementations.UserViews
return false;
}
- private bool IsUsingCollectionStrip(UserView view)
+ private static bool IsUsingCollectionStrip(UserView view)
{
string[] collectionStripViewTypes =
{
diff --git a/Emby.Server.Implementations/UserViews/FolderImageProvider.cs b/Emby.Server.Implementations/UserViews/FolderImageProvider.cs
index abd6810b0..057d22aec 100644
--- a/Emby.Server.Implementations/UserViews/FolderImageProvider.cs
+++ b/Emby.Server.Implementations/UserViews/FolderImageProvider.cs
@@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.Photos
Parent = item,
DtoOptions = new DtoOptions(true),
ImageTypes = new ImageType[] { ImageType.Primary },
- OrderBy = new System.ValueTuple<string, SortOrder>[]
+ OrderBy = new System.ValueTuple<string, SortOrder>[]
{
new System.ValueTuple<string, SortOrder>(ItemSortBy.IsFolder, SortOrder.Ascending),
new System.ValueTuple<string, SortOrder>(ItemSortBy.SortName, SortOrder.Ascending)
diff --git a/Emby.XmlTv/Emby.XmlTv.Console/Program.cs b/Emby.XmlTv/Emby.XmlTv.Console/Program.cs
index c57c45297..e72d94bf5 100644
--- a/Emby.XmlTv/Emby.XmlTv.Console/Program.cs
+++ b/Emby.XmlTv/Emby.XmlTv.Console/Program.cs
@@ -25,7 +25,7 @@ namespace Emby.XmlTv.Console
var timer = Stopwatch.StartNew();
System.Console.WriteLine("Running XMLTv Parsing");
- var resultsFile = String.Format("C:\\Temp\\{0}_Results_{1:HHmmss}.txt",
+ var resultsFile = String.Format("C:\\Temp\\{0}_Results_{1:HHmmss}.txt",
Path.GetFileNameWithoutExtension(filename),
DateTimeOffset.UtcNow);
diff --git a/Emby.XmlTv/Emby.XmlTv.Console/Properties/AssemblyInfo.cs b/Emby.XmlTv/Emby.XmlTv.Console/Properties/AssemblyInfo.cs
index cd1fcce68..4178a27a1 100644
--- a/Emby.XmlTv/Emby.XmlTv.Console/Properties/AssemblyInfo.cs
+++ b/Emby.XmlTv/Emby.XmlTv.Console/Properties/AssemblyInfo.cs
@@ -2,7 +2,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Emby.XmlTv.Console")]
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@@ -25,11 +25,11 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
-// Minor Version
+// Minor Version
// Build Number
// Revision
//
-// You can specify all the values or you can default the Build and Revision Numbers
+// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
diff --git a/Emby.XmlTv/Emby.XmlTv.Test/Properties/AssemblyInfo.cs b/Emby.XmlTv/Emby.XmlTv.Test/Properties/AssemblyInfo.cs
index b6fc4c8e2..e79fda8a8 100644
--- a/Emby.XmlTv/Emby.XmlTv.Test/Properties/AssemblyInfo.cs
+++ b/Emby.XmlTv/Emby.XmlTv.Test/Properties/AssemblyInfo.cs
@@ -2,7 +2,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Emby.XmlTv.Test")]
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@@ -25,11 +25,11 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
-// Minor Version
+// Minor Version
// Build Number
// Revision
//
-// You can specify all the values or you can default the Build and Revision Numbers
+// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
diff --git a/Emby.XmlTv/Emby.XmlTv.Test/XmlTvReaderDateTimeTests.cs b/Emby.XmlTv/Emby.XmlTv.Test/XmlTvReaderDateTimeTests.cs
index dbbd352ee..2e4516be5 100644
--- a/Emby.XmlTv/Emby.XmlTv.Test/XmlTvReaderDateTimeTests.cs
+++ b/Emby.XmlTv/Emby.XmlTv.Test/XmlTvReaderDateTimeTests.cs
@@ -16,7 +16,7 @@ namespace Emby.XmlTv.Test
{
var testFile = Path.GetFullPath(@"MultilanguageData.xml");
var reader = new XmlTvReader(testFile, "es");
-
+
Assert.AreEqual(Parse("01 Jan 2016 00:00:00"), reader.ParseDate("2016"));
Assert.AreEqual(Parse("01 Jan 2016 00:00:00"), reader.ParseDate("201601"));
Assert.AreEqual(Parse("01 Jan 2016 00:00:00"), reader.ParseDate("20160101"));
diff --git a/Emby.XmlTv/Emby.XmlTv.Test/XmlTvReaderLanguageTests.cs b/Emby.XmlTv/Emby.XmlTv.Test/XmlTvReaderLanguageTests.cs
index 489e16ee6..77dabe13e 100644
--- a/Emby.XmlTv/Emby.XmlTv.Test/XmlTvReaderLanguageTests.cs
+++ b/Emby.XmlTv/Emby.XmlTv.Test/XmlTvReaderLanguageTests.cs
@@ -12,23 +12,22 @@ namespace Emby.XmlTv.Test
[TestClass]
public class XmlTvReaderLanguageTests
{
- /*
- <title lang="es">Homes Under the Hammer - Spanish</title>
- <title lang="es">Homes Under the Hammer - Spanish 2</title>
- <title lang="en">Homes Under the Hammer - English</title>
- <title lang="en">Homes Under the Hammer - English 2</title>
- <title lang="">Homes Under the Hammer - Empty Language</title>
- <title lang="">Homes Under the Hammer - Empty Language 2</title>
- <title>Homes Under the Hammer - No Language</title>
- <title>Homes Under the Hammer - No Language 2</title>
- */
-
- /* Expected Behaviour:
- - Language = Null Homes Under the Hammer - No Language
- - Language = "" Homes Under the Hammer - No Language
- - Language = es Homes Under the Hammer - Spanish
- - Language = en Homes Under the Hammer - English
- */
+ /* <title lang="es">Homes Under the Hammer - Spanish</title>
+ * <title lang="es">Homes Under the Hammer - Spanish 2</title>
+ * <title lang="en">Homes Under the Hammer - English</title>
+ * <title lang="en">Homes Under the Hammer - English 2</title>
+ * <title lang="">Homes Under the Hammer - Empty Language</title>
+ * <title lang="">Homes Under the Hammer - Empty Language 2</title>
+ * <title>Homes Under the Hammer - No Language</title>
+ * <title>Homes Under the Hammer - No Language 2</title>
+ */
+
+ /* Expected Behaviour:
+ * - Language = Null Homes Under the Hammer - No Language
+ * - Language = "" Homes Under the Hammer - No Language
+ * - Language = es Homes Under the Hammer - Spanish
+ * - Language = en Homes Under the Hammer - English
+ */
[TestMethod]
[DeploymentItem("Xml Files\\MultilanguageData.xml")]
diff --git a/Emby.XmlTv/Emby.XmlTv/Classes/XmlTvReader.cs b/Emby.XmlTv/Emby.XmlTv/Classes/XmlTvReader.cs
index d96c391fb..aa4840664 100644
--- a/Emby.XmlTv/Emby.XmlTv/Classes/XmlTvReader.cs
+++ b/Emby.XmlTv/Emby.XmlTv/Classes/XmlTvReader.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
@@ -32,7 +32,7 @@ namespace Emby.XmlTv.Classes
_language = language;
}
- private XmlReader CreateXmlTextReader(string path)
+ private static XmlReader CreateXmlTextReader(string path)
{
XmlReaderSettings settings = new XmlReaderSettings();
@@ -315,7 +315,7 @@ namespace Emby.XmlTv.Classes
if (reader.NodeType == XmlNodeType.Element)
{
var language = reader.GetAttribute("lang");
- if (!String.IsNullOrEmpty(language))
+ if (!string.IsNullOrEmpty(language))
{
if (!results.ContainsKey(language))
{
@@ -580,7 +580,7 @@ namespace Emby.XmlTv.Classes
public void ParseEpisodeDataForOnScreen(XmlReader reader, XmlTvProgram result)
{
- //// example: 'Episode #FFEE'
+ //// example: 'Episode #FFEE'
//serEpNum = ConvertHTMLToAnsi(nodeEpisodeNum);
//int num1 = serEpNum.IndexOf("#", 0);
//if (num1 < 0) num1 = 0;
@@ -780,7 +780,7 @@ namespace Emby.XmlTv.Classes
var isPopulated = false;
var source = reader.GetAttribute("src");
- if (!String.IsNullOrEmpty(source))
+ if (!string.IsNullOrEmpty(source))
{
result.Source = source;
isPopulated = true;
@@ -788,7 +788,7 @@ namespace Emby.XmlTv.Classes
var widthString = reader.GetAttribute("width");
var width = 0;
- if (!String.IsNullOrEmpty(widthString) && Int32.TryParse(widthString, out width))
+ if (!string.IsNullOrEmpty(widthString) && int.TryParse(widthString, out width))
{
result.Width = width;
isPopulated = true;
@@ -796,7 +796,7 @@ namespace Emby.XmlTv.Classes
var heightString = reader.GetAttribute("height");
var height = 0;
- if (!String.IsNullOrEmpty(heightString) && Int32.TryParse(heightString, out height))
+ if (!string.IsNullOrEmpty(heightString) && int.TryParse(heightString, out height))
{
result.Height = height;
isPopulated = true;
@@ -832,23 +832,22 @@ namespace Emby.XmlTv.Classes
public void ProcessNode(XmlReader reader, Action<string> setter, string languageRequired = null, Action<string> allOccurrencesSetter = null)
{
- /*
- <title lang="es">Homes Under the Hammer - Spanish</title>
- <title lang="es">Homes Under the Hammer - Spanish 2</title>
- <title lang="en">Homes Under the Hammer - English</title>
- <title lang="en">Homes Under the Hammer - English 2</title>
- <title lang="">Homes Under the Hammer - Empty Language</title>
- <title lang="">Homes Under the Hammer - Empty Language 2</title>
- <title>Homes Under the Hammer - No Language</title>
- <title>Homes Under the Hammer - No Language 2</title>
- */
-
- /* Expected Behaviour:
- - Language = Null Homes Under the Hammer - No Language
- - Language = "" Homes Under the Hammer - No Language
- - Language = es Homes Under the Hammer - Spanish
- - Language = en Homes Under the Hammer - English
- */
+ /* <title lang="es">Homes Under the Hammer - Spanish</title>
+ * <title lang="es">Homes Under the Hammer - Spanish 2</title>
+ * <title lang="en">Homes Under the Hammer - English</title>
+ * <title lang="en">Homes Under the Hammer - English 2</title>
+ * <title lang="">Homes Under the Hammer - Empty Language</title>
+ * <title lang="">Homes Under the Hammer - Empty Language 2</title>
+ * <title>Homes Under the Hammer - No Language</title>
+ * <title>Homes Under the Hammer - No Language 2</title>
+ */
+
+ /* Expected Behaviour:
+ * - Language = Null Homes Under the Hammer - No Language
+ * - Language = "" Homes Under the Hammer - No Language
+ * - Language = es Homes Under the Hammer - Spanish
+ * - Language = en Homes Under the Hammer - English
+ */
var results = new List<Tuple<string, string>>();
@@ -921,23 +920,22 @@ namespace Emby.XmlTv.Classes
public void ProcessMultipleNodes(XmlReader reader, Action<string> setter, string languageRequired = null)
{
- /*
- <category lang="en">Property - English</category>
- <category lang="en">Property - English 2</category>
- <category lang="es">Property - Spanish</category>
- <category lang="es">Property - Spanish 2</category>
- <category lang="">Property - Empty Language</category>
- <category lang="">Property - Empty Language 2</category>
- <category>Property - No Language</category>
- <category>Property - No Language 2</category>
- */
-
- /* Expected Behaviour:
- - Language = Null Property - No Language / Property - No Language 2
- - Language = "" Property - Empty Language / Property - Empty Language 2
- - Language = es Property - Spanish / Property - Spanish 2
- - Language = en Property - English / Property - English 2
- */
+ /* <category lang="en">Property - English</category>
+ * <category lang="en">Property - English 2</category>
+ * <category lang="es">Property - Spanish</category>
+ * <category lang="es">Property - Spanish 2</category>
+ * <category lang="">Property - Empty Language</category>
+ * <category lang="">Property - Empty Language 2</category>
+ * <category>Property - No Language</category>
+ * <category>Property - No Language 2</category>
+ */
+
+ /* Expected Behaviour:
+ * - Language = Null Property - No Language / Property - No Language 2
+ * - Language = "" Property - Empty Language / Property - Empty Language 2
+ * - Language = es Property - Spanish / Property - Spanish 2
+ * - Language = en Property - English / Property - English 2
+ */
var currentElementName = reader.Name;
var values = new[] { new { Language = reader.GetAttribute("lang"), Value = reader.ReadElementContentAsString() } }.ToList();
@@ -973,7 +971,7 @@ namespace Emby.XmlTv.Classes
while (reader.Name == currentElementName)
{
var language = reader.GetAttribute("lang");
- if (String.IsNullOrEmpty(_language) || String.IsNullOrEmpty(language) || language == _language)
+ if (string.IsNullOrEmpty(_language) || string.IsNullOrEmpty(language) || language == _language)
{
setter(reader.ReadElementContentAsString());
}
@@ -1034,7 +1032,7 @@ namespace Emby.XmlTv.Classes
if (match.Success)
{
dateComponent = match.Groups["dateDigits"].Value;
- if (!String.IsNullOrEmpty(match.Groups["dateOffset"].Value))
+ if (!string.IsNullOrEmpty(match.Groups["dateOffset"].Value))
{
dateOffset = match.Groups["dateOffset"].Value; // Add in the colon to ease parsing later
if (dateOffset.Length == 5)
@@ -1054,7 +1052,7 @@ namespace Emby.XmlTv.Classes
dateComponent = dateComponent + completeDate.Substring(dateComponent.Length, completeDate.Length - dateComponent.Length);
}
- var standardDate = String.Format("{0} {1}", dateComponent, dateOffset);
+ var standardDate = string.Format("{0} {1}", dateComponent, dateOffset);
DateTimeOffset parsedDateTime;
if (DateTimeOffset.TryParseExact(standardDate, "yyyyMMddHHmmss zzz", CultureInfo.CurrentCulture, DateTimeStyles.None, out parsedDateTime))
{
@@ -1088,7 +1086,7 @@ namespace Emby.XmlTv.Classes
dateComponent = dateComponent + completeDate.Substring(dateComponent.Length, completeDate.Length - dateComponent.Length);
}
- return String.Format("{0} {1}", dateComponent, dateOffset);
+ return string.Format("{0} {1}", dateComponent, dateOffset);
}
}
}
diff --git a/Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj b/Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj
index b10551b99..41dd9dd97 100644
--- a/Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj
+++ b/Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj
@@ -6,4 +6,8 @@
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
+ <ItemGroup>
+ <Compile Include="..\..\SharedVersion.cs" Link="SharedVersion.cs" />
+ </ItemGroup>
+
</Project>
diff --git a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvChannel.cs b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvChannel.cs
index 632a9945f..2240fd9d4 100644
--- a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvChannel.cs
+++ b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvChannel.cs
@@ -5,9 +5,9 @@ namespace Emby.XmlTv.Entities
{
public class XmlTvChannel : IEquatable<XmlTvChannel>
{
- public String Id { get; set; }
- public String DisplayName { get; set; }
- public String Number { get; set; }
+ public string Id { get; set; }
+ public string DisplayName { get; set; }
+ public string Number { get; set; }
public string Url { get; set; }
public XmlTvIcon Icon { get; set; }
diff --git a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvCredit.cs b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvCredit.cs
index af9c82d3f..0077a3e6e 100644
--- a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvCredit.cs
+++ b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvCredit.cs
@@ -9,7 +9,7 @@ namespace Emby.XmlTv.Entities
public override string ToString()
{
- return String.Format("{0} - ({1})", Name, Type);
+ return string.Format("{0} - ({1})", Name, Type);
}
}
}
diff --git a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvEpisode.cs b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvEpisode.cs
index afcfb909e..de84ab5ba 100644
--- a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvEpisode.cs
+++ b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvEpisode.cs
@@ -27,7 +27,7 @@ namespace Emby.XmlTv.Entities
if (Episode.HasValue || EpisodeCount.HasValue)
{
- builder.Append(builder.Length > 0 ? ", " : String.Empty);
+ builder.Append(builder.Length > 0 ? ", " : string.Empty);
builder.AppendFormat("Episode {0}", Episode.HasValue ? Episode.Value.ToString() : "?");
if (EpisodeCount.HasValue)
{
@@ -37,7 +37,7 @@ namespace Emby.XmlTv.Entities
if (Part.HasValue || PartCount.HasValue)
{
- builder.Append(builder.Length > 0 ? ", " : String.Empty);
+ builder.Append(builder.Length > 0 ? ", " : string.Empty);
builder.AppendFormat("Part {0}", Part.HasValue ? Part.Value.ToString() : "?");
if (PartCount.HasValue)
{
@@ -49,5 +49,5 @@ namespace Emby.XmlTv.Entities
}
}
-
+
}
diff --git a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvIcon.cs b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvIcon.cs
index d0a91cabf..3417a717b 100644
--- a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvIcon.cs
+++ b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvIcon.cs
@@ -5,9 +5,9 @@ namespace Emby.XmlTv.Entities
{
public class XmlTvIcon
{
- public String Source { get; set; }
- public Int32? Width { get; set; }
- public Int32? Height { get; set; }
+ public string Source { get; set; }
+ public int? Width { get; set; }
+ public int? Height { get; set; }
public override string ToString()
{
diff --git a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvLanguage.cs b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvLanguage.cs
index 41c4cedb8..fea387244 100644
--- a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvLanguage.cs
+++ b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvLanguage.cs
@@ -7,11 +7,11 @@ namespace Emby.XmlTv.Entities
/// <summary>
/// The name.
/// </summary>
- public String Name { get; set; }
+ public string Name { get; set; }
/// <summary>
/// The relevance (number of occurances) of the language, can be used to order (desc)
/// </summary>
- public Int32 Relevance { get; set; }
+ public int Relevance { get; set; }
}
}
diff --git a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvProgram.cs b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvProgram.cs
index b5aa6cf7a..b6614afc1 100644
--- a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvProgram.cs
+++ b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvProgram.cs
@@ -13,7 +13,7 @@ namespace Emby.XmlTv.Entities
public DateTimeOffset EndDate { get; set; }
public string Title { get; set; }
-
+
public string Description { get; set; }
public string ProgramId { get; set; }
public string Quality { get; set; }
diff --git a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvRating.cs b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvRating.cs
index e55e70701..381294e7e 100644
--- a/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvRating.cs
+++ b/Emby.XmlTv/Emby.XmlTv/Entities/XmlTvRating.cs
@@ -14,7 +14,7 @@ namespace Emby.XmlTv.Entities
/// The literal name of the rating system
/// </summary>
/// <example>MPAA</example>
- public String System { get; set; }
+ public string System { get; set; }
/// <summary>
/// Describes the rating using the system specificed
@@ -25,12 +25,12 @@ namespace Emby.XmlTv.Entities
public override string ToString()
{
var builder = new StringBuilder();
- if (!String.IsNullOrEmpty(Value))
+ if (!string.IsNullOrEmpty(Value))
{
builder.Append(Value);
}
- if (!String.IsNullOrEmpty(System))
+ if (!string.IsNullOrEmpty(System))
{
builder.AppendFormat(" ({0})", System);
}
diff --git a/Emby.XmlTv/Emby.XmlTv/Properties/AssemblyInfo.cs b/Emby.XmlTv/Emby.XmlTv/Properties/AssemblyInfo.cs
index f33433c93..ff2efb078 100644
--- a/Emby.XmlTv/Emby.XmlTv/Properties/AssemblyInfo.cs
+++ b/Emby.XmlTv/Emby.XmlTv/Properties/AssemblyInfo.cs
@@ -1,32 +1,21 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
+using System.Reflection;
+using System.Resources;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("XmlTv")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("XmlTv")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0")]
diff --git a/Jellyfin.Server/Jellyfin.Server.csproj b/Jellyfin.Server/Jellyfin.Server.csproj
index 98c578e83..e7358e6a1 100644
--- a/Jellyfin.Server/Jellyfin.Server.csproj
+++ b/Jellyfin.Server/Jellyfin.Server.csproj
@@ -20,6 +20,13 @@
<EmbeddedResource Include="Resources/Configuration/*" />
</ItemGroup>
+ <!-- Code analysers-->
+ <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
+ <PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.3" />
+ <PackageReference Include="StyleCop.Analyzers" Version="1.0.2" />
+ <PackageReference Include="SerilogAnalyzer" Version="0.15.0" />
+ </ItemGroup>
+
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
diff --git a/Jellyfin.Server/Properties/AssemblyInfo.cs b/Jellyfin.Server/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..1934b6bc1
--- /dev/null
+++ b/Jellyfin.Server/Properties/AssemblyInfo.cs
@@ -0,0 +1,21 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Jellyfin.Server")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
diff --git a/Jellyfin.Server/SocketSharp/RequestMono.cs b/Jellyfin.Server/SocketSharp/RequestMono.cs
index 31f289497..4c3d8d1d5 100644
--- a/Jellyfin.Server/SocketSharp/RequestMono.cs
+++ b/Jellyfin.Server/SocketSharp/RequestMono.cs
@@ -97,12 +97,12 @@ namespace Jellyfin.SocketSharp
}
#if NET_4_0
- if (validateRequestNewMode && !checked_form) {
- // Setting this before calling the validator prevents
- // possible endless recursion
- checked_form = true;
- ValidateNameValueCollection ("Form", query_string_nvc, RequestValidationSource.Form);
- } else
+ if (validateRequestNewMode && !checked_form) {
+ // Setting this before calling the validator prevents
+ // possible endless recursion
+ checked_form = true;
+ ValidateNameValueCollection ("Form", query_string_nvc, RequestValidationSource.Form);
+ } else
#endif
if (validate_form && !checked_form)
{
@@ -138,7 +138,7 @@ namespace Jellyfin.SocketSharp
if (v.Length > 20)
v = v.Substring(0, 16) + "...\"";
- string msg = String.Format("A potentially dangerous Request.{0} value was " +
+ string msg = string.Format("A potentially dangerous Request.{0} value was " +
"detected from the client ({1}={2}).", name, key, v);
throw new Exception(msg);
@@ -328,13 +328,13 @@ namespace Jellyfin.SocketSharp
public override int Read(byte[] buffer, int dest_offset, int count)
{
if (buffer == null)
- throw new ArgumentNullException("buffer");
+ throw new ArgumentNullException(nameof(buffer));
if (dest_offset < 0)
- throw new ArgumentOutOfRangeException("dest_offset", "< 0");
+ throw new ArgumentOutOfRangeException(nameof(dest_offset), "< 0");
if (count < 0)
- throw new ArgumentOutOfRangeException("count", "< 0");
+ throw new ArgumentOutOfRangeException(nameof(count), "< 0");
int len = buffer.Length;
if (dest_offset > len)
@@ -546,7 +546,7 @@ namespace Jellyfin.SocketSharp
const byte HYPHEN = (byte)'-', LF = (byte)'\n', CR = (byte)'\r';
- // See RFC 2046
+ // See RFC 2046
// In the case of multipart entities, in which one or more different
// sets of data are combined in a single body, a "multipart" media type
// field must appear in the entity's header. The body must then contain
diff --git a/Jellyfin.Server/SocketSharp/SharpWebSocket.cs b/Jellyfin.Server/SocketSharp/SharpWebSocket.cs
index 77de50267..7101f83d9 100644
--- a/Jellyfin.Server/SocketSharp/SharpWebSocket.cs
+++ b/Jellyfin.Server/SocketSharp/SharpWebSocket.cs
@@ -29,12 +29,12 @@ namespace Jellyfin.SocketSharp
{
if (socket == null)
{
- throw new ArgumentNullException("socket");
+ throw new ArgumentNullException(nameof(socket));
}
if (logger == null)
{
- throw new ArgumentNullException("logger");
+ throw new ArgumentNullException(nameof(logger));
}
_logger = logger;
diff --git a/Jellyfin.Server/SocketSharp/WebSocketSharpListener.cs b/Jellyfin.Server/SocketSharp/WebSocketSharpListener.cs
index c360a8fce..468c4c5ca 100644
--- a/Jellyfin.Server/SocketSharp/WebSocketSharpListener.cs
+++ b/Jellyfin.Server/SocketSharp/WebSocketSharpListener.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
@@ -202,6 +202,7 @@ namespace Jellyfin.SocketSharp
}
catch (ObjectDisposedException)
{
+ //TODO Investigate and properly fix.
}
catch (Exception ex)
{
diff --git a/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs b/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs
index 7c9dc8f88..149842bd4 100644
--- a/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs
+++ b/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs
@@ -82,7 +82,7 @@ namespace Jellyfin.SocketSharp
{
get
{
- return String.IsNullOrEmpty(request.Headers["X-Forwarded-For"]) ? null : request.Headers["X-Forwarded-For"];
+ return string.IsNullOrEmpty(request.Headers["X-Forwarded-For"]) ? null : request.Headers["X-Forwarded-For"];
}
}
@@ -106,7 +106,7 @@ namespace Jellyfin.SocketSharp
{
get
{
- return String.IsNullOrEmpty(request.Headers["X-Real-IP"]) ? null : request.Headers["X-Real-IP"];
+ return string.IsNullOrEmpty(request.Headers["X-Real-IP"]) ? null : request.Headers["X-Real-IP"];
}
}
diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs
index ed0a0c81a..ef782ddfc 100644
--- a/MediaBrowser.Api/ApiEntryPoint.cs
+++ b/MediaBrowser.Api/ApiEntryPoint.cs
@@ -388,7 +388,7 @@ namespace MediaBrowser.Api
{
if (string.IsNullOrEmpty(playSessionId))
{
- throw new ArgumentNullException("playSessionId");
+ throw new ArgumentNullException(nameof(playSessionId));
}
//Logger.LogDebug("PingTranscodingJob PlaySessionId={0} isUsedPaused: {1}", playSessionId, isUserPaused);
@@ -397,7 +397,7 @@ namespace MediaBrowser.Api
lock (_activeTranscodingJobs)
{
- // This is really only needed for HLS.
+ // This is really only needed for HLS.
// Progressive streams can stop on their own reliably
jobs = _activeTranscodingJobs.Where(j => string.Equals(playSessionId, j.PlaySessionId, StringComparison.OrdinalIgnoreCase)).ToList();
}
@@ -499,7 +499,7 @@ namespace MediaBrowser.Api
lock (_activeTranscodingJobs)
{
- // This is really only needed for HLS.
+ // This is really only needed for HLS.
// Progressive streams can stop on their own reliably
jobs.AddRange(_activeTranscodingJobs.Where(killJob));
}
diff --git a/MediaBrowser.Api/DisplayPreferencesService.cs b/MediaBrowser.Api/DisplayPreferencesService.cs
index 6bc2f7e4a..eea83490a 100644
--- a/MediaBrowser.Api/DisplayPreferencesService.cs
+++ b/MediaBrowser.Api/DisplayPreferencesService.cs
@@ -41,7 +41,7 @@ namespace MediaBrowser.Api
[ApiMember(Name = "Client", Description = "Client", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
public string Client { get; set; }
}
-
+
/// <summary>
/// Class DisplayPreferencesService
/// </summary>
diff --git a/MediaBrowser.Api/EnvironmentService.cs b/MediaBrowser.Api/EnvironmentService.cs
index ea3920d38..d67867820 100644
--- a/MediaBrowser.Api/EnvironmentService.cs
+++ b/MediaBrowser.Api/EnvironmentService.cs
@@ -98,7 +98,7 @@ namespace MediaBrowser.Api
[Route("/Environment/DefaultDirectoryBrowser", "GET", Summary = "Gets the parent path of a given path")]
public class GetDefaultDirectoryBrowser : IReturn<DefaultDirectoryBrowserInfo>
{
-
+
}
/// <summary>
@@ -124,7 +124,7 @@ namespace MediaBrowser.Api
{
if (networkManager == null)
{
- throw new ArgumentNullException("networkManager");
+ throw new ArgumentNullException(nameof(networkManager));
}
_networkManager = networkManager;
@@ -193,7 +193,7 @@ namespace MediaBrowser.Api
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("Path");
+ throw new ArgumentNullException(nameof(Path));
}
var networkPrefix = UncSeparatorString + UncSeparatorString;
diff --git a/MediaBrowser.Api/Images/ImageByNameService.cs b/MediaBrowser.Api/Images/ImageByNameService.cs
index 2100e9e91..7d328a373 100644
--- a/MediaBrowser.Api/Images/ImageByNameService.cs
+++ b/MediaBrowser.Api/Images/ImageByNameService.cs
@@ -133,7 +133,7 @@ namespace MediaBrowser.Api.Images
{
try
{
- return _fileSystem.GetFiles(path, BaseItem.SupportedImageExtensions, false, true)
+ return _fileSystem.GetFiles(path, BaseItem.SupportedImageExtensions, false, true)
.Select(i => new ImageByNameInfo
{
Name = _fileSystem.GetFileNameWithoutExtension(i),
@@ -185,7 +185,7 @@ namespace MediaBrowser.Api.Images
var paths = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(_appPaths.GeneralPath, request.Name, filename + i)).ToList();
- var path = paths.FirstOrDefault(_fileSystem.FileExists) ?? paths.FirstOrDefault();
+ var path = paths.FirstOrDefault(_fileSystem.FileExists) ?? paths.FirstOrDefault();
return _resultFactory.GetStaticFileResult(Request, path);
}
@@ -199,11 +199,11 @@ namespace MediaBrowser.Api.Images
{
var themeFolder = Path.Combine(_appPaths.RatingsPath, request.Theme);
- if (_fileSystem.DirectoryExists(themeFolder))
+ if (_fileSystem.DirectoryExists(themeFolder))
{
var path = BaseItem.SupportedImageExtensions
.Select(i => Path.Combine(themeFolder, request.Name + i))
- .FirstOrDefault(_fileSystem.FileExists);
+ .FirstOrDefault(_fileSystem.FileExists);
if (!string.IsNullOrEmpty(path))
{
@@ -213,14 +213,14 @@ namespace MediaBrowser.Api.Images
var allFolder = Path.Combine(_appPaths.RatingsPath, "all");
- if (_fileSystem.DirectoryExists(allFolder))
+ if (_fileSystem.DirectoryExists(allFolder))
{
// Avoid implicitly captured closure
var currentRequest = request;
var path = BaseItem.SupportedImageExtensions
.Select(i => Path.Combine(allFolder, currentRequest.Name + i))
- .FirstOrDefault(_fileSystem.FileExists);
+ .FirstOrDefault(_fileSystem.FileExists);
if (!string.IsNullOrEmpty(path))
{
@@ -240,10 +240,10 @@ namespace MediaBrowser.Api.Images
{
var themeFolder = Path.Combine(_appPaths.MediaInfoImagesPath, request.Theme);
- if (_fileSystem.DirectoryExists(themeFolder))
+ if (_fileSystem.DirectoryExists(themeFolder))
{
var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(themeFolder, request.Name + i))
- .FirstOrDefault(_fileSystem.FileExists);
+ .FirstOrDefault(_fileSystem.FileExists);
if (!string.IsNullOrEmpty(path))
{
@@ -253,13 +253,13 @@ namespace MediaBrowser.Api.Images
var allFolder = Path.Combine(_appPaths.MediaInfoImagesPath, "all");
- if (_fileSystem.DirectoryExists(allFolder))
+ if (_fileSystem.DirectoryExists(allFolder))
{
// Avoid implicitly captured closure
var currentRequest = request;
var path = BaseItem.SupportedImageExtensions.Select(i => Path.Combine(allFolder, currentRequest.Name + i))
- .FirstOrDefault(_fileSystem.FileExists);
+ .FirstOrDefault(_fileSystem.FileExists);
if (!string.IsNullOrEmpty(path))
{
diff --git a/MediaBrowser.Api/Library/LibraryStructureService.cs b/MediaBrowser.Api/Library/LibraryStructureService.cs
index bba89acec..cd839e0f8 100644
--- a/MediaBrowser.Api/Library/LibraryStructureService.cs
+++ b/MediaBrowser.Api/Library/LibraryStructureService.cs
@@ -192,7 +192,7 @@ namespace MediaBrowser.Api.Library
{
if (appPaths == null)
{
- throw new ArgumentNullException("appPaths");
+ throw new ArgumentNullException(nameof(appPaths));
}
_appPaths = appPaths;
@@ -244,12 +244,12 @@ namespace MediaBrowser.Api.Library
{
if (string.IsNullOrWhiteSpace(request.Name))
{
- throw new ArgumentNullException("request");
+ throw new ArgumentNullException(nameof(request));
}
if (string.IsNullOrWhiteSpace(request.NewName))
{
- throw new ArgumentNullException("request");
+ throw new ArgumentNullException(nameof(request));
}
var rootFolderPath = _appPaths.DefaultUserViewsPath;
@@ -322,7 +322,7 @@ namespace MediaBrowser.Api.Library
{
if (string.IsNullOrWhiteSpace(request.Name))
{
- throw new ArgumentNullException("request");
+ throw new ArgumentNullException(nameof(request));
}
_libraryMonitor.Stop();
@@ -370,7 +370,7 @@ namespace MediaBrowser.Api.Library
{
if (string.IsNullOrWhiteSpace(request.Name))
{
- throw new ArgumentNullException("request");
+ throw new ArgumentNullException(nameof(request));
}
_libraryManager.UpdateMediaPath(request.Name, request.PathInfo);
@@ -384,7 +384,7 @@ namespace MediaBrowser.Api.Library
{
if (string.IsNullOrWhiteSpace(request.Name))
{
- throw new ArgumentNullException("request");
+ throw new ArgumentNullException(nameof(request));
}
_libraryMonitor.Stop();
diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs
index ef9ce9aec..fc645898c 100644
--- a/MediaBrowser.Api/LiveTv/LiveTvService.cs
+++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs
@@ -1030,7 +1030,7 @@ namespace MediaBrowser.Api.LiveTv
query.IsKids = request.IsKids;
query.IsSports = request.IsSports;
query.SeriesTimerId = request.SeriesTimerId;
- query.Genres = (request.Genres ?? String.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
+ query.Genres = (request.Genres ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
query.GenreIds = GetGuids(request.GenreIds);
if (!request.LibrarySeriesId.Equals(Guid.Empty))
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index fa6502bda..ba7f7070b 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Extensions;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Devices;
using MediaBrowser.Controller.Dlna;
@@ -595,8 +595,10 @@ namespace MediaBrowser.Api.Playback
/// <param name="request">The stream request.</param>
private void ParseStreamOptions(StreamRequest request)
{
- foreach (var param in Request.QueryString) {
- if (Char.IsLower(param.Name[0])) {
+ foreach (var param in Request.QueryString)
+ {
+ if (char.IsLower(param.Name[0]))
+ {
// This was probably not parsed initially and should be a StreamOptions
// TODO: This should be incorporated either in the lower framework for parsing requests
// or the generated URL should correctly serialize it
@@ -882,7 +884,7 @@ namespace MediaBrowser.Api.Playback
if (profile == null)
{
- // Don't use settings from the default profile.
+ // Don't use settings from the default profile.
// Only use a specific profile if it was requested.
return;
}
diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
index 7ef7b81e6..3e17d0b74 100644
--- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
@@ -269,7 +269,7 @@ namespace MediaBrowser.Api.Playback.Hls
{
var outputTsArg = Path.Combine(FileSystem.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state.Request);
- var timeDeltaParam = String.Empty;
+ var timeDeltaParam = string.Empty;
var segmentFormat = GetSegmentFileExtension(state.Request).TrimStart('.');
if (string.Equals(segmentFormat, "ts", StringComparison.OrdinalIgnoreCase))
@@ -296,7 +296,7 @@ namespace MediaBrowser.Api.Playback.Hls
).Trim();
}
- // add when stream copying?
+ // add when stream copying?
// -avoid_negative_ts make_zero -fflags +genpts
var args = string.Format("{0} {1} {2} -map_metadata -1 -map_chapters -1 -threads {3} {4} {5} -max_delay 5000000 -avoid_negative_ts disabled -start_at_zero {6} -hls_time {7} -individual_header_trailer 0 -start_number {8} -hls_list_size {9}{10} -y \"{11}\"",
diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
index 5361e313c..ff3712f8a 100644
--- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
@@ -934,7 +934,7 @@ namespace MediaBrowser.Api.Playback.Hls
var outputTsArg = Path.Combine(FileSystem.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state.Request);
- var timeDeltaParam = String.Empty;
+ var timeDeltaParam = string.Empty;
if (isEncoding && startNumber > 0)
{
diff --git a/MediaBrowser.Api/Playback/MediaInfoService.cs b/MediaBrowser.Api/Playback/MediaInfoService.cs
index 6dafe134c..b0154cc7e 100644
--- a/MediaBrowser.Api/Playback/MediaInfoService.cs
+++ b/MediaBrowser.Api/Playback/MediaInfoService.cs
@@ -118,7 +118,7 @@ namespace MediaBrowser.Api.Playback
var authInfo = _authContext.GetAuthorizationInfo(Request);
var result = await _mediaSourceManager.OpenLiveStream(request, CancellationToken.None).ConfigureAwait(false);
-
+
var profile = request.DeviceProfile;
if (profile == null)
{
@@ -262,6 +262,7 @@ namespace MediaBrowser.Api.Playback
catch (Exception ex)
{
mediaSources = new List<MediaSourceInfo>();
+ // TODO Log exception
// TODO PlaybackException ??
//result.ErrorCode = ex.ErrorCode;
}
@@ -386,10 +387,10 @@ namespace MediaBrowser.Api.Playback
}
else
{
- Logger.LogInformation("User policy for {0}. EnablePlaybackRemuxing: {1} EnableVideoPlaybackTranscoding: {2} EnableAudioPlaybackTranscoding: {3}",
+ Logger.LogInformation("User policy for {0}. EnablePlaybackRemuxing: {1} EnableVideoPlaybackTranscoding: {2} EnableAudioPlaybackTranscoding: {3}",
user.Name,
user.Policy.EnablePlaybackRemuxing,
- user.Policy.EnableVideoPlaybackTranscoding,
+ user.Policy.EnableVideoPlaybackTranscoding,
user.Policy.EnableAudioPlaybackTranscoding);
}
diff --git a/MediaBrowser.Api/Playback/StreamRequest.cs b/MediaBrowser.Api/Playback/StreamRequest.cs
index d95c30d65..6b0725f31 100644
--- a/MediaBrowser.Api/Playback/StreamRequest.cs
+++ b/MediaBrowser.Api/Playback/StreamRequest.cs
@@ -19,7 +19,7 @@ namespace MediaBrowser.Api.Playback
[ApiMember(Name = "MediaSourceId", Description = "The media version id, if playing an alternate version", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string MediaSourceId { get; set; }
-
+
[ApiMember(Name = "DeviceId", Description = "The device id of the client requesting. Used to stop encoding processes when needed.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string DeviceId { get; set; }
diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs
index 67fb04d0c..73741d527 100644
--- a/MediaBrowser.Api/Playback/StreamState.cs
+++ b/MediaBrowser.Api/Playback/StreamState.cs
@@ -117,7 +117,7 @@ namespace MediaBrowser.Api.Playback
public string UserAgent { get; set; }
- public StreamState(IMediaSourceManager mediaSourceManager, ILogger logger, TranscodingJobType transcodingType)
+ public StreamState(IMediaSourceManager mediaSourceManager, ILogger logger, TranscodingJobType transcodingType)
: base(logger, mediaSourceManager, transcodingType)
{
_mediaSourceManager = mediaSourceManager;
diff --git a/MediaBrowser.Api/PluginService.cs b/MediaBrowser.Api/PluginService.cs
index 1f1bb3614..17822fb54 100644
--- a/MediaBrowser.Api/PluginService.cs
+++ b/MediaBrowser.Api/PluginService.cs
@@ -1,16 +1,13 @@
using MediaBrowser.Common;
using MediaBrowser.Common.Net;
-using MediaBrowser.Common.Security;
using MediaBrowser.Common.Updates;
using MediaBrowser.Controller.Devices;
using MediaBrowser.Controller.Net;
-using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Serialization;
using System;
using System.IO;
using System.Linq;
-using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Services;
using MediaBrowser.Common.Plugins;
@@ -79,6 +76,16 @@ namespace MediaBrowser.Api
public Stream RequestStream { get; set; }
}
+ //TODO Once we have proper apps and plugins and decide to break compatibility with paid plugins,
+ // delete all these registration endpoints. They are only kept for compatibility.
+ [Route("/Registrations/{Name}", "GET", Summary = "Gets registration status for a feature", IsHidden = true)]
+ [Authenticated]
+ public class GetRegistration : IReturn<RegistrationInfo>
+ {
+ [ApiMember(Name = "Name", Description = "Feature Name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
+ public string Name { get; set; }
+ }
+
/// <summary>
/// Class GetPluginSecurityInfo
/// </summary>
@@ -105,14 +112,7 @@ namespace MediaBrowser.Api
public string Name { get; set; }
}
- [Route("/Registrations/{Name}", "GET", Summary = "Gets registration status for a feature", IsHidden = true)]
- [Authenticated]
- public class GetRegistration : IReturn<RegistrationInfo>
- {
- [ApiMember(Name = "Name", Description = "Feature Name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
- public string Name { get; set; }
- }
-
+ // TODO these two classes are only kept for compability with paid plugins and should be removed
public class RegistrationInfo
{
public string Name { get; set; }
@@ -121,14 +121,21 @@ namespace MediaBrowser.Api
public bool IsRegistered { get; set; }
}
- [Route("/Appstore/Register", "POST", Summary = "Registers an appstore sale", IsHidden = true)]
- [Authenticated]
- public class RegisterAppstoreSale
+ public class MBRegistrationRecord
{
- [ApiMember(Name = "Parameters", Description = "Java representation of parameters to pass through to admin server", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")]
- public string Parameters { get; set; }
+ public DateTime ExpirationDate { get; set; }
+ public bool IsRegistered { get; set; }
+ public bool RegChecked { get; set; }
+ public bool RegError { get; set; }
+ public bool TrialVersion { get; set; }
+ public bool IsValid { get; set; }
}
+ public class PluginSecurityInfo
+ {
+ public string SupporterKey { get; set; }
+ public bool IsMBSupporter { get; set; }
+ }
/// <summary>
/// Class PluginsService
/// </summary>
@@ -143,23 +150,19 @@ namespace MediaBrowser.Api
/// The _app host
/// </summary>
private readonly IApplicationHost _appHost;
-
- private readonly ISecurityManager _securityManager;
-
private readonly IInstallationManager _installationManager;
private readonly INetworkManager _network;
private readonly IDeviceManager _deviceManager;
- public PluginService(IJsonSerializer jsonSerializer, IApplicationHost appHost, ISecurityManager securityManager, IInstallationManager installationManager, INetworkManager network, IDeviceManager deviceManager)
+ public PluginService(IJsonSerializer jsonSerializer, IApplicationHost appHost, IInstallationManager installationManager, INetworkManager network, IDeviceManager deviceManager)
: base()
{
if (jsonSerializer == null)
{
- throw new ArgumentNullException("jsonSerializer");
+ throw new ArgumentNullException(nameof(jsonSerializer));
}
_appHost = appHost;
- _securityManager = securityManager;
_installationManager = installationManager;
_network = network;
_deviceManager = deviceManager;
@@ -173,20 +176,26 @@ namespace MediaBrowser.Api
/// <returns>System.Object.</returns>
public async Task<object> Get(GetRegistrationStatus request)
{
- var result = await _securityManager.GetRegistrationStatus(request.Name).ConfigureAwait(false);
+ var record = new MBRegistrationRecord
+ {
+ IsRegistered = true,
+ RegChecked = true,
+ TrialVersion = false,
+ IsValid = true,
+ RegError = false
+ };
- return ToOptimizedResult(result);
+ return ToOptimizedResult(record);
}
+ //TODO this function is only kept for compatibility and should be removed once paid plugins break
public async Task<object> Get(GetRegistration request)
{
- var result = await _securityManager.GetRegistrationStatus(request.Name).ConfigureAwait(false);
-
var info = new RegistrationInfo
{
- ExpirationDate = result.ExpirationDate,
- IsRegistered = result.IsRegistered,
- IsTrial = result.TrialVersion,
+ ExpirationDate = DateTime.Now.AddYears(100),
+ IsRegistered = true,
+ IsTrial = false,
Name = request.Name
};
@@ -201,45 +210,6 @@ namespace MediaBrowser.Api
public async Task<object> Get(GetPlugins request)
{
var result = _appHost.Plugins.OrderBy(p => p.Name).Select(p => p.GetPluginInfo()).ToArray();
- var requireAppStoreEnabled = request.IsAppStoreEnabled.HasValue && request.IsAppStoreEnabled.Value;
-
- // Don't fail just on account of image url's
- try
- {
- var packages = (await _installationManager.GetAvailablePackagesWithoutRegistrationInfo(CancellationToken.None));
-
- foreach (var plugin in result)
- {
- var pkg = packages.FirstOrDefault(i => !string.IsNullOrWhiteSpace(i.guid) && string.Equals(i.guid.Replace("-", string.Empty), plugin.Id.Replace("-", string.Empty), StringComparison.OrdinalIgnoreCase));
-
- if (pkg != null)
- {
- plugin.ImageUrl = pkg.thumbImage;
- }
- }
-
- if (requireAppStoreEnabled)
- {
- result = result
- .Where(plugin =>
- {
- var pkg = packages.FirstOrDefault(i => !string.IsNullOrWhiteSpace(i.guid) && new Guid(plugin.Id).Equals(new Guid(i.guid)));
- return pkg != null && pkg.enableInAppStore;
-
- })
- .ToArray();
- }
- }
- catch (Exception ex)
- {
- Logger.LogError(ex, "Error getting plugin list");
- // Play it safe here
- if (requireAppStoreEnabled)
- {
- result = new PluginInfo[] { };
- }
- }
-
return ToOptimizedResult(result);
}
@@ -265,30 +235,20 @@ namespace MediaBrowser.Api
{
var result = new PluginSecurityInfo
{
- IsMBSupporter = await _securityManager.IsSupporter().ConfigureAwait(false),
- SupporterKey = _securityManager.SupporterKey
+ IsMBSupporter = true,
+ SupporterKey = "IAmTotallyLegit"
};
return ToOptimizedResult(result);
}
/// <summary>
- /// Post app store sale
- /// </summary>
- /// <param name="request"></param>
- /// <returns></returns>
- public Task Post(RegisterAppstoreSale request)
- {
- return _securityManager.RegisterAppStoreSale(request.Parameters);
- }
-
- /// <summary>
/// Posts the specified request.
/// </summary>
/// <param name="request">The request.</param>
public Task Post(UpdatePluginSecurityInfo request)
{
- return _securityManager.UpdateSupporterKey(request.SupporterKey);
+ return Task.CompletedTask;
}
/// <summary>
diff --git a/MediaBrowser.Api/Properties/AssemblyInfo.cs b/MediaBrowser.Api/Properties/AssemblyInfo.cs
index c68952291..f86723031 100644
--- a/MediaBrowser.Api/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.Api/Properties/AssemblyInfo.cs
@@ -1,30 +1,21 @@
-using System.Reflection;
+using System.Reflection;
+using System.Resources;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MediaBrowser.Api")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("MediaBrowser.Api")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("13464b02-f033-48b8-9e1c-d071f8860935")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
diff --git a/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs b/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs
index 959bdcd55..719e80082 100644
--- a/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs
+++ b/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs
@@ -101,7 +101,7 @@ namespace MediaBrowser.Api.ScheduledTasks
{
if (taskManager == null)
{
- throw new ArgumentNullException("taskManager");
+ throw new ArgumentNullException(nameof(taskManager));
}
TaskManager = taskManager;
@@ -155,7 +155,7 @@ namespace MediaBrowser.Api.ScheduledTasks
return isEnabled == val;
});
}
-
+
var infos = result
.Select(ScheduledTaskHelpers.GetTaskInfo)
.ToArray();
diff --git a/MediaBrowser.Api/System/ActivityLogWebSocketListener.cs b/MediaBrowser.Api/System/ActivityLogWebSocketListener.cs
index b61ff8d93..29f01eab9 100644
--- a/MediaBrowser.Api/System/ActivityLogWebSocketListener.cs
+++ b/MediaBrowser.Api/System/ActivityLogWebSocketListener.cs
@@ -47,7 +47,7 @@ namespace MediaBrowser.Api.System
{
return Task.FromResult(new List<ActivityLogEntry>());
}
-
+
protected override void Dispose(bool dispose)
{
diff --git a/MediaBrowser.Api/System/SystemService.cs b/MediaBrowser.Api/System/SystemService.cs
index 52e14dbcc..c2c2386ac 100644
--- a/MediaBrowser.Api/System/SystemService.cs
+++ b/MediaBrowser.Api/System/SystemService.cs
@@ -1,6 +1,5 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Net;
-using MediaBrowser.Common.Security;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.System;
@@ -100,8 +99,6 @@ namespace MediaBrowser.Api.System
private readonly INetworkManager _network;
- private readonly ISecurityManager _security;
-
/// <summary>
/// Initializes a new instance of the <see cref="SystemService" /> class.
/// </summary>
@@ -109,13 +106,12 @@ namespace MediaBrowser.Api.System
/// <param name="appPaths">The application paths.</param>
/// <param name="fileSystem">The file system.</param>
/// <exception cref="ArgumentNullException">jsonSerializer</exception>
- public SystemService(IServerApplicationHost appHost, IApplicationPaths appPaths, IFileSystem fileSystem, INetworkManager network, ISecurityManager security)
+ public SystemService(IServerApplicationHost appHost, IApplicationPaths appPaths, IFileSystem fileSystem, INetworkManager network)
{
_appHost = appHost;
_appPaths = appPaths;
_fileSystem = fileSystem;
_network = network;
- _security = security;
}
public object Post(PingSystem request)
diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs
index 11c12c718..2ce9b0aec 100644
--- a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs
+++ b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs
@@ -214,7 +214,7 @@ namespace MediaBrowser.Api.UserLibrary
public string Genres { get; set; }
public string GenreIds { get; set; }
-
+
[ApiMember(Name = "OfficialRatings", Description = "Optional. If specified, results will be filtered based on OfficialRating. This allows multiple, pipe delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
public string OfficialRatings { get; set; }
@@ -412,7 +412,7 @@ namespace MediaBrowser.Api.UserLibrary
return val.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(v => (VideoType)Enum.Parse(typeof(VideoType), v, true)).ToArray();
}
-
+
/// <summary>
/// Gets the filters.
/// </summary>
diff --git a/MediaBrowser.Api/UserLibrary/GenresService.cs b/MediaBrowser.Api/UserLibrary/GenresService.cs
index 0bb7d7865..c897ba300 100644
--- a/MediaBrowser.Api/UserLibrary/GenresService.cs
+++ b/MediaBrowser.Api/UserLibrary/GenresService.cs
@@ -69,7 +69,7 @@ namespace MediaBrowser.Api.UserLibrary
var dtoOptions = GetDtoOptions(AuthorizationContext, request);
var item = GetGenre(request.Name, LibraryManager, dtoOptions);
-
+
if (!request.UserId.Equals(Guid.Empty))
{
var user = UserManager.GetUserById(request.UserId);
diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs
index aa17e85f3..e2febc25d 100644
--- a/MediaBrowser.Api/UserLibrary/ItemsService.cs
+++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs
@@ -62,19 +62,19 @@ namespace MediaBrowser.Api.UserLibrary
{
if (userManager == null)
{
- throw new ArgumentNullException("userManager");
+ throw new ArgumentNullException(nameof(userManager));
}
if (libraryManager == null)
{
- throw new ArgumentNullException("libraryManager");
+ throw new ArgumentNullException(nameof(libraryManager));
}
if (localization == null)
{
- throw new ArgumentNullException("localization");
+ throw new ArgumentNullException(nameof(localization));
}
if (dtoService == null)
{
- throw new ArgumentNullException("dtoService");
+ throw new ArgumentNullException(nameof(dtoService));
}
_userManager = userManager;
@@ -143,7 +143,7 @@ namespace MediaBrowser.Api.UserLibrary
{
if (request == null)
{
- throw new ArgumentNullException("request");
+ throw new ArgumentNullException(nameof(request));
}
var result = GetItems(request);
diff --git a/MediaBrowser.Api/UserLibrary/MusicGenresService.cs b/MediaBrowser.Api/UserLibrary/MusicGenresService.cs
index d4f1b3fa8..9583dacb2 100644
--- a/MediaBrowser.Api/UserLibrary/MusicGenresService.cs
+++ b/MediaBrowser.Api/UserLibrary/MusicGenresService.cs
@@ -60,7 +60,7 @@ namespace MediaBrowser.Api.UserLibrary
var dtoOptions = GetDtoOptions(AuthorizationContext, request);
var item = GetMusicGenre(request.Name, LibraryManager, dtoOptions);
-
+
if (!request.UserId.Equals(Guid.Empty))
{
var user = UserManager.GetUserById(request.UserId);
diff --git a/MediaBrowser.Api/UserLibrary/YearsService.cs b/MediaBrowser.Api/UserLibrary/YearsService.cs
index 30ac88e00..528406aa4 100644
--- a/MediaBrowser.Api/UserLibrary/YearsService.cs
+++ b/MediaBrowser.Api/UserLibrary/YearsService.cs
@@ -66,7 +66,7 @@ namespace MediaBrowser.Api.UserLibrary
private BaseItemDto GetItem(GetYear request)
{
var item = LibraryManager.GetYear(request.Year);
-
+
var dtoOptions = GetDtoOptions(AuthorizationContext, request);
if (!request.UserId.Equals(Guid.Empty))
diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj
index a485fa8be..af5536b36 100644
--- a/MediaBrowser.Common/MediaBrowser.Common.csproj
+++ b/MediaBrowser.Common/MediaBrowser.Common.csproj
@@ -3,6 +3,8 @@
<PropertyGroup>
<Authors>Jellyfin Contributors</Authors>
<PackageId>Jellyfin.Common</PackageId>
+ <PackageLicenseUrl>https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt</PackageLicenseUrl>
+ <RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
diff --git a/MediaBrowser.Common/Net/HttpResponseInfo.cs b/MediaBrowser.Common/Net/HttpResponseInfo.cs
index ed941a447..a36550a28 100644
--- a/MediaBrowser.Common/Net/HttpResponseInfo.cs
+++ b/MediaBrowser.Common/Net/HttpResponseInfo.cs
@@ -21,7 +21,7 @@ namespace MediaBrowser.Common.Net
/// </summary>
/// <value>The response URL.</value>
public string ResponseUrl { get; set; }
-
+
/// <summary>
/// Gets or sets the content.
/// </summary>
diff --git a/MediaBrowser.Common/Plugins/BasePlugin.cs b/MediaBrowser.Common/Plugins/BasePlugin.cs
index 82eb6ba4b..2fdee381d 100644
--- a/MediaBrowser.Common/Plugins/BasePlugin.cs
+++ b/MediaBrowser.Common/Plugins/BasePlugin.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Configuration;
+using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Serialization;
using System;
@@ -241,7 +241,7 @@ namespace MediaBrowser.Common.Plugins
{
if (configuration == null)
{
- throw new ArgumentNullException("configuration");
+ throw new ArgumentNullException(nameof(configuration));
}
Configuration = (TConfigurationType)configuration;
diff --git a/MediaBrowser.Common/Properties/AssemblyInfo.cs b/MediaBrowser.Common/Properties/AssemblyInfo.cs
index 09fd68f93..1a8fdb618 100644
--- a/MediaBrowser.Common/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.Common/Properties/AssemblyInfo.cs
@@ -1,27 +1,21 @@
-using System.Reflection;
+using System.Reflection;
+using System.Resources;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MediaBrowser.Common")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("MediaBrowser.Common")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-// \ No newline at end of file
diff --git a/MediaBrowser.Common/Security/IRequiresRegistration.cs b/MediaBrowser.Common/Security/IRequiresRegistration.cs
deleted file mode 100644
index 7b1667c2e..000000000
--- a/MediaBrowser.Common/Security/IRequiresRegistration.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Threading.Tasks;
-
-namespace MediaBrowser.Common.Security
-{
- public interface IRequiresRegistration
- {
- /// <summary>
- /// Load all registration information required for this entity.
- /// Your class should re-load all MBRegistrationRecords when this is called even if they were
- /// previously loaded.
- /// </summary>
- /// <returns></returns>
- Task LoadRegistrationInfoAsync();
- }
-}
diff --git a/MediaBrowser.Common/Security/ISecurityManager.cs b/MediaBrowser.Common/Security/ISecurityManager.cs
deleted file mode 100644
index b63a9efd0..000000000
--- a/MediaBrowser.Common/Security/ISecurityManager.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using MediaBrowser.Model.Entities;
-using System.Threading.Tasks;
-
-namespace MediaBrowser.Common.Security
-{
- public interface ISecurityManager
- {
- /// <summary>
- /// Gets a value indicating whether this instance is MB supporter.
- /// </summary>
- /// <value><c>true</c> if this instance is MB supporter; otherwise, <c>false</c>.</value>
- Task<bool> IsSupporter();
-
- /// <summary>
- /// Gets or sets the supporter key.
- /// </summary>
- /// <value>The supporter key.</value>
- string SupporterKey { get; }
-
- /// <summary>
- /// Gets the registration status. Overload to support existing plug-ins.
- /// </summary>
- Task<MBRegistrationRecord> GetRegistrationStatus(string feature);
-
- /// <summary>
- /// Register and app store sale with our back-end
- /// </summary>
- /// <param name="parameters">Json parameters to pass to admin server</param>
- Task RegisterAppStoreSale(string parameters);
- Task UpdateSupporterKey(string newValue);
- }
-} \ No newline at end of file
diff --git a/MediaBrowser.Common/Security/PaymentRequiredException.cs b/MediaBrowser.Common/Security/PaymentRequiredException.cs
deleted file mode 100644
index 27b3e6961..000000000
--- a/MediaBrowser.Common/Security/PaymentRequiredException.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using System;
-
-namespace MediaBrowser.Common.Security
-{
- public class PaymentRequiredException : Exception
- {
- }
-}
diff --git a/MediaBrowser.Common/Updates/IInstallationManager.cs b/MediaBrowser.Common/Updates/IInstallationManager.cs
index dab38b27c..a3e0277d9 100644
--- a/MediaBrowser.Common/Updates/IInstallationManager.cs
+++ b/MediaBrowser.Common/Updates/IInstallationManager.cs
@@ -49,9 +49,7 @@ namespace MediaBrowser.Common.Updates
/// <param name="applicationVersion">The application version.</param>
/// <returns>Task{List{PackageInfo}}.</returns>
Task<List<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken,
- bool withRegistration = true,
- string packageType = null,
- Version applicationVersion = null);
+ bool withRegistration = true, string packageType = null, Version applicationVersion = null);
/// <summary>
/// Gets all available packages from a static resource.
diff --git a/MediaBrowser.Controller/Authentication/AuthenticationResult.cs b/MediaBrowser.Controller/Authentication/AuthenticationResult.cs
index 6dd8f02d8..3c65156e3 100644
--- a/MediaBrowser.Controller/Authentication/AuthenticationResult.cs
+++ b/MediaBrowser.Controller/Authentication/AuthenticationResult.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Session;
+using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Dto;
diff --git a/MediaBrowser.Controller/Channels/IChannelManager.cs b/MediaBrowser.Controller/Channels/IChannelManager.cs
index a9839e1fb..b345001a6 100644
--- a/MediaBrowser.Controller/Channels/IChannelManager.cs
+++ b/MediaBrowser.Controller/Channels/IChannelManager.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Channels;
using MediaBrowser.Model.Dto;
@@ -46,14 +46,12 @@ namespace MediaBrowser.Controller.Channels
/// Gets the channels internal.
/// </summary>
/// <param name="query">The query.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
QueryResult<Channel> GetChannelsInternal(ChannelQuery query);
/// <summary>
/// Gets the channels.
/// </summary>
/// <param name="query">The query.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
QueryResult<BaseItemDto> GetChannels(ChannelQuery query);
/// <summary>
diff --git a/MediaBrowser.Controller/Dlna/IDlnaManager.cs b/MediaBrowser.Controller/Dlna/IDlnaManager.cs
index 2f64cd194..70529d062 100644
--- a/MediaBrowser.Controller/Dlna/IDlnaManager.cs
+++ b/MediaBrowser.Controller/Dlna/IDlnaManager.cs
@@ -30,26 +30,26 @@ namespace MediaBrowser.Controller.Dlna
/// </summary>
/// <param name="profile">The profile.</param>
void CreateProfile(DeviceProfile profile);
-
+
/// <summary>
/// Updates the profile.
/// </summary>
/// <param name="profile">The profile.</param>
void UpdateProfile(DeviceProfile profile);
-
+
/// <summary>
/// Deletes the profile.
/// </summary>
/// <param name="id">The identifier.</param>
void DeleteProfile(string id);
-
+
/// <summary>
/// Gets the profile.
/// </summary>
/// <param name="id">The identifier.</param>
/// <returns>DeviceProfile.</returns>
DeviceProfile GetProfile(string id);
-
+
/// <summary>
/// Gets the profile.
/// </summary>
diff --git a/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs b/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs
index 948219bf5..1b1e386e5 100644
--- a/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs
+++ b/MediaBrowser.Controller/Drawing/ImageProcessorExtensions.cs
@@ -9,7 +9,7 @@ namespace MediaBrowser.Controller.Drawing
{
return processor.GetImageCacheTag(item, imageType, 0);
}
-
+
public static string GetImageCacheTag(this IImageProcessor processor, BaseItem item, ImageType imageType, int imageIndex)
{
var imageInfo = item.GetImageInfo(imageType, imageIndex);
diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs
index a4601c270..6425fa41b 100644
--- a/MediaBrowser.Controller/Entities/AggregateFolder.cs
+++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs
@@ -187,7 +187,7 @@ namespace MediaBrowser.Controller.Entities
{
if (child == null)
{
- throw new ArgumentNullException();
+ throw new ArgumentNullException(nameof(child));
}
_virtualChildren.Add(child);
@@ -203,7 +203,7 @@ namespace MediaBrowser.Controller.Entities
{
if (id.Equals(Guid.Empty))
{
- throw new ArgumentNullException("id");
+ throw new ArgumentNullException(nameof(id));
}
foreach (var child in _virtualChildren)
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index a268e6d76..8298f4087 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -1139,7 +1139,7 @@ namespace MediaBrowser.Controller.Entities
{
if (item == null)
{
- throw new ArgumentNullException("media");
+ throw new ArgumentNullException(nameof(item));
}
var protocol = item.PathProtocol;
@@ -1756,7 +1756,7 @@ namespace MediaBrowser.Controller.Entities
{
if (user == null)
{
- throw new ArgumentNullException("user");
+ throw new ArgumentNullException(nameof(user));
}
if (!IsVisibleViaTags(user))
@@ -1906,7 +1906,7 @@ namespace MediaBrowser.Controller.Entities
{
if (user == null)
{
- throw new ArgumentNullException("user");
+ throw new ArgumentNullException(nameof(user));
}
return IsParentalAllowed(user);
@@ -2087,7 +2087,7 @@ namespace MediaBrowser.Controller.Entities
{
if (string.IsNullOrEmpty(name))
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
var current = Studios;
@@ -2100,7 +2100,7 @@ namespace MediaBrowser.Controller.Entities
}
else
{
- var list =
+ var list =
Studios = current.Concat(new [] { name }).ToArray();
}
}
@@ -2120,7 +2120,7 @@ namespace MediaBrowser.Controller.Entities
{
if (string.IsNullOrEmpty(name))
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
var genres = Genres;
@@ -2146,7 +2146,7 @@ namespace MediaBrowser.Controller.Entities
{
if (user == null)
{
- throw new ArgumentNullException();
+ throw new ArgumentNullException(nameof(user));
}
var data = UserDataManager.GetUserData(user, this);
@@ -2181,7 +2181,7 @@ namespace MediaBrowser.Controller.Entities
{
if (user == null)
{
- throw new ArgumentNullException();
+ throw new ArgumentNullException(nameof(user));
}
var data = UserDataManager.GetUserData(user, this);
@@ -2579,7 +2579,7 @@ namespace MediaBrowser.Controller.Entities
{
if (user == null)
{
- throw new ArgumentNullException("user");
+ throw new ArgumentNullException(nameof(user));
}
var userdata = UserDataManager.GetUserData(user, this);
@@ -2915,7 +2915,7 @@ namespace MediaBrowser.Controller.Entities
return GetExtras();
}
- public virtual bool IsHD {
+ public virtual bool IsHD {
get
{
return Height >= 720;
diff --git a/MediaBrowser.Controller/Entities/BaseItemExtensions.cs b/MediaBrowser.Controller/Entities/BaseItemExtensions.cs
index 8ab1788b5..bfd832d34 100644
--- a/MediaBrowser.Controller/Entities/BaseItemExtensions.cs
+++ b/MediaBrowser.Controller/Entities/BaseItemExtensions.cs
@@ -62,13 +62,13 @@ namespace MediaBrowser.Controller.Entities
item.SetImagePath(imageType, BaseItem.FileSystem.GetFileInfo(file));
}
}
-
+
/// <summary>
/// Copies all properties on object. Skips properties that do not exist.
/// </summary>
/// <param name="source">The source object.</param>
/// <param name="dest">The destination object.</param>
- public static void DeepCopy<T, TU>(this T source, TU dest)
+ public static void DeepCopy<T, TU>(this T source, TU dest)
where T : BaseItem
where TU : BaseItem
{
@@ -82,7 +82,7 @@ namespace MediaBrowser.Controller.Entities
if (destProps.Any(x => x.Name == sourceProp.Name))
{
var p = destProps.First(x => x.Name == sourceProp.Name);
- p.SetValue(dest, sourceProp.GetValue(source, null), null);
+ p.SetValue(dest, sourceProp.GetValue(source, null), null);
}
}
@@ -93,7 +93,7 @@ namespace MediaBrowser.Controller.Entities
/// Copies all properties on newly created object. Skips properties that do not exist.
/// </summary>
/// <param name="source">The source object.</param>
- public static TU DeepCopy<T, TU>(this T source)
+ public static TU DeepCopy<T, TU>(this T source)
where T : BaseItem
where TU : BaseItem, new()
{
diff --git a/MediaBrowser.Controller/Entities/Extensions.cs b/MediaBrowser.Controller/Entities/Extensions.cs
index ee135a14e..91f78b902 100644
--- a/MediaBrowser.Controller/Entities/Extensions.cs
+++ b/MediaBrowser.Controller/Entities/Extensions.cs
@@ -17,7 +17,7 @@ namespace MediaBrowser.Controller.Entities
{
if (string.IsNullOrEmpty(url))
{
- throw new ArgumentNullException("url");
+ throw new ArgumentNullException(nameof(url));
}
var current = item.RemoteTrailers.FirstOrDefault(i => string.Equals(i.Url, url, StringComparison.OrdinalIgnoreCase));
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index dbe30f9a5..d9952cea8 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -997,7 +997,7 @@ namespace MediaBrowser.Controller.Entities
{
if (items == null)
{
- throw new ArgumentNullException("items");
+ throw new ArgumentNullException(nameof(items));
}
if (CollapseBoxSetItems(query, queryParent, user, configurationManager))
@@ -1252,7 +1252,7 @@ namespace MediaBrowser.Controller.Entities
{
if (user == null)
{
- throw new ArgumentNullException();
+ throw new ArgumentNullException(nameof(user));
}
//the true root should return our users root folder children
@@ -1332,7 +1332,7 @@ namespace MediaBrowser.Controller.Entities
{
if (user == null)
{
- throw new ArgumentNullException("user");
+ throw new ArgumentNullException(nameof(user));
}
var result = new Dictionary<Guid, BaseItem>();
@@ -1705,7 +1705,7 @@ namespace MediaBrowser.Controller.Entities
{
get
{
- // These are just far too slow.
+ // These are just far too slow.
if (this is ICollectionFolder)
{
return false;
diff --git a/MediaBrowser.Controller/Entities/ISupportsBoxSetGrouping.cs b/MediaBrowser.Controller/Entities/ISupportsBoxSetGrouping.cs
index fbe5a06d0..7eede6708 100644
--- a/MediaBrowser.Controller/Entities/ISupportsBoxSetGrouping.cs
+++ b/MediaBrowser.Controller/Entities/ISupportsBoxSetGrouping.cs
@@ -3,7 +3,7 @@ namespace MediaBrowser.Controller.Entities
{
/// <summary>
/// Marker interface to denote a class that supports being hidden underneath it's boxset.
- /// Just about anything can be placed into a boxset,
+ /// Just about anything can be placed into a boxset,
/// but movies should also only appear underneath and not outside separately (subject to configuration).
/// </summary>
public interface ISupportsBoxSetGrouping
diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
index bb99c0a84..b35e36e1b 100644
--- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
+++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
@@ -158,7 +158,7 @@ namespace MediaBrowser.Controller.Entities
public bool EnableGroupByMetadataKey { get; set; }
public bool? HasChapterImages { get; set; }
- public ValueTuple<string, SortOrder>[] OrderBy { get; set; }
+ public ValueTuple<string, SortOrder>[] OrderBy { get; set; }
public DateTime? MinDateCreated { get; set; }
public DateTime? MinDateLastSaved { get; set; }
diff --git a/MediaBrowser.Controller/Entities/PeopleHelper.cs b/MediaBrowser.Controller/Entities/PeopleHelper.cs
index 9f85b2aea..d09ef3a15 100644
--- a/MediaBrowser.Controller/Entities/PeopleHelper.cs
+++ b/MediaBrowser.Controller/Entities/PeopleHelper.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,12 +11,12 @@ namespace MediaBrowser.Controller.Entities
{
if (person == null)
{
- throw new ArgumentNullException("person");
+ throw new ArgumentNullException(nameof(person));
}
if (string.IsNullOrEmpty(person.Name))
{
- throw new ArgumentNullException();
+ throw new ArgumentException("The person's name was empty or null.", nameof(person));
}
// Normalize
@@ -103,7 +103,7 @@ namespace MediaBrowser.Controller.Entities
{
if (string.IsNullOrEmpty(name))
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
foreach (var i in people)
diff --git a/MediaBrowser.Controller/Entities/TagExtensions.cs b/MediaBrowser.Controller/Entities/TagExtensions.cs
index 84e61be4f..3e079a2a8 100644
--- a/MediaBrowser.Controller/Entities/TagExtensions.cs
+++ b/MediaBrowser.Controller/Entities/TagExtensions.cs
@@ -9,7 +9,7 @@ namespace MediaBrowser.Controller.Entities
{
if (string.IsNullOrWhiteSpace(name))
{
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
}
var current = item.Tags;
diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs
index f569c8021..57e3210a1 100644
--- a/MediaBrowser.Controller/Entities/User.cs
+++ b/MediaBrowser.Controller/Entities/User.cs
@@ -19,7 +19,7 @@ namespace MediaBrowser.Controller.Entities
public static IXmlSerializer XmlSerializer { get; set; }
/// <summary>
- /// From now on all user paths will be Id-based.
+ /// From now on all user paths will be Id-based.
/// This is for backwards compatibility.
/// </summary>
public bool UsesIdForConfigurationPath { get; set; }
@@ -182,7 +182,7 @@ namespace MediaBrowser.Controller.Entities
{
if (string.IsNullOrEmpty(newName))
{
- throw new ArgumentNullException("newName");
+ throw new ArgumentNullException(nameof(newName));
}
// If only the casing is changing, leave the file system alone
@@ -259,7 +259,7 @@ namespace MediaBrowser.Controller.Entities
{
if (string.IsNullOrEmpty(username))
{
- throw new ArgumentNullException("username");
+ throw new ArgumentNullException(nameof(username));
}
var safeFolderName = FileSystem.GetValidFilename(username);
diff --git a/MediaBrowser.Controller/Entities/UserItemData.cs b/MediaBrowser.Controller/Entities/UserItemData.cs
index 0e1326949..9bd58417a 100644
--- a/MediaBrowser.Controller/Entities/UserItemData.cs
+++ b/MediaBrowser.Controller/Entities/UserItemData.cs
@@ -41,7 +41,7 @@ namespace MediaBrowser.Controller.Entities
{
if (value.Value < 0 || value.Value > 10)
{
- throw new ArgumentOutOfRangeException("value", "A 0 to 10 rating is required for UserItemData.");
+ throw new ArgumentOutOfRangeException(nameof(value), "A 0 to 10 rating is required for UserItemData.");
}
}
@@ -90,7 +90,7 @@ namespace MediaBrowser.Controller.Entities
public int? SubtitleStreamIndex { get; set; }
public const double MinLikeValue = 6.5;
-
+
/// <summary>
/// This is an interpreted property to indicate likes or dislikes
/// This should never be serialized.
diff --git a/MediaBrowser.Controller/Entities/UserRootFolder.cs b/MediaBrowser.Controller/Entities/UserRootFolder.cs
index f8e843d92..abfcd7984 100644
--- a/MediaBrowser.Controller/Entities/UserRootFolder.cs
+++ b/MediaBrowser.Controller/Entities/UserRootFolder.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Model.Serialization;
+using MediaBrowser.Model.Serialization;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Library;
using MediaBrowser.Model.Querying;
@@ -78,7 +78,7 @@ namespace MediaBrowser.Controller.Entities
return new QueryResult<BaseItem>
{
TotalRecordCount = totalCount,
- Items = itemsArray
+ Items = itemsArray //TODO Fix The co-variant conversion between Folder[] and BaseItem[], this can generate runtime issues.
};
}
diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
index b50a12d52..284ff2a53 100644
--- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs
+++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities.Audio;
+using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
@@ -412,7 +412,7 @@ namespace MediaBrowser.Controller.Entities
{
return new QueryResult<BaseItem>
{
- Items = result.Items,
+ Items = result.Items, //TODO Fix The co-variant conversion between T[] and BaseItem[], this can generate runtime issues if T is not BaseItem.
TotalRecordCount = result.TotalRecordCount
};
}
diff --git a/MediaBrowser.Controller/IO/FileData.cs b/MediaBrowser.Controller/IO/FileData.cs
index c0cf51ab2..a95d562a2 100644
--- a/MediaBrowser.Controller/IO/FileData.cs
+++ b/MediaBrowser.Controller/IO/FileData.cs
@@ -46,11 +46,11 @@ namespace MediaBrowser.Controller.IO
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
if (args == null)
{
- throw new ArgumentNullException("args");
+ throw new ArgumentNullException(nameof(args));
}
var entries = directoryService.GetFileSystemEntries(path);
diff --git a/MediaBrowser.Controller/IServerApplicationHost.cs b/MediaBrowser.Controller/IServerApplicationHost.cs
index 4dc559031..57a3bbc0a 100644
--- a/MediaBrowser.Controller/IServerApplicationHost.cs
+++ b/MediaBrowser.Controller/IServerApplicationHost.cs
@@ -37,7 +37,7 @@ namespace MediaBrowser.Controller
/// </summary>
/// <value>The HTTPS port.</value>
int HttpsPort { get; }
-
+
/// <summary>
/// Gets a value indicating whether [supports HTTPS].
/// </summary>
diff --git a/MediaBrowser.Controller/IServerApplicationPaths.cs b/MediaBrowser.Controller/IServerApplicationPaths.cs
index 5fb7968dd..0358b9264 100644
--- a/MediaBrowser.Controller/IServerApplicationPaths.cs
+++ b/MediaBrowser.Controller/IServerApplicationPaths.cs
@@ -12,11 +12,10 @@ namespace MediaBrowser.Controller
/// <summary>
/// Gets the application resources path. This is the path to the folder containing resources that are deployed as part of the application
- /// For example, this folder contains dashboard-ui and swagger-ui
/// </summary>
/// <value>The application resources path.</value>
string ApplicationResourcesPath { get; }
-
+
/// <summary>
/// Gets the path to the default user view directory. Used if no specific user view is defined.
/// </summary>
diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs
index d572716fa..cefa9ebdf 100644
--- a/MediaBrowser.Controller/Library/ILibraryManager.cs
+++ b/MediaBrowser.Controller/Library/ILibraryManager.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Providers;
@@ -163,7 +163,6 @@ namespace MediaBrowser.Controller.Library
/// Adds the parts.
/// </summary>
/// <param name="rules">The rules.</param>
- /// <param name="pluginFolders">The plugin folders.</param>
/// <param name="resolvers">The resolvers.</param>
/// <param name="introProviders">The intro providers.</param>
/// <param name="itemComparers">The item comparers.</param>
@@ -298,7 +297,7 @@ namespace MediaBrowser.Controller.Library
string name,
Guid parentId,
string viewType,
- string sortNamen);
+ string sortName);
/// <summary>
/// Gets the named view.
@@ -547,4 +546,4 @@ namespace MediaBrowser.Controller.Library
string videoPath,
string[] files);
}
-} \ No newline at end of file
+}
diff --git a/MediaBrowser.Controller/Library/IUserManager.cs b/MediaBrowser.Controller/Library/IUserManager.cs
index d29b164ef..154ef3b05 100644
--- a/MediaBrowser.Controller/Library/IUserManager.cs
+++ b/MediaBrowser.Controller/Library/IUserManager.cs
@@ -123,7 +123,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="user">The user.</param>
/// <returns>Task.</returns>
void ResetEasyPassword(User user);
-
+
/// <summary>
/// Changes the password.
/// </summary>
@@ -133,7 +133,7 @@ namespace MediaBrowser.Controller.Library
/// Changes the easy password.
/// </summary>
void ChangeEasyPassword(User user, string newPassword, string newPasswordSha1);
-
+
/// <summary>
/// Gets the user dto.
/// </summary>
diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.cs
index 9812802e7..4d1a4ed2f 100644
--- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs
+++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Providers;
using System;
using System.Collections.Generic;
@@ -126,7 +126,7 @@ namespace MediaBrowser.Controller.Library
{
var item = parent as T;
- // Just in case the user decided to nest episodes.
+ // Just in case the user decided to nest episodes.
// Not officially supported but in some cases we can handle it.
if (item == null)
{
@@ -155,7 +155,7 @@ namespace MediaBrowser.Controller.Library
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException();
+ throw new ArgumentException("The path was empty or null.", nameof(path));
}
if (AdditionalLocations == null)
@@ -190,7 +190,7 @@ namespace MediaBrowser.Controller.Library
{
if (string.IsNullOrEmpty(name))
{
- throw new ArgumentNullException();
+ throw new ArgumentException("The name was empty or null.", nameof(name));
}
return GetFileSystemEntryByPath(System.IO.Path.Combine(Path, name));
@@ -206,7 +206,7 @@ namespace MediaBrowser.Controller.Library
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException();
+ throw new ArgumentException("The path was empty or null.", nameof(path));
}
foreach (var file in FileSystemChildren)
diff --git a/MediaBrowser.Controller/LiveTv/ChannelInfo.cs b/MediaBrowser.Controller/LiveTv/ChannelInfo.cs
index c000da852..f45c7b71a 100644
--- a/MediaBrowser.Controller/LiveTv/ChannelInfo.cs
+++ b/MediaBrowser.Controller/LiveTv/ChannelInfo.cs
@@ -36,7 +36,7 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <value>The tuner host identifier.</value>
public string TunerHostId { get; set; }
-
+
/// <summary>
/// Gets or sets the type of the channel.
/// </summary>
diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs
index 601fb69aa..5986474d8 100644
--- a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs
+++ b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs
@@ -99,7 +99,7 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="program">The program.</param>
/// <returns>Task{SeriesTimerInfo}.</returns>
Task<SeriesTimerInfo> GetNewTimerDefaultsAsync(CancellationToken cancellationToken, ProgramInfo program = null);
-
+
/// <summary>
/// Gets the series timers asynchronous.
/// </summary>
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs b/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs
index 4da238acf..20e5d228b 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvServiceStatusInfo.cs
@@ -39,7 +39,7 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <value><c>true</c> if this instance is visible; otherwise, <c>false</c>.</value>
public bool IsVisible { get; set; }
-
+
public LiveTvServiceStatusInfo()
{
Tuners = new List<LiveTvTunerInfo>();
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvTunerInfo.cs b/MediaBrowser.Controller/LiveTv/LiveTvTunerInfo.cs
index 5c001f288..ade25abdc 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvTunerInfo.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvTunerInfo.cs
@@ -28,7 +28,7 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <value>The URL.</value>
public string Url { get; set; }
-
+
/// <summary>
/// Gets or sets the status.
/// </summary>
@@ -52,7 +52,7 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <value>The name of the program.</value>
public string ProgramName { get; set; }
-
+
/// <summary>
/// Gets or sets the clients.
/// </summary>
@@ -64,7 +64,7 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <value><c>true</c> if this instance can reset; otherwise, <c>false</c>.</value>
public bool CanReset { get; set; }
-
+
public LiveTvTunerInfo()
{
Clients = new List<string>();
diff --git a/MediaBrowser.Controller/LiveTv/RecordingInfo.cs b/MediaBrowser.Controller/LiveTv/RecordingInfo.cs
index 3006b9bbe..0ca4749d7 100644
--- a/MediaBrowser.Controller/LiveTv/RecordingInfo.cs
+++ b/MediaBrowser.Controller/LiveTv/RecordingInfo.cs
@@ -22,7 +22,7 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <value>The timer identifier.</value>
public string TimerId { get; set; }
-
+
/// <summary>
/// ChannelId of the recording.
/// </summary>
@@ -33,7 +33,7 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <value>The type of the channel.</value>
public ChannelType ChannelType { get; set; }
-
+
/// <summary>
/// Name of the recording.
/// </summary>
@@ -50,7 +50,7 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <value>The URL.</value>
public string Url { get; set; }
-
+
/// <summary>
/// Gets or sets the overview.
/// </summary>
diff --git a/MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs b/MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs
index 5c73ed833..a9bb9f4e8 100644
--- a/MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs
+++ b/MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs
@@ -15,13 +15,13 @@ namespace MediaBrowser.Controller.LiveTv
/// ChannelId of the recording.
/// </summary>
public string ChannelId { get; set; }
-
+
/// <summary>
/// Gets or sets the program identifier.
/// </summary>
/// <value>The program identifier.</value>
public string ProgramId { get; set; }
-
+
/// <summary>
/// Name of the recording.
/// </summary>
@@ -66,7 +66,7 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <value><c>true</c> if [record new only]; otherwise, <c>false</c>.</value>
public bool RecordNewOnly { get; set; }
-
+
/// <summary>
/// Gets or sets the days.
/// </summary>
@@ -108,7 +108,7 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <value>The series identifier.</value>
public string SeriesId { get; set; }
-
+
public SeriesTimerInfo()
{
Days = new List<DayOfWeek>();
diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
index 3decbc42f..5898d8f98 100644
--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj
+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
@@ -3,6 +3,8 @@
<PropertyGroup>
<Authors>Jellyfin Contributors</Authors>
<PackageId>Jellyfin.Controller</PackageId>
+ <PackageLicenseUrl>https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt</PackageLicenseUrl>
+ <RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
index 4fb9a711e..5dca45c1e 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
@@ -740,7 +740,7 @@ namespace MediaBrowser.Controller.MediaEncoding
level = NormalizeTranscodingLevel(state.OutputVideoCodec, level);
// h264_qsv and h264_nvenc expect levels to be expressed as a decimal. libx264 supports decimal and non-decimal format
- // also needed for libx264 due to https://trac.ffmpeg.org/ticket/3307
+ // also needed for libx264 due to https://trac.ffmpeg.org/ticket/3307
if (string.Equals(videoEncoder, "h264_qsv", StringComparison.OrdinalIgnoreCase) ||
string.Equals(videoEncoder, "libx264", StringComparison.OrdinalIgnoreCase))
{
@@ -1137,7 +1137,7 @@ namespace MediaBrowser.Controller.MediaEncoding
/// <summary>
/// Gets the number of audio channels to specify on the command line
/// </summary>
- /// <param name="request">The request.</param>
+ /// <param name="state">The state.</param>
/// <param name="audioStream">The audio stream.</param>
/// <param name="outputAudioCodec">The output audio codec.</param>
/// <returns>System.Nullable{System.Int32}.</returns>
@@ -1706,7 +1706,8 @@ namespace MediaBrowser.Controller.MediaEncoding
if (string.Equals(outputVideoCodec, "libvpx", StringComparison.OrdinalIgnoreCase))
{
// per docs:
- // -threads number of threads to use for encoding, can't be 0 [auto] with VP8 (recommended value : number of real cores - 1)
+ // -threads number of threads to use for encoding, can't be 0 [auto] with VP8
+ // (recommended value : number of real cores - 1)
return Math.Max(Environment.ProcessorCount - 1, 1);
}
@@ -1907,11 +1908,11 @@ namespace MediaBrowser.Controller.MediaEncoding
{
if (state == null)
{
- throw new ArgumentNullException("state");
+ throw new ArgumentNullException(nameof(state));
}
if (mediaSource == null)
{
- throw new ArgumentNullException("mediaSource");
+ throw new ArgumentNullException(nameof(mediaSource));
}
var path = mediaSource.Path;
diff --git a/MediaBrowser.Controller/MediaEncoding/ImageEncodingOptions.cs b/MediaBrowser.Controller/MediaEncoding/ImageEncodingOptions.cs
index a8d1e5a0f..d69c2e47d 100644
--- a/MediaBrowser.Controller/MediaEncoding/ImageEncodingOptions.cs
+++ b/MediaBrowser.Controller/MediaEncoding/ImageEncodingOptions.cs
@@ -4,7 +4,7 @@ namespace MediaBrowser.Controller.MediaEncoding
public class ImageEncodingOptions
{
public string InputPath { get; set; }
-
+
public int? Width { get; set; }
public int? Height { get; set; }
@@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.MediaEncoding
public int? MaxHeight { get; set; }
public int? Quality { get; set; }
-
+
public string Format { get; set; }
}
}
diff --git a/MediaBrowser.Controller/MediaEncoding/JobLogger.cs b/MediaBrowser.Controller/MediaEncoding/JobLogger.cs
index 8bb826bd1..0554822a8 100644
--- a/MediaBrowser.Controller/MediaEncoding/JobLogger.cs
+++ b/MediaBrowser.Controller/MediaEncoding/JobLogger.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Model.Extensions;
+using MediaBrowser.Model.Extensions;
using System;
using System.Globalization;
using System.IO;
@@ -39,6 +39,7 @@ namespace MediaBrowser.Controller.MediaEncoding
}
catch (ObjectDisposedException)
{
+ //TODO Investigate and properly fix.
// Don't spam the log. This doesn't seem to throw in windows, but sometimes under linux
}
catch (Exception ex)
diff --git a/MediaBrowser.Controller/Net/AuthorizationInfo.cs b/MediaBrowser.Controller/Net/AuthorizationInfo.cs
index 848d8fa15..86c7b7e0f 100644
--- a/MediaBrowser.Controller/Net/AuthorizationInfo.cs
+++ b/MediaBrowser.Controller/Net/AuthorizationInfo.cs
@@ -9,12 +9,12 @@ namespace MediaBrowser.Controller.Net
/// Gets or sets the user identifier.
/// </summary>
/// <value>The user identifier.</value>
- public Guid UserId {
+ public Guid UserId {
get {
return User == null ? Guid.Empty : User.Id;
}
}
-
+
/// <summary>
/// Gets or sets the device identifier.
/// </summary>
diff --git a/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs b/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs
index 31ec149bf..b97b2f97d 100644
--- a/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs
+++ b/MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Model.Net;
+using MediaBrowser.Model.Net;
using MediaBrowser.Model.Threading;
using System.Collections.Generic;
using System.Globalization;
@@ -50,7 +50,7 @@ namespace MediaBrowser.Controller.Net
{
if (logger == null)
{
- throw new ArgumentNullException("logger");
+ throw new ArgumentNullException(nameof(logger));
}
Logger = logger;
@@ -65,7 +65,7 @@ namespace MediaBrowser.Controller.Net
{
if (message == null)
{
- throw new ArgumentNullException("message");
+ throw new ArgumentNullException(nameof(message));
}
if (string.Equals(message.MessageType, Name + "Start", StringComparison.OrdinalIgnoreCase))
@@ -93,7 +93,7 @@ namespace MediaBrowser.Controller.Net
protected virtual void ParseMessageParams(string[] values)
{
-
+
}
/// <summary>
@@ -269,7 +269,7 @@ namespace MediaBrowser.Controller.Net
}
catch (ObjectDisposedException)
{
-
+ //TODO Investigate and properly fix.
}
}
@@ -280,10 +280,13 @@ namespace MediaBrowser.Controller.Net
}
catch (ObjectDisposedException)
{
-
+ //TODO Investigate and properly fix.
}
- ActiveConnections.Remove(connection);
+ lock (ActiveConnections)
+ {
+ ActiveConnections.Remove(connection);
+ }
}
/// <summary>
diff --git a/MediaBrowser.Controller/Net/IAuthorizationContext.cs b/MediaBrowser.Controller/Net/IAuthorizationContext.cs
index 5a9d0aa30..9b9b2226a 100644
--- a/MediaBrowser.Controller/Net/IAuthorizationContext.cs
+++ b/MediaBrowser.Controller/Net/IAuthorizationContext.cs
@@ -10,7 +10,7 @@ namespace MediaBrowser.Controller.Net
/// <param name="requestContext">The request context.</param>
/// <returns>AuthorizationInfo.</returns>
AuthorizationInfo GetAuthorizationInfo(object requestContext);
-
+
/// <summary>
/// Gets the authorization information.
/// </summary>
diff --git a/MediaBrowser.Controller/Net/IHttpResultFactory.cs b/MediaBrowser.Controller/Net/IHttpResultFactory.cs
index f8e631de3..d23733f5e 100644
--- a/MediaBrowser.Controller/Net/IHttpResultFactory.cs
+++ b/MediaBrowser.Controller/Net/IHttpResultFactory.cs
@@ -24,7 +24,7 @@ namespace MediaBrowser.Controller.Net
object GetResult(IRequest requestContext, byte[] content, string contentType, IDictionary<string, string> responseHeaders = null);
object GetResult(IRequest requestContext, Stream content, string contentType, IDictionary<string, string> responseHeaders = null);
- object GetResult(IRequest requestContext, string content, string contentType, IDictionary<string, string> responseHeaders = null);
+ object GetResult(IRequest requestContext, string content, string contentType, IDictionary<string, string> responseHeaders = null);
object GetRedirectResult(string url);
@@ -43,10 +43,10 @@ namespace MediaBrowser.Controller.Net
/// <param name="responseHeaders">The response headers.</param>
/// <param name="isHeadRequest">if set to <c>true</c> [is head request].</param>
/// <returns>System.Object.</returns>
- Task<object> GetStaticResult(IRequest requestContext,
- Guid cacheKey,
+ Task<object> GetStaticResult(IRequest requestContext,
+ Guid cacheKey,
DateTime? lastDateModified,
- TimeSpan? cacheDuration,
+ TimeSpan? cacheDuration,
string contentType, Func<Task<Stream>> factoryFn,
IDictionary<string, string> responseHeaders = null,
bool isHeadRequest = false);
@@ -74,7 +74,7 @@ namespace MediaBrowser.Controller.Net
/// <param name="requestContext">The request context.</param>
/// <param name="options">The options.</param>
/// <returns>System.Object.</returns>
- Task<object> GetStaticFileResult(IRequest requestContext,
+ Task<object> GetStaticFileResult(IRequest requestContext,
StaticFileResultOptions options);
}
}
diff --git a/MediaBrowser.Controller/Net/ISessionContext.cs b/MediaBrowser.Controller/Net/ISessionContext.cs
index 37ddbc2b3..40e76c252 100644
--- a/MediaBrowser.Controller/Net/ISessionContext.cs
+++ b/MediaBrowser.Controller/Net/ISessionContext.cs
@@ -5,7 +5,7 @@ using MediaBrowser.Model.Services;
namespace MediaBrowser.Controller.Net
{
- public interface ISessionContext
+ public interface ISessionContext
{
SessionInfo GetSession(object requestContext);
User GetUser(object requestContext);
diff --git a/MediaBrowser.Controller/Persistence/IUserRepository.cs b/MediaBrowser.Controller/Persistence/IUserRepository.cs
index 2817c4255..7d56924b6 100644
--- a/MediaBrowser.Controller/Persistence/IUserRepository.cs
+++ b/MediaBrowser.Controller/Persistence/IUserRepository.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities;
using System.Collections.Generic;
using System.Threading;
@@ -13,7 +13,6 @@ namespace MediaBrowser.Controller.Persistence
/// Deletes the user.
/// </summary>
/// <param name="user">The user.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
void DeleteUser(User user);
diff --git a/MediaBrowser.Controller/Plugins/ILocalizablePlugin.cs b/MediaBrowser.Controller/Plugins/ILocalizablePlugin.cs
index d294107d7..e914fc200 100644
--- a/MediaBrowser.Controller/Plugins/ILocalizablePlugin.cs
+++ b/MediaBrowser.Controller/Plugins/ILocalizablePlugin.cs
@@ -15,6 +15,6 @@ namespace MediaBrowser.Controller.Plugins
// Find all dictionaries using GetManifestResourceNames, start start with the prefix
// Return the one for the culture if exists, otherwise return the default
return null;
- }
+ }
}
}
diff --git a/MediaBrowser.Controller/Properties/AssemblyInfo.cs b/MediaBrowser.Controller/Properties/AssemblyInfo.cs
index 844b93f37..007a1d739 100644
--- a/MediaBrowser.Controller/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.Controller/Properties/AssemblyInfo.cs
@@ -1,27 +1,21 @@
-using System.Reflection;
+using System.Reflection;
+using System.Resources;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MediaBrowser.Controller")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("MediaBrowser.Controller")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-// \ No newline at end of file
diff --git a/MediaBrowser.Controller/Providers/ILocalMetadataProvider.cs b/MediaBrowser.Controller/Providers/ILocalMetadataProvider.cs
index fc4cca19c..68f1ae589 100644
--- a/MediaBrowser.Controller/Providers/ILocalMetadataProvider.cs
+++ b/MediaBrowser.Controller/Providers/ILocalMetadataProvider.cs
@@ -18,7 +18,7 @@ namespace MediaBrowser.Controller.Providers
/// <param name="directoryService">The directory service.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{MetadataResult{`0}}.</returns>
- Task<MetadataResult<TItemType>> GetMetadata(ItemInfo info,
+ Task<MetadataResult<TItemType>> GetMetadata(ItemInfo info,
IDirectoryService directoryService,
CancellationToken cancellationToken);
}
diff --git a/MediaBrowser.Controller/Providers/IPreRefreshProvider.cs b/MediaBrowser.Controller/Providers/IPreRefreshProvider.cs
index 608674905..4170bb375 100644
--- a/MediaBrowser.Controller/Providers/IPreRefreshProvider.cs
+++ b/MediaBrowser.Controller/Providers/IPreRefreshProvider.cs
@@ -2,6 +2,6 @@ namespace MediaBrowser.Controller.Providers
{
public interface IPreRefreshProvider : ICustomMetadataProvider
{
-
+
}
} \ No newline at end of file
diff --git a/MediaBrowser.Controller/Providers/IRemoteImageProvider.cs b/MediaBrowser.Controller/Providers/IRemoteImageProvider.cs
index 5db5ddbb2..32f51c650 100644
--- a/MediaBrowser.Controller/Providers/IRemoteImageProvider.cs
+++ b/MediaBrowser.Controller/Providers/IRemoteImageProvider.cs
@@ -19,7 +19,7 @@ namespace MediaBrowser.Controller.Providers
/// <param name="item">The item.</param>
/// <returns>IEnumerable{ImageType}.</returns>
IEnumerable<ImageType> GetSupportedImages(BaseItem item);
-
+
/// <summary>
/// Gets the images.
/// </summary>
diff --git a/MediaBrowser.Controller/Resolvers/IItemResolver.cs b/MediaBrowser.Controller/Resolvers/IItemResolver.cs
index 3af5d5f7f..298ec248a 100644
--- a/MediaBrowser.Controller/Resolvers/IItemResolver.cs
+++ b/MediaBrowser.Controller/Resolvers/IItemResolver.cs
@@ -29,7 +29,7 @@ namespace MediaBrowser.Controller.Resolvers
public interface IMultiItemResolver
{
MultiItemResolverResult ResolveMultiple(Folder parent,
- List<FileSystemMetadata> files,
+ List<FileSystemMetadata> files,
string collectionType,
IDirectoryService directoryService);
}
diff --git a/MediaBrowser.Controller/Security/AuthenticationInfo.cs b/MediaBrowser.Controller/Security/AuthenticationInfo.cs
index c75bf89e4..ecb3866d0 100644
--- a/MediaBrowser.Controller/Security/AuthenticationInfo.cs
+++ b/MediaBrowser.Controller/Security/AuthenticationInfo.cs
@@ -33,7 +33,7 @@ namespace MediaBrowser.Controller.Security
/// </summary>
/// <value>The application version.</value>
public string AppVersion { get; set; }
-
+
/// <summary>
/// Gets or sets the name of the device.
/// </summary>
diff --git a/MediaBrowser.Controller/Security/AuthenticationInfoQuery.cs b/MediaBrowser.Controller/Security/AuthenticationInfoQuery.cs
index 125534c46..2fa988ec1 100644
--- a/MediaBrowser.Controller/Security/AuthenticationInfoQuery.cs
+++ b/MediaBrowser.Controller/Security/AuthenticationInfoQuery.cs
@@ -21,7 +21,7 @@ namespace MediaBrowser.Controller.Security
/// </summary>
/// <value>The access token.</value>
public string AccessToken { get; set; }
-
+
/// <summary>
/// Gets or sets a value indicating whether this instance is active.
/// </summary>
@@ -33,7 +33,7 @@ namespace MediaBrowser.Controller.Security
/// </summary>
/// <value><c>null</c> if [has user] contains no value, <c>true</c> if [has user]; otherwise, <c>false</c>.</value>
public bool? HasUser { get; set; }
-
+
/// <summary>
/// Gets or sets the start index.
/// </summary>
diff --git a/MediaBrowser.Controller/Security/IAuthenticationRepository.cs b/MediaBrowser.Controller/Security/IAuthenticationRepository.cs
index 2843c6b73..4f454f895 100644
--- a/MediaBrowser.Controller/Security/IAuthenticationRepository.cs
+++ b/MediaBrowser.Controller/Security/IAuthenticationRepository.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Model.Devices;
+using MediaBrowser.Model.Devices;
using MediaBrowser.Model.Querying;
using System.Threading;
@@ -10,7 +10,6 @@ namespace MediaBrowser.Controller.Security
/// Creates the specified information.
/// </summary>
/// <param name="info">The information.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
void Create(AuthenticationInfo info);
@@ -18,7 +17,6 @@ namespace MediaBrowser.Controller.Security
/// Updates the specified information.
/// </summary>
/// <param name="info">The information.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
void Update(AuthenticationInfo info);
diff --git a/MediaBrowser.Controller/Session/ISessionManager.cs b/MediaBrowser.Controller/Session/ISessionManager.cs
index eca345cbc..1b51ddc16 100644
--- a/MediaBrowser.Controller/Session/ISessionManager.cs
+++ b/MediaBrowser.Controller/Session/ISessionManager.cs
@@ -43,7 +43,7 @@ namespace MediaBrowser.Controller.Session
event EventHandler<SessionEventArgs> SessionEnded;
event EventHandler<SessionEventArgs> SessionActivity;
-
+
/// <summary>
/// Occurs when [capabilities changed].
/// </summary>
@@ -58,7 +58,7 @@ namespace MediaBrowser.Controller.Session
/// Occurs when [authentication succeeded].
/// </summary>
event EventHandler<GenericEventArgs<AuthenticationResult>> AuthenticationSucceeded;
-
+
/// <summary>
/// Gets the sessions.
/// </summary>
@@ -119,7 +119,7 @@ namespace MediaBrowser.Controller.Session
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task SendGeneralCommand(string controllingSessionId, string sessionId, GeneralCommand command, CancellationToken cancellationToken);
-
+
/// <summary>
/// Sends the message command.
/// </summary>
@@ -189,7 +189,7 @@ namespace MediaBrowser.Controller.Session
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task SendMessageToUserDeviceSessions<T>(string deviceId, string name, T data, CancellationToken cancellationToken);
-
+
/// <summary>
/// Sends the restart required message.
/// </summary>
diff --git a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs
index e46709b78..890ceee31 100644
--- a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs
+++ b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Providers;
@@ -63,7 +63,7 @@ namespace MediaBrowser.LocalMetadata.Images
return false;
}
- private IEnumerable<FileSystemMetadata> GetFiles(BaseItem item, bool includeDirectories, IDirectoryService directoryService)
+ private static IEnumerable<FileSystemMetadata> GetFiles(BaseItem item, bool includeDirectories, IDirectoryService directoryService)
{
if (!item.IsFileProtocol)
{
diff --git a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs
index c22ca4d60..c3960bc8b 100644
--- a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs
+++ b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs
@@ -56,12 +56,12 @@ namespace MediaBrowser.LocalMetadata.Parsers
{
if (item == null)
{
- throw new ArgumentNullException();
+ throw new ArgumentNullException(nameof(item));
}
if (string.IsNullOrEmpty(metadataFile))
{
- throw new ArgumentNullException();
+ throw new ArgumentException("The metadata file was empty or null.",nameof(metadataFile));
}
var settings = XmlReaderSettingsFactory.Create(false);
diff --git a/MediaBrowser.LocalMetadata/Properties/AssemblyInfo.cs b/MediaBrowser.LocalMetadata/Properties/AssemblyInfo.cs
index 0d5a8003e..3eac83708 100644
--- a/MediaBrowser.LocalMetadata/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.LocalMetadata/Properties/AssemblyInfo.cs
@@ -1,33 +1,21 @@
-using System.Reflection;
+using System.Reflection;
+using System.Resources;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MediaBrowser.LocalMetadata")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("MediaBrowser.LocalMetadata")]
-[assembly: AssemblyCopyright("Copyright © 2014")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("1c669501-2113-493a-b0ed-f8fd26311941")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")] \ No newline at end of file
diff --git a/MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.cs b/MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.cs
index 557f4d637..da96f3855 100644
--- a/MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.cs
+++ b/MediaBrowser.MediaEncoding/BdInfo/BdInfoExaminer.cs
@@ -1,4 +1,4 @@
-using BDInfo;
+using BDInfo;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.MediaInfo;
using System;
@@ -32,7 +32,7 @@ namespace MediaBrowser.MediaEncoding.BdInfo
{
if (string.IsNullOrWhiteSpace(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
var bdrom = new BDROM(path, _fileSystem, _textEncoding);
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
index 9761de98f..1edc5c201 100644
--- a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs
@@ -46,7 +46,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
private readonly ILogger _logger;
private readonly IMediaSourceManager _mediaSourceManager;
- public EncodingJob(ILogger logger, IMediaSourceManager mediaSourceManager) :
+ public EncodingJob(ILogger logger, IMediaSourceManager mediaSourceManager) :
base(logger, mediaSourceManager, TranscodingJobType.Progressive)
{
_logger = logger;
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
index 4e6ee89e1..34bc8d1b9 100644
--- a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs
@@ -25,7 +25,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
private readonly IMediaEncoder _mediaEncoder;
protected static readonly CultureInfo UsCulture = new CultureInfo("en-US");
-
+
public EncodingJobFactory(ILogger logger, ILibraryManager libraryManager, IMediaSourceManager mediaSourceManager, IConfigurationManager config, IMediaEncoder mediaEncoder)
{
_logger = logger;
@@ -255,7 +255,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
if (profile == null)
{
- // Don't use settings from the default profile.
+ // Don't use settings from the default profile.
// Only use a specific profile if it was requested.
return;
}
diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
index a93dd9742..b19271d11 100644
--- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
@@ -70,7 +70,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
private readonly string _originalFFMpegPath;
private readonly string _originalFFProbePath;
private readonly int DefaultImageExtractionTimeoutMs;
- private readonly IEnvironmentInfo _environmentInfo;
public MediaEncoder(ILogger logger,
IJsonSerializer jsonSerializer,
@@ -89,8 +88,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
IHttpClient httpClient,
IZipClient zipClient,
IProcessFactory processFactory,
- int defaultImageExtractionTimeoutMs,
- IEnvironmentInfo environmentInfo)
+ int defaultImageExtractionTimeoutMs)
{
_logger = logger;
_jsonSerializer = jsonSerializer;
@@ -107,46 +105,13 @@ namespace MediaBrowser.MediaEncoding.Encoder
_zipClient = zipClient;
_processFactory = processFactory;
DefaultImageExtractionTimeoutMs = defaultImageExtractionTimeoutMs;
- _environmentInfo = environmentInfo;
FFProbePath = ffProbePath;
FFMpegPath = ffMpegPath;
_originalFFProbePath = ffProbePath;
_originalFFMpegPath = ffMpegPath;
-
_hasExternalEncoder = hasExternalEncoder;
}
- private readonly object _logLock = new object();
- public void SetLogFilename(string name)
- {
- lock (_logLock)
- {
- try
- {
- _environmentInfo.SetProcessEnvironmentVariable("FFREPORT", "file=" + name + ":level=32");
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Error setting FFREPORT environment variable");
- }
- }
- }
-
- public void ClearLogFilename()
- {
- lock (_logLock)
- {
- try
- {
- _environmentInfo.SetProcessEnvironmentVariable("FFREPORT", null);
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Error setting FFREPORT environment variable");
- }
- }
- }
-
public string EncoderLocationType
{
get
@@ -246,7 +211,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
{
if (string.IsNullOrWhiteSpace(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
if (!FileSystem.FileExists(path) && !FileSystem.DirectoryExists(path))
@@ -362,7 +327,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
private Tuple<string, string> GetPathsFromDirectory(string path)
{
- // Since we can't predict the file extension, first try directly within the folder
+ // Since we can't predict the file extension, first try directly within the folder
// If that doesn't pan out, then do a recursive search
var files = FileSystem.GetFilePaths(path);
@@ -525,7 +490,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
CreateNoWindow = true,
UseShellExecute = false,
- // Must consume both or ffmpeg may hang due to deadlocks. See comments below.
+ // Must consume both or ffmpeg may hang due to deadlocks. See comments below.
RedirectStandardOutput = true,
FileName = FFProbePath,
Arguments = string.Format(args, probeSizeArgument, inputPath).Trim(),
@@ -642,13 +607,13 @@ namespace MediaBrowser.MediaEncoding.Encoder
{
if (string.IsNullOrEmpty(inputPath))
{
- throw new ArgumentNullException("inputPath");
+ throw new ArgumentNullException(nameof(inputPath));
}
var tempExtractPath = Path.Combine(ConfigurationManager.ApplicationPaths.TempDirectory, Guid.NewGuid() + ".jpg");
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(tempExtractPath));
- // apply some filters to thumbnail extracted below (below) crop any black lines that we made and get the correct ar then scale to width 600.
+ // apply some filters to thumbnail extracted below (below) crop any black lines that we made and get the correct ar then scale to width 600.
// This filter chain may have adverse effects on recorded tv thumbnails if ar changes during presentation ex. commercials @ diff ar
var vf = "scale=600:trunc(600/dar/2)*2";
@@ -676,7 +641,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
break;
}
}
-
+
var mapArg = imageStreamIndex.HasValue ? (" -map 0:v:" + imageStreamIndex.Value.ToString(CultureInfo.InvariantCulture)) : string.Empty;
var enableThumbnail = !new List<string> { "wtv" }.Contains(container ?? string.Empty, StringComparer.OrdinalIgnoreCase);
diff --git a/MediaBrowser.MediaEncoding/Probing/FFProbeHelpers.cs b/MediaBrowser.MediaEncoding/Probing/FFProbeHelpers.cs
index 396c85e21..12d906bb2 100644
--- a/MediaBrowser.MediaEncoding/Probing/FFProbeHelpers.cs
+++ b/MediaBrowser.MediaEncoding/Probing/FFProbeHelpers.cs
@@ -13,7 +13,7 @@ namespace MediaBrowser.MediaEncoding.Probing
{
if (result == null)
{
- throw new ArgumentNullException("result");
+ throw new ArgumentNullException(nameof(result));
}
if (result.format != null && result.format.tags != null)
diff --git a/MediaBrowser.MediaEncoding/Probing/InternalMediaInfoResult.cs b/MediaBrowser.MediaEncoding/Probing/InternalMediaInfoResult.cs
index eef273250..350a2e3e5 100644
--- a/MediaBrowser.MediaEncoding/Probing/InternalMediaInfoResult.cs
+++ b/MediaBrowser.MediaEncoding/Probing/InternalMediaInfoResult.cs
@@ -149,7 +149,7 @@ namespace MediaBrowser.MediaEncoding.Probing
/// </summary>
/// <value>The bits_per_raw_sample.</value>
public int bits_per_raw_sample { get; set; }
-
+
/// <summary>
/// Gets or sets the r_frame_rate.
/// </summary>
diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
index 5367a87f7..2d3352f64 100644
--- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
+++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
@@ -132,7 +132,7 @@ namespace MediaBrowser.MediaEncoding.Probing
if (!string.IsNullOrWhiteSpace(iTunEXTC))
{
var parts = iTunEXTC.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
- // Example
+ // Example
// mpaa|G|100|For crude humor
if (parts.Length > 1)
{
@@ -423,7 +423,7 @@ namespace MediaBrowser.MediaEncoding.Probing
Type = PersonType.Writer
});
}
-
+
}
else if (string.Equals(key, "producers", StringComparison.OrdinalIgnoreCase))
{
@@ -619,7 +619,7 @@ namespace MediaBrowser.MediaEncoding.Probing
else if (string.Equals(stream.Codec, "mjpeg", StringComparison.OrdinalIgnoreCase))
{
// How to differentiate between video and embedded image?
- // The only difference I've seen thus far is presence of codec tag, also embedded images have high (unusual) framerates
+ // The only difference I've seen thus far is presence of codec tag, also embedded images have high (unusual) framerates
if (!string.IsNullOrWhiteSpace(stream.CodecTag))
{
stream.Type = MediaStreamType.Video;
@@ -1054,7 +1054,7 @@ namespace MediaBrowser.MediaEncoding.Probing
/// <returns>System.String[][].</returns>
private IEnumerable<string> Split(string val, bool allowCommaDelimiter)
{
- // Only use the comma as a delimeter if there are no slashes or pipes.
+ // Only use the comma as a delimeter if there are no slashes or pipes.
// We want to be careful not to split names that have commas in them
var delimeter = !allowCommaDelimiter || _nameDelimiters.Any(i => val.IndexOf(i) != -1) ?
_nameDelimiters :
@@ -1301,7 +1301,7 @@ namespace MediaBrowser.MediaEncoding.Probing
// OR -> COMMENT. SUBTITLE: DESCRIPTION
// e.g. -> 4/13. The Doctor's Wife: Science fiction drama. When he follows a Time Lord distress signal, the Doctor puts Amy, Rory and his beloved TARDIS in grave danger. Also in HD. [AD,S]
// e.g. -> CBeebies Bedtime Hour. The Mystery: Animated adventures of two friends who live on an island in the middle of the big city. Some of Abney and Teal's favourite objects are missing. [S]
- if (String.IsNullOrWhiteSpace(subTitle) && !String.IsNullOrWhiteSpace(description) && description.Substring(0, Math.Min(description.Length, MaxSubtitleDescriptionExtractionLength)).Contains(":")) // Check within the Subtitle size limit, otherwise from description it can get too long creating an invalid filename
+ if (string.IsNullOrWhiteSpace(subTitle) && !string.IsNullOrWhiteSpace(description) && description.Substring(0, Math.Min(description.Length, MaxSubtitleDescriptionExtractionLength)).Contains(":")) // Check within the Subtitle size limit, otherwise from description it can get too long creating an invalid filename
{
string[] parts = description.Split(':');
if (parts.Length > 0)
@@ -1315,7 +1315,7 @@ namespace MediaBrowser.MediaEncoding.Probing
video.IndexNumber = int.Parse(numbers[0].Replace(".", "").Split('/')[0]);
int totalEpisodesInSeason = int.Parse(numbers[0].Replace(".", "").Split('/')[1]);
- description = String.Join(" ", numbers, 1, numbers.Length - 1).Trim(); // Skip the first, concatenate the rest, clean up spaces and save it
+ description = string.Join(" ", numbers, 1, numbers.Length - 1).Trim(); // Skip the first, concatenate the rest, clean up spaces and save it
}
else
throw new Exception(); // Switch to default parsing
@@ -1323,7 +1323,7 @@ namespace MediaBrowser.MediaEncoding.Probing
catch // Default parsing
{
if (subtitle.Contains(".")) // skip the comment, keep the subtitle
- description = String.Join(".", subtitle.Split('.'), 1, subtitle.Split('.').Length - 1).Trim(); // skip the first
+ description = string.Join(".", subtitle.Split('.'), 1, subtitle.Split('.').Length - 1).Trim(); // skip the first
else
description = subtitle.Trim(); // Clean up whitespaces and save it
}
diff --git a/MediaBrowser.MediaEncoding/Properties/AssemblyInfo.cs b/MediaBrowser.MediaEncoding/Properties/AssemblyInfo.cs
index 53f4eb403..6ecdf89bc 100644
--- a/MediaBrowser.MediaEncoding/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.MediaEncoding/Properties/AssemblyInfo.cs
@@ -1,33 +1,21 @@
-using System.Reflection;
+using System.Reflection;
+using System.Resources;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MediaBrowser.MediaEncoding")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("MediaBrowser.MediaEncoding")]
-[assembly: AssemblyCopyright("Copyright © 2014")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("05f49ab9-2a90-4332-9d41-7817a9cccd90")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")] \ No newline at end of file
diff --git a/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs b/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs
index 71fefba44..73df2b1e0 100644
--- a/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs
+++ b/MediaBrowser.MediaEncoding/Subtitles/AssParser.cs
@@ -29,7 +29,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
while ((line = reader.ReadLine()) != null)
{
cancellationToken.ThrowIfCancellationRequested();
-
+
if (string.IsNullOrWhiteSpace(line))
{
continue;
@@ -49,7 +49,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
RemoteNativeFormatting(subEvent);
subEvent.Text = subEvent.Text.Replace("\\n", ParserValues.NewLine, StringComparison.OrdinalIgnoreCase);
-
+
subEvent.Text = Regex.Replace(subEvent.Text, @"\{(\\[\w]+\(?([\w\d]+,?)+\)?)+\}", string.Empty, RegexOptions.IgnoreCase);
trackEvents.Add(subEvent);
diff --git a/MediaBrowser.MediaEncoding/Subtitles/OpenSubtitleDownloader.cs b/MediaBrowser.MediaEncoding/Subtitles/OpenSubtitleDownloader.cs
index b62fa8398..1c1906de7 100644
--- a/MediaBrowser.MediaEncoding/Subtitles/OpenSubtitleDownloader.cs
+++ b/MediaBrowser.MediaEncoding/Subtitles/OpenSubtitleDownloader.cs
@@ -121,7 +121,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
{
if (string.IsNullOrWhiteSpace(id))
{
- throw new ArgumentNullException("id");
+ throw new ArgumentNullException(nameof(id));
}
var idParts = id.Split(new[] { '-' }, 3);
diff --git a/MediaBrowser.MediaEncoding/Subtitles/SrtParser.cs b/MediaBrowser.MediaEncoding/Subtitles/SrtParser.cs
index 7ca8aa1fd..e9f9c6f58 100644
--- a/MediaBrowser.MediaEncoding/Subtitles/SrtParser.cs
+++ b/MediaBrowser.MediaEncoding/Subtitles/SrtParser.cs
@@ -43,7 +43,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
{
continue;
}
-
+
var time = Regex.Split(line, @"[\t ]*-->[\t ]*");
if (time.Length < 2)
@@ -85,7 +85,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
TimeSpan span;
return TimeSpan.TryParseExact(time, @"hh\:mm\:ss\.fff", _usCulture, out span)
? span.Ticks
- : (TimeSpan.TryParseExact(time, @"hh\:mm\:ss\,fff", _usCulture, out span)
+ : (TimeSpan.TryParseExact(time, @"hh\:mm\:ss\,fff", _usCulture, out span)
? span.Ticks : 0);
}
}
diff --git a/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs b/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs
index a2cee7793..022fca1c8 100644
--- a/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs
+++ b/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs
@@ -129,8 +129,8 @@ namespace MediaBrowser.MediaEncoding.Subtitles
}
}
}
- }
-
+ }
+
//if (header.Length > 0)
//subtitle.Header = header.ToString();
diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs
index 68faffa91..202623c8b 100644
--- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs
@@ -130,11 +130,11 @@ namespace MediaBrowser.MediaEncoding.Subtitles
{
if (item == null)
{
- throw new ArgumentNullException("item");
+ throw new ArgumentNullException(nameof(item));
}
if (string.IsNullOrWhiteSpace(mediaSourceId))
{
- throw new ArgumentNullException("mediaSourceId");
+ throw new ArgumentNullException(nameof(mediaSourceId));
}
// TODO network path substition useful ?
@@ -300,7 +300,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
{
if (string.IsNullOrEmpty(format))
{
- throw new ArgumentNullException("format");
+ throw new ArgumentNullException(nameof(format));
}
if (string.Equals(format, SubtitleFormat.SRT, StringComparison.OrdinalIgnoreCase))
@@ -328,7 +328,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
{
if (string.IsNullOrEmpty(format))
{
- throw new ArgumentNullException("format");
+ throw new ArgumentNullException(nameof(format));
}
if (string.Equals(format, "json", StringComparison.OrdinalIgnoreCase))
@@ -423,12 +423,12 @@ namespace MediaBrowser.MediaEncoding.Subtitles
{
if (string.IsNullOrEmpty(inputPath))
{
- throw new ArgumentNullException("inputPath");
+ throw new ArgumentNullException(nameof(inputPath));
}
if (string.IsNullOrEmpty(outputPath))
{
- throw new ArgumentNullException("outputPath");
+ throw new ArgumentNullException(nameof(outputPath));
}
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(outputPath));
@@ -566,12 +566,12 @@ namespace MediaBrowser.MediaEncoding.Subtitles
{
if (string.IsNullOrEmpty(inputPath))
{
- throw new ArgumentNullException("inputPath");
+ throw new ArgumentNullException(nameof(inputPath));
}
if (string.IsNullOrEmpty(outputPath))
{
- throw new ArgumentNullException("outputPath");
+ throw new ArgumentNullException(nameof(outputPath));
}
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(outputPath));
@@ -759,7 +759,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
return _fileSystem.ReadAllBytes(path);
}
- throw new ArgumentOutOfRangeException("protocol");
+ throw new ArgumentOutOfRangeException(nameof(protocol));
}
}
}
diff --git a/MediaBrowser.MediaEncoding/Subtitles/TtmlWriter.cs b/MediaBrowser.MediaEncoding/Subtitles/TtmlWriter.cs
index c32005f89..f0cf3b31a 100644
--- a/MediaBrowser.MediaEncoding/Subtitles/TtmlWriter.cs
+++ b/MediaBrowser.MediaEncoding/Subtitles/TtmlWriter.cs
@@ -45,7 +45,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
writer.WriteLine("</div>");
writer.WriteLine("</body>");
-
+
writer.WriteLine("</tt>");
}
}
diff --git a/MediaBrowser.Model/Channels/ChannelFeatures.cs b/MediaBrowser.Model/Channels/ChannelFeatures.cs
index d4caf499b..259370b7e 100644
--- a/MediaBrowser.Model/Channels/ChannelFeatures.cs
+++ b/MediaBrowser.Model/Channels/ChannelFeatures.cs
@@ -61,7 +61,7 @@ namespace MediaBrowser.Model.Channels
/// </summary>
/// <value><c>true</c> if [supports latest media]; otherwise, <c>false</c>.</value>
public bool SupportsLatestMedia { get; set; }
-
+
/// <summary>
/// Gets or sets a value indicating whether this instance can filter.
/// </summary>
diff --git a/MediaBrowser.Model/Channels/ChannelQuery.cs b/MediaBrowser.Model/Channels/ChannelQuery.cs
index 6b5e95d69..9651cb6c2 100644
--- a/MediaBrowser.Model/Channels/ChannelQuery.cs
+++ b/MediaBrowser.Model/Channels/ChannelQuery.cs
@@ -14,7 +14,7 @@ namespace MediaBrowser.Model.Channels
public bool? EnableImages { get; set; }
public int? ImageTypeLimit { get; set; }
public ImageType[] EnableImageTypes { get; set; }
-
+
/// <summary>
/// Gets or sets the user identifier.
/// </summary>
diff --git a/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs b/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs
index 08bf2379f..76b5924e9 100644
--- a/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs
@@ -40,7 +40,7 @@ namespace MediaBrowser.Model.Configuration
/// </summary>
/// <value>The cache path.</value>
public string CachePath { get; set; }
-
+
/// <summary>
/// Initializes a new instance of the <see cref="BaseApplicationConfiguration" /> class.
/// </summary>
diff --git a/MediaBrowser.Model/Diagnostics/IProcessFactory.cs b/MediaBrowser.Model/Diagnostics/IProcessFactory.cs
index a60c4b4fb..c4ad02fab 100644
--- a/MediaBrowser.Model/Diagnostics/IProcessFactory.cs
+++ b/MediaBrowser.Model/Diagnostics/IProcessFactory.cs
@@ -9,9 +9,9 @@ namespace MediaBrowser.Model.Diagnostics
public class ProcessOptions
{
- public String FileName { get; set; }
- public String Arguments { get; set; }
- public String WorkingDirectory { get; set; }
+ public string FileName { get; set; }
+ public string Arguments { get; set; }
+ public string WorkingDirectory { get; set; }
public bool CreateNoWindow { get; set; }
public bool UseShellExecute { get; set; }
public bool EnableRaisingEvents { get; set; }
diff --git a/MediaBrowser.Model/Dlna/AudioOptions.cs b/MediaBrowser.Model/Dlna/AudioOptions.cs
index 189f64635..9480311b5 100644
--- a/MediaBrowser.Model/Dlna/AudioOptions.cs
+++ b/MediaBrowser.Model/Dlna/AudioOptions.cs
@@ -55,7 +55,7 @@ namespace MediaBrowser.Model.Dlna
/// </summary>
/// <value>The audio transcoding bitrate.</value>
public int? AudioTranscodingBitrate { get; set; }
-
+
/// <summary>
/// Gets the maximum bitrate.
/// </summary>
diff --git a/MediaBrowser.Model/Dlna/CodecProfile.cs b/MediaBrowser.Model/Dlna/CodecProfile.cs
index 6d143962d..c40408e9b 100644
--- a/MediaBrowser.Model/Dlna/CodecProfile.cs
+++ b/MediaBrowser.Model/Dlna/CodecProfile.cs
@@ -9,7 +9,7 @@ namespace MediaBrowser.Model.Dlna
{
[XmlAttribute("type")]
public CodecType Type { get; set; }
-
+
public ProfileCondition[] Conditions { get; set; }
public ProfileCondition[] ApplyConditions { get; set; }
diff --git a/MediaBrowser.Model/Dlna/ConditionProcessor.cs b/MediaBrowser.Model/Dlna/ConditionProcessor.cs
index a550ee982..5bcee6de2 100644
--- a/MediaBrowser.Model/Dlna/ConditionProcessor.cs
+++ b/MediaBrowser.Model/Dlna/ConditionProcessor.cs
@@ -98,7 +98,7 @@ namespace MediaBrowser.Model.Dlna
public bool IsVideoAudioConditionSatisfied(ProfileCondition condition,
int? audioChannels,
int? audioBitrate,
- int? audioSampleRate,
+ int? audioSampleRate,
int? audioBitDepth,
string audioProfile,
bool? isSecondaryTrack)
diff --git a/MediaBrowser.Model/Dlna/DlnaFlags.cs b/MediaBrowser.Model/Dlna/DlnaFlags.cs
index b981e8455..28c93464d 100644
--- a/MediaBrowser.Model/Dlna/DlnaFlags.cs
+++ b/MediaBrowser.Model/Dlna/DlnaFlags.cs
@@ -5,14 +5,14 @@ namespace MediaBrowser.Model.Dlna
[Flags]
public enum DlnaFlags : ulong
{
- /*! <i>Background</i> transfer mode.
- For use with upload and download transfers to and from the server.
- The primary difference between \ref DH_TransferMode_Interactive and
- \ref DH_TransferMode_Bulk is that the latter assumes that the user
- is not relying on the transfer for immediately rendering the content
- and there are no issues with causing a buffer overflow if the
- receiver uses TCP flow control to reduce total throughput.
- */
+ /*! <i>Background</i> transfer mode.
+ For use with upload and download transfers to and from the server.
+ The primary difference between \ref DH_TransferMode_Interactive and
+ \ref DH_TransferMode_Bulk is that the latter assumes that the user
+ is not relying on the transfer for immediately rendering the content
+ and there are no issues with causing a buffer overflow if the
+ receiver uses TCP flow control to reduce total throughput.
+ */
BackgroundTransferMode = 1 << 22,
ByteBasedSeek = 1 << 29,
@@ -21,10 +21,10 @@ namespace MediaBrowser.Model.Dlna
DlnaV15 = 1 << 20,
/*! <i>Interactive</i> transfer mode.
- For best effort transfer of images and non-real-time transfers.
- URIs with image content usually support \ref DH_TransferMode_Bulk too.
- The primary difference between \ref DH_TransferMode_Interactive and
- \ref DH_TransferMode_Bulk is that the former assumes that the
+ For best effort transfer of images and non-real-time transfers.
+ URIs with image content usually support \ref DH_TransferMode_Bulk too.
+ The primary difference between \ref DH_TransferMode_Interactive and
+ \ref DH_TransferMode_Bulk is that the former assumes that the
transfer is intended for immediate rendering.
*/
InteractiveTransferMode = 1 << 23,
@@ -35,14 +35,14 @@ namespace MediaBrowser.Model.Dlna
SenderPaced = 1L << 31,
SnIncrease = 1 << 26,
- /*! <i>Streaming</i> transfer mode.
- The server transmits at a throughput sufficient for real-time playback of
- audio or video. URIs with audio or video often support the
- \ref DH_TransferMode_Interactive and \ref DH_TransferMode_Bulk transfer modes.
- The most well-known exception to this general claim is for live streams.
+ /*! <i>Streaming</i> transfer mode.
+ The server transmits at a throughput sufficient for real-time playback of
+ audio or video. URIs with audio or video often support the
+ \ref DH_TransferMode_Interactive and \ref DH_TransferMode_Bulk transfer modes.
+ The most well-known exception to this general claim is for live streams.
*/
StreamingTransferMode = 1 << 24,
TimeBasedSeek = 1 << 30
}
-} \ No newline at end of file
+}
diff --git a/MediaBrowser.Model/Dlna/ProfileCondition.cs b/MediaBrowser.Model/Dlna/ProfileCondition.cs
index 9234a2713..39f99b92e 100644
--- a/MediaBrowser.Model/Dlna/ProfileCondition.cs
+++ b/MediaBrowser.Model/Dlna/ProfileCondition.cs
@@ -24,7 +24,7 @@ namespace MediaBrowser.Model.Dlna
public ProfileCondition(ProfileConditionType condition, ProfileConditionValue property, string value)
: this(condition, property, value, false)
{
-
+
}
public ProfileCondition(ProfileConditionType condition, ProfileConditionValue property, string value, bool isRequired)
diff --git a/MediaBrowser.Model/Dlna/SearchCriteria.cs b/MediaBrowser.Model/Dlna/SearchCriteria.cs
index 533605d89..50ee4a378 100644
--- a/MediaBrowser.Model/Dlna/SearchCriteria.cs
+++ b/MediaBrowser.Model/Dlna/SearchCriteria.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Model.Extensions;
+using MediaBrowser.Model.Extensions;
using System;
using System.Text.RegularExpressions;
@@ -15,7 +15,7 @@ namespace MediaBrowser.Model.Dlna
/// <param name="term">The term.</param>
/// <param name="limit">The limit.</param>
/// <returns>System.String[].</returns>
- private string[] RegexSplit(string str, string term, int limit)
+ private static string[] RegexSplit(string str, string term, int limit)
{
return new Regex(term).Split(str, limit);
}
@@ -26,7 +26,7 @@ namespace MediaBrowser.Model.Dlna
/// <param name="str">The string.</param>
/// <param name="term">The term.</param>
/// <returns>System.String[].</returns>
- private string[] RegexSplit(string str, string term)
+ private static string[] RegexSplit(string str, string term)
{
return Regex.Split(str, term, RegexOptions.IgnoreCase);
}
@@ -35,20 +35,20 @@ namespace MediaBrowser.Model.Dlna
{
if (string.IsNullOrEmpty(search))
{
- throw new ArgumentNullException("search");
+ throw new ArgumentNullException(nameof(search));
}
SearchType = SearchType.Unknown;
- String[] factors = RegexSplit(search, "(and|or)");
- foreach (String factor in factors)
+ string[] factors = RegexSplit(search, "(and|or)");
+ foreach (string factor in factors)
{
- String[] subFactors = RegexSplit(factor.Trim().Trim('(').Trim(')').Trim(), "\\s", 3);
+ string[] subFactors = RegexSplit(factor.Trim().Trim('(').Trim(')').Trim(), "\\s", 3);
if (subFactors.Length == 3)
{
- if (StringHelper.EqualsIgnoreCase("upnp:class", subFactors[0]) &&
+ if (StringHelper.EqualsIgnoreCase("upnp:class", subFactors[0]) &&
(StringHelper.EqualsIgnoreCase("=", subFactors[1]) || StringHelper.EqualsIgnoreCase("derivedfrom", subFactors[1])))
{
if (StringHelper.EqualsIgnoreCase("\"object.item.imageItem\"", subFactors[2]) || StringHelper.EqualsIgnoreCase("\"object.item.imageItem.photo\"", subFactors[2]))
diff --git a/MediaBrowser.Model/Dlna/SortCriteria.cs b/MediaBrowser.Model/Dlna/SortCriteria.cs
index 600a2f58e..ecaf32614 100644
--- a/MediaBrowser.Model/Dlna/SortCriteria.cs
+++ b/MediaBrowser.Model/Dlna/SortCriteria.cs
@@ -11,7 +11,7 @@ namespace MediaBrowser.Model.Dlna
public SortCriteria(string value)
{
-
+
}
}
}
diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs
index 41306b4c3..c571d8384 100644
--- a/MediaBrowser.Model/Dlna/StreamBuilder.cs
+++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs
@@ -700,7 +700,7 @@ namespace MediaBrowser.Model.Dlna
{
if (item == null)
{
- throw new ArgumentNullException("item");
+ throw new ArgumentNullException(nameof(item));
}
var transcodeReasons = new List<TranscodeReason>();
@@ -951,7 +951,7 @@ namespace MediaBrowser.Model.Dlna
if (audioStream != null)
{
- // Seeing webm encoding failures when source has 1 audio channel and 22k bitrate.
+ // Seeing webm encoding failures when source has 1 audio channel and 22k bitrate.
// Any attempts to transcode over 64k will fail
if (audioStream.Channels.HasValue &&
audioStream.Channels.Value == 1)
diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs
index ba0ac0486..ec76d93f0 100644
--- a/MediaBrowser.Model/Dlna/StreamInfo.cs
+++ b/MediaBrowser.Model/Dlna/StreamInfo.cs
@@ -153,7 +153,7 @@ namespace MediaBrowser.Model.Dlna
if (string.IsNullOrEmpty(baseUrl))
{
- throw new ArgumentNullException(baseUrl);
+ throw new ArgumentNullException(nameof(baseUrl));
}
List<string> list = new List<string>();
@@ -195,7 +195,7 @@ namespace MediaBrowser.Model.Dlna
{
if (string.IsNullOrEmpty(baseUrl))
{
- throw new ArgumentNullException(baseUrl);
+ throw new ArgumentNullException(nameof(baseUrl));
}
string extension = string.IsNullOrEmpty(Container) ? string.Empty : "." + Container;
diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs
index 746d38679..7ff883798 100644
--- a/MediaBrowser.Model/Dto/BaseItemDto.cs
+++ b/MediaBrowser.Model/Dto/BaseItemDto.cs
@@ -46,7 +46,7 @@ namespace MediaBrowser.Model.Dto
/// </summary>
/// <value>The type of the source.</value>
public string SourceType { get; set; }
-
+
/// <summary>
/// Gets or sets the playlist item identifier.
/// </summary>
diff --git a/MediaBrowser.Model/Dto/GameSystemSummary.cs b/MediaBrowser.Model/Dto/GameSystemSummary.cs
index 0f21533a0..b42e98842 100644
--- a/MediaBrowser.Model/Dto/GameSystemSummary.cs
+++ b/MediaBrowser.Model/Dto/GameSystemSummary.cs
@@ -18,7 +18,7 @@ namespace MediaBrowser.Model.Dto
/// </summary>
/// <value>The name.</value>
public string DisplayName { get; set; }
-
+
/// <summary>
/// Gets or sets the game count.
/// </summary>
diff --git a/MediaBrowser.Model/Dto/ImageOptions.cs b/MediaBrowser.Model/Dto/ImageOptions.cs
index 98bd0279a..e98d54435 100644
--- a/MediaBrowser.Model/Dto/ImageOptions.cs
+++ b/MediaBrowser.Model/Dto/ImageOptions.cs
@@ -92,7 +92,7 @@ namespace MediaBrowser.Model.Dto
/// </summary>
/// <value>The un played count.</value>
public int? UnPlayedCount { get; set; }
-
+
/// <summary>
/// Gets or sets the color of the background.
/// </summary>
diff --git a/MediaBrowser.Model/Dto/NameValuePair.cs b/MediaBrowser.Model/Dto/NameValuePair.cs
index a6e687949..564e32dcd 100644
--- a/MediaBrowser.Model/Dto/NameValuePair.cs
+++ b/MediaBrowser.Model/Dto/NameValuePair.cs
@@ -5,7 +5,7 @@ namespace MediaBrowser.Model.Dto
{
public NameValuePair()
{
-
+
}
public NameValuePair(string name, string value)
diff --git a/MediaBrowser.Model/Dto/UserDto.cs b/MediaBrowser.Model/Dto/UserDto.cs
index 8d7679fdb..eb4979632 100644
--- a/MediaBrowser.Model/Dto/UserDto.cs
+++ b/MediaBrowser.Model/Dto/UserDto.cs
@@ -44,13 +44,13 @@ namespace MediaBrowser.Model.Dto
/// </summary>
/// <value>The type of the connect link.</value>
public UserLinkType? ConnectLinkType { get; set; }
-
+
/// <summary>
/// Gets or sets the id.
/// </summary>
/// <value>The id.</value>
public Guid Id { get; set; }
-
+
/// <summary>
/// Gets or sets the primary image tag.
/// </summary>
diff --git a/MediaBrowser.Model/Entities/MBRegistrationRecord.cs b/MediaBrowser.Model/Entities/MBRegistrationRecord.cs
deleted file mode 100644
index 00176fb34..000000000
--- a/MediaBrowser.Model/Entities/MBRegistrationRecord.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-
-namespace MediaBrowser.Model.Entities
-{
- public class MBRegistrationRecord
- {
- public DateTime ExpirationDate { get; set; }
- public bool IsRegistered { get; set; }
- public bool RegChecked { get; set; }
- public bool RegError { get; set; }
- public bool TrialVersion { get; set; }
- public bool IsValid { get; set; }
- }
-} \ No newline at end of file
diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs
index 35369fbbb..454e6ff16 100644
--- a/MediaBrowser.Model/Entities/MediaStream.cs
+++ b/MediaBrowser.Model/Entities/MediaStream.cs
@@ -420,7 +420,7 @@ namespace MediaBrowser.Model.Entities
var fromCodec = Codec;
- // Can't convert from this
+ // Can't convert from this
if (StringHelper.EqualsIgnoreCase(fromCodec, "ass"))
{
return false;
@@ -430,7 +430,7 @@ namespace MediaBrowser.Model.Entities
return false;
}
- // Can't convert to this
+ // Can't convert to this
if (StringHelper.EqualsIgnoreCase(toCodec, "ass"))
{
return false;
diff --git a/MediaBrowser.Model/Entities/PluginSecurityInfo.cs b/MediaBrowser.Model/Entities/PluginSecurityInfo.cs
deleted file mode 100644
index 5cab55013..000000000
--- a/MediaBrowser.Model/Entities/PluginSecurityInfo.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-
-namespace MediaBrowser.Model.Entities
-{
- /// <summary>
- /// Class PluginSecurityInfo
- /// </summary>
- public class PluginSecurityInfo
- {
- /// <summary>
- /// Gets or sets the supporter key.
- /// </summary>
- /// <value>The supporter key.</value>
- public string SupporterKey { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether this instance is MB supporter.
- /// </summary>
- /// <value><c>true</c> if this instance is MB supporter; otherwise, <c>false</c>.</value>
- public bool IsMBSupporter { get; set; }
- }
-}
diff --git a/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs
index e10232baa..3f8873798 100644
--- a/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs
+++ b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs
@@ -18,7 +18,7 @@ namespace MediaBrowser.Model.Entities
{
return !string.IsNullOrEmpty(instance.GetProviderId(provider.ToString()));
}
-
+
/// <summary>
/// Gets a provider id
/// </summary>
@@ -40,7 +40,7 @@ namespace MediaBrowser.Model.Entities
{
if (instance == null)
{
- throw new ArgumentNullException("instance");
+ throw new ArgumentNullException(nameof(instance));
}
if (instance.ProviderIds == null)
@@ -63,9 +63,9 @@ namespace MediaBrowser.Model.Entities
{
if (instance == null)
{
- throw new ArgumentNullException("instance");
+ throw new ArgumentNullException(nameof(instance));
}
-
+
// If it's null remove the key from the dictionary
if (string.IsNullOrEmpty(value))
{
diff --git a/MediaBrowser.Model/Extensions/LinqExtensions.cs b/MediaBrowser.Model/Extensions/LinqExtensions.cs
index 1223e689e..4e33edb41 100644
--- a/MediaBrowser.Model/Extensions/LinqExtensions.cs
+++ b/MediaBrowser.Model/Extensions/LinqExtensions.cs
@@ -6,13 +6,13 @@ namespace MediaBrowser.Model.Extensions
{
// MoreLINQ - Extensions to LINQ to Objects
// Copyright (c) 2008 Jonathan Skeet. All rights reserved.
- //
+ //
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
- //
+ //
// http://www.apache.org/licenses/LICENSE-2.0
- //
+ //
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -64,8 +64,8 @@ namespace MediaBrowser.Model.Extensions
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(this IEnumerable<TSource> source,
Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
{
- if (source == null) throw new ArgumentNullException("source");
- if (keySelector == null) throw new ArgumentNullException("keySelector");
+ if (source == null) throw new ArgumentNullException(nameof(source));
+ if (keySelector == null) throw new ArgumentNullException(nameof(keySelector));
return DistinctByImpl(source, keySelector, comparer);
}
diff --git a/MediaBrowser.Model/Extensions/ListHelper.cs b/MediaBrowser.Model/Extensions/ListHelper.cs
index 243ae3105..68379d463 100644
--- a/MediaBrowser.Model/Extensions/ListHelper.cs
+++ b/MediaBrowser.Model/Extensions/ListHelper.cs
@@ -8,7 +8,7 @@ namespace MediaBrowser.Model.Extensions
{
if (value == null)
{
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
foreach (var item in list)
diff --git a/MediaBrowser.Model/IO/IFileSystem.cs b/MediaBrowser.Model/IO/IFileSystem.cs
index 3200affd6..37fca6ea1 100644
--- a/MediaBrowser.Model/IO/IFileSystem.cs
+++ b/MediaBrowser.Model/IO/IFileSystem.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
@@ -117,7 +117,7 @@ namespace MediaBrowser.Model.IO
/// </summary>
/// <param name="path">The path.</param>
/// <returns>Stream.</returns>
- Stream OpenRead(String path);
+ Stream OpenRead(string path);
string DefaultDirectory { get; }
@@ -328,7 +328,7 @@ namespace MediaBrowser.Model.IO
void SetExecutable(string path);
}
-
+ //TODO Investigate if can be replaced by the one from System.IO ?
public enum FileOpenMode
{
//
diff --git a/MediaBrowser.Model/IO/IIsoMounter.cs b/MediaBrowser.Model/IO/IIsoMounter.cs
index 7efbc2024..f0153a928 100644
--- a/MediaBrowser.Model/IO/IIsoMounter.cs
+++ b/MediaBrowser.Model/IO/IIsoMounter.cs
@@ -1,4 +1,5 @@
-using System;
+using System;
+using System.IO;
using System.Threading;
using System.Threading.Tasks;
diff --git a/MediaBrowser.Model/LiveTv/LiveTvChannelQuery.cs b/MediaBrowser.Model/LiveTv/LiveTvChannelQuery.cs
index 5fe77d41e..a9546bb95 100644
--- a/MediaBrowser.Model/LiveTv/LiveTvChannelQuery.cs
+++ b/MediaBrowser.Model/LiveTv/LiveTvChannelQuery.cs
@@ -37,7 +37,7 @@ namespace MediaBrowser.Model.LiveTv
/// </summary>
/// <value><c>true</c> if [enable favorite sorting]; otherwise, <c>false</c>.</value>
public bool EnableFavoriteSorting { get; set; }
-
+
/// <summary>
/// Gets or sets the user identifier.
/// </summary>
diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj
index e223f2cc8..4aacc4a49 100644
--- a/MediaBrowser.Model/MediaBrowser.Model.csproj
+++ b/MediaBrowser.Model/MediaBrowser.Model.csproj
@@ -3,6 +3,8 @@
<PropertyGroup>
<Authors>Jellyfin Contributors</Authors>
<PackageId>Jellyfin.Model</PackageId>
+ <PackageLicenseUrl>https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt</PackageLicenseUrl>
+ <RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
</PropertyGroup>
<PropertyGroup>
diff --git a/MediaBrowser.Model/Net/HttpException.cs b/MediaBrowser.Model/Net/HttpException.cs
index 698b1bc7e..2f45299e3 100644
--- a/MediaBrowser.Model/Net/HttpException.cs
+++ b/MediaBrowser.Model/Net/HttpException.cs
@@ -28,7 +28,7 @@ namespace MediaBrowser.Model.Net
public HttpException(string message, Exception innerException)
: base(message, innerException)
{
-
+
}
/// <summary>
diff --git a/MediaBrowser.Model/Net/ISocketFactory.cs b/MediaBrowser.Model/Net/ISocketFactory.cs
index 6a4b99600..2100aae2a 100644
--- a/MediaBrowser.Model/Net/ISocketFactory.cs
+++ b/MediaBrowser.Model/Net/ISocketFactory.cs
@@ -7,14 +7,13 @@ namespace MediaBrowser.Model.Net
/// Implemented by components that can create a platform specific UDP socket implementation, and wrap it in the cross platform <see cref="ISocket"/> interface.
/// </summary>
public interface ISocketFactory
- {
-
- /// <summary>
- /// Createa a new unicast socket using the specified local port number.
- /// </summary>
- /// <param name="localPort">The local port to bind to.</param>
- /// <returns>A <see cref="ISocket"/> implementation.</returns>
- ISocket CreateUdpSocket(int localPort);
+ {
+ /// <summary>
+ /// Createa a new unicast socket using the specified local port number.
+ /// </summary>
+ /// <param name="localPort">The local port to bind to.</param>
+ /// <returns>A <see cref="ISocket"/> implementation.</returns>
+ ISocket CreateUdpSocket(int localPort);
ISocket CreateUdpBroadcastSocket(int localPort);
diff --git a/MediaBrowser.Model/Net/IpAddressInfo.cs b/MediaBrowser.Model/Net/IpAddressInfo.cs
index 520f8fb54..c2c228faf 100644
--- a/MediaBrowser.Model/Net/IpAddressInfo.cs
+++ b/MediaBrowser.Model/Net/IpAddressInfo.cs
@@ -23,7 +23,7 @@ namespace MediaBrowser.Model.Net
return string.Equals(address.Address, Address, StringComparison.OrdinalIgnoreCase);
}
- public override String ToString()
+ public override string ToString()
{
return Address;
}
diff --git a/MediaBrowser.Model/Net/MimeTypes.cs b/MediaBrowser.Model/Net/MimeTypes.cs
index c22e77beb..93e51633e 100644
--- a/MediaBrowser.Model/Net/MimeTypes.cs
+++ b/MediaBrowser.Model/Net/MimeTypes.cs
@@ -127,7 +127,7 @@ namespace MediaBrowser.Model.Net
{
if (string.IsNullOrEmpty(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
var ext = Path.GetExtension(path) ?? string.Empty;
@@ -333,7 +333,7 @@ namespace MediaBrowser.Model.Net
{
if (string.IsNullOrEmpty(mimeType))
{
- throw new ArgumentNullException("mimeType");
+ throw new ArgumentNullException(nameof(mimeType));
}
// handle text/html; charset=UTF-8
diff --git a/MediaBrowser.Model/Net/SocketReceiveResult.cs b/MediaBrowser.Model/Net/SocketReceiveResult.cs
index 483e2297b..5a5004de6 100644
--- a/MediaBrowser.Model/Net/SocketReceiveResult.cs
+++ b/MediaBrowser.Model/Net/SocketReceiveResult.cs
@@ -5,16 +5,16 @@ namespace MediaBrowser.Model.Net
/// Used by the sockets wrapper to hold raw data received from a UDP socket.
/// </summary>
public sealed class SocketReceiveResult
- {
- /// <summary>
- /// The buffer to place received data into.
- /// </summary>
- public byte[] Buffer { get; set; }
+ {
+ /// <summary>
+ /// The buffer to place received data into.
+ /// </summary>
+ public byte[] Buffer { get; set; }
- /// <summary>
- /// The number of bytes received.
- /// </summary>
- public int ReceivedBytes { get; set; }
+ /// <summary>
+ /// The number of bytes received.
+ /// </summary>
+ public int ReceivedBytes { get; set; }
/// <summary>
/// The <see cref="IpEndPointInfo"/> the data was received from.
diff --git a/MediaBrowser.Model/Notifications/NotificationOption.cs b/MediaBrowser.Model/Notifications/NotificationOption.cs
index ce49ae209..51a07370f 100644
--- a/MediaBrowser.Model/Notifications/NotificationOption.cs
+++ b/MediaBrowser.Model/Notifications/NotificationOption.cs
@@ -21,7 +21,7 @@ namespace MediaBrowser.Model.Notifications
/// </summary>
/// <value><c>true</c> if enabled; otherwise, <c>false</c>.</value>
public bool Enabled { get; set; }
-
+
/// <summary>
/// Gets or sets the disabled services.
/// </summary>
diff --git a/MediaBrowser.Model/Properties/AssemblyInfo.cs b/MediaBrowser.Model/Properties/AssemblyInfo.cs
index fabfd908b..e78719e35 100644
--- a/MediaBrowser.Model/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.Model/Properties/AssemblyInfo.cs
@@ -1,23 +1,21 @@
-using System.Reflection;
+using System.Reflection;
using System.Resources;
+using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MediaBrowser.Model")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("MediaBrowser.Model")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-// \ No newline at end of file
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
diff --git a/MediaBrowser.Model/Providers/RemoteImageInfo.cs b/MediaBrowser.Model/Providers/RemoteImageInfo.cs
index 6db7f77bd..90c1ba0af 100644
--- a/MediaBrowser.Model/Providers/RemoteImageInfo.cs
+++ b/MediaBrowser.Model/Providers/RemoteImageInfo.cs
@@ -24,7 +24,7 @@ namespace MediaBrowser.Model.Providers
/// Gets a url used for previewing a smaller version
/// </summary>
public string ThumbnailUrl { get; set; }
-
+
/// <summary>
/// Gets or sets the height.
/// </summary>
diff --git a/MediaBrowser.Model/Querying/AllThemeMediaResult.cs b/MediaBrowser.Model/Querying/AllThemeMediaResult.cs
index 89640eb65..57114cc4a 100644
--- a/MediaBrowser.Model/Querying/AllThemeMediaResult.cs
+++ b/MediaBrowser.Model/Querying/AllThemeMediaResult.cs
@@ -7,7 +7,7 @@
public ThemeMediaResult ThemeSongsResult { get; set; }
public ThemeMediaResult SoundtrackSongsResult { get; set; }
-
+
public AllThemeMediaResult()
{
ThemeVideosResult = new ThemeMediaResult();
diff --git a/MediaBrowser.Model/Querying/EpisodeQuery.cs b/MediaBrowser.Model/Querying/EpisodeQuery.cs
index 78fe943e3..cae87b852 100644
--- a/MediaBrowser.Model/Querying/EpisodeQuery.cs
+++ b/MediaBrowser.Model/Querying/EpisodeQuery.cs
@@ -53,7 +53,7 @@ namespace MediaBrowser.Model.Querying
/// </summary>
/// <value>The start item identifier.</value>
public string StartItemId { get; set; }
-
+
public EpisodeQuery()
{
Fields = new ItemFields[] { };
diff --git a/MediaBrowser.Model/Querying/ItemFields.cs b/MediaBrowser.Model/Querying/ItemFields.cs
index 92fa3822b..ceccf5ee5 100644
--- a/MediaBrowser.Model/Querying/ItemFields.cs
+++ b/MediaBrowser.Model/Querying/ItemFields.cs
@@ -41,7 +41,7 @@
/// The custom rating
/// </summary>
CustomRating,
-
+
/// <summary>
/// The date created of the item
/// </summary>
diff --git a/MediaBrowser.Model/Querying/NextUpQuery.cs b/MediaBrowser.Model/Querying/NextUpQuery.cs
index d20ff99c2..2af8738d7 100644
--- a/MediaBrowser.Model/Querying/NextUpQuery.cs
+++ b/MediaBrowser.Model/Querying/NextUpQuery.cs
@@ -16,13 +16,13 @@ namespace MediaBrowser.Model.Querying
/// </summary>
/// <value>The parent identifier.</value>
public string ParentId { get; set; }
-
+
/// <summary>
/// Gets or sets the series id.
/// </summary>
/// <value>The series id.</value>
public string SeriesId { get; set; }
-
+
/// <summary>
/// Skips over a given number of items within the results. Use for paging.
/// </summary>
diff --git a/MediaBrowser.Model/Search/SearchHint.cs b/MediaBrowser.Model/Search/SearchHint.cs
index daa3566cf..48da8e4bc 100644
--- a/MediaBrowser.Model/Search/SearchHint.cs
+++ b/MediaBrowser.Model/Search/SearchHint.cs
@@ -14,7 +14,7 @@ namespace MediaBrowser.Model.Search
public Guid ItemId { get; set; }
public Guid Id { get; set; }
-
+
/// <summary>
/// Gets or sets the name.
/// </summary>
@@ -26,7 +26,7 @@ namespace MediaBrowser.Model.Search
/// </summary>
/// <value>The matched term.</value>
public string MatchedTerm { get; set; }
-
+
/// <summary>
/// Gets or sets the index number.
/// </summary>
@@ -38,7 +38,7 @@ namespace MediaBrowser.Model.Search
/// </summary>
/// <value>The production year.</value>
public int? ProductionYear { get; set; }
-
+
/// <summary>
/// Gets or sets the parent index number.
/// </summary>
@@ -74,7 +74,7 @@ namespace MediaBrowser.Model.Search
/// </summary>
/// <value>The backdrop image item identifier.</value>
public string BackdropImageItemId { get; set; }
-
+
/// <summary>
/// Gets or sets the type.
/// </summary>
@@ -82,13 +82,13 @@ namespace MediaBrowser.Model.Search
public string Type { get; set; }
public bool? IsFolder { get; set; }
-
+
/// <summary>
/// Gets or sets the run time ticks.
/// </summary>
/// <value>The run time ticks.</value>
public long? RunTimeTicks { get; set; }
-
+
/// <summary>
/// Gets or sets the type of the media.
/// </summary>
diff --git a/MediaBrowser.Model/Serialization/IJsonSerializer.cs b/MediaBrowser.Model/Serialization/IJsonSerializer.cs
index a582beb7f..06e48f412 100644
--- a/MediaBrowser.Model/Serialization/IJsonSerializer.cs
+++ b/MediaBrowser.Model/Serialization/IJsonSerializer.cs
@@ -11,7 +11,7 @@ namespace MediaBrowser.Model.Serialization
/// </summary>
/// <param name="obj">The obj.</param>
/// <param name="stream">The stream.</param>
- /// <exception cref="System.ArgumentNullException">obj</exception>
+ /// <exception cref="ArgumentNullException">obj</exception>
void SerializeToStream(object obj, Stream stream);
/// <summary>
@@ -19,7 +19,7 @@ namespace MediaBrowser.Model.Serialization
/// </summary>
/// <param name="obj">The obj.</param>
/// <param name="file">The file.</param>
- /// <exception cref="System.ArgumentNullException">obj</exception>
+ /// <exception cref="ArgumentNullException">obj</exception>
void SerializeToFile(object obj, string file);
/// <summary>
@@ -28,7 +28,7 @@ namespace MediaBrowser.Model.Serialization
/// <param name="type">The type.</param>
/// <param name="file">The file.</param>
/// <returns>System.Object.</returns>
- /// <exception cref="System.ArgumentNullException">type</exception>
+ /// <exception cref="ArgumentNullException">type</exception>
object DeserializeFromFile(Type type, string file);
/// <summary>
@@ -37,7 +37,7 @@ namespace MediaBrowser.Model.Serialization
/// <typeparam name="T"></typeparam>
/// <param name="file">The file.</param>
/// <returns>``0.</returns>
- /// <exception cref="System.ArgumentNullException">file</exception>
+ /// <exception cref="ArgumentNullException">file</exception>
T DeserializeFromFile<T>(string file)
where T : class;
@@ -47,7 +47,7 @@ namespace MediaBrowser.Model.Serialization
/// <typeparam name="T"></typeparam>
/// <param name="stream">The stream.</param>
/// <returns>``0.</returns>
- /// <exception cref="System.ArgumentNullException">stream</exception>
+ /// <exception cref="ArgumentNullException">stream</exception>
T DeserializeFromStream<T>(Stream stream);
/// <summary>
@@ -56,7 +56,7 @@ namespace MediaBrowser.Model.Serialization
/// <typeparam name="T"></typeparam>
/// <param name="text">The text.</param>
/// <returns>``0.</returns>
- /// <exception cref="System.ArgumentNullException">text</exception>
+ /// <exception cref="ArgumentNullException">text</exception>
T DeserializeFromString<T>(string text);
/// <summary>
@@ -65,7 +65,7 @@ namespace MediaBrowser.Model.Serialization
/// <param name="stream">The stream.</param>
/// <param name="type">The type.</param>
/// <returns>System.Object.</returns>
- /// <exception cref="System.ArgumentNullException">stream</exception>
+ /// <exception cref="ArgumentNullException">stream</exception>
object DeserializeFromStream(Stream stream, Type type);
/// <summary>
@@ -74,7 +74,7 @@ namespace MediaBrowser.Model.Serialization
/// <param name="json">The json.</param>
/// <param name="type">The type.</param>
/// <returns>System.Object.</returns>
- /// <exception cref="System.ArgumentNullException">json</exception>
+ /// <exception cref="ArgumentNullException">json</exception>
object DeserializeFromString(string json, Type type);
/// <summary>
@@ -82,7 +82,7 @@ namespace MediaBrowser.Model.Serialization
/// </summary>
/// <param name="obj">The obj.</param>
/// <returns>System.String.</returns>
- /// <exception cref="System.ArgumentNullException">obj</exception>
+ /// <exception cref="ArgumentNullException">obj</exception>
string SerializeToString(object obj);
Task<object> DeserializeFromStreamAsync(Stream stream, Type type);
diff --git a/MediaBrowser.Model/Serialization/IXmlSerializer.cs b/MediaBrowser.Model/Serialization/IXmlSerializer.cs
index b26b673f3..eb23d784f 100644
--- a/MediaBrowser.Model/Serialization/IXmlSerializer.cs
+++ b/MediaBrowser.Model/Serialization/IXmlSerializer.cs
@@ -34,7 +34,7 @@ namespace MediaBrowser.Model.Serialization
/// <param name="file">The file.</param>
/// <returns>System.Object.</returns>
object DeserializeFromFile(Type type, string file);
-
+
/// <summary>
/// Deserializes from bytes.
/// </summary>
diff --git a/MediaBrowser.Model/Services/ApiMemberAttribute.cs b/MediaBrowser.Model/Services/ApiMemberAttribute.cs
index 4a2831775..9e5faad29 100644
--- a/MediaBrowser.Model/Services/ApiMemberAttribute.cs
+++ b/MediaBrowser.Model/Services/ApiMemberAttribute.cs
@@ -16,7 +16,7 @@ namespace MediaBrowser.Model.Services
public string ParameterType { get; set; }
/// <summary>
- /// Gets or sets unique name for the parameter. Each name must be unique, even if they are associated with different paramType values.
+ /// Gets or sets unique name for the parameter. Each name must be unique, even if they are associated with different paramType values.
/// </summary>
/// <remarks>
/// <para>
@@ -49,7 +49,7 @@ namespace MediaBrowser.Model.Services
public bool AllowMultiple { get; set; }
/// <summary>
- /// Gets or sets route to which applies attribute, matches using StartsWith. By default applies to all routes.
+ /// Gets or sets route to which applies attribute, matches using StartsWith. By default applies to all routes.
/// </summary>
public string Route { get; set; }
diff --git a/MediaBrowser.Model/Services/HttpUtility.cs b/MediaBrowser.Model/Services/HttpUtility.cs
index f8fd96801..1bf3b28d1 100644
--- a/MediaBrowser.Model/Services/HttpUtility.cs
+++ b/MediaBrowser.Model/Services/HttpUtility.cs
@@ -9,516 +9,286 @@ namespace MediaBrowser.Model.Services
{
// Must be sorted
static readonly long[] entities = new long[] {
- (long)'A' << 56 | (long)'E' << 48 | (long)'l' << 40 | (long)'i' << 32 | (long)'g' << 24,
- (long)'A' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
- (long)'A' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
- (long)'A' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
- (long)'A' << 56 | (long)'l' << 48 | (long)'p' << 40 | (long)'h' << 32 | (long)'a' << 24,
- (long)'A' << 56 | (long)'r' << 48 | (long)'i' << 40 | (long)'n' << 32 | (long)'g' << 24,
- (long)'A' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'l' << 32 | (long)'d' << 24 | (long)'e' << 16,
- (long)'A' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
- (long)'B' << 56 | (long)'e' << 48 | (long)'t' << 40 | (long)'a' << 32,
- (long)'C' << 56 | (long)'c' << 48 | (long)'e' << 40 | (long)'d' << 32 | (long)'i' << 24 | (long)'l' << 16,
- (long)'C' << 56 | (long)'h' << 48 | (long)'i' << 40,
- (long)'D' << 56 | (long)'a' << 48 | (long)'g' << 40 | (long)'g' << 32 | (long)'e' << 24 | (long)'r' << 16,
- (long)'D' << 56 | (long)'e' << 48 | (long)'l' << 40 | (long)'t' << 32 | (long)'a' << 24,
- (long)'E' << 56 | (long)'T' << 48 | (long)'H' << 40,
- (long)'E' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
- (long)'E' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
- (long)'E' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
- (long)'E' << 56 | (long)'p' << 48 | (long)'s' << 40 | (long)'i' << 32 | (long)'l' << 24 | (long)'o' << 16 | (long)'n' << 8,
- (long)'E' << 56 | (long)'t' << 48 | (long)'a' << 40,
- (long)'E' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
- (long)'G' << 56 | (long)'a' << 48 | (long)'m' << 40 | (long)'m' << 32 | (long)'a' << 24,
- (long)'I' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
- (long)'I' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
- (long)'I' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
- (long)'I' << 56 | (long)'o' << 48 | (long)'t' << 40 | (long)'a' << 32,
- (long)'I' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
- (long)'K' << 56 | (long)'a' << 48 | (long)'p' << 40 | (long)'p' << 32 | (long)'a' << 24,
- (long)'L' << 56 | (long)'a' << 48 | (long)'m' << 40 | (long)'b' << 32 | (long)'d' << 24 | (long)'a' << 16,
- (long)'M' << 56 | (long)'u' << 48,
- (long)'N' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'l' << 32 | (long)'d' << 24 | (long)'e' << 16,
- (long)'N' << 56 | (long)'u' << 48,
- (long)'O' << 56 | (long)'E' << 48 | (long)'l' << 40 | (long)'i' << 32 | (long)'g' << 24,
- (long)'O' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
- (long)'O' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
- (long)'O' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
- (long)'O' << 56 | (long)'m' << 48 | (long)'e' << 40 | (long)'g' << 32 | (long)'a' << 24,
- (long)'O' << 56 | (long)'m' << 48 | (long)'i' << 40 | (long)'c' << 32 | (long)'r' << 24 | (long)'o' << 16 | (long)'n' << 8,
- (long)'O' << 56 | (long)'s' << 48 | (long)'l' << 40 | (long)'a' << 32 | (long)'s' << 24 | (long)'h' << 16,
- (long)'O' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'l' << 32 | (long)'d' << 24 | (long)'e' << 16,
- (long)'O' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
- (long)'P' << 56 | (long)'h' << 48 | (long)'i' << 40,
- (long)'P' << 56 | (long)'i' << 48,
- (long)'P' << 56 | (long)'r' << 48 | (long)'i' << 40 | (long)'m' << 32 | (long)'e' << 24,
- (long)'P' << 56 | (long)'s' << 48 | (long)'i' << 40,
- (long)'R' << 56 | (long)'h' << 48 | (long)'o' << 40,
- (long)'S' << 56 | (long)'c' << 48 | (long)'a' << 40 | (long)'r' << 32 | (long)'o' << 24 | (long)'n' << 16,
- (long)'S' << 56 | (long)'i' << 48 | (long)'g' << 40 | (long)'m' << 32 | (long)'a' << 24,
- (long)'T' << 56 | (long)'H' << 48 | (long)'O' << 40 | (long)'R' << 32 | (long)'N' << 24,
- (long)'T' << 56 | (long)'a' << 48 | (long)'u' << 40,
- (long)'T' << 56 | (long)'h' << 48 | (long)'e' << 40 | (long)'t' << 32 | (long)'a' << 24,
- (long)'U' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
- (long)'U' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
- (long)'U' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
- (long)'U' << 56 | (long)'p' << 48 | (long)'s' << 40 | (long)'i' << 32 | (long)'l' << 24 | (long)'o' << 16 | (long)'n' << 8,
- (long)'U' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
- (long)'X' << 56 | (long)'i' << 48,
- (long)'Y' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
- (long)'Y' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
- (long)'Z' << 56 | (long)'e' << 48 | (long)'t' << 40 | (long)'a' << 32,
- (long)'a' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
- (long)'a' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
- (long)'a' << 56 | (long)'c' << 48 | (long)'u' << 40 | (long)'t' << 32 | (long)'e' << 24,
- (long)'a' << 56 | (long)'e' << 48 | (long)'l' << 40 | (long)'i' << 32 | (long)'g' << 24,
- (long)'a' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
- (long)'a' << 56 | (long)'l' << 48 | (long)'e' << 40 | (long)'f' << 32 | (long)'s' << 24 | (long)'y' << 16 | (long)'m' << 8,
- (long)'a' << 56 | (long)'l' << 48 | (long)'p' << 40 | (long)'h' << 32 | (long)'a' << 24,
- (long)'a' << 56 | (long)'m' << 48 | (long)'p' << 40,
- (long)'a' << 56 | (long)'n' << 48 | (long)'d' << 40,
- (long)'a' << 56 | (long)'n' << 48 | (long)'g' << 40,
- (long)'a' << 56 | (long)'p' << 48 | (long)'o' << 40 | (long)'s' << 32,
- (long)'a' << 56 | (long)'r' << 48 | (long)'i' << 40 | (long)'n' << 32 | (long)'g' << 24,
- (long)'a' << 56 | (long)'s' << 48 | (long)'y' << 40 | (long)'m' << 32 | (long)'p' << 24,
- (long)'a' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'l' << 32 | (long)'d' << 24 | (long)'e' << 16,
- (long)'a' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
- (long)'b' << 56 | (long)'d' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24,
- (long)'b' << 56 | (long)'e' << 48 | (long)'t' << 40 | (long)'a' << 32,
- (long)'b' << 56 | (long)'r' << 48 | (long)'v' << 40 | (long)'b' << 32 | (long)'a' << 24 | (long)'r' << 16,
- (long)'b' << 56 | (long)'u' << 48 | (long)'l' << 40 | (long)'l' << 32,
- (long)'c' << 56 | (long)'a' << 48 | (long)'p' << 40,
- (long)'c' << 56 | (long)'c' << 48 | (long)'e' << 40 | (long)'d' << 32 | (long)'i' << 24 | (long)'l' << 16,
- (long)'c' << 56 | (long)'e' << 48 | (long)'d' << 40 | (long)'i' << 32 | (long)'l' << 24,
- (long)'c' << 56 | (long)'e' << 48 | (long)'n' << 40 | (long)'t' << 32,
- (long)'c' << 56 | (long)'h' << 48 | (long)'i' << 40,
- (long)'c' << 56 | (long)'i' << 48 | (long)'r' << 40 | (long)'c' << 32,
- (long)'c' << 56 | (long)'l' << 48 | (long)'u' << 40 | (long)'b' << 32 | (long)'s' << 24,
- (long)'c' << 56 | (long)'o' << 48 | (long)'n' << 40 | (long)'g' << 32,
- (long)'c' << 56 | (long)'o' << 48 | (long)'p' << 40 | (long)'y' << 32,
- (long)'c' << 56 | (long)'r' << 48 | (long)'a' << 40 | (long)'r' << 32 | (long)'r' << 24,
- (long)'c' << 56 | (long)'u' << 48 | (long)'p' << 40,
- (long)'c' << 56 | (long)'u' << 48 | (long)'r' << 40 | (long)'r' << 32 | (long)'e' << 24 | (long)'n' << 16,
- (long)'d' << 56 | (long)'A' << 48 | (long)'r' << 40 | (long)'r' << 32,
- (long)'d' << 56 | (long)'a' << 48 | (long)'g' << 40 | (long)'g' << 32 | (long)'e' << 24 | (long)'r' << 16,
- (long)'d' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'r' << 32,
- (long)'d' << 56 | (long)'e' << 48 | (long)'g' << 40,
- (long)'d' << 56 | (long)'e' << 48 | (long)'l' << 40 | (long)'t' << 32 | (long)'a' << 24,
- (long)'d' << 56 | (long)'i' << 48 | (long)'a' << 40 | (long)'m' << 32 | (long)'s' << 24,
- (long)'d' << 56 | (long)'i' << 48 | (long)'v' << 40 | (long)'i' << 32 | (long)'d' << 24 | (long)'e' << 16,
- (long)'e' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
- (long)'e' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
- (long)'e' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
- (long)'e' << 56 | (long)'m' << 48 | (long)'p' << 40 | (long)'t' << 32 | (long)'y' << 24,
- (long)'e' << 56 | (long)'m' << 48 | (long)'s' << 40 | (long)'p' << 32,
- (long)'e' << 56 | (long)'n' << 48 | (long)'s' << 40 | (long)'p' << 32,
- (long)'e' << 56 | (long)'p' << 48 | (long)'s' << 40 | (long)'i' << 32 | (long)'l' << 24 | (long)'o' << 16 | (long)'n' << 8,
- (long)'e' << 56 | (long)'q' << 48 | (long)'u' << 40 | (long)'i' << 32 | (long)'v' << 24,
- (long)'e' << 56 | (long)'t' << 48 | (long)'a' << 40,
- (long)'e' << 56 | (long)'t' << 48 | (long)'h' << 40,
- (long)'e' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
- (long)'e' << 56 | (long)'u' << 48 | (long)'r' << 40 | (long)'o' << 32,
- (long)'e' << 56 | (long)'x' << 48 | (long)'i' << 40 | (long)'s' << 32 | (long)'t' << 24,
- (long)'f' << 56 | (long)'n' << 48 | (long)'o' << 40 | (long)'f' << 32,
- (long)'f' << 56 | (long)'o' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'l' << 24 | (long)'l' << 16,
- (long)'f' << 56 | (long)'r' << 48 | (long)'a' << 40 | (long)'c' << 32 | (long)'1' << 24 | (long)'2' << 16,
- (long)'f' << 56 | (long)'r' << 48 | (long)'a' << 40 | (long)'c' << 32 | (long)'1' << 24 | (long)'4' << 16,
- (long)'f' << 56 | (long)'r' << 48 | (long)'a' << 40 | (long)'c' << 32 | (long)'3' << 24 | (long)'4' << 16,
- (long)'f' << 56 | (long)'r' << 48 | (long)'a' << 40 | (long)'s' << 32 | (long)'l' << 24,
- (long)'g' << 56 | (long)'a' << 48 | (long)'m' << 40 | (long)'m' << 32 | (long)'a' << 24,
- (long)'g' << 56 | (long)'e' << 48,
- (long)'g' << 56 | (long)'t' << 48,
- (long)'h' << 56 | (long)'A' << 48 | (long)'r' << 40 | (long)'r' << 32,
- (long)'h' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'r' << 32,
- (long)'h' << 56 | (long)'e' << 48 | (long)'a' << 40 | (long)'r' << 32 | (long)'t' << 24 | (long)'s' << 16,
- (long)'h' << 56 | (long)'e' << 48 | (long)'l' << 40 | (long)'l' << 32 | (long)'i' << 24 | (long)'p' << 16,
- (long)'i' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
- (long)'i' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
- (long)'i' << 56 | (long)'e' << 48 | (long)'x' << 40 | (long)'c' << 32 | (long)'l' << 24,
- (long)'i' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
- (long)'i' << 56 | (long)'m' << 48 | (long)'a' << 40 | (long)'g' << 32 | (long)'e' << 24,
- (long)'i' << 56 | (long)'n' << 48 | (long)'f' << 40 | (long)'i' << 32 | (long)'n' << 24,
- (long)'i' << 56 | (long)'n' << 48 | (long)'t' << 40,
- (long)'i' << 56 | (long)'o' << 48 | (long)'t' << 40 | (long)'a' << 32,
- (long)'i' << 56 | (long)'q' << 48 | (long)'u' << 40 | (long)'e' << 32 | (long)'s' << 24 | (long)'t' << 16,
- (long)'i' << 56 | (long)'s' << 48 | (long)'i' << 40 | (long)'n' << 32,
- (long)'i' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
- (long)'k' << 56 | (long)'a' << 48 | (long)'p' << 40 | (long)'p' << 32 | (long)'a' << 24,
- (long)'l' << 56 | (long)'A' << 48 | (long)'r' << 40 | (long)'r' << 32,
- (long)'l' << 56 | (long)'a' << 48 | (long)'m' << 40 | (long)'b' << 32 | (long)'d' << 24 | (long)'a' << 16,
- (long)'l' << 56 | (long)'a' << 48 | (long)'n' << 40 | (long)'g' << 32,
- (long)'l' << 56 | (long)'a' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24,
- (long)'l' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'r' << 32,
- (long)'l' << 56 | (long)'c' << 48 | (long)'e' << 40 | (long)'i' << 32 | (long)'l' << 24,
- (long)'l' << 56 | (long)'d' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24,
- (long)'l' << 56 | (long)'e' << 48,
- (long)'l' << 56 | (long)'f' << 48 | (long)'l' << 40 | (long)'o' << 32 | (long)'o' << 24 | (long)'r' << 16,
- (long)'l' << 56 | (long)'o' << 48 | (long)'w' << 40 | (long)'a' << 32 | (long)'s' << 24 | (long)'t' << 16,
- (long)'l' << 56 | (long)'o' << 48 | (long)'z' << 40,
- (long)'l' << 56 | (long)'r' << 48 | (long)'m' << 40,
- (long)'l' << 56 | (long)'s' << 48 | (long)'a' << 40 | (long)'q' << 32 | (long)'u' << 24 | (long)'o' << 16,
- (long)'l' << 56 | (long)'s' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24,
- (long)'l' << 56 | (long)'t' << 48,
- (long)'m' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'r' << 32,
- (long)'m' << 56 | (long)'d' << 48 | (long)'a' << 40 | (long)'s' << 32 | (long)'h' << 24,
- (long)'m' << 56 | (long)'i' << 48 | (long)'c' << 40 | (long)'r' << 32 | (long)'o' << 24,
- (long)'m' << 56 | (long)'i' << 48 | (long)'d' << 40 | (long)'d' << 32 | (long)'o' << 24 | (long)'t' << 16,
- (long)'m' << 56 | (long)'i' << 48 | (long)'n' << 40 | (long)'u' << 32 | (long)'s' << 24,
- (long)'m' << 56 | (long)'u' << 48,
- (long)'n' << 56 | (long)'a' << 48 | (long)'b' << 40 | (long)'l' << 32 | (long)'a' << 24,
- (long)'n' << 56 | (long)'b' << 48 | (long)'s' << 40 | (long)'p' << 32,
- (long)'n' << 56 | (long)'d' << 48 | (long)'a' << 40 | (long)'s' << 32 | (long)'h' << 24,
- (long)'n' << 56 | (long)'e' << 48,
- (long)'n' << 56 | (long)'i' << 48,
- (long)'n' << 56 | (long)'o' << 48 | (long)'t' << 40,
- (long)'n' << 56 | (long)'o' << 48 | (long)'t' << 40 | (long)'i' << 32 | (long)'n' << 24,
- (long)'n' << 56 | (long)'s' << 48 | (long)'u' << 40 | (long)'b' << 32,
- (long)'n' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'l' << 32 | (long)'d' << 24 | (long)'e' << 16,
- (long)'n' << 56 | (long)'u' << 48,
- (long)'o' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
- (long)'o' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
- (long)'o' << 56 | (long)'e' << 48 | (long)'l' << 40 | (long)'i' << 32 | (long)'g' << 24,
- (long)'o' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
- (long)'o' << 56 | (long)'l' << 48 | (long)'i' << 40 | (long)'n' << 32 | (long)'e' << 24,
- (long)'o' << 56 | (long)'m' << 48 | (long)'e' << 40 | (long)'g' << 32 | (long)'a' << 24,
- (long)'o' << 56 | (long)'m' << 48 | (long)'i' << 40 | (long)'c' << 32 | (long)'r' << 24 | (long)'o' << 16 | (long)'n' << 8,
- (long)'o' << 56 | (long)'p' << 48 | (long)'l' << 40 | (long)'u' << 32 | (long)'s' << 24,
- (long)'o' << 56 | (long)'r' << 48,
- (long)'o' << 56 | (long)'r' << 48 | (long)'d' << 40 | (long)'f' << 32,
- (long)'o' << 56 | (long)'r' << 48 | (long)'d' << 40 | (long)'m' << 32,
- (long)'o' << 56 | (long)'s' << 48 | (long)'l' << 40 | (long)'a' << 32 | (long)'s' << 24 | (long)'h' << 16,
- (long)'o' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'l' << 32 | (long)'d' << 24 | (long)'e' << 16,
- (long)'o' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'m' << 32 | (long)'e' << 24 | (long)'s' << 16,
- (long)'o' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
- (long)'p' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'a' << 32,
- (long)'p' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'t' << 32,
- (long)'p' << 56 | (long)'e' << 48 | (long)'r' << 40 | (long)'m' << 32 | (long)'i' << 24 | (long)'l' << 16,
- (long)'p' << 56 | (long)'e' << 48 | (long)'r' << 40 | (long)'p' << 32,
- (long)'p' << 56 | (long)'h' << 48 | (long)'i' << 40,
- (long)'p' << 56 | (long)'i' << 48,
- (long)'p' << 56 | (long)'i' << 48 | (long)'v' << 40,
- (long)'p' << 56 | (long)'l' << 48 | (long)'u' << 40 | (long)'s' << 32 | (long)'m' << 24 | (long)'n' << 16,
- (long)'p' << 56 | (long)'o' << 48 | (long)'u' << 40 | (long)'n' << 32 | (long)'d' << 24,
- (long)'p' << 56 | (long)'r' << 48 | (long)'i' << 40 | (long)'m' << 32 | (long)'e' << 24,
- (long)'p' << 56 | (long)'r' << 48 | (long)'o' << 40 | (long)'d' << 32,
- (long)'p' << 56 | (long)'r' << 48 | (long)'o' << 40 | (long)'p' << 32,
- (long)'p' << 56 | (long)'s' << 48 | (long)'i' << 40,
- (long)'q' << 56 | (long)'u' << 48 | (long)'o' << 40 | (long)'t' << 32,
- (long)'r' << 56 | (long)'A' << 48 | (long)'r' << 40 | (long)'r' << 32,
- (long)'r' << 56 | (long)'a' << 48 | (long)'d' << 40 | (long)'i' << 32 | (long)'c' << 24,
- (long)'r' << 56 | (long)'a' << 48 | (long)'n' << 40 | (long)'g' << 32,
- (long)'r' << 56 | (long)'a' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24,
- (long)'r' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'r' << 32,
- (long)'r' << 56 | (long)'c' << 48 | (long)'e' << 40 | (long)'i' << 32 | (long)'l' << 24,
- (long)'r' << 56 | (long)'d' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24,
- (long)'r' << 56 | (long)'e' << 48 | (long)'a' << 40 | (long)'l' << 32,
- (long)'r' << 56 | (long)'e' << 48 | (long)'g' << 40,
- (long)'r' << 56 | (long)'f' << 48 | (long)'l' << 40 | (long)'o' << 32 | (long)'o' << 24 | (long)'r' << 16,
- (long)'r' << 56 | (long)'h' << 48 | (long)'o' << 40,
- (long)'r' << 56 | (long)'l' << 48 | (long)'m' << 40,
- (long)'r' << 56 | (long)'s' << 48 | (long)'a' << 40 | (long)'q' << 32 | (long)'u' << 24 | (long)'o' << 16,
- (long)'r' << 56 | (long)'s' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24,
- (long)'s' << 56 | (long)'b' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24,
- (long)'s' << 56 | (long)'c' << 48 | (long)'a' << 40 | (long)'r' << 32 | (long)'o' << 24 | (long)'n' << 16,
- (long)'s' << 56 | (long)'d' << 48 | (long)'o' << 40 | (long)'t' << 32,
- (long)'s' << 56 | (long)'e' << 48 | (long)'c' << 40 | (long)'t' << 32,
- (long)'s' << 56 | (long)'h' << 48 | (long)'y' << 40,
- (long)'s' << 56 | (long)'i' << 48 | (long)'g' << 40 | (long)'m' << 32 | (long)'a' << 24,
- (long)'s' << 56 | (long)'i' << 48 | (long)'g' << 40 | (long)'m' << 32 | (long)'a' << 24 | (long)'f' << 16,
- (long)'s' << 56 | (long)'i' << 48 | (long)'m' << 40,
- (long)'s' << 56 | (long)'p' << 48 | (long)'a' << 40 | (long)'d' << 32 | (long)'e' << 24 | (long)'s' << 16,
- (long)'s' << 56 | (long)'u' << 48 | (long)'b' << 40,
- (long)'s' << 56 | (long)'u' << 48 | (long)'b' << 40 | (long)'e' << 32,
- (long)'s' << 56 | (long)'u' << 48 | (long)'m' << 40,
- (long)'s' << 56 | (long)'u' << 48 | (long)'p' << 40,
- (long)'s' << 56 | (long)'u' << 48 | (long)'p' << 40 | (long)'1' << 32,
- (long)'s' << 56 | (long)'u' << 48 | (long)'p' << 40 | (long)'2' << 32,
- (long)'s' << 56 | (long)'u' << 48 | (long)'p' << 40 | (long)'3' << 32,
- (long)'s' << 56 | (long)'u' << 48 | (long)'p' << 40 | (long)'e' << 32,
- (long)'s' << 56 | (long)'z' << 48 | (long)'l' << 40 | (long)'i' << 32 | (long)'g' << 24,
- (long)'t' << 56 | (long)'a' << 48 | (long)'u' << 40,
- (long)'t' << 56 | (long)'h' << 48 | (long)'e' << 40 | (long)'r' << 32 | (long)'e' << 24 | (long)'4' << 16,
- (long)'t' << 56 | (long)'h' << 48 | (long)'e' << 40 | (long)'t' << 32 | (long)'a' << 24,
- (long)'t' << 56 | (long)'h' << 48 | (long)'e' << 40 | (long)'t' << 32 | (long)'a' << 24 | (long)'s' << 16 | (long)'y' << 8 | (long)'m' << 0,
- (long)'t' << 56 | (long)'h' << 48 | (long)'i' << 40 | (long)'n' << 32 | (long)'s' << 24 | (long)'p' << 16,
- (long)'t' << 56 | (long)'h' << 48 | (long)'o' << 40 | (long)'r' << 32 | (long)'n' << 24,
- (long)'t' << 56 | (long)'i' << 48 | (long)'l' << 40 | (long)'d' << 32 | (long)'e' << 24,
- (long)'t' << 56 | (long)'i' << 48 | (long)'m' << 40 | (long)'e' << 32 | (long)'s' << 24,
- (long)'t' << 56 | (long)'r' << 48 | (long)'a' << 40 | (long)'d' << 32 | (long)'e' << 24,
- (long)'u' << 56 | (long)'A' << 48 | (long)'r' << 40 | (long)'r' << 32,
- (long)'u' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
- (long)'u' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'r' << 32,
- (long)'u' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
- (long)'u' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
- (long)'u' << 56 | (long)'m' << 48 | (long)'l' << 40,
- (long)'u' << 56 | (long)'p' << 48 | (long)'s' << 40 | (long)'i' << 32 | (long)'h' << 24,
- (long)'u' << 56 | (long)'p' << 48 | (long)'s' << 40 | (long)'i' << 32 | (long)'l' << 24 | (long)'o' << 16 | (long)'n' << 8,
- (long)'u' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
- (long)'w' << 56 | (long)'e' << 48 | (long)'i' << 40 | (long)'e' << 32 | (long)'r' << 24 | (long)'p' << 16,
- (long)'x' << 56 | (long)'i' << 48,
- (long)'y' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
- (long)'y' << 56 | (long)'e' << 48 | (long)'n' << 40,
- (long)'y' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
- (long)'z' << 56 | (long)'e' << 48 | (long)'t' << 40 | (long)'a' << 32,
- (long)'z' << 56 | (long)'w' << 48 | (long)'j' << 40,
- (long)'z' << 56 | (long)'w' << 48 | (long)'n' << 40 | (long)'j' << 32
- };
+ (long)'A' << 56 | (long)'E' << 48 | (long)'l' << 40 | (long)'i' << 32 | (long)'g' << 24,
+ (long)'A' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
+ (long)'A' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
+ (long)'A' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
+ (long)'A' << 56 | (long)'l' << 48 | (long)'p' << 40 | (long)'h' << 32 | (long)'a' << 24,
+ (long)'A' << 56 | (long)'r' << 48 | (long)'i' << 40 | (long)'n' << 32 | (long)'g' << 24,
+ (long)'A' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'l' << 32 | (long)'d' << 24 | (long)'e' << 16,
+ (long)'A' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
+ (long)'B' << 56 | (long)'e' << 48 | (long)'t' << 40 | (long)'a' << 32,
+ (long)'C' << 56 | (long)'c' << 48 | (long)'e' << 40 | (long)'d' << 32 | (long)'i' << 24 | (long)'l' << 16,
+ (long)'C' << 56 | (long)'h' << 48 | (long)'i' << 40,
+ (long)'D' << 56 | (long)'a' << 48 | (long)'g' << 40 | (long)'g' << 32 | (long)'e' << 24 | (long)'r' << 16,
+ (long)'D' << 56 | (long)'e' << 48 | (long)'l' << 40 | (long)'t' << 32 | (long)'a' << 24,
+ (long)'E' << 56 | (long)'T' << 48 | (long)'H' << 40,
+ (long)'E' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
+ (long)'E' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
+ (long)'E' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
+ (long)'E' << 56 | (long)'p' << 48 | (long)'s' << 40 | (long)'i' << 32 | (long)'l' << 24 | (long)'o' << 16 | (long)'n' << 8,
+ (long)'E' << 56 | (long)'t' << 48 | (long)'a' << 40,
+ (long)'E' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
+ (long)'G' << 56 | (long)'a' << 48 | (long)'m' << 40 | (long)'m' << 32 | (long)'a' << 24,
+ (long)'I' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
+ (long)'I' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
+ (long)'I' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
+ (long)'I' << 56 | (long)'o' << 48 | (long)'t' << 40 | (long)'a' << 32,
+ (long)'I' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
+ (long)'K' << 56 | (long)'a' << 48 | (long)'p' << 40 | (long)'p' << 32 | (long)'a' << 24,
+ (long)'L' << 56 | (long)'a' << 48 | (long)'m' << 40 | (long)'b' << 32 | (long)'d' << 24 | (long)'a' << 16,
+ (long)'M' << 56 | (long)'u' << 48,
+ (long)'N' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'l' << 32 | (long)'d' << 24 | (long)'e' << 16,
+ (long)'N' << 56 | (long)'u' << 48,
+ (long)'O' << 56 | (long)'E' << 48 | (long)'l' << 40 | (long)'i' << 32 | (long)'g' << 24,
+ (long)'O' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
+ (long)'O' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
+ (long)'O' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
+ (long)'O' << 56 | (long)'m' << 48 | (long)'e' << 40 | (long)'g' << 32 | (long)'a' << 24,
+ (long)'O' << 56 | (long)'m' << 48 | (long)'i' << 40 | (long)'c' << 32 | (long)'r' << 24 | (long)'o' << 16 | (long)'n' << 8,
+ (long)'O' << 56 | (long)'s' << 48 | (long)'l' << 40 | (long)'a' << 32 | (long)'s' << 24 | (long)'h' << 16,
+ (long)'O' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'l' << 32 | (long)'d' << 24 | (long)'e' << 16,
+ (long)'O' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
+ (long)'P' << 56 | (long)'h' << 48 | (long)'i' << 40,
+ (long)'P' << 56 | (long)'i' << 48,
+ (long)'P' << 56 | (long)'r' << 48 | (long)'i' << 40 | (long)'m' << 32 | (long)'e' << 24,
+ (long)'P' << 56 | (long)'s' << 48 | (long)'i' << 40,
+ (long)'R' << 56 | (long)'h' << 48 | (long)'o' << 40,
+ (long)'S' << 56 | (long)'c' << 48 | (long)'a' << 40 | (long)'r' << 32 | (long)'o' << 24 | (long)'n' << 16,
+ (long)'S' << 56 | (long)'i' << 48 | (long)'g' << 40 | (long)'m' << 32 | (long)'a' << 24,
+ (long)'T' << 56 | (long)'H' << 48 | (long)'O' << 40 | (long)'R' << 32 | (long)'N' << 24,
+ (long)'T' << 56 | (long)'a' << 48 | (long)'u' << 40,
+ (long)'T' << 56 | (long)'h' << 48 | (long)'e' << 40 | (long)'t' << 32 | (long)'a' << 24,
+ (long)'U' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
+ (long)'U' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
+ (long)'U' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
+ (long)'U' << 56 | (long)'p' << 48 | (long)'s' << 40 | (long)'i' << 32 | (long)'l' << 24 | (long)'o' << 16 | (long)'n' << 8,
+ (long)'U' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
+ (long)'X' << 56 | (long)'i' << 48,
+ (long)'Y' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
+ (long)'Y' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
+ (long)'Z' << 56 | (long)'e' << 48 | (long)'t' << 40 | (long)'a' << 32,
+ (long)'a' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
+ (long)'a' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
+ (long)'a' << 56 | (long)'c' << 48 | (long)'u' << 40 | (long)'t' << 32 | (long)'e' << 24,
+ (long)'a' << 56 | (long)'e' << 48 | (long)'l' << 40 | (long)'i' << 32 | (long)'g' << 24,
+ (long)'a' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
+ (long)'a' << 56 | (long)'l' << 48 | (long)'e' << 40 | (long)'f' << 32 | (long)'s' << 24 | (long)'y' << 16 | (long)'m' << 8,
+ (long)'a' << 56 | (long)'l' << 48 | (long)'p' << 40 | (long)'h' << 32 | (long)'a' << 24,
+ (long)'a' << 56 | (long)'m' << 48 | (long)'p' << 40,
+ (long)'a' << 56 | (long)'n' << 48 | (long)'d' << 40,
+ (long)'a' << 56 | (long)'n' << 48 | (long)'g' << 40,
+ (long)'a' << 56 | (long)'p' << 48 | (long)'o' << 40 | (long)'s' << 32,
+ (long)'a' << 56 | (long)'r' << 48 | (long)'i' << 40 | (long)'n' << 32 | (long)'g' << 24,
+ (long)'a' << 56 | (long)'s' << 48 | (long)'y' << 40 | (long)'m' << 32 | (long)'p' << 24,
+ (long)'a' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'l' << 32 | (long)'d' << 24 | (long)'e' << 16,
+ (long)'a' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
+ (long)'b' << 56 | (long)'d' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24,
+ (long)'b' << 56 | (long)'e' << 48 | (long)'t' << 40 | (long)'a' << 32,
+ (long)'b' << 56 | (long)'r' << 48 | (long)'v' << 40 | (long)'b' << 32 | (long)'a' << 24 | (long)'r' << 16,
+ (long)'b' << 56 | (long)'u' << 48 | (long)'l' << 40 | (long)'l' << 32,
+ (long)'c' << 56 | (long)'a' << 48 | (long)'p' << 40,
+ (long)'c' << 56 | (long)'c' << 48 | (long)'e' << 40 | (long)'d' << 32 | (long)'i' << 24 | (long)'l' << 16,
+ (long)'c' << 56 | (long)'e' << 48 | (long)'d' << 40 | (long)'i' << 32 | (long)'l' << 24,
+ (long)'c' << 56 | (long)'e' << 48 | (long)'n' << 40 | (long)'t' << 32,
+ (long)'c' << 56 | (long)'h' << 48 | (long)'i' << 40,
+ (long)'c' << 56 | (long)'i' << 48 | (long)'r' << 40 | (long)'c' << 32,
+ (long)'c' << 56 | (long)'l' << 48 | (long)'u' << 40 | (long)'b' << 32 | (long)'s' << 24,
+ (long)'c' << 56 | (long)'o' << 48 | (long)'n' << 40 | (long)'g' << 32,
+ (long)'c' << 56 | (long)'o' << 48 | (long)'p' << 40 | (long)'y' << 32,
+ (long)'c' << 56 | (long)'r' << 48 | (long)'a' << 40 | (long)'r' << 32 | (long)'r' << 24,
+ (long)'c' << 56 | (long)'u' << 48 | (long)'p' << 40,
+ (long)'c' << 56 | (long)'u' << 48 | (long)'r' << 40 | (long)'r' << 32 | (long)'e' << 24 | (long)'n' << 16,
+ (long)'d' << 56 | (long)'A' << 48 | (long)'r' << 40 | (long)'r' << 32,
+ (long)'d' << 56 | (long)'a' << 48 | (long)'g' << 40 | (long)'g' << 32 | (long)'e' << 24 | (long)'r' << 16,
+ (long)'d' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'r' << 32,
+ (long)'d' << 56 | (long)'e' << 48 | (long)'g' << 40,
+ (long)'d' << 56 | (long)'e' << 48 | (long)'l' << 40 | (long)'t' << 32 | (long)'a' << 24,
+ (long)'d' << 56 | (long)'i' << 48 | (long)'a' << 40 | (long)'m' << 32 | (long)'s' << 24,
+ (long)'d' << 56 | (long)'i' << 48 | (long)'v' << 40 | (long)'i' << 32 | (long)'d' << 24 | (long)'e' << 16,
+ (long)'e' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
+ (long)'e' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
+ (long)'e' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
+ (long)'e' << 56 | (long)'m' << 48 | (long)'p' << 40 | (long)'t' << 32 | (long)'y' << 24,
+ (long)'e' << 56 | (long)'m' << 48 | (long)'s' << 40 | (long)'p' << 32,
+ (long)'e' << 56 | (long)'n' << 48 | (long)'s' << 40 | (long)'p' << 32,
+ (long)'e' << 56 | (long)'p' << 48 | (long)'s' << 40 | (long)'i' << 32 | (long)'l' << 24 | (long)'o' << 16 | (long)'n' << 8,
+ (long)'e' << 56 | (long)'q' << 48 | (long)'u' << 40 | (long)'i' << 32 | (long)'v' << 24,
+ (long)'e' << 56 | (long)'t' << 48 | (long)'a' << 40,
+ (long)'e' << 56 | (long)'t' << 48 | (long)'h' << 40,
+ (long)'e' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
+ (long)'e' << 56 | (long)'u' << 48 | (long)'r' << 40 | (long)'o' << 32,
+ (long)'e' << 56 | (long)'x' << 48 | (long)'i' << 40 | (long)'s' << 32 | (long)'t' << 24,
+ (long)'f' << 56 | (long)'n' << 48 | (long)'o' << 40 | (long)'f' << 32,
+ (long)'f' << 56 | (long)'o' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'l' << 24 | (long)'l' << 16,
+ (long)'f' << 56 | (long)'r' << 48 | (long)'a' << 40 | (long)'c' << 32 | (long)'1' << 24 | (long)'2' << 16,
+ (long)'f' << 56 | (long)'r' << 48 | (long)'a' << 40 | (long)'c' << 32 | (long)'1' << 24 | (long)'4' << 16,
+ (long)'f' << 56 | (long)'r' << 48 | (long)'a' << 40 | (long)'c' << 32 | (long)'3' << 24 | (long)'4' << 16,
+ (long)'f' << 56 | (long)'r' << 48 | (long)'a' << 40 | (long)'s' << 32 | (long)'l' << 24,
+ (long)'g' << 56 | (long)'a' << 48 | (long)'m' << 40 | (long)'m' << 32 | (long)'a' << 24,
+ (long)'g' << 56 | (long)'e' << 48,
+ (long)'g' << 56 | (long)'t' << 48,
+ (long)'h' << 56 | (long)'A' << 48 | (long)'r' << 40 | (long)'r' << 32,
+ (long)'h' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'r' << 32,
+ (long)'h' << 56 | (long)'e' << 48 | (long)'a' << 40 | (long)'r' << 32 | (long)'t' << 24 | (long)'s' << 16,
+ (long)'h' << 56 | (long)'e' << 48 | (long)'l' << 40 | (long)'l' << 32 | (long)'i' << 24 | (long)'p' << 16,
+ (long)'i' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
+ (long)'i' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
+ (long)'i' << 56 | (long)'e' << 48 | (long)'x' << 40 | (long)'c' << 32 | (long)'l' << 24,
+ (long)'i' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
+ (long)'i' << 56 | (long)'m' << 48 | (long)'a' << 40 | (long)'g' << 32 | (long)'e' << 24,
+ (long)'i' << 56 | (long)'n' << 48 | (long)'f' << 40 | (long)'i' << 32 | (long)'n' << 24,
+ (long)'i' << 56 | (long)'n' << 48 | (long)'t' << 40,
+ (long)'i' << 56 | (long)'o' << 48 | (long)'t' << 40 | (long)'a' << 32,
+ (long)'i' << 56 | (long)'q' << 48 | (long)'u' << 40 | (long)'e' << 32 | (long)'s' << 24 | (long)'t' << 16,
+ (long)'i' << 56 | (long)'s' << 48 | (long)'i' << 40 | (long)'n' << 32,
+ (long)'i' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
+ (long)'k' << 56 | (long)'a' << 48 | (long)'p' << 40 | (long)'p' << 32 | (long)'a' << 24,
+ (long)'l' << 56 | (long)'A' << 48 | (long)'r' << 40 | (long)'r' << 32,
+ (long)'l' << 56 | (long)'a' << 48 | (long)'m' << 40 | (long)'b' << 32 | (long)'d' << 24 | (long)'a' << 16,
+ (long)'l' << 56 | (long)'a' << 48 | (long)'n' << 40 | (long)'g' << 32,
+ (long)'l' << 56 | (long)'a' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24,
+ (long)'l' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'r' << 32,
+ (long)'l' << 56 | (long)'c' << 48 | (long)'e' << 40 | (long)'i' << 32 | (long)'l' << 24,
+ (long)'l' << 56 | (long)'d' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24,
+ (long)'l' << 56 | (long)'e' << 48,
+ (long)'l' << 56 | (long)'f' << 48 | (long)'l' << 40 | (long)'o' << 32 | (long)'o' << 24 | (long)'r' << 16,
+ (long)'l' << 56 | (long)'o' << 48 | (long)'w' << 40 | (long)'a' << 32 | (long)'s' << 24 | (long)'t' << 16,
+ (long)'l' << 56 | (long)'o' << 48 | (long)'z' << 40,
+ (long)'l' << 56 | (long)'r' << 48 | (long)'m' << 40,
+ (long)'l' << 56 | (long)'s' << 48 | (long)'a' << 40 | (long)'q' << 32 | (long)'u' << 24 | (long)'o' << 16,
+ (long)'l' << 56 | (long)'s' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24,
+ (long)'l' << 56 | (long)'t' << 48,
+ (long)'m' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'r' << 32,
+ (long)'m' << 56 | (long)'d' << 48 | (long)'a' << 40 | (long)'s' << 32 | (long)'h' << 24,
+ (long)'m' << 56 | (long)'i' << 48 | (long)'c' << 40 | (long)'r' << 32 | (long)'o' << 24,
+ (long)'m' << 56 | (long)'i' << 48 | (long)'d' << 40 | (long)'d' << 32 | (long)'o' << 24 | (long)'t' << 16,
+ (long)'m' << 56 | (long)'i' << 48 | (long)'n' << 40 | (long)'u' << 32 | (long)'s' << 24,
+ (long)'m' << 56 | (long)'u' << 48,
+ (long)'n' << 56 | (long)'a' << 48 | (long)'b' << 40 | (long)'l' << 32 | (long)'a' << 24,
+ (long)'n' << 56 | (long)'b' << 48 | (long)'s' << 40 | (long)'p' << 32,
+ (long)'n' << 56 | (long)'d' << 48 | (long)'a' << 40 | (long)'s' << 32 | (long)'h' << 24,
+ (long)'n' << 56 | (long)'e' << 48,
+ (long)'n' << 56 | (long)'i' << 48,
+ (long)'n' << 56 | (long)'o' << 48 | (long)'t' << 40,
+ (long)'n' << 56 | (long)'o' << 48 | (long)'t' << 40 | (long)'i' << 32 | (long)'n' << 24,
+ (long)'n' << 56 | (long)'s' << 48 | (long)'u' << 40 | (long)'b' << 32,
+ (long)'n' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'l' << 32 | (long)'d' << 24 | (long)'e' << 16,
+ (long)'n' << 56 | (long)'u' << 48,
+ (long)'o' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
+ (long)'o' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
+ (long)'o' << 56 | (long)'e' << 48 | (long)'l' << 40 | (long)'i' << 32 | (long)'g' << 24,
+ (long)'o' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
+ (long)'o' << 56 | (long)'l' << 48 | (long)'i' << 40 | (long)'n' << 32 | (long)'e' << 24,
+ (long)'o' << 56 | (long)'m' << 48 | (long)'e' << 40 | (long)'g' << 32 | (long)'a' << 24,
+ (long)'o' << 56 | (long)'m' << 48 | (long)'i' << 40 | (long)'c' << 32 | (long)'r' << 24 | (long)'o' << 16 | (long)'n' << 8,
+ (long)'o' << 56 | (long)'p' << 48 | (long)'l' << 40 | (long)'u' << 32 | (long)'s' << 24,
+ (long)'o' << 56 | (long)'r' << 48,
+ (long)'o' << 56 | (long)'r' << 48 | (long)'d' << 40 | (long)'f' << 32,
+ (long)'o' << 56 | (long)'r' << 48 | (long)'d' << 40 | (long)'m' << 32,
+ (long)'o' << 56 | (long)'s' << 48 | (long)'l' << 40 | (long)'a' << 32 | (long)'s' << 24 | (long)'h' << 16,
+ (long)'o' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'l' << 32 | (long)'d' << 24 | (long)'e' << 16,
+ (long)'o' << 56 | (long)'t' << 48 | (long)'i' << 40 | (long)'m' << 32 | (long)'e' << 24 | (long)'s' << 16,
+ (long)'o' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
+ (long)'p' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'a' << 32,
+ (long)'p' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'t' << 32,
+ (long)'p' << 56 | (long)'e' << 48 | (long)'r' << 40 | (long)'m' << 32 | (long)'i' << 24 | (long)'l' << 16,
+ (long)'p' << 56 | (long)'e' << 48 | (long)'r' << 40 | (long)'p' << 32,
+ (long)'p' << 56 | (long)'h' << 48 | (long)'i' << 40,
+ (long)'p' << 56 | (long)'i' << 48,
+ (long)'p' << 56 | (long)'i' << 48 | (long)'v' << 40,
+ (long)'p' << 56 | (long)'l' << 48 | (long)'u' << 40 | (long)'s' << 32 | (long)'m' << 24 | (long)'n' << 16,
+ (long)'p' << 56 | (long)'o' << 48 | (long)'u' << 40 | (long)'n' << 32 | (long)'d' << 24,
+ (long)'p' << 56 | (long)'r' << 48 | (long)'i' << 40 | (long)'m' << 32 | (long)'e' << 24,
+ (long)'p' << 56 | (long)'r' << 48 | (long)'o' << 40 | (long)'d' << 32,
+ (long)'p' << 56 | (long)'r' << 48 | (long)'o' << 40 | (long)'p' << 32,
+ (long)'p' << 56 | (long)'s' << 48 | (long)'i' << 40,
+ (long)'q' << 56 | (long)'u' << 48 | (long)'o' << 40 | (long)'t' << 32,
+ (long)'r' << 56 | (long)'A' << 48 | (long)'r' << 40 | (long)'r' << 32,
+ (long)'r' << 56 | (long)'a' << 48 | (long)'d' << 40 | (long)'i' << 32 | (long)'c' << 24,
+ (long)'r' << 56 | (long)'a' << 48 | (long)'n' << 40 | (long)'g' << 32,
+ (long)'r' << 56 | (long)'a' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24,
+ (long)'r' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'r' << 32,
+ (long)'r' << 56 | (long)'c' << 48 | (long)'e' << 40 | (long)'i' << 32 | (long)'l' << 24,
+ (long)'r' << 56 | (long)'d' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24,
+ (long)'r' << 56 | (long)'e' << 48 | (long)'a' << 40 | (long)'l' << 32,
+ (long)'r' << 56 | (long)'e' << 48 | (long)'g' << 40,
+ (long)'r' << 56 | (long)'f' << 48 | (long)'l' << 40 | (long)'o' << 32 | (long)'o' << 24 | (long)'r' << 16,
+ (long)'r' << 56 | (long)'h' << 48 | (long)'o' << 40,
+ (long)'r' << 56 | (long)'l' << 48 | (long)'m' << 40,
+ (long)'r' << 56 | (long)'s' << 48 | (long)'a' << 40 | (long)'q' << 32 | (long)'u' << 24 | (long)'o' << 16,
+ (long)'r' << 56 | (long)'s' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24,
+ (long)'s' << 56 | (long)'b' << 48 | (long)'q' << 40 | (long)'u' << 32 | (long)'o' << 24,
+ (long)'s' << 56 | (long)'c' << 48 | (long)'a' << 40 | (long)'r' << 32 | (long)'o' << 24 | (long)'n' << 16,
+ (long)'s' << 56 | (long)'d' << 48 | (long)'o' << 40 | (long)'t' << 32,
+ (long)'s' << 56 | (long)'e' << 48 | (long)'c' << 40 | (long)'t' << 32,
+ (long)'s' << 56 | (long)'h' << 48 | (long)'y' << 40,
+ (long)'s' << 56 | (long)'i' << 48 | (long)'g' << 40 | (long)'m' << 32 | (long)'a' << 24,
+ (long)'s' << 56 | (long)'i' << 48 | (long)'g' << 40 | (long)'m' << 32 | (long)'a' << 24 | (long)'f' << 16,
+ (long)'s' << 56 | (long)'i' << 48 | (long)'m' << 40,
+ (long)'s' << 56 | (long)'p' << 48 | (long)'a' << 40 | (long)'d' << 32 | (long)'e' << 24 | (long)'s' << 16,
+ (long)'s' << 56 | (long)'u' << 48 | (long)'b' << 40,
+ (long)'s' << 56 | (long)'u' << 48 | (long)'b' << 40 | (long)'e' << 32,
+ (long)'s' << 56 | (long)'u' << 48 | (long)'m' << 40,
+ (long)'s' << 56 | (long)'u' << 48 | (long)'p' << 40,
+ (long)'s' << 56 | (long)'u' << 48 | (long)'p' << 40 | (long)'1' << 32,
+ (long)'s' << 56 | (long)'u' << 48 | (long)'p' << 40 | (long)'2' << 32,
+ (long)'s' << 56 | (long)'u' << 48 | (long)'p' << 40 | (long)'3' << 32,
+ (long)'s' << 56 | (long)'u' << 48 | (long)'p' << 40 | (long)'e' << 32,
+ (long)'s' << 56 | (long)'z' << 48 | (long)'l' << 40 | (long)'i' << 32 | (long)'g' << 24,
+ (long)'t' << 56 | (long)'a' << 48 | (long)'u' << 40,
+ (long)'t' << 56 | (long)'h' << 48 | (long)'e' << 40 | (long)'r' << 32 | (long)'e' << 24 | (long)'4' << 16,
+ (long)'t' << 56 | (long)'h' << 48 | (long)'e' << 40 | (long)'t' << 32 | (long)'a' << 24,
+ (long)'t' << 56 | (long)'h' << 48 | (long)'e' << 40 | (long)'t' << 32 | (long)'a' << 24 | (long)'s' << 16 | (long)'y' << 8 | (long)'m' << 0,
+ (long)'t' << 56 | (long)'h' << 48 | (long)'i' << 40 | (long)'n' << 32 | (long)'s' << 24 | (long)'p' << 16,
+ (long)'t' << 56 | (long)'h' << 48 | (long)'o' << 40 | (long)'r' << 32 | (long)'n' << 24,
+ (long)'t' << 56 | (long)'i' << 48 | (long)'l' << 40 | (long)'d' << 32 | (long)'e' << 24,
+ (long)'t' << 56 | (long)'i' << 48 | (long)'m' << 40 | (long)'e' << 32 | (long)'s' << 24,
+ (long)'t' << 56 | (long)'r' << 48 | (long)'a' << 40 | (long)'d' << 32 | (long)'e' << 24,
+ (long)'u' << 56 | (long)'A' << 48 | (long)'r' << 40 | (long)'r' << 32,
+ (long)'u' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
+ (long)'u' << 56 | (long)'a' << 48 | (long)'r' << 40 | (long)'r' << 32,
+ (long)'u' << 56 | (long)'c' << 48 | (long)'i' << 40 | (long)'r' << 32 | (long)'c' << 24,
+ (long)'u' << 56 | (long)'g' << 48 | (long)'r' << 40 | (long)'a' << 32 | (long)'v' << 24 | (long)'e' << 16,
+ (long)'u' << 56 | (long)'m' << 48 | (long)'l' << 40,
+ (long)'u' << 56 | (long)'p' << 48 | (long)'s' << 40 | (long)'i' << 32 | (long)'h' << 24,
+ (long)'u' << 56 | (long)'p' << 48 | (long)'s' << 40 | (long)'i' << 32 | (long)'l' << 24 | (long)'o' << 16 | (long)'n' << 8,
+ (long)'u' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
+ (long)'w' << 56 | (long)'e' << 48 | (long)'i' << 40 | (long)'e' << 32 | (long)'r' << 24 | (long)'p' << 16,
+ (long)'x' << 56 | (long)'i' << 48,
+ (long)'y' << 56 | (long)'a' << 48 | (long)'c' << 40 | (long)'u' << 32 | (long)'t' << 24 | (long)'e' << 16,
+ (long)'y' << 56 | (long)'e' << 48 | (long)'n' << 40,
+ (long)'y' << 56 | (long)'u' << 48 | (long)'m' << 40 | (long)'l' << 32,
+ (long)'z' << 56 | (long)'e' << 48 | (long)'t' << 40 | (long)'a' << 32,
+ (long)'z' << 56 | (long)'w' << 48 | (long)'j' << 40,
+ (long)'z' << 56 | (long)'w' << 48 | (long)'n' << 40 | (long)'j' << 32
+ };
static readonly char[] entities_values = new char[] {
- '\u00C6',
- '\u00C1',
- '\u00C2',
- '\u00C0',
- '\u0391',
- '\u00C5',
- '\u00C3',
- '\u00C4',
- '\u0392',
- '\u00C7',
- '\u03A7',
- '\u2021',
- '\u0394',
- '\u00D0',
- '\u00C9',
- '\u00CA',
- '\u00C8',
- '\u0395',
- '\u0397',
- '\u00CB',
- '\u0393',
- '\u00CD',
- '\u00CE',
- '\u00CC',
- '\u0399',
- '\u00CF',
- '\u039A',
- '\u039B',
- '\u039C',
- '\u00D1',
- '\u039D',
- '\u0152',
- '\u00D3',
- '\u00D4',
- '\u00D2',
- '\u03A9',
- '\u039F',
- '\u00D8',
- '\u00D5',
- '\u00D6',
- '\u03A6',
- '\u03A0',
- '\u2033',
- '\u03A8',
- '\u03A1',
- '\u0160',
- '\u03A3',
- '\u00DE',
- '\u03A4',
- '\u0398',
- '\u00DA',
- '\u00DB',
- '\u00D9',
- '\u03A5',
- '\u00DC',
- '\u039E',
- '\u00DD',
- '\u0178',
- '\u0396',
- '\u00E1',
- '\u00E2',
- '\u00B4',
- '\u00E6',
- '\u00E0',
- '\u2135',
- '\u03B1',
- '\u0026',
- '\u2227',
- '\u2220',
- '\u0027',
- '\u00E5',
- '\u2248',
- '\u00E3',
- '\u00E4',
- '\u201E',
- '\u03B2',
- '\u00A6',
- '\u2022',
- '\u2229',
- '\u00E7',
- '\u00B8',
- '\u00A2',
- '\u03C7',
- '\u02C6',
- '\u2663',
- '\u2245',
- '\u00A9',
- '\u21B5',
- '\u222A',
- '\u00A4',
- '\u21D3',
- '\u2020',
- '\u2193',
- '\u00B0',
- '\u03B4',
- '\u2666',
- '\u00F7',
- '\u00E9',
- '\u00EA',
- '\u00E8',
- '\u2205',
- '\u2003',
- '\u2002',
- '\u03B5',
- '\u2261',
- '\u03B7',
- '\u00F0',
- '\u00EB',
- '\u20AC',
- '\u2203',
- '\u0192',
- '\u2200',
- '\u00BD',
- '\u00BC',
- '\u00BE',
- '\u2044',
- '\u03B3',
- '\u2265',
- '\u003E',
- '\u21D4',
- '\u2194',
- '\u2665',
- '\u2026',
- '\u00ED',
- '\u00EE',
- '\u00A1',
- '\u00EC',
- '\u2111',
- '\u221E',
- '\u222B',
- '\u03B9',
- '\u00BF',
- '\u2208',
- '\u00EF',
- '\u03BA',
- '\u21D0',
- '\u03BB',
- '\u2329',
- '\u00AB',
- '\u2190',
- '\u2308',
- '\u201C',
- '\u2264',
- '\u230A',
- '\u2217',
- '\u25CA',
- '\u200E',
- '\u2039',
- '\u2018',
- '\u003C',
- '\u00AF',
- '\u2014',
- '\u00B5',
- '\u00B7',
- '\u2212',
- '\u03BC',
- '\u2207',
- '\u00A0',
- '\u2013',
- '\u2260',
- '\u220B',
- '\u00AC',
- '\u2209',
- '\u2284',
- '\u00F1',
- '\u03BD',
- '\u00F3',
- '\u00F4',
- '\u0153',
- '\u00F2',
- '\u203E',
- '\u03C9',
- '\u03BF',
- '\u2295',
- '\u2228',
- '\u00AA',
- '\u00BA',
- '\u00F8',
- '\u00F5',
- '\u2297',
- '\u00F6',
- '\u00B6',
- '\u2202',
- '\u2030',
- '\u22A5',
- '\u03C6',
- '\u03C0',
- '\u03D6',
- '\u00B1',
- '\u00A3',
- '\u2032',
- '\u220F',
- '\u221D',
- '\u03C8',
- '\u0022',
- '\u21D2',
- '\u221A',
- '\u232A',
- '\u00BB',
- '\u2192',
- '\u2309',
- '\u201D',
- '\u211C',
- '\u00AE',
- '\u230B',
- '\u03C1',
- '\u200F',
- '\u203A',
- '\u2019',
- '\u201A',
- '\u0161',
- '\u22C5',
- '\u00A7',
- '\u00AD',
- '\u03C3',
- '\u03C2',
- '\u223C',
- '\u2660',
- '\u2282',
- '\u2286',
- '\u2211',
- '\u2283',
- '\u00B9',
- '\u00B2',
- '\u00B3',
- '\u2287',
- '\u00DF',
- '\u03C4',
- '\u2234',
- '\u03B8',
- '\u03D1',
- '\u2009',
- '\u00FE',
- '\u02DC',
- '\u00D7',
- '\u2122',
- '\u21D1',
- '\u00FA',
- '\u2191',
- '\u00FB',
- '\u00F9',
- '\u00A8',
- '\u03D2',
- '\u03C5',
- '\u00FC',
- '\u2118',
- '\u03BE',
- '\u00FD',
- '\u00A5',
- '\u00FF',
- '\u03B6',
- '\u200D',
- '\u200C'
- };
+ '\u00C6', '\u00C1', '\u00C2', '\u00C0', '\u0391', '\u00C5', '\u00C3', '\u00C4', '\u0392', '\u00C7', '\u03A7',
+ '\u2021', '\u0394', '\u00D0', '\u00C9', '\u00CA', '\u00C8', '\u0395', '\u0397', '\u00CB', '\u0393', '\u00CD',
+ '\u00CE', '\u00CC', '\u0399', '\u00CF', '\u039A', '\u039B', '\u039C', '\u00D1', '\u039D', '\u0152', '\u00D3',
+ '\u00D4', '\u00D2', '\u03A9', '\u039F', '\u00D8', '\u00D5', '\u00D6', '\u03A6', '\u03A0', '\u2033', '\u03A8',
+ '\u03A1', '\u0160', '\u03A3', '\u00DE', '\u03A4', '\u0398', '\u00DA', '\u00DB', '\u00D9', '\u03A5', '\u00DC',
+ '\u039E', '\u00DD', '\u0178', '\u0396', '\u00E1', '\u00E2', '\u00B4', '\u00E6', '\u00E0', '\u2135', '\u03B1',
+ '\u0026', '\u2227', '\u2220', '\u0027', '\u00E5', '\u2248', '\u00E3', '\u00E4', '\u201E', '\u03B2', '\u00A6',
+ '\u2022', '\u2229', '\u00E7', '\u00B8', '\u00A2', '\u03C7', '\u02C6', '\u2663', '\u2245', '\u00A9', '\u21B5',
+ '\u222A', '\u00A4', '\u21D3', '\u2020', '\u2193', '\u00B0', '\u03B4', '\u2666', '\u00F7', '\u00E9', '\u00EA',
+ '\u00E8', '\u2205', '\u2003', '\u2002', '\u03B5', '\u2261', '\u03B7', '\u00F0', '\u00EB', '\u20AC', '\u2203',
+ '\u0192', '\u2200', '\u00BD', '\u00BC', '\u00BE', '\u2044', '\u03B3', '\u2265', '\u003E', '\u21D4', '\u2194',
+ '\u2665', '\u2026', '\u00ED', '\u00EE', '\u00A1', '\u00EC', '\u2111', '\u221E', '\u222B', '\u03B9', '\u00BF',
+ '\u2208', '\u00EF', '\u03BA', '\u21D0', '\u03BB', '\u2329', '\u00AB', '\u2190', '\u2308', '\u201C', '\u2264',
+ '\u230A', '\u2217', '\u25CA', '\u200E', '\u2039', '\u2018', '\u003C', '\u00AF', '\u2014', '\u00B5', '\u00B7',
+ '\u2212', '\u03BC', '\u2207', '\u00A0', '\u2013', '\u2260', '\u220B', '\u00AC', '\u2209', '\u2284', '\u00F1',
+ '\u03BD', '\u00F3', '\u00F4', '\u0153', '\u00F2', '\u203E', '\u03C9', '\u03BF', '\u2295', '\u2228', '\u00AA',
+ '\u00BA', '\u00F8', '\u00F5', '\u2297', '\u00F6', '\u00B6', '\u2202', '\u2030', '\u22A5', '\u03C6', '\u03C0',
+ '\u03D6', '\u00B1', '\u00A3', '\u2032', '\u220F', '\u221D', '\u03C8', '\u0022', '\u21D2', '\u221A', '\u232A',
+ '\u00BB', '\u2192', '\u2309', '\u201D', '\u211C', '\u00AE', '\u230B', '\u03C1', '\u200F', '\u203A', '\u2019',
+ '\u201A', '\u0161', '\u22C5', '\u00A7', '\u00AD', '\u03C3', '\u03C2', '\u223C', '\u2660', '\u2282', '\u2286',
+ '\u2211', '\u2283', '\u00B9', '\u00B2', '\u00B3', '\u2287', '\u00DF', '\u03C4', '\u2234', '\u03B8', '\u03D1',
+ '\u2009', '\u00FE', '\u02DC', '\u00D7', '\u2122', '\u21D1', '\u00FA', '\u2191', '\u00FB', '\u00F9', '\u00A8',
+ '\u03D2', '\u03C5', '\u00FC', '\u2118', '\u03BE', '\u00FD', '\u00A5', '\u00FF', '\u03B6', '\u200D', '\u200C'
+ };
#region Methods
@@ -670,7 +440,7 @@ namespace MediaBrowser.Model.Services
public static string HtmlDecode(string s)
{
if (s == null)
- throw new ArgumentNullException("s");
+ throw new ArgumentNullException(nameof(s));
if (s.IndexOf('&') == -1)
return s;
@@ -791,7 +561,7 @@ namespace MediaBrowser.Model.Services
break;
}
- if (Char.IsDigit(c))
+ if (char.IsDigit(c))
{
if (digit_start == 0)
digit_start = i;
@@ -845,9 +615,9 @@ namespace MediaBrowser.Model.Services
public static QueryParamCollection ParseQueryString(string query, Encoding encoding)
{
if (query == null)
- throw new ArgumentNullException("query");
+ throw new ArgumentNullException(nameof(query));
if (encoding == null)
- throw new ArgumentNullException("encoding");
+ throw new ArgumentNullException(nameof(encoding));
if (query.Length == 0 || (query.Length == 1 && query[0] == '?'))
return new QueryParamCollection();
if (query[0] == '?')
diff --git a/MediaBrowser.Model/Services/IHasRequestFilter.cs b/MediaBrowser.Model/Services/IHasRequestFilter.cs
index 2164179d5..90cfc2a31 100644
--- a/MediaBrowser.Model/Services/IHasRequestFilter.cs
+++ b/MediaBrowser.Model/Services/IHasRequestFilter.cs
@@ -4,7 +4,7 @@ namespace MediaBrowser.Model.Services
public interface IHasRequestFilter
{
/// <summary>
- /// Order in which Request Filters are executed.
+ /// Order in which Request Filters are executed.
/// &lt;0 Executed before global request filters
/// &gt;0 Executed after global request filters
/// </summary>
diff --git a/MediaBrowser.Model/Services/IHttpResponse.cs b/MediaBrowser.Model/Services/IHttpResponse.cs
index cd9c07d46..9d77eefc9 100644
--- a/MediaBrowser.Model/Services/IHttpResponse.cs
+++ b/MediaBrowser.Model/Services/IHttpResponse.cs
@@ -17,7 +17,7 @@ namespace MediaBrowser.Model.Services
void SetCookie(Cookie cookie);
/// <summary>
- /// Removes all pending Set-Cookie instructions
+ /// Removes all pending Set-Cookie instructions
/// </summary>
void ClearCookies();
}
diff --git a/MediaBrowser.Model/Services/QueryParamCollection.cs b/MediaBrowser.Model/Services/QueryParamCollection.cs
index 4dd4303a8..05ba6f18d 100644
--- a/MediaBrowser.Model/Services/QueryParamCollection.cs
+++ b/MediaBrowser.Model/Services/QueryParamCollection.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using MediaBrowser.Model.Dto;
@@ -20,12 +20,12 @@ namespace MediaBrowser.Model.Services
}
}
- private StringComparison GetStringComparison()
+ private static StringComparison GetStringComparison()
{
return StringComparison.OrdinalIgnoreCase;
}
- private StringComparer GetStringComparer()
+ private static StringComparer GetStringComparer()
{
return StringComparer.OrdinalIgnoreCase;
}
@@ -218,7 +218,7 @@ namespace MediaBrowser.Model.Services
return pair.Name + "=" + pair.Value;
}
- public override String ToString()
+ public override string ToString()
{
var vals = this.Select(GetQueryStringValue).ToArray();
diff --git a/MediaBrowser.Model/Services/RouteAttribute.cs b/MediaBrowser.Model/Services/RouteAttribute.cs
index 264500e60..0dc52af7b 100644
--- a/MediaBrowser.Model/Services/RouteAttribute.cs
+++ b/MediaBrowser.Model/Services/RouteAttribute.cs
@@ -6,12 +6,12 @@ namespace MediaBrowser.Model.Services
public class RouteAttribute : Attribute
{
/// <summary>
- /// <para>Initializes an instance of the <see cref="RouteAttribute"/> class.</para>
+ /// <para>Initializes an instance of the <see cref="RouteAttribute"/> class.</para>
/// </summary>
/// <param name="path">
- /// <para>The path template to map to the request. See
- /// <see cref="Path">RouteAttribute.Path</see>
- /// for details on the correct format.</para>
+ /// <para>The path template to map to the request. See
+ /// <see cref="Path">RouteAttribute.Path</see>
+ /// for details on the correct format.</para>
/// </param>
public RouteAttribute(string path)
: this(path, null)
@@ -19,15 +19,15 @@ namespace MediaBrowser.Model.Services
}
/// <summary>
- /// <para>Initializes an instance of the <see cref="RouteAttribute"/> class.</para>
+ /// <para>Initializes an instance of the <see cref="RouteAttribute"/> class.</para>
/// </summary>
/// <param name="path">
- /// <para>The path template to map to the request. See
- /// <see cref="Path">RouteAttribute.Path</see>
- /// for details on the correct format.</para>
+ /// <para>The path template to map to the request. See
+ /// <see cref="Path">RouteAttribute.Path</see>
+ /// for details on the correct format.</para>
/// </param>
- /// <param name="verbs">A comma-delimited list of HTTP verbs supported by the
- /// service. If unspecified, all verbs are assumed to be supported.</param>
+ /// <param name="verbs">A comma-delimited list of HTTP verbs supported by the
+ /// service. If unspecified, all verbs are assumed to be supported.</param>
public RouteAttribute(string path, string verbs)
{
Path = path;
@@ -35,51 +35,51 @@ namespace MediaBrowser.Model.Services
}
/// <summary>
- /// Gets or sets the path template to be mapped to the request.
+ /// Gets or sets the path template to be mapped to the request.
/// </summary>
/// <value>
- /// A <see cref="String"/> value providing the path mapped to
- /// the request. Never <see langword="null"/>.
+ /// A <see cref="String"/> value providing the path mapped to
+ /// the request. Never <see langword="null"/>.
/// </value>
/// <remarks>
- /// <para>Some examples of valid paths are:</para>
- ///
- /// <list>
- /// <item>"/Inventory"</item>
- /// <item>"/Inventory/{Category}/{ItemId}"</item>
- /// <item>"/Inventory/{ItemPath*}"</item>
- /// </list>
- ///
- /// <para>Variables are specified within "{}"
- /// brackets. Each variable in the path is mapped to the same-named property
- /// on the request DTO. At runtime, ServiceStack will parse the
- /// request URL, extract the variable values, instantiate the request DTO,
- /// and assign the variable values into the corresponding request properties,
- /// prior to passing the request DTO to the service object for processing.</para>
- ///
- /// <para>It is not necessary to specify all request properties as
- /// variables in the path. For unspecified properties, callers may provide
- /// values in the query string. For example: the URL
- /// "http://services/Inventory?Category=Books&amp;ItemId=12345" causes the same
- /// request DTO to be processed as "http://services/Inventory/Books/12345",
- /// provided that the paths "/Inventory" (which supports the first URL) and
- /// "/Inventory/{Category}/{ItemId}" (which supports the second URL)
- /// are both mapped to the request DTO.</para>
- ///
- /// <para>Please note that while it is possible to specify property values
- /// in the query string, it is generally considered to be less RESTful and
- /// less desirable than to specify them as variables in the path. Using the
- /// query string to specify property values may also interfere with HTTP
- /// caching.</para>
- ///
- /// <para>The final variable in the path may contain a "*" suffix
- /// to grab all remaining segments in the path portion of the request URL and assign
- /// them to a single property on the request DTO.
- /// For example, if the path "/Inventory/{ItemPath*}" is mapped to the request DTO,
- /// then the request URL "http://services/Inventory/Books/12345" will result
- /// in a request DTO whose ItemPath property contains "Books/12345".
- /// You may only specify one such variable in the path, and it must be positioned at
- /// the end of the path.</para>
+ /// <para>Some examples of valid paths are:</para>
+ ///
+ /// <list>
+ /// <item>"/Inventory"</item>
+ /// <item>"/Inventory/{Category}/{ItemId}"</item>
+ /// <item>"/Inventory/{ItemPath*}"</item>
+ /// </list>
+ ///
+ /// <para>Variables are specified within "{}"
+ /// brackets. Each variable in the path is mapped to the same-named property
+ /// on the request DTO. At runtime, ServiceStack will parse the
+ /// request URL, extract the variable values, instantiate the request DTO,
+ /// and assign the variable values into the corresponding request properties,
+ /// prior to passing the request DTO to the service object for processing.</para>
+ ///
+ /// <para>It is not necessary to specify all request properties as
+ /// variables in the path. For unspecified properties, callers may provide
+ /// values in the query string. For example: the URL
+ /// "http://services/Inventory?Category=Books&amp;ItemId=12345" causes the same
+ /// request DTO to be processed as "http://services/Inventory/Books/12345",
+ /// provided that the paths "/Inventory" (which supports the first URL) and
+ /// "/Inventory/{Category}/{ItemId}" (which supports the second URL)
+ /// are both mapped to the request DTO.</para>
+ ///
+ /// <para>Please note that while it is possible to specify property values
+ /// in the query string, it is generally considered to be less RESTful and
+ /// less desirable than to specify them as variables in the path. Using the
+ /// query string to specify property values may also interfere with HTTP
+ /// caching.</para>
+ ///
+ /// <para>The final variable in the path may contain a "*" suffix
+ /// to grab all remaining segments in the path portion of the request URL and assign
+ /// them to a single property on the request DTO.
+ /// For example, if the path "/Inventory/{ItemPath*}" is mapped to the request DTO,
+ /// then the request URL "http://services/Inventory/Books/12345" will result
+ /// in a request DTO whose ItemPath property contains "Books/12345".
+ /// You may only specify one such variable in the path, and it must be positioned at
+ /// the end of the path.</para>
/// </remarks>
public string Path { get; set; }
@@ -93,22 +93,22 @@ namespace MediaBrowser.Model.Services
public bool IsHidden { get; set; }
/// <summary>
- /// Gets or sets longer text to explain the behaviour of the route.
+ /// Gets or sets longer text to explain the behaviour of the route.
/// </summary>
public string Notes { get; set; }
/// <summary>
- /// Gets or sets a comma-delimited list of HTTP verbs supported by the service, such as
- /// "GET,PUT,POST,DELETE".
+ /// Gets or sets a comma-delimited list of HTTP verbs supported by the service, such as
+ /// "GET,PUT,POST,DELETE".
/// </summary>
/// <value>
- /// A <see cref="String"/> providing a comma-delimited list of HTTP verbs supported
- /// by the service, <see langword="null"/> or empty if all verbs are supported.
+ /// A <see cref="String"/> providing a comma-delimited list of HTTP verbs supported
+ /// by the service, <see langword="null"/> or empty if all verbs are supported.
/// </value>
public string Verbs { get; set; }
/// <summary>
- /// Used to rank the precedences of route definitions in reverse routing.
+ /// Used to rank the precedences of route definitions in reverse routing.
/// i.e. Priorities below 0 are auto-generated have less precedence.
/// </summary>
public int Priority { get; set; }
diff --git a/MediaBrowser.Model/Session/PlaybackProgressInfo.cs b/MediaBrowser.Model/Session/PlaybackProgressInfo.cs
index ce6b2875e..dfdd42c36 100644
--- a/MediaBrowser.Model/Session/PlaybackProgressInfo.cs
+++ b/MediaBrowser.Model/Session/PlaybackProgressInfo.cs
@@ -25,7 +25,7 @@ namespace MediaBrowser.Model.Session
/// </summary>
/// <value>The item identifier.</value>
public Guid ItemId { get; set; }
-
+
/// <summary>
/// Gets or sets the session id.
/// </summary>
diff --git a/MediaBrowser.Model/System/IEnvironmentInfo.cs b/MediaBrowser.Model/System/IEnvironmentInfo.cs
index 6af514dc8..faf9f0a42 100644
--- a/MediaBrowser.Model/System/IEnvironmentInfo.cs
+++ b/MediaBrowser.Model/System/IEnvironmentInfo.cs
@@ -8,10 +8,6 @@ namespace MediaBrowser.Model.System
string OperatingSystemName { get; }
string OperatingSystemVersion { get; }
Architecture SystemArchitecture { get; }
- string GetEnvironmentVariable(string name);
- void SetProcessEnvironmentVariable(string name, string value);
- string StackTrace { get; }
- char PathSeparator { get; }
}
public enum OperatingSystem
diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.cs
index a63ce5e66..5d019932a 100644
--- a/MediaBrowser.Model/System/SystemInfo.cs
+++ b/MediaBrowser.Model/System/SystemInfo.cs
@@ -17,7 +17,7 @@ namespace MediaBrowser.Model.System
public string OperatingSystemDisplayName { get; set; }
public string PackageName { get; set; }
-
+
/// <summary>
/// Gets or sets a value indicating whether this instance has pending restart.
/// </summary>
diff --git a/MediaBrowser.Model/Tasks/ITaskManager.cs b/MediaBrowser.Model/Tasks/ITaskManager.cs
index cbc18032c..dd29cdb65 100644
--- a/MediaBrowser.Model/Tasks/ITaskManager.cs
+++ b/MediaBrowser.Model/Tasks/ITaskManager.cs
@@ -52,7 +52,7 @@ namespace MediaBrowser.Model.Tasks
void QueueIfNotRunning<T>()
where T : IScheduledTask;
-
+
/// <summary>
/// Queues the scheduled task.
/// </summary>
@@ -69,7 +69,7 @@ namespace MediaBrowser.Model.Tasks
void Execute<T>()
where T : IScheduledTask;
-
+
event EventHandler<GenericEventArgs<IScheduledTaskWorker>> TaskExecuting;
event EventHandler<TaskCompletionEventArgs> TaskCompleted;
diff --git a/MediaBrowser.Model/Tasks/TaskResult.cs b/MediaBrowser.Model/Tasks/TaskResult.cs
index 39eacdf66..9cc45a16b 100644
--- a/MediaBrowser.Model/Tasks/TaskResult.cs
+++ b/MediaBrowser.Model/Tasks/TaskResult.cs
@@ -36,7 +36,7 @@ namespace MediaBrowser.Model.Tasks
/// </summary>
/// <value>The key.</value>
public string Key { get; set; }
-
+
/// <summary>
/// Gets or sets the id.
/// </summary>
diff --git a/MediaBrowser.Model/Updates/PackageInfo.cs b/MediaBrowser.Model/Updates/PackageInfo.cs
index e46d59fc0..464ea295d 100644
--- a/MediaBrowser.Model/Updates/PackageInfo.cs
+++ b/MediaBrowser.Model/Updates/PackageInfo.cs
@@ -164,7 +164,7 @@ namespace MediaBrowser.Model.Updates
/// </summary>
/// <value>The installs.</value>
public int installs { get; set; }
-
+
/// <summary>
/// Initializes a new instance of the <see cref="PackageInfo"/> class.
/// </summary>
diff --git a/MediaBrowser.Providers/BoxSets/MovieDbBoxSetImageProvider.cs b/MediaBrowser.Providers/BoxSets/MovieDbBoxSetImageProvider.cs
index 729897290..79b9aaf98 100644
--- a/MediaBrowser.Providers/BoxSets/MovieDbBoxSetImageProvider.cs
+++ b/MediaBrowser.Providers/BoxSets/MovieDbBoxSetImageProvider.cs
@@ -42,7 +42,7 @@ namespace MediaBrowser.Providers.BoxSets
{
return new List<ImageType>
{
- ImageType.Primary,
+ ImageType.Primary,
ImageType.Backdrop
};
}
diff --git a/MediaBrowser.Providers/BoxSets/MovieDbBoxSetProvider.cs b/MediaBrowser.Providers/BoxSets/MovieDbBoxSetProvider.cs
index 0369e8ca1..a196fa398 100644
--- a/MediaBrowser.Providers/BoxSets/MovieDbBoxSetProvider.cs
+++ b/MediaBrowser.Providers/BoxSets/MovieDbBoxSetProvider.cs
@@ -50,7 +50,7 @@ namespace MediaBrowser.Providers.BoxSets
}
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
-
+
public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(BoxSetInfo searchInfo, CancellationToken cancellationToken)
{
var tmdbId = searchInfo.GetProviderId(MetadataProviders.Tmdb);
@@ -73,7 +73,7 @@ namespace MediaBrowser.Providers.BoxSets
Name = info.name,
SearchProviderName = Name,
-
+
ImageUrl = images.Count == 0 ? null : (tmdbImageUrl + images[0].file_path)
};
@@ -122,7 +122,7 @@ namespace MediaBrowser.Providers.BoxSets
{
if (string.IsNullOrEmpty(tmdbId))
{
- throw new ArgumentNullException("tmdbId");
+ throw new ArgumentNullException(nameof(tmdbId));
}
await EnsureInfo(tmdbId, language, cancellationToken).ConfigureAwait(false);
@@ -158,7 +158,7 @@ namespace MediaBrowser.Providers.BoxSets
var dataFilePath = GetDataFilePath(_config.ApplicationPaths, tmdbId, preferredMetadataLanguage);
- _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(dataFilePath));
+ _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(dataFilePath));
_json.SerializeToFile(mainResult, dataFilePath);
}
diff --git a/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs b/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs
index 0e6c07357..49656a410 100644
--- a/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs
+++ b/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs
@@ -83,7 +83,7 @@ namespace Priority_Queue
#if DEBUG
if (node == null)
{
- throw new ArgumentNullException("node");
+ throw new ArgumentNullException(nameof(node));
}
if (node.QueueIndex < 0 || node.QueueIndex >= _nodes.Length)
{
@@ -106,7 +106,7 @@ namespace Priority_Queue
#if DEBUG
if (node == null)
{
- throw new ArgumentNullException("node");
+ throw new ArgumentNullException(nameof(node));
}
if (_numNodes >= _nodes.Length - 1)
{
@@ -303,7 +303,7 @@ namespace Priority_Queue
}
/// <summary>
- /// This method must be called on a node every time its priority changes while it is in the queue.
+ /// This method must be called on a node every time its priority changes while it is in the queue.
/// <b>Forgetting to call this method will result in a corrupted queue!</b>
/// Calling this method on a node not in the queue results in undefined behavior
/// O(log n)
@@ -314,7 +314,7 @@ namespace Priority_Queue
#if DEBUG
if (node == null)
{
- throw new ArgumentNullException("node");
+ throw new ArgumentNullException(nameof(node));
}
if (!Contains(node))
{
@@ -344,7 +344,7 @@ namespace Priority_Queue
}
/// <summary>
- /// Removes a node from the queue. The node does not need to be the head of the queue.
+ /// Removes a node from the queue. The node does not need to be the head of the queue.
/// If the node is not in the queue, the result is undefined. If unsure, check Contains() first
/// O(log n)
/// </summary>
@@ -353,7 +353,7 @@ namespace Priority_Queue
#if DEBUG
if (node == null)
{
- throw new ArgumentNullException("node");
+ throw new ArgumentNullException(nameof(node));
}
if (!Contains(node))
{
diff --git a/MediaBrowser.Providers/Manager/IPriorityQueue.cs b/MediaBrowser.Providers/Manager/IPriorityQueue.cs
index 23f08a13e..efc9fc2ef 100644
--- a/MediaBrowser.Providers/Manager/IPriorityQueue.cs
+++ b/MediaBrowser.Providers/Manager/IPriorityQueue.cs
@@ -36,12 +36,12 @@ namespace Priority_Queue
bool Contains(TItem node);
/// <summary>
- /// Removes a node from the queue. The node does not need to be the head of the queue.
+ /// Removes a node from the queue. The node does not need to be the head of the queue.
/// </summary>
void Remove(TItem node);
/// <summary>
- /// Call this method to change the priority of a node.
+ /// Call this method to change the priority of a node.
/// </summary>
void UpdatePriority(TItem node, TPriority priority);
diff --git a/MediaBrowser.Providers/Manager/ImageSaver.cs b/MediaBrowser.Providers/Manager/ImageSaver.cs
index 6790f9b33..bf5bb5907 100644
--- a/MediaBrowser.Providers/Manager/ImageSaver.cs
+++ b/MediaBrowser.Providers/Manager/ImageSaver.cs
@@ -75,7 +75,7 @@ namespace MediaBrowser.Providers.Manager
{
if (string.IsNullOrEmpty(mimeType))
{
- throw new ArgumentNullException("mimeType");
+ throw new ArgumentNullException(nameof(mimeType));
}
var saveLocally = item.SupportsLocalMetadata && item.IsSaveLocalMetadataEnabled() && !item.ExtraType.HasValue && !(item is Audio);
@@ -174,7 +174,7 @@ namespace MediaBrowser.Providers.Manager
}
catch (FileNotFoundException)
{
-
+
}
finally
{
@@ -504,7 +504,7 @@ namespace MediaBrowser.Providers.Manager
{
if (!imageIndex.HasValue)
{
- throw new ArgumentNullException("imageIndex");
+ throw new ArgumentNullException(nameof(imageIndex));
}
if (imageIndex.Value == 0)
diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs
index ae3788f34..d21d58cf3 100644
--- a/MediaBrowser.Providers/Manager/ProviderManager.cs
+++ b/MediaBrowser.Providers/Manager/ProviderManager.cs
@@ -179,7 +179,7 @@ namespace MediaBrowser.Providers.Manager
{
if (string.IsNullOrWhiteSpace(source))
{
- throw new ArgumentNullException("source");
+ throw new ArgumentNullException(nameof(source));
}
var fileStream = _fileSystem.GetFileStream(source, FileOpenMode.Open, FileAccessMode.Read, FileShareMode.ReadWrite, true);
diff --git a/MediaBrowser.Providers/Manager/ProviderUtils.cs b/MediaBrowser.Providers/Manager/ProviderUtils.cs
index 3a961fe0e..f83d87ad5 100644
--- a/MediaBrowser.Providers/Manager/ProviderUtils.cs
+++ b/MediaBrowser.Providers/Manager/ProviderUtils.cs
@@ -23,11 +23,11 @@ namespace MediaBrowser.Providers.Manager
if (source == null)
{
- throw new ArgumentNullException("source");
+ throw new ArgumentNullException(nameof(source));
}
if (target == null)
{
- throw new ArgumentNullException("target");
+ throw new ArgumentNullException(nameof(target));
}
if (!lockedFields.Contains(MetadataFields.Name))
diff --git a/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs b/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs
index 879ae1dca..36f2605fa 100644
--- a/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs
+++ b/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs
@@ -167,9 +167,9 @@ namespace Priority_Queue
}
/// <summary>
- /// Removes an item from the queue. The item does not need to be the head of the queue.
+ /// Removes an item from the queue. The item does not need to be the head of the queue.
/// If the item is not in the queue, an exception is thrown. If unsure, check Contains() first.
- /// If multiple copies of the item are enqueued, only the first one is removed.
+ /// If multiple copies of the item are enqueued, only the first one is removed.
/// O(n)
/// </summary>
public void Remove(TItem item)
diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs
index c2fe392ab..29c94ccd9 100644
--- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs
+++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs
@@ -333,7 +333,7 @@ namespace MediaBrowser.Providers.MediaInfo
{
if (string.IsNullOrWhiteSpace(path))
{
- throw new ArgumentNullException("path");
+ throw new ArgumentNullException(nameof(path));
}
try
diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs b/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs
index 81abedeb9..02fb50ae9 100644
--- a/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs
+++ b/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs
@@ -210,8 +210,8 @@ namespace MediaBrowser.Providers.MediaInfo
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{
- return new[] {
-
+ return new[] {
+
// Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
};
diff --git a/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs b/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs
index 9ac993118..b56167320 100644
--- a/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs
+++ b/MediaBrowser.Providers/Movies/FanartMovieImageProvider.cs
@@ -69,7 +69,7 @@ namespace MediaBrowser.Providers.Movies
{
return new List<ImageType>
{
- ImageType.Primary,
+ ImageType.Primary,
ImageType.Thumb,
ImageType.Art,
ImageType.Logo,
@@ -269,7 +269,7 @@ namespace MediaBrowser.Providers.Movies
var path = GetFanartJsonPath(id);
- _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
+ _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
try
{
diff --git a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs
index 1fce01903..039f2efaf 100644
--- a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs
+++ b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs
@@ -43,7 +43,7 @@ namespace MediaBrowser.Providers.Movies
var tmdbId = itemId.GetProviderId(MetadataProviders.Tmdb);
var imdbId = itemId.GetProviderId(MetadataProviders.Imdb);
- // Don't search for music video id's because it is very easy to misidentify.
+ // Don't search for music video id's because it is very easy to misidentify.
if (string.IsNullOrEmpty(tmdbId) && string.IsNullOrEmpty(imdbId) && typeof(T) != typeof(MusicVideo))
{
var searchResults = await new MovieDbSearch(_logger, _jsonSerializer, _libraryManager).GetMovieSearchResults(itemId, cancellationToken).ConfigureAwait(false);
diff --git a/MediaBrowser.Providers/Movies/MovieDbImageProvider.cs b/MediaBrowser.Providers/Movies/MovieDbImageProvider.cs
index ad45c8432..ae466c47e 100644
--- a/MediaBrowser.Providers/Movies/MovieDbImageProvider.cs
+++ b/MediaBrowser.Providers/Movies/MovieDbImageProvider.cs
@@ -50,7 +50,7 @@ namespace MediaBrowser.Providers.Movies
{
return new List<ImageType>
{
- ImageType.Primary,
+ ImageType.Primary,
ImageType.Backdrop
};
}
diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs
index 8465634bc..00848c20e 100644
--- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs
+++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs
@@ -215,7 +215,7 @@ namespace MediaBrowser.Providers.Movies
{
if (string.IsNullOrEmpty(tmdbId))
{
- throw new ArgumentNullException("tmdbId");
+ throw new ArgumentNullException(nameof(tmdbId));
}
var path = GetDataFilePath(tmdbId, language);
@@ -238,7 +238,7 @@ namespace MediaBrowser.Providers.Movies
{
if (string.IsNullOrEmpty(tmdbId))
{
- throw new ArgumentNullException("tmdbId");
+ throw new ArgumentNullException(nameof(tmdbId));
}
var path = GetMovieDataPath(_configurationManager.ApplicationPaths, tmdbId);
diff --git a/MediaBrowser.Providers/Music/AlbumMetadataService.cs b/MediaBrowser.Providers/Music/AlbumMetadataService.cs
index ae81545a6..a035dd758 100644
--- a/MediaBrowser.Providers/Music/AlbumMetadataService.cs
+++ b/MediaBrowser.Providers/Music/AlbumMetadataService.cs
@@ -79,7 +79,7 @@ namespace MediaBrowser.Providers.Music
private ItemUpdateType SetAlbumArtistFromSongs(MusicAlbum item, IEnumerable<Audio> songs)
{
var updateType = ItemUpdateType.None;
-
+
var artists = songs
.SelectMany(i => i.AlbumArtists)
.Distinct(StringComparer.OrdinalIgnoreCase)
diff --git a/MediaBrowser.Providers/Music/AudioDbAlbumImageProvider.cs b/MediaBrowser.Providers/Music/AudioDbAlbumImageProvider.cs
index 273962c6a..7e16b2e10 100644
--- a/MediaBrowser.Providers/Music/AudioDbAlbumImageProvider.cs
+++ b/MediaBrowser.Providers/Music/AudioDbAlbumImageProvider.cs
@@ -29,7 +29,7 @@ namespace MediaBrowser.Providers.Music
{
return new List<ImageType>
{
- ImageType.Primary,
+ ImageType.Primary,
ImageType.Disc
};
}
@@ -81,7 +81,7 @@ namespace MediaBrowser.Providers.Music
return list;
}
-
+
public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
{
return _httpClient.GetResponse(new HttpRequestOptions
diff --git a/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs b/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs
index aaf0ece3d..618e520bf 100644
--- a/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs
+++ b/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs
@@ -158,7 +158,7 @@ namespace MediaBrowser.Providers.Music
var path = GetAlbumInfoPath(_config.ApplicationPaths, musicBrainzReleaseGroupId);
- _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
+ _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
using (var httpResponse = await _httpClient.SendAsync(new HttpRequestOptions
{
diff --git a/MediaBrowser.Providers/Music/AudioDbArtistImageProvider.cs b/MediaBrowser.Providers/Music/AudioDbArtistImageProvider.cs
index 89635872f..7fc62f75b 100644
--- a/MediaBrowser.Providers/Music/AudioDbArtistImageProvider.cs
+++ b/MediaBrowser.Providers/Music/AudioDbArtistImageProvider.cs
@@ -29,7 +29,7 @@ namespace MediaBrowser.Providers.Music
{
return new List<ImageType>
{
- ImageType.Primary,
+ ImageType.Primary,
ImageType.Logo,
ImageType.Banner,
ImageType.Backdrop
diff --git a/MediaBrowser.Providers/Music/Extensions.cs b/MediaBrowser.Providers/Music/Extensions.cs
index c83e69165..21675e03b 100644
--- a/MediaBrowser.Providers/Music/Extensions.cs
+++ b/MediaBrowser.Providers/Music/Extensions.cs
@@ -54,7 +54,7 @@ namespace MediaBrowser.Providers.Music
{
info.ArtistProviderIds.TryGetValue(MetadataProviders.MusicBrainzArtist.ToString(), out id);
}
-
+
if (string.IsNullOrEmpty(id))
{
return info.SongInfos.Select(i => i.GetProviderId(MetadataProviders.MusicBrainzAlbumArtist))
diff --git a/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs b/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs
index 2f7d70be0..f19c982b6 100644
--- a/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs
+++ b/MediaBrowser.Providers/Music/FanArtAlbumProvider.cs
@@ -57,7 +57,7 @@ namespace MediaBrowser.Providers.Music
{
return new List<ImageType>
{
- ImageType.Primary,
+ ImageType.Primary,
ImageType.Disc
};
}
diff --git a/MediaBrowser.Providers/Music/FanArtArtistProvider.cs b/MediaBrowser.Providers/Music/FanArtArtistProvider.cs
index 041a2690f..2e246f614 100644
--- a/MediaBrowser.Providers/Music/FanArtArtistProvider.cs
+++ b/MediaBrowser.Providers/Music/FanArtArtistProvider.cs
@@ -68,7 +68,7 @@ namespace MediaBrowser.Providers.Music
{
return new List<ImageType>
{
- ImageType.Primary,
+ ImageType.Primary,
ImageType.Logo,
ImageType.Art,
ImageType.Banner,
@@ -84,7 +84,7 @@ namespace MediaBrowser.Providers.Music
var artistMusicBrainzId = artist.GetProviderId(MetadataProviders.MusicBrainzArtist);
- if (!String.IsNullOrEmpty(artistMusicBrainzId))
+ if (!string.IsNullOrEmpty(artistMusicBrainzId))
{
await EnsureArtistJson(artistMusicBrainzId, cancellationToken).ConfigureAwait(false);
@@ -106,24 +106,24 @@ namespace MediaBrowser.Providers.Music
var language = item.GetPreferredMetadataLanguage();
- var isLanguageEn = String.Equals(language, "en", StringComparison.OrdinalIgnoreCase);
+ var isLanguageEn = string.Equals(language, "en", StringComparison.OrdinalIgnoreCase);
// Sort first by width to prioritize HD versions
return list.OrderByDescending(i => i.Width ?? 0)
.ThenByDescending(i =>
{
- if (String.Equals(language, i.Language, StringComparison.OrdinalIgnoreCase))
+ if (string.Equals(language, i.Language, StringComparison.OrdinalIgnoreCase))
{
return 3;
}
if (!isLanguageEn)
{
- if (String.Equals("en", i.Language, StringComparison.OrdinalIgnoreCase))
+ if (string.Equals("en", i.Language, StringComparison.OrdinalIgnoreCase))
{
return 2;
}
}
- if (String.IsNullOrEmpty(i.Language))
+ if (string.IsNullOrEmpty(i.Language))
{
return isLanguageEn ? 3 : 2;
}
diff --git a/MediaBrowser.Providers/Music/MusicBrainzArtistProvider.cs b/MediaBrowser.Providers/Music/MusicBrainzArtistProvider.cs
index 8e2a47100..54ec1bf03 100644
--- a/MediaBrowser.Providers/Music/MusicBrainzArtistProvider.cs
+++ b/MediaBrowser.Providers/Music/MusicBrainzArtistProvider.cs
@@ -48,7 +48,7 @@ namespace MediaBrowser.Providers.Music
// They seem to throw bad request failures on any term with a slash
var nameToSearch = searchInfo.Name.Replace('/', ' ');
- var url = String.Format("/ws/2/artist/?query=\"{0}\"&dismax=true", UrlEncode(nameToSearch));
+ var url = string.Format("/ws/2/artist/?query=\"{0}\"&dismax=true", UrlEncode(nameToSearch));
using (var response = await MusicBrainzAlbumProvider.Current.GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false))
{
@@ -66,7 +66,7 @@ namespace MediaBrowser.Providers.Music
if (HasDiacritics(searchInfo.Name))
{
// Try again using the search with accent characters url
- url = String.Format("/ws/2/artist/?query=artistaccent:\"{0}\"", UrlEncode(nameToSearch));
+ url = string.Format("/ws/2/artist/?query=artistaccent:\"{0}\"", UrlEncode(nameToSearch));
using (var response = await MusicBrainzAlbumProvider.Current.GetMusicBrainzResponse(url, true, cancellationToken).ConfigureAwait(false))
{
@@ -271,7 +271,7 @@ namespace MediaBrowser.Providers.Music
/// <returns><c>true</c> if the specified text has diacritics; otherwise, <c>false</c>.</returns>
private bool HasDiacritics(string text)
{
- return !String.Equals(text, text.RemoveDiacritics(), StringComparison.Ordinal);
+ return !string.Equals(text, text.RemoveDiacritics(), StringComparison.Ordinal);
}
/// <summary>
diff --git a/MediaBrowser.Providers/Omdb/OmdbProvider.cs b/MediaBrowser.Providers/Omdb/OmdbProvider.cs
index e8e1e3a29..6aca093ec 100644
--- a/MediaBrowser.Providers/Omdb/OmdbProvider.cs
+++ b/MediaBrowser.Providers/Omdb/OmdbProvider.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Model.IO;
+using MediaBrowser.Model.IO;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
@@ -41,7 +41,7 @@ namespace MediaBrowser.Providers.Omdb
{
if (string.IsNullOrWhiteSpace(imdbId))
{
- throw new ArgumentNullException("imdbId");
+ throw new ArgumentNullException(nameof(imdbId));
}
T item = itemResult.Item;
@@ -111,7 +111,7 @@ namespace MediaBrowser.Providers.Omdb
{
if (string.IsNullOrWhiteSpace(seriesImdbId))
{
- throw new ArgumentNullException("seriesImdbId");
+ throw new ArgumentNullException(nameof(seriesImdbId));
}
T item = itemResult.Item;
@@ -283,7 +283,7 @@ namespace MediaBrowser.Providers.Omdb
{
if (string.IsNullOrWhiteSpace(imdbId))
{
- throw new ArgumentNullException("imdbId");
+ throw new ArgumentNullException(nameof(imdbId));
}
var imdbParam = imdbId.StartsWith("tt", StringComparison.OrdinalIgnoreCase) ? imdbId : "tt" + imdbId;
@@ -320,7 +320,7 @@ namespace MediaBrowser.Providers.Omdb
{
if (string.IsNullOrWhiteSpace(seriesImdbId))
{
- throw new ArgumentNullException("imdbId");
+ throw new ArgumentException("The series IMDb ID was null or whitespace.", nameof(seriesImdbId));
}
var imdbParam = seriesImdbId.StartsWith("tt", StringComparison.OrdinalIgnoreCase) ? seriesImdbId : "tt" + seriesImdbId;
@@ -368,7 +368,7 @@ namespace MediaBrowser.Providers.Omdb
{
if (string.IsNullOrEmpty(imdbId))
{
- throw new ArgumentNullException("imdbId");
+ throw new ArgumentNullException(nameof(imdbId));
}
var dataPath = Path.Combine(_configurationManager.ApplicationPaths.CachePath, "omdb");
@@ -382,7 +382,7 @@ namespace MediaBrowser.Providers.Omdb
{
if (string.IsNullOrEmpty(imdbId))
{
- throw new ArgumentNullException("imdbId");
+ throw new ArgumentNullException(nameof(imdbId));
}
var dataPath = Path.Combine(_configurationManager.ApplicationPaths.CachePath, "omdb");
diff --git a/MediaBrowser.Providers/Properties/AssemblyInfo.cs b/MediaBrowser.Providers/Properties/AssemblyInfo.cs
index 7676a4c5f..d2b13fc89 100644
--- a/MediaBrowser.Providers/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.Providers/Properties/AssemblyInfo.cs
@@ -1,30 +1,21 @@
-using System.Reflection;
+using System.Reflection;
+using System.Resources;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MediaBrowser.Providers")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("MediaBrowser.Providers")]
-[assembly: AssemblyCopyright("Copyright © 2013")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("1b12f094-879f-4e02-ac92-17b72069feb8")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-// \ No newline at end of file
diff --git a/MediaBrowser.Providers/Studios/StudiosImageProvider.cs b/MediaBrowser.Providers/Studios/StudiosImageProvider.cs
index 2949c903f..764bb8903 100644
--- a/MediaBrowser.Providers/Studios/StudiosImageProvider.cs
+++ b/MediaBrowser.Providers/Studios/StudiosImageProvider.cs
@@ -42,7 +42,7 @@ namespace MediaBrowser.Providers.Studios
{
return new List<ImageType>
{
- ImageType.Primary,
+ ImageType.Primary,
ImageType.Thumb
};
}
diff --git a/MediaBrowser.Providers/TV/FanArt/FanArtSeasonProvider.cs b/MediaBrowser.Providers/TV/FanArt/FanArtSeasonProvider.cs
index a89dee1e9..7e7cda0fb 100644
--- a/MediaBrowser.Providers/TV/FanArt/FanArtSeasonProvider.cs
+++ b/MediaBrowser.Providers/TV/FanArt/FanArtSeasonProvider.cs
@@ -60,7 +60,7 @@ namespace MediaBrowser.Providers.TV
{
return new List<ImageType>
{
- ImageType.Backdrop,
+ ImageType.Backdrop,
ImageType.Thumb,
ImageType.Banner,
ImageType.Primary
diff --git a/MediaBrowser.Providers/TV/FanArt/FanartSeriesProvider.cs b/MediaBrowser.Providers/TV/FanArt/FanartSeriesProvider.cs
index 62fd82d35..185c01a78 100644
--- a/MediaBrowser.Providers/TV/FanArt/FanartSeriesProvider.cs
+++ b/MediaBrowser.Providers/TV/FanArt/FanartSeriesProvider.cs
@@ -68,7 +68,7 @@ namespace MediaBrowser.Providers.TV
{
return new List<ImageType>
{
- ImageType.Primary,
+ ImageType.Primary,
ImageType.Thumb,
ImageType.Art,
ImageType.Logo,
@@ -311,7 +311,7 @@ namespace MediaBrowser.Providers.TV
var path = GetFanartJsonPath(tvdbId);
- _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
+ _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
try
{
diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeImageProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeImageProvider.cs
index d9933ba2a..6dc31a787 100644
--- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeImageProvider.cs
+++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeImageProvider.cs
@@ -22,7 +22,7 @@ namespace MediaBrowser.Providers.TV
{
public class MovieDbEpisodeImageProvider :
MovieDbProviderBase,
- IRemoteImageProvider,
+ IRemoteImageProvider,
IHasOrder
{
public MovieDbEpisodeImageProvider(IHttpClient httpClient, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IFileSystem fileSystem, ILocalizationManager localization, ILoggerFactory loggerFactory)
diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs
index 095ce0e17..36e3c93d9 100644
--- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs
+++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs
@@ -128,7 +128,7 @@ namespace MediaBrowser.Providers.TV
{
foreach (var video in response.videos.results)
{
- if (video.type.Equals("trailer", System.StringComparison.OrdinalIgnoreCase)
+ if (video.type.Equals("trailer", System.StringComparison.OrdinalIgnoreCase)
|| video.type.Equals("clip", System.StringComparison.OrdinalIgnoreCase))
{
if (video.site.Equals("youtube", System.StringComparison.OrdinalIgnoreCase))
diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbProviderBase.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbProviderBase.cs
index facf5cadf..94807aee9 100644
--- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbProviderBase.cs
+++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbProviderBase.cs
@@ -56,11 +56,11 @@ namespace MediaBrowser.Providers.TV
{
if (string.IsNullOrEmpty(tmdbId))
{
- throw new ArgumentNullException("tmdbId");
+ throw new ArgumentNullException(nameof(tmdbId));
}
if (string.IsNullOrEmpty(language))
{
- throw new ArgumentNullException("language");
+ throw new ArgumentNullException(nameof(language));
}
var path = GetDataFilePath(tmdbId, seasonNumber, episodeNumber, language);
@@ -83,11 +83,11 @@ namespace MediaBrowser.Providers.TV
{
if (string.IsNullOrEmpty(tmdbId))
{
- throw new ArgumentNullException("tmdbId");
+ throw new ArgumentNullException(nameof(tmdbId));
}
if (string.IsNullOrEmpty(preferredLanguage))
{
- throw new ArgumentNullException("preferredLanguage");
+ throw new ArgumentNullException(nameof(preferredLanguage));
}
var path = MovieDbSeriesProvider.GetSeriesDataPath(_configurationManager.ApplicationPaths, tmdbId);
@@ -106,7 +106,7 @@ namespace MediaBrowser.Providers.TV
var dataFilePath = GetDataFilePath(id, seasonNumber, episodeNumber, preferredMetadataLanguage);
- _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(dataFilePath));
+ _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(dataFilePath));
_jsonSerializer.SerializeToFile(mainResult, dataFilePath);
}
diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeasonProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeasonProvider.cs
index 217dab663..27edfdea7 100644
--- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeasonProvider.cs
+++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeasonProvider.cs
@@ -145,11 +145,11 @@ namespace MediaBrowser.Providers.TV
{
if (string.IsNullOrEmpty(tmdbId))
{
- throw new ArgumentNullException("tmdbId");
+ throw new ArgumentNullException(nameof(tmdbId));
}
if (string.IsNullOrEmpty(language))
{
- throw new ArgumentNullException("language");
+ throw new ArgumentNullException(nameof(language));
}
var path = GetDataFilePath(tmdbId, seasonNumber, language);
@@ -172,11 +172,11 @@ namespace MediaBrowser.Providers.TV
{
if (string.IsNullOrEmpty(tmdbId))
{
- throw new ArgumentNullException("tmdbId");
+ throw new ArgumentNullException(nameof(tmdbId));
}
if (string.IsNullOrEmpty(preferredLanguage))
{
- throw new ArgumentNullException("preferredLanguage");
+ throw new ArgumentNullException(nameof(preferredLanguage));
}
var path = MovieDbSeriesProvider.GetSeriesDataPath(_configurationManager.ApplicationPaths, tmdbId);
@@ -194,7 +194,7 @@ namespace MediaBrowser.Providers.TV
var dataFilePath = GetDataFilePath(id, seasonNumber, preferredMetadataLanguage);
- _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(dataFilePath));
+ _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(dataFilePath));
_jsonSerializer.SerializeToFile(mainResult, dataFilePath);
}
diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesImageProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesImageProvider.cs
index 6124e7a9c..5a89356c2 100644
--- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesImageProvider.cs
+++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesImageProvider.cs
@@ -49,7 +49,7 @@ namespace MediaBrowser.Providers.TV
{
return new List<ImageType>
{
- ImageType.Primary,
+ ImageType.Primary,
ImageType.Backdrop
};
}
diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs
index c3981ae8f..c48719e84 100644
--- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs
+++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs
@@ -447,7 +447,7 @@ namespace MediaBrowser.Providers.TV
{
if (string.IsNullOrEmpty(tmdbId))
{
- throw new ArgumentNullException("tmdbId");
+ throw new ArgumentNullException(nameof(tmdbId));
}
var path = GetDataFilePath(tmdbId, language);
@@ -470,7 +470,7 @@ namespace MediaBrowser.Providers.TV
{
if (string.IsNullOrEmpty(tmdbId))
{
- throw new ArgumentNullException("tmdbId");
+ throw new ArgumentNullException(nameof(tmdbId));
}
var path = GetSeriesDataPath(_configurationManager.ApplicationPaths, tmdbId);
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeImageProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeImageProvider.cs
index 23fefa484..722bf559d 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeImageProvider.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeImageProvider.cs
@@ -58,27 +58,27 @@ namespace MediaBrowser.Providers.TV
// Process images
var seriesDataPath = TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, series.ProviderIds);
- var nodes = TvdbEpisodeProvider.Current.GetEpisodeXmlNodes(seriesDataPath, episode.GetLookupInfo());
+ var nodes = TvdbEpisodeProvider.Current.GetEpisodeXmlNodes(seriesDataPath, episode.GetLookupInfo());
var result = nodes.Select(i => GetImageInfo(i, cancellationToken))
.Where(i => i != null)
- .ToList();
+ .ToList();
- return Task.FromResult<IEnumerable<RemoteImageInfo>>(result);
+ return Task.FromResult<IEnumerable<RemoteImageInfo>>(result);
}
return Task.FromResult<IEnumerable<RemoteImageInfo>>(new RemoteImageInfo[] { });
}
- private RemoteImageInfo GetImageInfo(XmlReader reader, CancellationToken cancellationToken)
+ private RemoteImageInfo GetImageInfo(XmlReader reader, CancellationToken cancellationToken)
{
var height = 225;
var width = 400;
var url = string.Empty;
- // Use XmlReader for best performance
- using (reader)
- {
+ // Use XmlReader for best performance
+ using (reader)
+ {
reader.MoveToContent();
reader.Read();
@@ -146,7 +146,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
}
}
- }
+ }
if (string.IsNullOrEmpty(url))
{
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs
index d1d8e32c2..5c00229e8 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Net;
+using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
@@ -143,7 +143,7 @@ namespace MediaBrowser.Providers.TV
/// <param name="seriesDataPath">The series data path.</param>
/// <param name="searchInfo">The search information.</param>
/// <returns>List{FileInfo}.</returns>
- internal List<XmlReader> GetEpisodeXmlNodes(string seriesDataPath, EpisodeInfo searchInfo)
+ internal List<XmlReader> GetEpisodeXmlNodes(string seriesDataPath, EpisodeInfo searchInfo)
{
var seriesXmlPath = TvdbSeriesProvider.Current.GetSeriesXmlPath(searchInfo.SeriesProviderIds, searchInfo.MetadataLanguage);
@@ -165,7 +165,6 @@ namespace MediaBrowser.Providers.TV
/// Fetches the episode data.
/// </summary>
/// <param name="id">The identifier.</param>
- /// <param name="searchNumbers">The search numbers.</param>
/// <param name="seriesDataPath">The series data path.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{System.Boolean}.</returns>
@@ -306,7 +305,7 @@ namespace MediaBrowser.Providers.TV
return GetXmlReader(_fileSystem.ReadAllText(xmlFile.FullName, Encoding.UTF8));
}
- private XmlReader GetXmlReader(String xml)
+ private XmlReader GetXmlReader(string xml)
{
var streamReader = new StringReader(xml);
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs
index 319ece156..ed9deeba0 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs
@@ -57,7 +57,7 @@ namespace MediaBrowser.Providers.TV
{
return new List<ImageType>
{
- ImageType.Primary,
+ ImageType.Primary,
ImageType.Banner,
ImageType.Backdrop
};
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesImageProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesImageProvider.cs
index e76ac6cd1..97abaab21 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesImageProvider.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesImageProvider.cs
@@ -58,7 +58,7 @@ namespace MediaBrowser.Providers.TV
{
return new List<ImageType>
{
- ImageType.Primary,
+ ImageType.Primary,
ImageType.Banner,
ImageType.Backdrop
};
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
index 515f58c27..232758896 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
@@ -195,7 +195,7 @@ namespace MediaBrowser.Providers.TV
{
if (string.IsNullOrWhiteSpace(seriesId))
{
- throw new ArgumentNullException("seriesId");
+ throw new ArgumentNullException(nameof(seriesId));
}
if (!string.Equals(idType, "tvdb", StringComparison.OrdinalIgnoreCase))
@@ -222,7 +222,7 @@ namespace MediaBrowser.Providers.TV
if (string.IsNullOrWhiteSpace(seriesId))
{
- throw new ArgumentNullException("seriesId");
+ throw new ArgumentNullException(nameof(seriesId));
}
var url = string.Format(SeriesGetZip, TVUtils.TvdbApiKey, seriesId, NormalizeLanguage(preferredMetadataLanguage));
@@ -272,7 +272,7 @@ namespace MediaBrowser.Providers.TV
private async Task<string> GetSeriesByRemoteId(string id, string idType, string language, CancellationToken cancellationToken)
{
- String url;
+ string url;
if (string.Equals(idType, MetadataProviders.Zap2It.ToString(), StringComparison.OrdinalIgnoreCase))
{
url = string.Format(GetSeriesByZap2ItId, id, NormalizeLanguage(language));
@@ -787,7 +787,7 @@ namespace MediaBrowser.Providers.TV
{
if ((int)c >= 0x2B0 && (int)c <= 0x0333)
{
- // skip char modifier and diacritics
+ // skip char modifier and diacritics
}
else if (remove.IndexOf(c) > -1)
{
diff --git a/MediaBrowser.Tests/MediaEncoding/Subtitles/VttWriterTest.cs b/MediaBrowser.Tests/MediaEncoding/Subtitles/VttWriterTest.cs
index 00feb286c..d9e48ac06 100644
--- a/MediaBrowser.Tests/MediaEncoding/Subtitles/VttWriterTest.cs
+++ b/MediaBrowser.Tests/MediaEncoding/Subtitles/VttWriterTest.cs
@@ -98,7 +98,7 @@ namespace MediaBrowser.Tests.MediaEncoding.Subtitles {
var result = File.ReadAllText("testVTT.vtt");
var expectedText = File.ReadAllText(@"MediaEncoding\Subtitles\TestSubtitles\expected.vtt");
-
+
Assert.AreEqual(expectedText, result);
}
}
diff --git a/MediaBrowser.Tests/Properties/AssemblyInfo.cs b/MediaBrowser.Tests/Properties/AssemblyInfo.cs
index 8efecf8e2..700b2f508 100644
--- a/MediaBrowser.Tests/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.Tests/Properties/AssemblyInfo.cs
@@ -1,7 +1,7 @@
using System.Reflection;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MediaBrowser.Tests")]
@@ -13,8 +13,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@@ -24,11 +24,11 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values:
//
// Major Version
-// Minor Version
+// Minor Version
// Build Number
// Revision
//
-// You can specify all the values or you can default the Build and Revision Numbers
+// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs
index 58d02ef04..ef4f9c2af 100644
--- a/MediaBrowser.WebDashboard/Api/DashboardService.cs
+++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs
@@ -138,9 +138,9 @@ namespace MediaBrowser.WebDashboard.Api
}
/// <summary>
- /// Gets the dashboard UI path.
+ /// Gets the path for the web interface.
/// </summary>
- /// <value>The dashboard UI path.</value>
+ /// <value>The path for the web interface.</value>
public string DashboardUIPath
{
get
@@ -150,7 +150,7 @@ namespace MediaBrowser.WebDashboard.Api
return _serverConfigurationManager.Configuration.DashboardSourcePath;
}
- return Path.Combine(_serverConfigurationManager.ApplicationPaths.ApplicationResourcesPath, "dashboard-ui");
+ return Path.Combine(_serverConfigurationManager.ApplicationPaths.ApplicationResourcesPath, "jellyfin-web", "src");
}
}
@@ -311,7 +311,7 @@ namespace MediaBrowser.WebDashboard.Api
// Bounce them to the startup wizard if it hasn't been completed yet
if (!_serverConfigurationManager.Configuration.IsStartupWizardCompleted &&
- Request.RawUrl.IndexOf("wizard", StringComparison.OrdinalIgnoreCase) == -1 &&
+ Request.RawUrl.IndexOf("wizard", StringComparison.OrdinalIgnoreCase) == -1 &&
GetPackageCreator(basePath).IsCoreHtml(path))
{
// But don't redirect if an html import is being requested.
diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs
index f510ed51f..88fb95936 100644
--- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs
+++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Controller.Configuration;
+using MediaBrowser.Controller.Configuration;
using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using System;
@@ -59,7 +59,7 @@ namespace MediaBrowser.WebDashboard.Api
/// <param name="path">The path.</param>
/// <param name="format">The format.</param>
/// <returns><c>true</c> if the specified path is HTML; otherwise, <c>false</c>.</returns>
- private bool IsFormat(string path, string format)
+ private static bool IsFormat(string path, string format)
{
return Path.GetExtension(path).EndsWith(format, StringComparison.OrdinalIgnoreCase);
}
diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj
index 855b8b627..c5367ba75 100644
--- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj
+++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj
@@ -10,7 +10,7 @@
</ItemGroup>
<ItemGroup>
- <None Include="dashboard-ui\**\*.*">
+ <None Include="jellyfin-web\src\**\*.*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
diff --git a/MediaBrowser.WebDashboard/Properties/AssemblyInfo.cs b/MediaBrowser.WebDashboard/Properties/AssemblyInfo.cs
index 599a895be..416ce4826 100644
--- a/MediaBrowser.WebDashboard/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.WebDashboard/Properties/AssemblyInfo.cs
@@ -1,30 +1,21 @@
-using System.Reflection;
+using System.Reflection;
+using System.Resources;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MediaBrowser.WebDashboard")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("MediaBrowser.WebDashboard")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("c6c73d12-933d-4389-be56-e59973c9ed00")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-// \ No newline at end of file
diff --git a/MediaBrowser.WebDashboard/jellyfin-web b/MediaBrowser.WebDashboard/jellyfin-web
new file mode 160000
+Subproject 4678528d0028685b45c7c6daa2e24b72a363535
diff --git a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs
index 0aaa0b362..5390f5049 100644
--- a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs
+++ b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Common.Configuration;
+using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
@@ -60,12 +60,12 @@ namespace MediaBrowser.XbmcMetadata.Parsers
{
if (item == null)
{
- throw new ArgumentNullException();
+ throw new ArgumentNullException(nameof(item));
}
if (string.IsNullOrEmpty(metadataFile))
{
- throw new ArgumentNullException();
+ throw new ArgumentException("The metadata file was empty or null.", nameof(metadataFile));
}
var settings = XmlReaderSettingsFactory.Create(false);
diff --git a/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs
index ce56e080a..3e7fd1c82 100644
--- a/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs
+++ b/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs
@@ -18,7 +18,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
{
public void Fetch(MetadataResult<Episode> item,
List<LocalImageInfo> images,
- string metadataFile,
+ string metadataFile,
CancellationToken cancellationToken)
{
Fetch(item, metadataFile, cancellationToken);
diff --git a/MediaBrowser.XbmcMetadata/Properties/AssemblyInfo.cs b/MediaBrowser.XbmcMetadata/Properties/AssemblyInfo.cs
index 078136371..11e513f1b 100644
--- a/MediaBrowser.XbmcMetadata/Properties/AssemblyInfo.cs
+++ b/MediaBrowser.XbmcMetadata/Properties/AssemblyInfo.cs
@@ -1,33 +1,21 @@
-using System.Reflection;
+using System.Reflection;
+using System.Resources;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MediaBrowser.XbmcMetadata")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("MediaBrowser.XbmcMetadata")]
-[assembly: AssemblyCopyright("Copyright © 2014")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("bbdf434b-65f1-4178-8ddf-067447df3e20")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")] \ No newline at end of file
diff --git a/MediaBrowser.XbmcMetadata/Savers/AlbumNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/AlbumNfoSaver.cs
index 54d0b8bae..7a293801b 100644
--- a/MediaBrowser.XbmcMetadata/Savers/AlbumNfoSaver.cs
+++ b/MediaBrowser.XbmcMetadata/Savers/AlbumNfoSaver.cs
@@ -41,7 +41,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
protected override void WriteCustomElements(BaseItem item, XmlWriter writer)
{
var album = (MusicAlbum)item;
-
+
foreach (var artist in album.Artists)
{
writer.WriteElementString("artist", artist);
@@ -53,8 +53,8 @@ namespace MediaBrowser.XbmcMetadata.Savers
}
AddTracks(album.Tracks, writer);
- }
-
+ }
+
private readonly CultureInfo UsCulture = new CultureInfo("en-US");
private void AddTracks(IEnumerable<BaseItem> tracks, XmlWriter writer)
diff --git a/MediaBrowser.XbmcMetadata/Savers/ArtistNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/ArtistNfoSaver.cs
index cc0da1b36..110b1446a 100644
--- a/MediaBrowser.XbmcMetadata/Savers/ArtistNfoSaver.cs
+++ b/MediaBrowser.XbmcMetadata/Savers/ArtistNfoSaver.cs
@@ -47,7 +47,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
writer.WriteElementString("disbanded", artist.EndDate.Value.ToLocalTime().ToString(formatString));
}
-
+
var albums = artist
.GetRecursiveChildren(i => i is MusicAlbum);
@@ -55,7 +55,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
}
private readonly CultureInfo UsCulture = new CultureInfo("en-US");
-
+
private void AddAlbums(IList<BaseItem> albums, XmlWriter writer)
{
foreach (var album in albums)
diff --git a/MediaBrowser.XbmcMetadata/Savers/SeasonNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/SeasonNfoSaver.cs
index 50ae8d24e..32253ca3b 100644
--- a/MediaBrowser.XbmcMetadata/Savers/SeasonNfoSaver.cs
+++ b/MediaBrowser.XbmcMetadata/Savers/SeasonNfoSaver.cs
@@ -38,7 +38,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
return false;
}
- return updateType >= MinimumUpdateType || (updateType >= ItemUpdateType.MetadataImport && FileSystem.FileExists(GetSavePath(item)));
+ return updateType >= MinimumUpdateType || (updateType >= ItemUpdateType.MetadataImport && FileSystem.FileExists(GetSavePath(item)));
}
protected override void WriteCustomElements(BaseItem item, XmlWriter writer)
@@ -62,7 +62,15 @@ namespace MediaBrowser.XbmcMetadata.Savers
return list;
}
- public SeasonNfoSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory)
+ public SeasonNfoSaver(
+ IFileSystem fileSystem,
+ IServerConfigurationManager configurationManager,
+ ILibraryManager libraryManager,
+ IUserManager userManager,
+ IUserDataManager userDataManager,
+ ILogger logger,
+ IXmlReaderSettingsFactory xmlReaderSettingsFactory)
+ : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory)
{
}
}
diff --git a/MediaBrowser.XbmcMetadata/Savers/SeriesNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/SeriesNfoSaver.cs
index e0f08dbdb..270d779bf 100644
--- a/MediaBrowser.XbmcMetadata/Savers/SeriesNfoSaver.cs
+++ b/MediaBrowser.XbmcMetadata/Savers/SeriesNfoSaver.cs
@@ -58,7 +58,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
writer.WriteAttributeString("cache", string.Format("{0}.xml", tvdb));
writer.WriteString(string.Format("http://www.thetvdb.com/api/1D62F2F90030C444/series/{0}/all/{1}.zip", tvdb, language));
writer.WriteEndElement();
-
+
writer.WriteEndElement();
}
diff --git a/MediaBrowser.sln b/MediaBrowser.sln
index 13d1e26db..3fd7d8df9 100644
--- a/MediaBrowser.sln
+++ b/MediaBrowser.sln
@@ -150,6 +150,10 @@ Global
{E5AF7B26-2239-4CE0-B477-0AA2018EDAA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5AF7B26-2239-4CE0-B477-0AA2018EDAA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5AF7B26-2239-4CE0-B477-0AA2018EDAA2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D45FC504-D06B-41A0-A220-C20B7E8F1304}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D45FC504-D06B-41A0-A220-C20B7E8F1304}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D45FC504-D06B-41A0-A220-C20B7E8F1304}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D45FC504-D06B-41A0-A220-C20B7E8F1304}.Release|Any CPU.Build.0 = Release|Any CPU
{6EAFA7F0-8A82-49E6-B2FA-086C5CAEA95B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6EAFA7F0-8A82-49E6-B2FA-086C5CAEA95B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6EAFA7F0-8A82-49E6-B2FA-086C5CAEA95B}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -174,9 +178,12 @@ Global
SolutionGuid = {3448830C-EBDC-426C-85CD-7BBB9651A7FE}
EndGlobalSection
GlobalSection(AutomaticVersions) = postSolution
+ PrimaryVersionType = AssemblyFileVersionAttribute
UpdateAssemblyVersion = True
UpdateAssemblyFileVersion = True
UpdateAssemblyInfoVersion = True
+ ShouldCreateLogs = True
+ AdvancedSettingsExpanded = True
AssemblyVersionSettings = None.None.None.None
AssemblyFileVersionSettings = None.None.None.None
AssemblyInfoVersionSettings = None.None.None.None
diff --git a/Mono.Nat/AbstractNatDevice.cs b/Mono.Nat/AbstractNatDevice.cs
index 1b4216002..1241170c1 100644
--- a/Mono.Nat/AbstractNatDevice.cs
+++ b/Mono.Nat/AbstractNatDevice.cs
@@ -13,10 +13,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -34,23 +34,22 @@ using System.Threading.Tasks;
namespace Mono.Nat
{
- public abstract class AbstractNatDevice : INatDevice
- {
- private DateTime lastSeen;
-
- protected AbstractNatDevice ()
- {
+ public abstract class AbstractNatDevice : INatDevice
+ {
+ private DateTime lastSeen;
+
+ protected AbstractNatDevice()
+ {
+ }
- }
+ public abstract IPAddress LocalAddress { get; }
- public abstract IPAddress LocalAddress { get; }
-
- public DateTime LastSeen
- {
- get { return lastSeen; }
- set { lastSeen = value; }
- }
+ public DateTime LastSeen
+ {
+ get { return lastSeen; }
+ set { lastSeen = value; }
+ }
- public abstract Task CreatePortMap(Mapping mapping);
- }
+ public abstract Task CreatePortMap(Mapping mapping);
+ }
}
diff --git a/Mono.Nat/Enums/ProtocolType.cs b/Mono.Nat/Enums/ProtocolType.cs
index a1f5cbb0e..54480598d 100644
--- a/Mono.Nat/Enums/ProtocolType.cs
+++ b/Mono.Nat/Enums/ProtocolType.cs
@@ -11,10 +11,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -28,9 +28,9 @@ using System;
namespace Mono.Nat
{
- public enum Protocol
- {
- Tcp,
- Udp
- }
-} \ No newline at end of file
+ public enum Protocol
+ {
+ Tcp,
+ Udp
+ }
+}
diff --git a/Mono.Nat/EventArgs/DeviceEventArgs.cs b/Mono.Nat/EventArgs/DeviceEventArgs.cs
index fbbbf63e3..6358a0c29 100644
--- a/Mono.Nat/EventArgs/DeviceEventArgs.cs
+++ b/Mono.Nat/EventArgs/DeviceEventArgs.cs
@@ -11,10 +11,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -28,18 +28,18 @@ using System;
namespace Mono.Nat
{
- public class DeviceEventArgs : EventArgs
- {
- private INatDevice device;
-
- public DeviceEventArgs(INatDevice device)
- {
- this.device = device;
- }
-
- public INatDevice Device
- {
- get { return this.device; }
- }
- }
-} \ No newline at end of file
+ public class DeviceEventArgs : EventArgs
+ {
+ private INatDevice device;
+
+ public DeviceEventArgs(INatDevice device)
+ {
+ this.device = device;
+ }
+
+ public INatDevice Device
+ {
+ get { return this.device; }
+ }
+ }
+}
diff --git a/Mono.Nat/INatDevice.cs b/Mono.Nat/INatDevice.cs
index b0401627b..6a1509071 100644
--- a/Mono.Nat/INatDevice.cs
+++ b/Mono.Nat/INatDevice.cs
@@ -13,10 +13,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -34,12 +34,12 @@ using System.Threading.Tasks;
namespace Mono.Nat
{
- public interface INatDevice
- {
- Task CreatePortMap (Mapping mapping);
-
- IPAddress LocalAddress { get; }
+ public interface INatDevice
+ {
+ Task CreatePortMap (Mapping mapping);
+
+ IPAddress LocalAddress { get; }
- DateTime LastSeen { get; set; }
- }
+ DateTime LastSeen { get; set; }
+ }
}
diff --git a/Mono.Nat/ISearcher.cs b/Mono.Nat/ISearcher.cs
index fff7e8d75..95c2f2aa9 100644
--- a/Mono.Nat/ISearcher.cs
+++ b/Mono.Nat/ISearcher.cs
@@ -15,10 +15,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
diff --git a/Mono.Nat/Mapping.cs b/Mono.Nat/Mapping.cs
index dd49404c6..438068934 100644
--- a/Mono.Nat/Mapping.cs
+++ b/Mono.Nat/Mapping.cs
@@ -13,10 +13,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -30,94 +30,92 @@ using System;
namespace Mono.Nat
{
- public class Mapping
- {
+ public class Mapping
+ {
private string description;
private DateTime expiration;
private int lifetime;
private int privatePort;
- private Protocol protocol;
- private int publicPort;
-
+ private Protocol protocol;
+ private int publicPort;
+ public Mapping(Protocol protocol, int privatePort, int publicPort)
+ : this (protocol, privatePort, publicPort, 0)
+ {
+ }
- public Mapping (Protocol protocol, int privatePort, int publicPort)
- : this (protocol, privatePort, publicPort, 0)
- {
- }
-
- public Mapping (Protocol protocol, int privatePort, int publicPort, int lifetime)
- {
- this.protocol = protocol;
- this.privatePort = privatePort;
- this.publicPort = publicPort;
- this.lifetime = lifetime;
+ public Mapping(Protocol protocol, int privatePort, int publicPort, int lifetime)
+ {
+ this.protocol = protocol;
+ this.privatePort = privatePort;
+ this.publicPort = publicPort;
+ this.lifetime = lifetime;
- if (lifetime == int.MaxValue)
- this.expiration = DateTime.MaxValue;
- else if (lifetime == 0)
- this.expiration = DateTime.Now;
- else
- this.expiration = DateTime.Now.AddSeconds (lifetime);
- }
+ if (lifetime == int.MaxValue)
+ this.expiration = DateTime.MaxValue;
+ else if (lifetime == 0)
+ this.expiration = DateTime.Now;
+ else
+ this.expiration = DateTime.Now.AddSeconds (lifetime);
+ }
public string Description
{
get { return description; }
set { description = value; }
}
-
- public Protocol Protocol
- {
- get { return protocol; }
- internal set { protocol = value; }
- }
- public int PrivatePort
- {
- get { return privatePort; }
- internal set { privatePort = value; }
- }
-
- public int PublicPort
- {
- get { return publicPort; }
- internal set { publicPort = value; }
- }
-
- public int Lifetime
- {
- get { return lifetime; }
- internal set { lifetime = value; }
- }
-
- public DateTime Expiration
- {
- get { return expiration; }
- internal set { expiration = value; }
- }
-
- public bool IsExpired ()
- {
- return expiration < DateTime.Now;
- }
+ public Protocol Protocol
+ {
+ get { return protocol; }
+ internal set { protocol = value; }
+ }
+
+ public int PrivatePort
+ {
+ get { return privatePort; }
+ internal set { privatePort = value; }
+ }
- public override bool Equals (object obj)
- {
- Mapping other = obj as Mapping;
- return other == null ? false : this.protocol == other.protocol &&
- this.privatePort == other.privatePort && this.publicPort == other.publicPort;
- }
+ public int PublicPort
+ {
+ get { return publicPort; }
+ internal set { publicPort = value; }
+ }
- public override int GetHashCode()
- {
- return this.protocol.GetHashCode() ^ this.privatePort.GetHashCode() ^ this.publicPort.GetHashCode();
- }
+ public int Lifetime
+ {
+ get { return lifetime; }
+ internal set { lifetime = value; }
+ }
+
+ public DateTime Expiration
+ {
+ get { return expiration; }
+ internal set { expiration = value; }
+ }
+
+ public bool IsExpired()
+ {
+ return expiration < DateTime.Now;
+ }
+
+ public override bool Equals(object obj)
+ {
+ Mapping other = obj as Mapping;
+ return other == null ? false : this.protocol == other.protocol &&
+ this.privatePort == other.privatePort && this.publicPort == other.publicPort;
+ }
+
+ public override int GetHashCode()
+ {
+ return this.protocol.GetHashCode() ^ this.privatePort.GetHashCode() ^ this.publicPort.GetHashCode();
+ }
- public override string ToString( )
+ public override string ToString()
{
- return String.Format( "Protocol: {0}, Public Port: {1}, Private Port: {2}, Description: {3}, Expiration: {4}, Lifetime: {5}",
- this.protocol, this.publicPort, this.privatePort, this.description, this.expiration, this.lifetime );
+ return String.Format( "Protocol: {0}, Public Port: {1}, Private Port: {2}, Description: {3}, Expiration: {4}, Lifetime: {5}",
+ this.protocol, this.publicPort, this.privatePort, this.description, this.expiration, this.lifetime );
}
- }
+ }
}
diff --git a/Mono.Nat/Pmp/PmpConstants.cs b/Mono.Nat/Pmp/PmpConstants.cs
index ff3eb6230..83fa8e07c 100644
--- a/Mono.Nat/Pmp/PmpConstants.cs
+++ b/Mono.Nat/Pmp/PmpConstants.cs
@@ -11,10 +11,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -29,28 +29,28 @@ using System;
namespace Mono.Nat.Pmp
{
internal static class PmpConstants
- {
- public const byte Version = (byte)0;
-
- public const byte OperationCode = (byte)0;
- public const byte OperationCodeUdp = (byte)1;
- public const byte OperationCodeTcp = (byte)2;
+ {
+ public const byte Version = (byte)0;
+
+ public const byte OperationCode = (byte)0;
+ public const byte OperationCodeUdp = (byte)1;
+ public const byte OperationCodeTcp = (byte)2;
public const byte ServerNoop = (byte)128;
-
- public const int ClientPort = 5350;
- public const int ServerPort = 5351;
-
- public const int RetryDelay = 250;
- public const int RetryAttempts = 9;
-
- public const int RecommendedLeaseTime = 60 * 60;
- public const int DefaultLeaseTime = RecommendedLeaseTime;
-
- public const short ResultCodeSuccess = 0;
- public const short ResultCodeUnsupportedVersion = 1;
- public const short ResultCodeNotAuthorized = 2;
- public const short ResultCodeNetworkFailure = 3;
- public const short ResultCodeOutOfResources = 4;
- public const short ResultCodeUnsupportedOperationCode = 5;
- }
-} \ No newline at end of file
+
+ public const int ClientPort = 5350;
+ public const int ServerPort = 5351;
+
+ public const int RetryDelay = 250;
+ public const int RetryAttempts = 9;
+
+ public const int RecommendedLeaseTime = 60 * 60;
+ public const int DefaultLeaseTime = RecommendedLeaseTime;
+
+ public const short ResultCodeSuccess = 0;
+ public const short ResultCodeUnsupportedVersion = 1;
+ public const short ResultCodeNotAuthorized = 2;
+ public const short ResultCodeNetworkFailure = 3;
+ public const short ResultCodeOutOfResources = 4;
+ public const short ResultCodeUnsupportedOperationCode = 5;
+ }
+}
diff --git a/Mono.Nat/Pmp/PmpNatDevice.cs b/Mono.Nat/Pmp/PmpNatDevice.cs
index fbf3032d4..9398e2bf9 100644
--- a/Mono.Nat/Pmp/PmpNatDevice.cs
+++ b/Mono.Nat/Pmp/PmpNatDevice.cs
@@ -11,10 +11,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -46,7 +46,7 @@ namespace Mono.Nat.Pmp
{
if (localAddress == null)
{
- throw new ArgumentNullException("localAddress");
+ throw new ArgumentNullException(nameof(localAddress));
}
this.localAddress = localAddress;
diff --git a/Mono.Nat/Pmp/PmpSearcher.cs b/Mono.Nat/Pmp/PmpSearcher.cs
index 98cf37f14..5e4155841 100644
--- a/Mono.Nat/Pmp/PmpSearcher.cs
+++ b/Mono.Nat/Pmp/PmpSearcher.cs
@@ -15,10 +15,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -108,8 +108,8 @@ namespace Mono.Nat
foreach (var unicast in properties.UnicastAddresses)
{
if (/*unicast.DuplicateAddressDetectionState == DuplicateAddressDetectionState.Preferred
- && unicast.AddressPreferredLifetime != UInt32.MaxValue
- && */unicast.Address.AddressFamily == AddressFamily.InterNetwork)
+ && unicast.AddressPreferredLifetime != UInt32.MaxValue
+ && */unicast.Address.AddressFamily == AddressFamily.InterNetwork)
{
var bytes = unicast.Address.GetAddressBytes();
bytes[3] = 1;
@@ -165,7 +165,7 @@ namespace Mono.Nat
async Task Search(UdpClient client)
{
- // Sort out the time for the next search first. The spec says the
+ // Sort out the time for the next search first. The spec says the
// timeout should double after each attempt. Once it reaches 64 seconds
// (and that attempt fails), assume no devices available
nextSearch = DateTime.Now.AddMilliseconds(timeout);
diff --git a/Mono.Nat/Properties/AssemblyInfo.cs b/Mono.Nat/Properties/AssemblyInfo.cs
index 18b183817..ea1c9dee6 100644
--- a/Mono.Nat/Properties/AssemblyInfo.cs
+++ b/Mono.Nat/Properties/AssemblyInfo.cs
@@ -1,34 +1,21 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
+using System.Reflection;
+using System.Resources;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Mono.Nat")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Mono.Nat")]
-[assembly: AssemblyCopyright("Copyright © 2017")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2006 Alan McGovern. Copyright © 2007 Ben Motmans. Code releases unde the MIT license. Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("cb7f2326-6497-4a3d-ba03-48513b17a7be")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")] \ No newline at end of file
diff --git a/Mono.Nat/Upnp/Messages/GetServicesMessage.cs b/Mono.Nat/Upnp/Messages/GetServicesMessage.cs
index 4b765fd42..72b4c2b25 100644
--- a/Mono.Nat/Upnp/Messages/GetServicesMessage.cs
+++ b/Mono.Nat/Upnp/Messages/GetServicesMessage.cs
@@ -11,10 +11,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
diff --git a/Mono.Nat/Upnp/Messages/Requests/CreatePortMappingMessage.cs b/Mono.Nat/Upnp/Messages/Requests/CreatePortMappingMessage.cs
index e9caa916d..5a2ab009a 100644
--- a/Mono.Nat/Upnp/Messages/Requests/CreatePortMappingMessage.cs
+++ b/Mono.Nat/Upnp/Messages/Requests/CreatePortMappingMessage.cs
@@ -11,10 +11,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
diff --git a/Mono.Nat/Upnp/Messages/UpnpMessage.cs b/Mono.Nat/Upnp/Messages/UpnpMessage.cs
index 37a46e47d..e734db8f4 100644
--- a/Mono.Nat/Upnp/Messages/UpnpMessage.cs
+++ b/Mono.Nat/Upnp/Messages/UpnpMessage.cs
@@ -11,10 +11,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
diff --git a/Mono.Nat/Upnp/Searchers/UpnpSearcher.cs b/Mono.Nat/Upnp/Searchers/UpnpSearcher.cs
index bcf358d1c..57ecdeca9 100644
--- a/Mono.Nat/Upnp/Searchers/UpnpSearcher.cs
+++ b/Mono.Nat/Upnp/Searchers/UpnpSearcher.cs
@@ -15,10 +15,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -58,28 +58,28 @@ namespace Mono.Nat
}
public void Search()
- {
- }
+ {
+ }
public async Task Handle(IPAddress localAddress, UpnpDeviceInfo deviceInfo, IPEndPoint endpoint)
{
if (localAddress == null)
{
- throw new ArgumentNullException("localAddress");
+ throw new ArgumentNullException(nameof(localAddress));
}
try
{
- /* For UPnP Port Mapping we need ot find either WANPPPConnection or WANIPConnection.
- Any other device type is no good to us for this purpose. See the IGP overview paper
- page 5 for an overview of device types and their hierarchy.
- http://upnp.org/specs/gw/UPnP-gw-InternetGatewayDevice-v1-Device.pdf */
+ /* For UPnP Port Mapping we need ot find either WANPPPConnection or WANIPConnection.
+ * Any other device type is no good to us for this purpose. See the IGP overview paper
+ * page 5 for an overview of device types and their hierarchy.
+ * http://upnp.org/specs/gw/UPnP-gw-InternetGatewayDevice-v1-Device.pdf */
/* TODO: Currently we are assuming version 1 of the protocol. We should figure out which
- version it is and apply the correct URN. */
+ * version it is and apply the correct URN. */
/* Some routers don't correctly implement the version ID on the URN, so we only search for the type
- prefix. */
+ * prefix. */
// We have an internet gateway device now
UpnpNatDevice d = new UpnpNatDevice(localAddress, deviceInfo, endpoint, string.Empty, _logger, _httpClient);
diff --git a/Mono.Nat/Upnp/UpnpNatDevice.cs b/Mono.Nat/Upnp/UpnpNatDevice.cs
index 62539103a..f37d6dd0c 100644
--- a/Mono.Nat/Upnp/UpnpNatDevice.cs
+++ b/Mono.Nat/Upnp/UpnpNatDevice.cs
@@ -13,10 +13,10 @@
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -58,7 +58,7 @@ namespace Mono.Nat.Upnp
{
if (localAddress == null)
{
- throw new ArgumentNullException("localAddress");
+ throw new ArgumentNullException(nameof(localAddress));
}
this.LastSeen = DateTime.Now;
diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec
deleted file mode 100644
index a3cb05bf7..000000000
--- a/Nuget/MediaBrowser.Common.nuspec
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
- <metadata>
- <id>MediaBrowser.Common</id>
- <version>3.0.748</version>
- <title>Emby.Common</title>
- <authors>Emby Team</authors>
- <owners>ebr,Luke,scottisafool</owners>
- <projectUrl>https://github.com/MediaBrowser/Emby</projectUrl>
- <iconUrl>http://www.mb3admin.com/images/mb3icons1-1.png</iconUrl>
- <requireLicenseAcceptance>false</requireLicenseAcceptance>
- <description>Contains common model objects and interfaces used by all Emby solutions.</description>
- <copyright>Copyright © Emby 2013</copyright>
- </metadata>
- <files>
- <file src="dlls\MediaBrowser.Common.dll" target="lib\portable-net45+win8+wpa81\MediaBrowser.Common.dll" />
- <file src="dlls\MediaBrowser.Model.dll" target="lib\portable-net45+win8+wpa81\MediaBrowser.Model.dll" />
- </files>
-</package>
diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec
deleted file mode 100644
index 6c2f2d399..000000000
--- a/Nuget/MediaBrowser.Server.Core.nuspec
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
- <metadata>
- <id>MediaBrowser.Server.Core</id>
- <version>3.0.748</version>
- <title>Emby.Server.Core</title>
- <authors>Emby Team</authors>
- <owners>ebr,Luke,scottisafool</owners>
- <projectUrl>https://github.com/MediaBrowser/Emby</projectUrl>
- <iconUrl>http://www.mb3admin.com/images/mb3icons1-1.png</iconUrl>
- <requireLicenseAcceptance>false</requireLicenseAcceptance>
- <description>Contains core components required to build plugins for Emby Server.</description>
- <copyright>Copyright © Emby 2013</copyright>
- <dependencies>
- <dependency id="MediaBrowser.Common" version="3.0.748" />
- </dependencies>
- </metadata>
- <files>
- <file src="dlls\MediaBrowser.Controller.dll" target="lib\net45\MediaBrowser.Controller.dll" />
- <file src="dlls\MediaBrowser.Controller.dll" target="lib\portable-net45+win8+wpa81\MediaBrowser.Controller.dll" />
- </files>
-</package> \ No newline at end of file
diff --git a/Nuget/readme.txt b/Nuget/readme.txt
deleted file mode 100644
index 3dd1cf65a..000000000
--- a/Nuget/readme.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-To update the nuget packages, follow the below procedure:
-
-1. Build the solution in release mode. This will update the contents of the dll's folder
-2. Open each nuspec file, and increment the versions of each, as well as each of the MB dependencies.
-
-For example, in MediaBrowser.Common.Internal, increment <version>, as well as <dependency id="MediaBrowser.Common" version
-
-This is quickest using notepad++. It can also be done with nuget package explorer.
-
-By keeping all the version numbers the same, it makes this largely a mindless activity. If we allow each package to have their own version, this process will be slower and prone to human error.
-
-3. Once this is done, publish the packages using nuget package explorer. File -> Publish.
-
-4. Check the nuspec files in right away, otherwise there will be merge conflicts. \ No newline at end of file
diff --git a/OpenSubtitlesHandler/Console/OSHConsole.cs b/OpenSubtitlesHandler/Console/OSHConsole.cs
index 04c00bf25..348c1ce89 100644
--- a/OpenSubtitlesHandler/Console/OSHConsole.cs
+++ b/OpenSubtitlesHandler/Console/OSHConsole.cs
@@ -26,7 +26,7 @@ namespace OpenSubtitlesHandler.Console
/// <summary>
/// Write line to the console and raise the "LineWritten" event
/// </summary>
- ///
+ ///
/// <param name="text">The debug line</param>
/// <param name="code">The status</param>
public static void WriteLine(string text, DebugCode code = DebugCode.None)
diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseAutoUpdate.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseAutoUpdate.cs
index 5007cc6bb..42d85ef09 100644
--- a/OpenSubtitlesHandler/MethodResponses/MethodResponseAutoUpdate.cs
+++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseAutoUpdate.cs
@@ -37,22 +37,22 @@ namespace OpenSubtitlesHandler
private string _comments;
private string _url_linux;
/// <summary>
- /// Latest application version
+ /// Latest application version
/// </summary>
[Description("Latest application version"), Category("AutoUpdate")]
public string version { get { return _version; } set { _version = value; } }
/// <summary>
- /// Download URL for Windows version
+ /// Download URL for Windows version
/// </summary>
[Description("Download URL for Windows version"), Category("AutoUpdate")]
public string url_windows { get { return _url_windows; } set { _url_windows = value; } }
/// <summary>
- /// Application changelog and other comments
+ /// Application changelog and other comments
/// </summary>
[Description("Application changelog and other comments"), Category("AutoUpdate")]
public string comments { get { return _comments; } set { _comments = value; } }
/// <summary>
- /// Download URL for Linux version
+ /// Download URL for Linux version
/// </summary>
[Description("Download URL for Linux version"), Category("AutoUpdate")]
public string url_linux { get { return _url_linux; } set { _url_linux = value; } }
diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseMovieDetails.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseMovieDetails.cs
index 02e6a1e75..511581d71 100644
--- a/OpenSubtitlesHandler/MethodResponses/MethodResponseMovieDetails.cs
+++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseMovieDetails.cs
@@ -36,7 +36,7 @@ namespace OpenSubtitlesHandler
private string title;
private string year;
private string coverLink;
-
+
private string duration;
private string tagline;
private string plot;
diff --git a/OpenSubtitlesHandler/MethodResponses/MethodResponseServerInfo.cs b/OpenSubtitlesHandler/MethodResponses/MethodResponseServerInfo.cs
index d41ac8e82..b37862466 100644
--- a/OpenSubtitlesHandler/MethodResponses/MethodResponseServerInfo.cs
+++ b/OpenSubtitlesHandler/MethodResponses/MethodResponseServerInfo.cs
@@ -49,12 +49,12 @@ namespace OpenSubtitlesHandler
private List<string> _last_update_strings = new List<string>();
/// <summary>
- /// Version of server's XML-RPC API implementation
+ /// Version of server's XML-RPC API implementation
/// </summary>
[Description("Version of server's XML-RPC API implementation"), Category("OS")]
public string xmlrpc_version { get { return _xmlrpc_version; } set { _xmlrpc_version = value; } }
/// <summary>
- /// XML-RPC interface URL
+ /// XML-RPC interface URL
/// </summary>
[Description("XML-RPC interface URL"), Category("OS")]
public string xmlrpc_url { get { return _xmlrpc_url; } set { _xmlrpc_url = value; } }
@@ -64,27 +64,27 @@ namespace OpenSubtitlesHandler
[Description("Server's application name and version"), Category("OS")]
public string application { get { return _application; } set { _application = value; } }
/// <summary>
- /// Contact e-mail address for server related quuestions and problems
+ /// Contact e-mail address for server related quuestions and problems
/// </summary>
[Description("Contact e-mail address for server related quuestions and problems"), Category("OS")]
public string contact { get { return _contact; } set { _contact = value; } }
/// <summary>
- /// Main server URL
+ /// Main server URL
/// </summary>
[Description("Main server URL"), Category("OS")]
public string website_url { get { return _website_url; } set { _website_url = value; } }
/// <summary>
- /// Number of users currently online
+ /// Number of users currently online
/// </summary>
[Description("Number of users currently online"), Category("OS")]
public int users_online_total { get { return _users_online_total; } set { _users_online_total = value; } }
/// <summary>
- /// Number of users currently online using a client application (XML-RPC API)
+ /// Number of users currently online using a client application (XML-RPC API)
/// </summary>
[Description("Number of users currently online using a client application (XML-RPC API)"), Category("OS")]
public int users_online_program { get { return _users_online_program; } set { _users_online_program = value; } }
/// <summary>
- /// Number of currently logged-in users
+ /// Number of currently logged-in users
/// </summary>
[Description("Number of currently logged-in users"), Category("OS")]
public int users_loggedin { get { return _users_loggedin; } set { _users_loggedin = value; } }
@@ -104,7 +104,7 @@ namespace OpenSubtitlesHandler
[Description("Total number of subtitle downloads"), Category("OS")]
public string subs_downloads { get { return _subs_downloads; } set { _subs_downloads = value; } }
/// <summary>
- /// Total number of subtitle files stored on the server
+ /// Total number of subtitle files stored on the server
/// </summary>
[Description("Total number of subtitle files stored on the server"), Category("OS")]
public string subs_subtitle_files { get { return _subs_subtitle_files; } set { _subs_subtitle_files = value; } }
@@ -119,7 +119,7 @@ namespace OpenSubtitlesHandler
[Description("Total number of movie A.K.A. titles in the database"), Category("OS")]
public string movies_aka { get { return _movies_aka; } set { _movies_aka = value; } }
/// <summary>
- /// Total number of subtitle languages supported
+ /// Total number of subtitle languages supported
/// </summary>
[Description("Total number of subtitle languages supported"), Category("OS")]
public string total_subtitles_languages { get { return _total_subtitles_languages; } set { _total_subtitles_languages = value; } }
diff --git a/OpenSubtitlesHandler/OpenSubtitles.cs b/OpenSubtitlesHandler/OpenSubtitles.cs
index 2dc71560b..91e1e5104 100644
--- a/OpenSubtitlesHandler/OpenSubtitles.cs
+++ b/OpenSubtitlesHandler/OpenSubtitles.cs
@@ -132,17 +132,17 @@ namespace OpenSubtitlesHandler
{
switch (MEMBER.Name)
{
- case "token":
- re.Token = TOKEN = MEMBER.Data.Data.ToString();
- OSHConsole.WriteLine(MEMBER.Name + "= " + MEMBER.Data.Data.ToString());
+ case "token":
+ re.Token = TOKEN = MEMBER.Data.Data.ToString();
+ OSHConsole.WriteLine(MEMBER.Name + "= " + MEMBER.Data.Data.ToString());
break;
case "seconds":
re.Seconds = double.Parse(MEMBER.Data.Data.ToString(), CultureInfo.InvariantCulture);
- OSHConsole.WriteLine(MEMBER.Name + "= " + MEMBER.Data.Data.ToString());
+ OSHConsole.WriteLine(MEMBER.Name + "= " + MEMBER.Data.Data.ToString());
break;
- case "status":
- re.Status = MEMBER.Data.Data.ToString();
- OSHConsole.WriteLine(MEMBER.Name + "= " + MEMBER.Data.Data.ToString());
+ case "status":
+ re.Status = MEMBER.Data.Data.ToString();
+ OSHConsole.WriteLine(MEMBER.Name + "= " + MEMBER.Data.Data.ToString());
break;
}
}
@@ -157,7 +157,7 @@ namespace OpenSubtitlesHandler
}
return new MethodResponseError("Fail", "Log in failed !");
}
-
+
/// <summary>
/// Log out from the server. Call this to terminate the session.
/// </summary>
@@ -203,7 +203,7 @@ namespace OpenSubtitlesHandler
return new MethodResponseError("Fail", "Log out failed !");
}
/// <summary>
- /// keep-alive user's session, verify token/session validity
+ /// keep-alive user's session, verify token/session validity
/// </summary>
/// <returns>Status of the call operation</returns>
public static IMethodResponse NoOperation()
@@ -270,7 +270,7 @@ namespace OpenSubtitlesHandler
}
/*Search and download*/
/// <summary>
- /// Search for subtitle files matching your videos using either video file hashes or IMDb IDs.
+ /// Search for subtitle files matching your videos using either video file hashes or IMDb IDs.
/// </summary>
/// <param name="parameters">List of search subtitle parameters which each one represents 'struct parameter' as descriped at http://trac.opensubtitles.org/projects/opensubtitles/wiki/XmlRpcSearchSubtitles </param>
/// <returns>Status of the call operation. If the call success the response will be 'MethodResponseSubtitleSearch'</returns>
@@ -284,12 +284,12 @@ namespace OpenSubtitlesHandler
if (parameters == null)
{
OSHConsole.UpdateLine("No subtitle search parameter passed !!", DebugCode.Error);
- return new MethodResponseError("Fail", "No subtitle search parameter passed"); ;
+ return new MethodResponseError("Fail", "No subtitle search parameter passed");
}
if (parameters.Length == 0)
{
OSHConsole.UpdateLine("No subtitle search parameter passed !!", DebugCode.Error);
- return new MethodResponseError("Fail", "No subtitle search parameter passed"); ;
+ return new MethodResponseError("Fail", "No subtitle search parameter passed");
}
// Method call ..
List<IXmlRpcValue> parms = new List<IXmlRpcValue>();
@@ -349,7 +349,7 @@ namespace OpenSubtitlesHandler
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -461,12 +461,12 @@ namespace OpenSubtitlesHandler
if (parameters == null)
{
OSHConsole.UpdateLine("No subtitle search parameter passed !!", DebugCode.Error);
- return new MethodResponseError("Fail", "No subtitle search parameter passed"); ;
+ return new MethodResponseError("Fail", "No subtitle search parameter passed");
}
if (parameters.Length == 0)
{
OSHConsole.UpdateLine("No subtitle search parameter passed !!", DebugCode.Error);
- return new MethodResponseError("Fail", "No subtitle search parameter passed"); ;
+ return new MethodResponseError("Fail", "No subtitle search parameter passed");
}
// Method call ..
List<IXmlRpcValue> parms = new List<IXmlRpcValue>();
@@ -529,7 +529,7 @@ namespace OpenSubtitlesHandler
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -630,7 +630,7 @@ namespace OpenSubtitlesHandler
}
return new MethodResponseError("Fail", "Search Subtitles call failed !");
}
-
+
/// <summary>
/// Download subtitle file(s)
/// </summary>
@@ -646,12 +646,12 @@ namespace OpenSubtitlesHandler
if (subIDS == null)
{
OSHConsole.UpdateLine("No subtitle id passed !!", DebugCode.Error);
- return new MethodResponseError("Fail", "No subtitle id passed"); ;
+ return new MethodResponseError("Fail", "No subtitle id passed");
}
if (subIDS.Length == 0)
{
OSHConsole.UpdateLine("No subtitle id passed !!", DebugCode.Error);
- return new MethodResponseError("Fail", "No subtitle id passed"); ;
+ return new MethodResponseError("Fail", "No subtitle id passed");
}
// Method call ..
List<IXmlRpcValue> parms = new List<IXmlRpcValue>();
@@ -672,7 +672,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -753,12 +753,12 @@ namespace OpenSubtitlesHandler
if (subIDS == null)
{
OSHConsole.UpdateLine("No subtitle id passed !!", DebugCode.Error);
- return new MethodResponseError("Fail", "No subtitle id passed"); ;
+ return new MethodResponseError("Fail", "No subtitle id passed");
}
if (subIDS.Length == 0)
{
OSHConsole.UpdateLine("No subtitle id passed !!", DebugCode.Error);
- return new MethodResponseError("Fail", "No subtitle id passed"); ;
+ return new MethodResponseError("Fail", "No subtitle id passed");
}
// Method call ..
List<IXmlRpcValue> parms = new List<IXmlRpcValue>();
@@ -782,7 +782,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(httpResponse);
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -852,7 +852,7 @@ namespace OpenSubtitlesHandler
}
return new MethodResponseError("Fail", "DownloadSubtitles call failed !");
}
-
+
/// <summary>
/// Returns comments for subtitles
/// </summary>
@@ -868,12 +868,12 @@ namespace OpenSubtitlesHandler
if (subIDS == null)
{
OSHConsole.UpdateLine("No subtitle id passed !!", DebugCode.Error);
- return new MethodResponseError("Fail", "No subtitle id passed"); ;
+ return new MethodResponseError("Fail", "No subtitle id passed");
}
if (subIDS.Length == 0)
{
OSHConsole.UpdateLine("No subtitle id passed !!", DebugCode.Error);
- return new MethodResponseError("Fail", "No subtitle id passed"); ;
+ return new MethodResponseError("Fail", "No subtitle id passed");
}
// Method call ..
List<IXmlRpcValue> parms = new List<IXmlRpcValue>();
@@ -890,7 +890,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -996,7 +996,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -1029,7 +1029,7 @@ namespace OpenSubtitlesHandler
}
/*Movies*/
/// <summary>
- /// Search for a movie (using movie title)
+ /// Search for a movie (using movie title)
/// </summary>
/// <param name="query">Movie title user is searching for, this is cleaned-up a bit (remove dvdrip, etc.) before searching </param>
/// <returns>Status of the call operation. If the call success the response will be 'MethodResponseSubtitleSearch'</returns>
@@ -1053,7 +1053,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -1120,7 +1120,7 @@ namespace OpenSubtitlesHandler
return new MethodResponseError("Fail", "SearchMoviesOnIMDB call failed !");
}
/// <summary>
- /// Get movie details for given IMDb ID
+ /// Get movie details for given IMDb ID
/// </summary>
/// <param name="imdbid">http://www.imdb.com/</param>
/// <returns>Status of the call operation. If the call success the response will be 'MethodResponseMovieDetails'</returns>
@@ -1144,7 +1144,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -1288,7 +1288,7 @@ namespace OpenSubtitlesHandler
return new MethodResponseError("Fail", "GetIMDBMovieDetails call failed !");
}
/// <summary>
- /// Allows registered users to insert new movies (not stored in IMDb) to the database.
+ /// Allows registered users to insert new movies (not stored in IMDb) to the database.
/// </summary>
/// <param name="movieName">Movie title </param>
/// <param name="movieyear">Release year </param>
@@ -1316,7 +1316,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -1390,7 +1390,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -1458,7 +1458,7 @@ namespace OpenSubtitlesHandler
}
/*Reporting and rating*/
/// <summary>
- /// Get basic server information and statistics
+ /// Get basic server information and statistics
/// </summary>
/// <returns>Status of the call operation. If the call success the response will be 'MethodResponseServerInfo'</returns>
public static IMethodResponse ServerInfo()
@@ -1479,7 +1479,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -1609,7 +1609,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -1647,9 +1647,9 @@ namespace OpenSubtitlesHandler
return new MethodResponseError("Fail", "ReportWrongMovieHash call failed !");
}
/// <summary>
- /// This method is needed to report bad movie hash for imdbid. This method should be used for correcting wrong entries,
- /// when using CheckMovieHash2. Pass moviehash and moviebytesize for file, and imdbid as new, corrected one IMDBID
- /// (id number without trailing zeroes). After some reports, moviehash will be linked to new imdbid.
+ /// This method is needed to report bad movie hash for imdbid. This method should be used for correcting wrong entries,
+ /// when using CheckMovieHash2. Pass moviehash and moviebytesize for file, and imdbid as new, corrected one IMDBID
+ /// (id number without trailing zeroes). After some reports, moviehash will be linked to new imdbid.
/// </summary>
/// <param name="moviehash">The movie hash</param>
/// <param name="moviebytesize">The movie size in bytes</param>
@@ -1677,7 +1677,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -1709,7 +1709,7 @@ namespace OpenSubtitlesHandler
return new MethodResponseError("Fail", "ReportWrongImdbMovie call failed !");
}
/// <summary>
- /// Rate subtitles
+ /// Rate subtitles
/// </summary>
/// <param name="idsubtitle">Id of subtitle (NOT subtitle file) user wants to rate </param>
/// <param name="score">Subtitle rating, must be in interval 1 (worst) to 10 (best). </param>
@@ -1735,7 +1735,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -1780,7 +1780,7 @@ namespace OpenSubtitlesHandler
return new MethodResponseError("Fail", "SubtitlesVote call failed !");
}
/// <summary>
- /// Add comment to a subtitle
+ /// Add comment to a subtitle
/// </summary>
/// <param name="idsubtitle">Subtitle identifier (BEWARE! this is not the ID of subtitle file but of the whole subtitle (a subtitle can contain multiple subtitle files))</param>
/// <param name="comment">User's comment</param>
@@ -1808,7 +1808,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -1868,7 +1868,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -1933,7 +1933,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -1993,7 +1993,7 @@ namespace OpenSubtitlesHandler
return new MethodResponseError("Fail", "GetSubLanguages call failed !");
}
/// <summary>
- /// Detect language for given strings
+ /// Detect language for given strings
/// </summary>
/// <param name="texts">Array of strings you want language detected for</param>
/// <param name="encodingUsed">The encoding that will be used to get buffer of given strings. (this is not OS official parameter)</param>
@@ -2029,7 +2029,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -2102,7 +2102,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -2161,7 +2161,7 @@ namespace OpenSubtitlesHandler
return new MethodResponseError("Fail", "GetAvailableTranslations call failed !");
}
/// <summary>
- /// Get a translation for given program and language
+ /// Get a translation for given program and language
/// </summary>
/// <param name="iso639">language ​ISO639-1 2-letter code </param>
/// <param name="format">available formats: [gnugettext compatible: mo, po] and [additional: txt, xml]</param>
@@ -2188,7 +2188,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -2221,7 +2221,7 @@ namespace OpenSubtitlesHandler
return new MethodResponseError("Fail", "GetTranslation call failed !");
}
/// <summary>
- /// Check for the latest version of given application
+ /// Check for the latest version of given application
/// </summary>
/// <param name="program">name of the program/client application you want to check. (Currently supported values: subdownloader, oscar)</param>
/// <returns>Status of the call operation. If the call success the response will be 'MethodResponseAutoUpdate'</returns>
@@ -2244,7 +2244,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -2303,7 +2303,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -2357,7 +2357,7 @@ namespace OpenSubtitlesHandler
return new MethodResponseError("Fail", "CheckMovieHash call failed !");
}
/// <summary>
- /// Check if video file hashes are already stored in the database. This method returns matching !MovieImdbID, MovieName, MovieYear, SeriesSeason, SeriesEpisode,
+ /// Check if video file hashes are already stored in the database. This method returns matching !MovieImdbID, MovieName, MovieYear, SeriesSeason, SeriesEpisode,
/// MovieKind if available for each $moviehash, always sorted by SeenCount DESC.
/// </summary>
/// <param name="hashes">Array of video file hashes</param>
@@ -2380,7 +2380,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -2444,7 +2444,7 @@ namespace OpenSubtitlesHandler
return new MethodResponseError("Fail", "CheckMovieHash2 call failed !");
}
/// <summary>
- /// Check if given subtitle files are already stored in the database
+ /// Check if given subtitle files are already stored in the database
/// </summary>
/// <param name="hashes">Array of subtitle file hashes (MD5 hashes of subtitle file contents) </param>
/// <returns>Status of the call operation. If the call success the response will be 'MethodResponseCheckSubHash'</returns>
@@ -2466,7 +2466,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -2511,7 +2511,7 @@ namespace OpenSubtitlesHandler
}
/*Upload*/
/// <summary>
- /// Try to upload subtitles, perform pre-upload checking (i.e. check if subtitles already exist on server)
+ /// Try to upload subtitles, perform pre-upload checking (i.e. check if subtitles already exist on server)
/// </summary>
/// <param name="subs">The subtitle parameters collection to try to upload</param>
/// <returns>Status of the call operation. If the call success the response will be 'MethodResponseTryUploadSubtitles'</returns>
@@ -2551,7 +2551,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
@@ -2643,7 +2643,7 @@ namespace OpenSubtitlesHandler
return new MethodResponseError("Fail", "TryUploadSubtitles call failed !");
}
/// <summary>
- /// Upload given subtitles to OSDb server
+ /// Upload given subtitles to OSDb server
/// </summary>
/// <param name="info">The pamaters of upload method</param>
/// <returns>Status of the call operation. If the call success the response will be 'MethodResponseUploadSubtitles'</returns>
@@ -2664,7 +2664,7 @@ namespace OpenSubtitlesHandler
XmlRpcStructMember member = new XmlRpcStructMember("baseinfo", null);
XmlRpcValueStruct memberStruct = new XmlRpcValueStruct(new List<XmlRpcStructMember>());
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("sublanguageid", new XmlRpcValueBasic(info.sublanguageid)));
memberStruct.Members.Add(new XmlRpcStructMember("moviereleasename", new XmlRpcValueBasic(info.moviereleasename)));
memberStruct.Members.Add(new XmlRpcStructMember("movieaka", new XmlRpcValueBasic(info.movieaka)));
memberStruct.Members.Add(new XmlRpcStructMember("subauthorcomment", new XmlRpcValueBasic(info.subauthorcomment)));
@@ -2704,7 +2704,7 @@ namespace OpenSubtitlesHandler
string response = Utilities.GetStreamString(Utilities.SendRequest(XmlRpcGenerator.Generate(call), XML_PRC_USERAGENT));
if (!response.Contains("ERROR:"))
{
- // No error occur, get and decode the response.
+ // No error occur, get and decode the response.
XmlRpcMethodCall[] calls = XmlRpcGenerator.DecodeMethodResponse(response);
if (calls.Length > 0)
{
diff --git a/OpenSubtitlesHandler/Properties/AssemblyInfo.cs b/OpenSubtitlesHandler/Properties/AssemblyInfo.cs
index 349e289b3..ad4fbbb02 100644
--- a/OpenSubtitlesHandler/Properties/AssemblyInfo.cs
+++ b/OpenSubtitlesHandler/Properties/AssemblyInfo.cs
@@ -1,35 +1,24 @@
-using System.Reflection;
+using System.Reflection;
+using System.Resources;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenSubtitlesHandler")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("OpenSubtitlesHandler")]
-[assembly: AssemblyCopyright("Copyright © 2014")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2013 Ala Ibrahim Hadid. Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("7c43bda2-2037-449d-8aac-9c0ccee8191f")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSubtitlesHandler/SubtitleTypes/SubtitleSearchParameters.cs b/OpenSubtitlesHandler/SubtitleTypes/SubtitleSearchParameters.cs
index 101d7f7df..33eeea5cd 100644
--- a/OpenSubtitlesHandler/SubtitleTypes/SubtitleSearchParameters.cs
+++ b/OpenSubtitlesHandler/SubtitleTypes/SubtitleSearchParameters.cs
@@ -68,7 +68,7 @@ namespace OpenSubtitlesHandler
/// </summary>
public string MovieHash { get { return movieHash; } set { movieHash = value; } }
/// <summary>
- /// Size of video file in bytes
+ /// Size of video file in bytes
/// </summary>
public long MovieByteSize { get { return movieByteSize; } set { movieByteSize = value; } }
/// <summary>
diff --git a/OpenSubtitlesHandler/Utilities.cs b/OpenSubtitlesHandler/Utilities.cs
index f8cfa5c4f..0806c6fc0 100644
--- a/OpenSubtitlesHandler/Utilities.cs
+++ b/OpenSubtitlesHandler/Utilities.cs
@@ -47,7 +47,7 @@ namespace OpenSubtitlesHandler
/// <returns>The hash as Hexadecimal string</returns>
public static string ComputeHash(Stream stream)
{
- byte[] hash = MovieHasher.ComputeMovieHash(stream);
+ byte[] hash = MovieHasher.ComputeMovieHash(stream);
return MovieHasher.ToHexadecimal(hash);
}
/// <summary>
diff --git a/OpenSubtitlesHandler/XML-RPC/XmlRpcGenerator.cs b/OpenSubtitlesHandler/XML-RPC/XmlRpcGenerator.cs
index 06fc945a8..1efa3dd5b 100644
--- a/OpenSubtitlesHandler/XML-RPC/XmlRpcGenerator.cs
+++ b/OpenSubtitlesHandler/XML-RPC/XmlRpcGenerator.cs
@@ -250,7 +250,7 @@ namespace XmlRpcHandler
}
return reader.ReadContentAsString();
}
-
+
private static IXmlRpcValue ReadValue(XmlReader xmlReader, bool skipRead = false)
{
while (skipRead || xmlReader.Read())
diff --git a/RSSDP/DeviceAvailableEventArgs.cs b/RSSDP/DeviceAvailableEventArgs.cs
index d80b4b65b..edc8687e9 100644
--- a/RSSDP/DeviceAvailableEventArgs.cs
+++ b/RSSDP/DeviceAvailableEventArgs.cs
@@ -6,11 +6,11 @@ using MediaBrowser.Model.Net;
namespace Rssdp
{
- /// <summary>
- /// Event arguments for the <see cref="Rssdp.Infrastructure.SsdpDeviceLocatorBase.DeviceAvailable"/> event.
- /// </summary>
- public sealed class DeviceAvailableEventArgs : EventArgs
- {
+ /// <summary>
+ /// Event arguments for the <see cref="Rssdp.Infrastructure.SsdpDeviceLocatorBase.DeviceAvailable"/> event.
+ /// </summary>
+ public sealed class DeviceAvailableEventArgs : EventArgs
+ {
public IpAddressInfo LocalIpAddress { get; set; }
#region Fields
@@ -30,7 +30,7 @@ namespace Rssdp
/// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="discoveredDevice"/> parameter is null.</exception>
public DeviceAvailableEventArgs(DiscoveredSsdpDevice discoveredDevice, bool isNewlyDiscovered)
{
- if (discoveredDevice == null) throw new ArgumentNullException("discoveredDevice");
+ if (discoveredDevice == null) throw new ArgumentNullException(nameof(discoveredDevice));
_DiscoveredDevice = discoveredDevice;
_IsNewlyDiscovered = isNewlyDiscovered;
diff --git a/RSSDP/DeviceEventArgs.cs b/RSSDP/DeviceEventArgs.cs
index 774d812ee..55b23b68c 100644
--- a/RSSDP/DeviceEventArgs.cs
+++ b/RSSDP/DeviceEventArgs.cs
@@ -1,48 +1,48 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Text;
namespace Rssdp
{
- /// <summary>
- /// Event arguments for the <see cref="SsdpDevice.DeviceAdded"/> and <see cref="SsdpDevice.DeviceRemoved"/> events.
- /// </summary>
- public sealed class DeviceEventArgs : EventArgs
- {
+ /// <summary>
+ /// Event arguments for the <see cref="SsdpDevice.DeviceAdded"/> and <see cref="SsdpDevice.DeviceRemoved"/> events.
+ /// </summary>
+ public sealed class DeviceEventArgs : EventArgs
+ {
- #region Fields
+ #region Fields
- private readonly SsdpDevice _Device;
+ private readonly SsdpDevice _Device;
- #endregion
+ #endregion
- #region Constructors
+ #region Constructors
- /// <summary>
- /// Constructs a new instance for the specified <see cref="SsdpDevice"/>.
- /// </summary>
- /// <param name="device">The <see cref="SsdpDevice"/> associated with the event this argument class is being used for.</param>
- /// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
- public DeviceEventArgs(SsdpDevice device)
- {
- if (device == null) throw new ArgumentNullException("device");
+ /// <summary>
+ /// Constructs a new instance for the specified <see cref="SsdpDevice"/>.
+ /// </summary>
+ /// <param name="device">The <see cref="SsdpDevice"/> associated with the event this argument class is being used for.</param>
+ /// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
+ public DeviceEventArgs(SsdpDevice device)
+ {
+ if (device == null) throw new ArgumentNullException(nameof(device));
- _Device = device;
- }
+ _Device = device;
+ }
- #endregion
+ #endregion
- #region Public Properties
+ #region Public Properties
- /// <summary>
- /// Returns the <see cref="SsdpDevice"/> instance the event being raised for.
- /// </summary>
- public SsdpDevice Device
- {
- get { return _Device; }
- }
+ /// <summary>
+ /// Returns the <see cref="SsdpDevice"/> instance the event being raised for.
+ /// </summary>
+ public SsdpDevice Device
+ {
+ get { return _Device; }
+ }
- #endregion
+ #endregion
- }
-} \ No newline at end of file
+ }
+}
diff --git a/RSSDP/DeviceUnavailableEventArgs.cs b/RSSDP/DeviceUnavailableEventArgs.cs
index 171a834a0..ecba7c013 100644
--- a/RSSDP/DeviceUnavailableEventArgs.cs
+++ b/RSSDP/DeviceUnavailableEventArgs.cs
@@ -1,59 +1,59 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace Rssdp
{
- /// <summary>
- /// Event arguments for the <see cref="Rssdp.Infrastructure.SsdpDeviceLocatorBase.DeviceUnavailable"/> event.
- /// </summary>
- public sealed class DeviceUnavailableEventArgs : EventArgs
- {
-
- #region Fields
-
- private readonly DiscoveredSsdpDevice _DiscoveredDevice;
- private readonly bool _Expired;
-
- #endregion
-
- #region Constructors
-
- /// <summary>
- /// Full constructor.
- /// </summary>
- /// <param name="discoveredDevice">A <see cref="DiscoveredSsdpDevice"/> instance representing the device that has become unavailable.</param>
- /// <param name="expired">A boolean value indicating whether this device is unavailable because it expired, or because it explicitly sent a byebye notification.. See <see cref="Expired"/> for more detail.</param>
- /// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="discoveredDevice"/> parameter is null.</exception>
- public DeviceUnavailableEventArgs(DiscoveredSsdpDevice discoveredDevice, bool expired)
- {
- if (discoveredDevice == null) throw new ArgumentNullException("discoveredDevice");
-
- _DiscoveredDevice = discoveredDevice;
- _Expired = expired;
- }
-
- #endregion
-
- #region Public Properties
-
- /// <summary>
- /// Returns true if the device is considered unavailable because it's cached information expired before a new alive notification or search result was received. Returns false if the device is unavailable because it sent an explicit notification of it's unavailability.
- /// </summary>
- public bool Expired
- {
- get { return _Expired; }
- }
-
- /// <summary>
- /// A reference to a <see cref="Rssdp.DiscoveredSsdpDevice"/> instance containing the discovery details of the removed device.
- /// </summary>
- public DiscoveredSsdpDevice DiscoveredDevice
- {
- get { return _DiscoveredDevice; }
- }
-
- #endregion
- }
-} \ No newline at end of file
+ /// <summary>
+ /// Event arguments for the <see cref="Rssdp.Infrastructure.SsdpDeviceLocatorBase.DeviceUnavailable"/> event.
+ /// </summary>
+ public sealed class DeviceUnavailableEventArgs : EventArgs
+ {
+
+ #region Fields
+
+ private readonly DiscoveredSsdpDevice _DiscoveredDevice;
+ private readonly bool _Expired;
+
+ #endregion
+
+ #region Constructors
+
+ /// <summary>
+ /// Full constructor.
+ /// </summary>
+ /// <param name="discoveredDevice">A <see cref="DiscoveredSsdpDevice"/> instance representing the device that has become unavailable.</param>
+ /// <param name="expired">A boolean value indicating whether this device is unavailable because it expired, or because it explicitly sent a byebye notification.. See <see cref="Expired"/> for more detail.</param>
+ /// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="discoveredDevice"/> parameter is null.</exception>
+ public DeviceUnavailableEventArgs(DiscoveredSsdpDevice discoveredDevice, bool expired)
+ {
+ if (discoveredDevice == null) throw new ArgumentNullException(nameof(discoveredDevice));
+
+ _DiscoveredDevice = discoveredDevice;
+ _Expired = expired;
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ /// <summary>
+ /// Returns true if the device is considered unavailable because it's cached information expired before a new alive notification or search result was received. Returns false if the device is unavailable because it sent an explicit notification of it's unavailability.
+ /// </summary>
+ public bool Expired
+ {
+ get { return _Expired; }
+ }
+
+ /// <summary>
+ /// A reference to a <see cref="Rssdp.DiscoveredSsdpDevice"/> instance containing the discovery details of the removed device.
+ /// </summary>
+ public DiscoveredSsdpDevice DiscoveredDevice
+ {
+ get { return _DiscoveredDevice; }
+ }
+
+ #endregion
+ }
+}
diff --git a/RSSDP/DiscoveredSsdpDevice.cs b/RSSDP/DiscoveredSsdpDevice.cs
index 7e70817dd..0c5701d29 100644
--- a/RSSDP/DiscoveredSsdpDevice.cs
+++ b/RSSDP/DiscoveredSsdpDevice.cs
@@ -7,88 +7,88 @@ using System.Net.Http.Headers;
namespace Rssdp
{
- /// <summary>
- /// 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.
- /// </summary>
- /// <seealso cref="SsdpDevice"/>
- /// <seealso cref="Rssdp.Infrastructure.ISsdpDeviceLocator"/>
- public sealed class DiscoveredSsdpDevice
- {
-
- #region Fields
-
- private DateTimeOffset _AsAt;
-
- #endregion
-
- #region Public Properties
-
- /// <summary>
- /// Sets or returns the type of notification, being either a uuid, device type, service type or upnp:rootdevice.
- /// </summary>
- public string NotificationType { get; set; }
-
- /// <summary>
- /// Sets or returns the universal service name (USN) of the device.
- /// </summary>
- public string Usn { get; set; }
-
- /// <summary>
- /// Sets or returns a URL pointing to the device description document for this device.
- /// </summary>
- public Uri DescriptionLocation { get; set; }
-
- /// <summary>
- /// Sets or returns the length of time this information is valid for (from the <see cref="AsAt"/> time).
- /// </summary>
- public TimeSpan CacheLifetime { get; set; }
-
- /// <summary>
- /// Sets or returns the date and time this information was received.
- /// </summary>
- public DateTimeOffset AsAt
- {
- get { return _AsAt; }
- set
- {
- if (_AsAt != value)
- {
- _AsAt = value;
- }
- }
- }
-
- /// <summary>
- /// Returns the headers from the SSDP device response message
- /// </summary>
- public HttpHeaders ResponseHeaders { get; set; }
-
- #endregion
-
- #region Public Methods
-
- /// <summary>
- /// Returns true if this device information has expired, based on the current date/time, and the <see cref="CacheLifetime"/> &amp; <see cref="AsAt"/> properties.
- /// </summary>
- /// <returns></returns>
- public bool IsExpired()
- {
- return this.CacheLifetime == TimeSpan.Zero || this.AsAt.Add(this.CacheLifetime) <= DateTimeOffset.Now;
- }
-
- #endregion
-
- #region Overrides
-
- /// <summary>
- /// Returns the device's <see cref="Usn"/> value.
- /// </summary>
- /// <returns>A string containing the device's universal service name.</returns>
- public override string ToString()
- {
- return this.Usn;
- }
-
- #endregion
- }
+ /// <summary>
+ /// 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.
+ /// </summary>
+ /// <seealso cref="SsdpDevice"/>
+ /// <seealso cref="Rssdp.Infrastructure.ISsdpDeviceLocator"/>
+ public sealed class DiscoveredSsdpDevice
+ {
+
+ #region Fields
+
+ private DateTimeOffset _AsAt;
+
+ #endregion
+
+ #region Public Properties
+
+ /// <summary>
+ /// Sets or returns the type of notification, being either a uuid, device type, service type or upnp:rootdevice.
+ /// </summary>
+ public string NotificationType { get; set; }
+
+ /// <summary>
+ /// Sets or returns the universal service name (USN) of the device.
+ /// </summary>
+ public string Usn { get; set; }
+
+ /// <summary>
+ /// Sets or returns a URL pointing to the device description document for this device.
+ /// </summary>
+ public Uri DescriptionLocation { get; set; }
+
+ /// <summary>
+ /// Sets or returns the length of time this information is valid for (from the <see cref="AsAt"/> time).
+ /// </summary>
+ public TimeSpan CacheLifetime { get; set; }
+
+ /// <summary>
+ /// Sets or returns the date and time this information was received.
+ /// </summary>
+ public DateTimeOffset AsAt
+ {
+ get { return _AsAt; }
+ set
+ {
+ if (_AsAt != value)
+ {
+ _AsAt = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Returns the headers from the SSDP device response message
+ /// </summary>
+ public HttpHeaders ResponseHeaders { get; set; }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Returns true if this device information has expired, based on the current date/time, and the <see cref="CacheLifetime"/> &amp; <see cref="AsAt"/> properties.
+ /// </summary>
+ /// <returns></returns>
+ public bool IsExpired()
+ {
+ return this.CacheLifetime == TimeSpan.Zero || this.AsAt.Add(this.CacheLifetime) <= DateTimeOffset.Now;
+ }
+
+ #endregion
+
+ #region Overrides
+
+ /// <summary>
+ /// Returns the device's <see cref="Usn"/> value.
+ /// </summary>
+ /// <returns>A string containing the device's universal service name.</returns>
+ public override string ToString()
+ {
+ return this.Usn;
+ }
+
+ #endregion
+ }
}
diff --git a/RSSDP/DisposableManagedObjectBase.cs b/RSSDP/DisposableManagedObjectBase.cs
index 7a0fdd45a..c1349dd5c 100644
--- a/RSSDP/DisposableManagedObjectBase.cs
+++ b/RSSDP/DisposableManagedObjectBase.cs
@@ -5,44 +5,44 @@ using System.Threading.Tasks;
namespace Rssdp.Infrastructure
{
- /// <summary>
- /// Correclty implements the <see cref="IDisposable"/> interface and pattern for an object containing only managed resources, and adds a few common niceities not on the interface such as an <see cref="IsDisposed"/> property.
- /// </summary>
- public abstract class DisposableManagedObjectBase : IDisposable
- {
-
- #region Public Methods
-
- /// <summary>
- /// Override this method and dispose any objects you own the lifetime of if disposing is true;
- /// </summary>
- /// <param name="disposing">True if managed objects should be disposed, if false, only unmanaged resources should be released.</param>
- protected abstract void Dispose(bool disposing);
-
- /// <summary>
- /// Throws and <see cref="System.ObjectDisposedException"/> if the <see cref="IsDisposed"/> property is true.
- /// </summary>
- /// <seealso cref="IsDisposed"/>
- /// <exception cref="System.ObjectDisposedException">Thrown if the <see cref="IsDisposed"/> property is true.</exception>
- /// <seealso cref="Dispose()"/>
- protected virtual void ThrowIfDisposed()
- {
- if (this.IsDisposed) throw new ObjectDisposedException(this.GetType().FullName);
- }
-
- #endregion
-
- #region Public Properties
-
- /// <summary>
- /// Sets or returns a boolean indicating whether or not this instance has been disposed.
- /// </summary>
- /// <seealso cref="Dispose()"/>
- public bool IsDisposed
- {
- get;
- private set;
- }
+ /// <summary>
+ /// Correclty implements the <see cref="IDisposable"/> interface and pattern for an object containing only managed resources, and adds a few common niceities not on the interface such as an <see cref="IsDisposed"/> property.
+ /// </summary>
+ public abstract class DisposableManagedObjectBase : IDisposable
+ {
+
+ #region Public Methods
+
+ /// <summary>
+ /// Override this method and dispose any objects you own the lifetime of if disposing is true;
+ /// </summary>
+ /// <param name="disposing">True if managed objects should be disposed, if false, only unmanaged resources should be released.</param>
+ protected abstract void Dispose(bool disposing);
+
+ /// <summary>
+ /// Throws and <see cref="System.ObjectDisposedException"/> if the <see cref="IsDisposed"/> property is true.
+ /// </summary>
+ /// <seealso cref="IsDisposed"/>
+ /// <exception cref="System.ObjectDisposedException">Thrown if the <see cref="IsDisposed"/> property is true.</exception>
+ /// <seealso cref="Dispose()"/>
+ protected virtual void ThrowIfDisposed()
+ {
+ if (this.IsDisposed) throw new ObjectDisposedException(this.GetType().FullName);
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ /// <summary>
+ /// Sets or returns a boolean indicating whether or not this instance has been disposed.
+ /// </summary>
+ /// <seealso cref="Dispose()"/>
+ public bool IsDisposed
+ {
+ get;
+ private set;
+ }
#endregion
@@ -63,7 +63,7 @@ namespace Rssdp.Infrastructure
return builder.ToString();
}
-
+
#region IDisposable Members
/// <summary>
@@ -74,8 +74,8 @@ namespace Rssdp.Infrastructure
/// </remarks>
/// <seealso cref="IsDisposed"/>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly", Justification="We do exactly as asked, but CA doesn't seem to like us also setting the IsDisposed property. Too bad, it's a good idea and shouldn't cause an exception or anything likely to interfer with the dispose process.")]
- public void Dispose()
- {
+ public void Dispose()
+ {
IsDisposed = true;
Dispose(true);
@@ -83,4 +83,4 @@ namespace Rssdp.Infrastructure
#endregion
}
-} \ No newline at end of file
+}
diff --git a/RSSDP/HttpParserBase.cs b/RSSDP/HttpParserBase.cs
index e841feab3..000d6db26 100644
--- a/RSSDP/HttpParserBase.cs
+++ b/RSSDP/HttpParserBase.cs
@@ -42,9 +42,9 @@ namespace Rssdp.Infrastructure
[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)
{
- if (data == null) throw new ArgumentNullException("data");
- if (data.Length == 0) throw new ArgumentException("data cannot be an empty string.", "data");
- if (!LineTerminators.Any(data.Contains)) throw new ArgumentException("data is not a valid request, it does not contain any CRLF/LF terminators.", "data");
+ if (data == null) throw new ArgumentNullException(nameof(data));
+ if (data.Length == 0) throw new ArgumentException("data cannot be an empty string.", nameof(data));
+ if (!LineTerminators.Any(data.Contains)) throw new ArgumentException("data is not a valid request, it does not contain any CRLF/LF terminators.", nameof(data));
using (var retVal = new ByteArrayContent(EmptyByteArray))
{
@@ -77,10 +77,10 @@ namespace Rssdp.Infrastructure
/// <returns>A <see cref="Version"/> object containing the parsed version data.</returns>
protected Version ParseHttpVersion(string versionData)
{
- if (versionData == null) throw new ArgumentNullException("versionData");
+ if (versionData == null) throw new ArgumentNullException(nameof(versionData));
var versionSeparatorIndex = versionData.IndexOf('/');
- if (versionSeparatorIndex <= 0 || versionSeparatorIndex == versionData.Length) throw new ArgumentException("request header line is invalid. Http Version not supplied or incorrect format.", "versionData");
+ if (versionSeparatorIndex <= 0 || versionSeparatorIndex == versionData.Length) throw new ArgumentException("request header line is invalid. Http Version not supplied or incorrect format.", nameof(versionData));
return Version.Parse(versionData.Substring(versionSeparatorIndex + 1));
}
diff --git a/RSSDP/HttpRequestParser.cs b/RSSDP/HttpRequestParser.cs
index 8460e1ca5..1af7f0d51 100644
--- a/RSSDP/HttpRequestParser.cs
+++ b/RSSDP/HttpRequestParser.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
@@ -8,70 +8,70 @@ using System.Threading.Tasks;
namespace Rssdp.Infrastructure
{
- /// <summary>
- /// Parses a string into a <see cref="System.Net.Http.HttpRequestMessage"/> or throws an exception.
- /// </summary>
- public sealed class HttpRequestParser : HttpParserBase<HttpRequestMessage>
- {
-
- #region Fields & Constants
-
- private readonly string[] ContentHeaderNames = new string[]
- {
- "Allow", "Content-Disposition", "Content-Encoding", "Content-Language", "Content-Length", "Content-Location", "Content-MD5", "Content-Range", "Content-Type", "Expires", "Last-Modified"
- };
-
- #endregion
-
- #region Public Methods
-
- /// <summary>
- /// Parses the specified data into a <see cref="System.Net.Http.HttpRequestMessage"/> instance.
- /// </summary>
- /// <param name="data">A string containing the data to parse.</param>
- /// <returns>A <see cref="System.Net.Http.HttpRequestMessage"/> instance containing the parsed data.</returns>
- public override System.Net.Http.HttpRequestMessage Parse(string data)
- {
- System.Net.Http.HttpRequestMessage retVal = null;
-
- try
- {
- retVal = new System.Net.Http.HttpRequestMessage();
-
- Parse(retVal, retVal.Headers, data);
-
- return retVal;
- }
- finally
- {
- if (retVal != null)
- retVal.Dispose();
- }
- }
-
- #endregion
-
- #region Overrides
-
- /// <summary>
- /// Used to parse the first line of an HTTP request or response and assign the values to the appropriate properties on the <paramref name="message"/>.
- /// </summary>
- /// <param name="data">The first line of the HTTP message to be parsed.</param>
- /// <param name="message">Either a <see cref="System.Net.Http.HttpResponseMessage"/> or <see cref="System.Net.Http.HttpRequestMessage"/> to assign the parsed values to.</param>
- protected override void ParseStatusLine(string data, HttpRequestMessage message)
- {
- if (data == null) throw new ArgumentNullException("data");
- if (message == null) throw new ArgumentNullException("message");
-
- var parts = data.Split(' ');
- if (parts.Length < 2) throw new ArgumentException("Status line is invalid. Insufficient status parts.", "data");
-
- message.Method = new HttpMethod(parts[0].Trim());
- Uri requestUri;
- if (Uri.TryCreate(parts[1].Trim(), UriKind.RelativeOrAbsolute, out requestUri))
- message.RequestUri = requestUri;
- else
- System.Diagnostics.Debug.WriteLine(parts[1]);
+ /// <summary>
+ /// Parses a string into a <see cref="System.Net.Http.HttpRequestMessage"/> or throws an exception.
+ /// </summary>
+ public sealed class HttpRequestParser : HttpParserBase<HttpRequestMessage>
+ {
+
+ #region Fields & Constants
+
+ private readonly string[] ContentHeaderNames = new string[]
+ {
+ "Allow", "Content-Disposition", "Content-Encoding", "Content-Language", "Content-Length", "Content-Location", "Content-MD5", "Content-Range", "Content-Type", "Expires", "Last-Modified"
+ };
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Parses the specified data into a <see cref="System.Net.Http.HttpRequestMessage"/> instance.
+ /// </summary>
+ /// <param name="data">A string containing the data to parse.</param>
+ /// <returns>A <see cref="System.Net.Http.HttpRequestMessage"/> instance containing the parsed data.</returns>
+ public override System.Net.Http.HttpRequestMessage Parse(string data)
+ {
+ System.Net.Http.HttpRequestMessage retVal = null;
+
+ try
+ {
+ retVal = new System.Net.Http.HttpRequestMessage();
+
+ Parse(retVal, retVal.Headers, data);
+
+ return retVal;
+ }
+ finally
+ {
+ if (retVal != null)
+ retVal.Dispose();
+ }
+ }
+
+ #endregion
+
+ #region Overrides
+
+ /// <summary>
+ /// Used to parse the first line of an HTTP request or response and assign the values to the appropriate properties on the <paramref name="message"/>.
+ /// </summary>
+ /// <param name="data">The first line of the HTTP message to be parsed.</param>
+ /// <param name="message">Either a <see cref="System.Net.Http.HttpResponseMessage"/> or <see cref="System.Net.Http.HttpRequestMessage"/> to assign the parsed values to.</param>
+ protected override void ParseStatusLine(string data, HttpRequestMessage message)
+ {
+ if (data == null) throw new ArgumentNullException(nameof(data));
+ if (message == null) throw new ArgumentNullException(nameof(message));
+
+ var parts = data.Split(' ');
+ if (parts.Length < 2) throw new ArgumentException("Status line is invalid. Insufficient status parts.", nameof(data));
+
+ message.Method = new HttpMethod(parts[0].Trim());
+ Uri requestUri;
+ if (Uri.TryCreate(parts[1].Trim(), UriKind.RelativeOrAbsolute, out requestUri))
+ message.RequestUri = requestUri;
+ else
+ System.Diagnostics.Debug.WriteLine(parts[1]);
if (parts.Length >= 3)
{
@@ -79,16 +79,16 @@ namespace Rssdp.Infrastructure
}
}
- /// <summary>
- /// Returns a boolean indicating whether the specified HTTP header name represents a content header (true), or a message header (false).
- /// </summary>
- /// <param name="headerName">A string containing the name of the header to return the type of.</param>
- protected override bool IsContentHeader(string headerName)
- {
- return ContentHeaderNames.Contains(headerName, StringComparer.OrdinalIgnoreCase);
- }
+ /// <summary>
+ /// Returns a boolean indicating whether the specified HTTP header name represents a content header (true), or a message header (false).
+ /// </summary>
+ /// <param name="headerName">A string containing the name of the header to return the type of.</param>
+ protected override bool IsContentHeader(string headerName)
+ {
+ return ContentHeaderNames.Contains(headerName, StringComparer.OrdinalIgnoreCase);
+ }
- #endregion
+ #endregion
- }
-} \ No newline at end of file
+ }
+}
diff --git a/RSSDP/HttpResponseParser.cs b/RSSDP/HttpResponseParser.cs
index 8ecb944c2..d864a8bb7 100644
--- a/RSSDP/HttpResponseParser.cs
+++ b/RSSDP/HttpResponseParser.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
@@ -8,82 +8,82 @@ using System.Threading.Tasks;
namespace Rssdp.Infrastructure
{
- /// <summary>
- /// Parses a string into a <see cref="System.Net.Http.HttpResponseMessage"/> or throws an exception.
- /// </summary>
- public sealed class HttpResponseParser : HttpParserBase<System.Net.Http.HttpResponseMessage>
- {
-
- #region Fields & Constants
-
- private readonly string[] ContentHeaderNames = new string[]
- {
- "Allow", "Content-Disposition", "Content-Encoding", "Content-Language", "Content-Length", "Content-Location", "Content-MD5", "Content-Range", "Content-Type", "Expires", "Last-Modified"
- };
-
- #endregion
-
- #region Public Methods
-
- /// <summary>
- /// Parses the specified data into a <see cref="System.Net.Http.HttpResponseMessage"/> instance.
- /// </summary>
- /// <param name="data">A string containing the data to parse.</param>
- /// <returns>A <see cref="System.Net.Http.HttpResponseMessage"/> instance containing the parsed data.</returns>
- public override HttpResponseMessage Parse(string data)
- {
- System.Net.Http.HttpResponseMessage retVal = null;
- try
- {
- retVal = new System.Net.Http.HttpResponseMessage();
-
- Parse(retVal, retVal.Headers, data);
-
- return retVal;
- }
- catch
- {
- if (retVal != null)
- retVal.Dispose();
-
- throw;
- }
- }
-
- #endregion
-
- #region Overrides Methods
-
- /// <summary>
- /// Returns a boolean indicating whether the specified HTTP header name represents a content header (true), or a message header (false).
- /// </summary>
- /// <param name="headerName">A string containing the name of the header to return the type of.</param>
- /// <returns>A boolean, true if th specified header relates to HTTP content, otherwise false.</returns>
- protected override bool IsContentHeader(string headerName)
- {
- return ContentHeaderNames.Contains(headerName, StringComparer.OrdinalIgnoreCase);
- }
-
- /// <summary>
- /// Used to parse the first line of an HTTP request or response and assign the values to the appropriate properties on the <paramref name="message"/>.
- /// </summary>
- /// <param name="data">The first line of the HTTP message to be parsed.</param>
- /// <param name="message">Either a <see cref="System.Net.Http.HttpResponseMessage"/> or <see cref="System.Net.Http.HttpRequestMessage"/> to assign the parsed values to.</param>
- protected override void ParseStatusLine(string data, HttpResponseMessage message)
- {
- if (data == null) throw new ArgumentNullException("data");
- if (message == null) throw new ArgumentNullException("message");
-
- var parts = data.Split(' ');
- if (parts.Length < 2) throw new ArgumentException("data status line is invalid. Insufficient status parts.", "data");
-
- message.Version = ParseHttpVersion(parts[0].Trim());
-
- int statusCode = -1;
- if (!Int32.TryParse(parts[1].Trim(), out statusCode))
- throw new ArgumentException("data status line is invalid. Status code is not a valid integer.", "data");
-
- message.StatusCode = (HttpStatusCode)statusCode;
+ /// <summary>
+ /// Parses a string into a <see cref="System.Net.Http.HttpResponseMessage"/> or throws an exception.
+ /// </summary>
+ public sealed class HttpResponseParser : HttpParserBase<System.Net.Http.HttpResponseMessage>
+ {
+
+ #region Fields & Constants
+
+ private readonly string[] ContentHeaderNames = new string[]
+ {
+ "Allow", "Content-Disposition", "Content-Encoding", "Content-Language", "Content-Length", "Content-Location", "Content-MD5", "Content-Range", "Content-Type", "Expires", "Last-Modified"
+ };
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Parses the specified data into a <see cref="System.Net.Http.HttpResponseMessage"/> instance.
+ /// </summary>
+ /// <param name="data">A string containing the data to parse.</param>
+ /// <returns>A <see cref="System.Net.Http.HttpResponseMessage"/> instance containing the parsed data.</returns>
+ public override HttpResponseMessage Parse(string data)
+ {
+ System.Net.Http.HttpResponseMessage retVal = null;
+ try
+ {
+ retVal = new System.Net.Http.HttpResponseMessage();
+
+ Parse(retVal, retVal.Headers, data);
+
+ return retVal;
+ }
+ catch
+ {
+ if (retVal != null)
+ retVal.Dispose();
+
+ throw;
+ }
+ }
+
+ #endregion
+
+ #region Overrides Methods
+
+ /// <summary>
+ /// Returns a boolean indicating whether the specified HTTP header name represents a content header (true), or a message header (false).
+ /// </summary>
+ /// <param name="headerName">A string containing the name of the header to return the type of.</param>
+ /// <returns>A boolean, true if th specified header relates to HTTP content, otherwise false.</returns>
+ protected override bool IsContentHeader(string headerName)
+ {
+ return ContentHeaderNames.Contains(headerName, StringComparer.OrdinalIgnoreCase);
+ }
+
+ /// <summary>
+ /// Used to parse the first line of an HTTP request or response and assign the values to the appropriate properties on the <paramref name="message"/>.
+ /// </summary>
+ /// <param name="data">The first line of the HTTP message to be parsed.</param>
+ /// <param name="message">Either a <see cref="System.Net.Http.HttpResponseMessage"/> or <see cref="System.Net.Http.HttpRequestMessage"/> to assign the parsed values to.</param>
+ protected override void ParseStatusLine(string data, HttpResponseMessage message)
+ {
+ if (data == null) throw new ArgumentNullException(nameof(data));
+ if (message == null) throw new ArgumentNullException(nameof(message));
+
+ var parts = data.Split(' ');
+ if (parts.Length < 2) throw new ArgumentException("data status line is invalid. Insufficient status parts.", nameof(data));
+
+ message.Version = ParseHttpVersion(parts[0].Trim());
+
+ int statusCode = -1;
+ if (!Int32.TryParse(parts[1].Trim(), out statusCode))
+ throw new ArgumentException("data status line is invalid. Status code is not a valid integer.", nameof(data));
+
+ message.StatusCode = (HttpStatusCode)statusCode;
if (parts.Length >= 3)
{
@@ -91,7 +91,6 @@ namespace Rssdp.Infrastructure
}
}
- #endregion
-
- }
-} \ No newline at end of file
+ #endregion
+ }
+}
diff --git a/RSSDP/IEnumerableExtensions.cs b/RSSDP/IEnumerableExtensions.cs
index f72073949..c96542dca 100644
--- a/RSSDP/IEnumerableExtensions.cs
+++ b/RSSDP/IEnumerableExtensions.cs
@@ -1,28 +1,28 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Rssdp.Infrastructure
{
- internal static class IEnumerableExtensions
- {
- public static IEnumerable<T> SelectManyRecursive<T>(this IEnumerable<T> source, Func<T, IEnumerable<T>> selector)
- {
- if (source == null) throw new ArgumentNullException("source");
- if (selector == null) throw new ArgumentNullException("selector");
+ internal static class IEnumerableExtensions
+ {
+ public static IEnumerable<T> SelectManyRecursive<T>(this IEnumerable<T> source, Func<T, IEnumerable<T>> selector)
+ {
+ if (source == null) throw new ArgumentNullException(nameof(source));
+ if (selector == null) throw new ArgumentNullException(nameof(selector));
- return !source.Any() ? source :
- source.Concat(
- source
- .SelectMany(i => selector(i).EmptyIfNull())
- .SelectManyRecursive(selector)
- );
- }
+ return !source.Any() ? source :
+ source.Concat(
+ source
+ .SelectMany(i => selector(i).EmptyIfNull())
+ .SelectManyRecursive(selector)
+ );
+ }
- public static IEnumerable<T> EmptyIfNull<T>(this IEnumerable<T> source)
- {
- return source ?? Enumerable.Empty<T>();
- }
- }
+ public static IEnumerable<T> EmptyIfNull<T>(this IEnumerable<T> source)
+ {
+ return source ?? Enumerable.Empty<T>();
+ }
+ }
}
diff --git a/RSSDP/ISsdpDeviceLocator.cs b/RSSDP/ISsdpDeviceLocator.cs
index 3ab271836..32235c095 100644
--- a/RSSDP/ISsdpDeviceLocator.cs
+++ b/RSSDP/ISsdpDeviceLocator.cs
@@ -2,140 +2,140 @@
namespace Rssdp.Infrastructure
{
- /// <summary>
- /// Interface for components that discover the existence of SSDP devices.
- /// </summary>
- /// <remarks>
- /// <para>Discovering devices includes explicit search requests as well as listening for broadcast status notifications.</para>
- /// </remarks>
- /// <seealso cref="DiscoveredSsdpDevice"/>
- /// <seealso cref="SsdpDevice"/>
- /// <seealso cref="ISsdpDevicePublisher"/>
- public interface ISsdpDeviceLocator
- {
-
- #region Events
-
- /// <summary>
- /// Event raised when a device becomes available or is found by a search request.
- /// </summary>
- /// <seealso cref="NotificationFilter"/>
- /// <seealso cref="DeviceUnavailable"/>
- /// <seealso cref="StartListeningForNotifications"/>
- /// <seealso cref="StopListeningForNotifications"/>
- event EventHandler<DeviceAvailableEventArgs> DeviceAvailable;
-
- /// <summary>
- /// Event raised when a device explicitly notifies of shutdown or a device expires from the cache.
- /// </summary>
- /// <seeseealso cref="NotificationFilter"/>
- /// <seealso cref="DeviceAvailable"/>
- /// <seealso cref="StartListeningForNotifications"/>
- /// <seealso cref="StopListeningForNotifications"/>
- event EventHandler<DeviceUnavailableEventArgs> DeviceUnavailable;
-
- #endregion
-
- #region Properties
-
- /// <summary>
- /// Sets or returns a string containing the filter for notifications. Notifications not matching the filter will not raise the <see cref="DeviceAvailable"/> or <see cref="DeviceUnavailable"/> events.
- /// </summary>
- /// <remarks>
- /// <para>Device alive/byebye notifications whose NT header does not match this filter value will still be captured and cached internally, but will not raise events about device availability. Usually used with either a device type of uuid NT header value.</para>
- /// <para>Example filters follow;</para>
- /// <example>upnp:rootdevice</example>
- /// <example>urn:schemas-upnp-org:device:WANDevice:1</example>
- /// <example>"uuid:9F15356CC-95FA-572E-0E99-85B456BD3012"</example>
- /// </remarks>
- /// <seealso cref="DeviceAvailable"/>
- /// <seealso cref="DeviceUnavailable"/>
- /// <seealso cref="StartListeningForNotifications"/>
- /// <seealso cref="StopListeningForNotifications"/>
- string NotificationFilter
- {
- get;
- set;
- }
-
- #endregion
-
- #region Methods
-
- #region SearchAsync Overloads
-
- /// <summary>
- /// Aynchronously performs a search for all devices using the default search timeout, and returns an awaitable task that can be used to retrieve the results.
- /// </summary>
- /// <returns>A task whose result is an <see cref="System.Collections.Generic.IEnumerable{T}"/> of <see cref="DiscoveredSsdpDevice" /> instances, representing all found devices.</returns>
- System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<DiscoveredSsdpDevice>> SearchAsync();
-
- /// <summary>
- /// Performs a search for the specified search target (criteria) and default search timeout.
- /// </summary>
- /// <param name="searchTarget">The criteria for the search. Value can be;
- /// <list type="table">
- /// <item><term>Root devices</term><description>upnp:rootdevice</description></item>
- /// <item><term>Specific device by UUID</term><description>uuid:&lt;device uuid&gt;</description></item>
- /// <item><term>Device type</term><description>Fully qualified device type starting with urn: i.e urn:schemas-upnp-org:Basic:1</description></item>
- /// </list>
- /// </param>
- /// <returns>A task whose result is an <see cref="System.Collections.Generic.IEnumerable{T}"/> of <see cref="DiscoveredSsdpDevice" /> instances, representing all found devices.</returns>
- System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<DiscoveredSsdpDevice>> SearchAsync(string searchTarget);
-
- /// <summary>
- /// Performs a search for the specified search target (criteria) and search timeout.
- /// </summary>
- /// <param name="searchTarget">The criteria for the search. Value can be;
- /// <list type="table">
- /// <item><term>Root devices</term><description>upnp:rootdevice</description></item>
- /// <item><term>Specific device by UUID</term><description>uuid:&lt;device uuid&gt;</description></item>
- /// <item><term>Device type</term><description>A device namespace and type in format of urn:&lt;device namespace&gt;:device:&lt;device type&gt;:&lt;device version&gt; i.e urn:schemas-upnp-org:device:Basic:1</description></item>
- /// <item><term>Service type</term><description>A service namespace and type in format of urn:&lt;service namespace&gt;:service:&lt;servicetype&gt;:&lt;service version&gt; i.e urn:my-namespace:service:MyCustomService:1</description></item>
- /// </list>
- /// </param>
- /// <param name="searchWaitTime">The amount of time to wait for network responses to the search request. Longer values will likely return more devices, but increase search time. A value between 1 and 5 is recommended by the UPnP 1.1 specification. Specify TimeSpan.Zero to return only devices already in the cache.</param>
- /// <remarks>
- /// <para>By design RSSDP does not support 'publishing services' as it is intended for use with non-standard UPnP devices that don't publish UPnP style services. However, it is still possible to use RSSDP to search for devices implemetning these services if you know the service type.</para>
- /// </remarks>
- /// <returns>A task whose result is an <see cref="System.Collections.Generic.IEnumerable{T}"/> of <see cref="DiscoveredSsdpDevice" /> instances, representing all found devices.</returns>
- System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<DiscoveredSsdpDevice>> SearchAsync(string searchTarget, TimeSpan searchWaitTime);
-
- /// <summary>
- /// Performs a search for all devices using the specified search timeout.
- /// </summary>
- /// <param name="searchWaitTime">The amount of time to wait for network responses to the search request. Longer values will likely return more devices, but increase search time. A value between 1 and 5 is recommended by the UPnP 1.1 specification. Specify TimeSpan.Zero to return only devices already in the cache.</param>
- /// <returns>A task whose result is an <see cref="System.Collections.Generic.IEnumerable{T}"/> of <see cref="DiscoveredSsdpDevice" /> instances, representing all found devices.</returns>
- System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<DiscoveredSsdpDevice>> SearchAsync(TimeSpan searchWaitTime);
-
- #endregion
-
- /// <summary>
- /// Starts listening for broadcast notifications of service availability.
- /// </summary>
- /// <remarks>
- /// <para>When called the system will listen for 'alive' and 'byebye' notifications. This can speed up searching, as well as provide dynamic notification of new devices appearing on the network, and previously discovered devices disappearing.</para>
- /// </remarks>
- /// <seealso cref="StopListeningForNotifications"/>
- /// <seealso cref="DeviceAvailable"/>
- /// <seealso cref="DeviceUnavailable"/>
- /// <seealso cref="NotificationFilter"/>
- void StartListeningForNotifications();
-
- /// <summary>
- /// Stops listening for broadcast notifications of service availability.
- /// </summary>
- /// <remarks>
- /// <para>Does nothing if this instance is not already listening for notifications.</para>
- /// </remarks>
- /// <exception cref="System.ObjectDisposedException">Throw if the <see cref="DisposableManagedObjectBase.IsDisposed"/> property is true.</exception>
- /// <seealso cref="StartListeningForNotifications"/>
- /// <seealso cref="DeviceAvailable"/>
- /// <seealso cref="DeviceUnavailable"/>
- /// <seealso cref="NotificationFilter"/>
- void StopListeningForNotifications();
-
- #endregion
-
- }
-} \ No newline at end of file
+ /// <summary>
+ /// Interface for components that discover the existence of SSDP devices.
+ /// </summary>
+ /// <remarks>
+ /// <para>Discovering devices includes explicit search requests as well as listening for broadcast status notifications.</para>
+ /// </remarks>
+ /// <seealso cref="DiscoveredSsdpDevice"/>
+ /// <seealso cref="SsdpDevice"/>
+ /// <seealso cref="ISsdpDevicePublisher"/>
+ public interface ISsdpDeviceLocator
+ {
+
+ #region Events
+
+ /// <summary>
+ /// Event raised when a device becomes available or is found by a search request.
+ /// </summary>
+ /// <seealso cref="NotificationFilter"/>
+ /// <seealso cref="DeviceUnavailable"/>
+ /// <seealso cref="StartListeningForNotifications"/>
+ /// <seealso cref="StopListeningForNotifications"/>
+ event EventHandler<DeviceAvailableEventArgs> DeviceAvailable;
+
+ /// <summary>
+ /// Event raised when a device explicitly notifies of shutdown or a device expires from the cache.
+ /// </summary>
+ /// <seeseealso cref="NotificationFilter"/>
+ /// <seealso cref="DeviceAvailable"/>
+ /// <seealso cref="StartListeningForNotifications"/>
+ /// <seealso cref="StopListeningForNotifications"/>
+ event EventHandler<DeviceUnavailableEventArgs> DeviceUnavailable;
+
+ #endregion
+
+ #region Properties
+
+ /// <summary>
+ /// Sets or returns a string containing the filter for notifications. Notifications not matching the filter will not raise the <see cref="DeviceAvailable"/> or <see cref="DeviceUnavailable"/> events.
+ /// </summary>
+ /// <remarks>
+ /// <para>Device alive/byebye notifications whose NT header does not match this filter value will still be captured and cached internally, but will not raise events about device availability. Usually used with either a device type of uuid NT header value.</para>
+ /// <para>Example filters follow;</para>
+ /// <example>upnp:rootdevice</example>
+ /// <example>urn:schemas-upnp-org:device:WANDevice:1</example>
+ /// <example>"uuid:9F15356CC-95FA-572E-0E99-85B456BD3012"</example>
+ /// </remarks>
+ /// <seealso cref="DeviceAvailable"/>
+ /// <seealso cref="DeviceUnavailable"/>
+ /// <seealso cref="StartListeningForNotifications"/>
+ /// <seealso cref="StopListeningForNotifications"/>
+ string NotificationFilter
+ {
+ get;
+ set;
+ }
+
+ #endregion
+
+ #region Methods
+
+ #region SearchAsync Overloads
+
+ /// <summary>
+ /// Aynchronously performs a search for all devices using the default search timeout, and returns an awaitable task that can be used to retrieve the results.
+ /// </summary>
+ /// <returns>A task whose result is an <see cref="System.Collections.Generic.IEnumerable{T}"/> of <see cref="DiscoveredSsdpDevice" /> instances, representing all found devices.</returns>
+ System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<DiscoveredSsdpDevice>> SearchAsync();
+
+ /// <summary>
+ /// Performs a search for the specified search target (criteria) and default search timeout.
+ /// </summary>
+ /// <param name="searchTarget">The criteria for the search. Value can be;
+ /// <list type="table">
+ /// <item><term>Root devices</term><description>upnp:rootdevice</description></item>
+ /// <item><term>Specific device by UUID</term><description>uuid:&lt;device uuid&gt;</description></item>
+ /// <item><term>Device type</term><description>Fully qualified device type starting with urn: i.e urn:schemas-upnp-org:Basic:1</description></item>
+ /// </list>
+ /// </param>
+ /// <returns>A task whose result is an <see cref="System.Collections.Generic.IEnumerable{T}"/> of <see cref="DiscoveredSsdpDevice" /> instances, representing all found devices.</returns>
+ System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<DiscoveredSsdpDevice>> SearchAsync(string searchTarget);
+
+ /// <summary>
+ /// Performs a search for the specified search target (criteria) and search timeout.
+ /// </summary>
+ /// <param name="searchTarget">The criteria for the search. Value can be;
+ /// <list type="table">
+ /// <item><term>Root devices</term><description>upnp:rootdevice</description></item>
+ /// <item><term>Specific device by UUID</term><description>uuid:&lt;device uuid&gt;</description></item>
+ /// <item><term>Device type</term><description>A device namespace and type in format of urn:&lt;device namespace&gt;:device:&lt;device type&gt;:&lt;device version&gt; i.e urn:schemas-upnp-org:device:Basic:1</description></item>
+ /// <item><term>Service type</term><description>A service namespace and type in format of urn:&lt;service namespace&gt;:service:&lt;servicetype&gt;:&lt;service version&gt; i.e urn:my-namespace:service:MyCustomService:1</description></item>
+ /// </list>
+ /// </param>
+ /// <param name="searchWaitTime">The amount of time to wait for network responses to the search request. Longer values will likely return more devices, but increase search time. A value between 1 and 5 is recommended by the UPnP 1.1 specification. Specify TimeSpan.Zero to return only devices already in the cache.</param>
+ /// <remarks>
+ /// <para>By design RSSDP does not support 'publishing services' as it is intended for use with non-standard UPnP devices that don't publish UPnP style services. However, it is still possible to use RSSDP to search for devices implemetning these services if you know the service type.</para>
+ /// </remarks>
+ /// <returns>A task whose result is an <see cref="System.Collections.Generic.IEnumerable{T}"/> of <see cref="DiscoveredSsdpDevice" /> instances, representing all found devices.</returns>
+ System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<DiscoveredSsdpDevice>> SearchAsync(string searchTarget, TimeSpan searchWaitTime);
+
+ /// <summary>
+ /// Performs a search for all devices using the specified search timeout.
+ /// </summary>
+ /// <param name="searchWaitTime">The amount of time to wait for network responses to the search request. Longer values will likely return more devices, but increase search time. A value between 1 and 5 is recommended by the UPnP 1.1 specification. Specify TimeSpan.Zero to return only devices already in the cache.</param>
+ /// <returns>A task whose result is an <see cref="System.Collections.Generic.IEnumerable{T}"/> of <see cref="DiscoveredSsdpDevice" /> instances, representing all found devices.</returns>
+ System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<DiscoveredSsdpDevice>> SearchAsync(TimeSpan searchWaitTime);
+
+ #endregion
+
+ /// <summary>
+ /// Starts listening for broadcast notifications of service availability.
+ /// </summary>
+ /// <remarks>
+ /// <para>When called the system will listen for 'alive' and 'byebye' notifications. This can speed up searching, as well as provide dynamic notification of new devices appearing on the network, and previously discovered devices disappearing.</para>
+ /// </remarks>
+ /// <seealso cref="StopListeningForNotifications"/>
+ /// <seealso cref="DeviceAvailable"/>
+ /// <seealso cref="DeviceUnavailable"/>
+ /// <seealso cref="NotificationFilter"/>
+ void StartListeningForNotifications();
+
+ /// <summary>
+ /// Stops listening for broadcast notifications of service availability.
+ /// </summary>
+ /// <remarks>
+ /// <para>Does nothing if this instance is not already listening for notifications.</para>
+ /// </remarks>
+ /// <exception cref="System.ObjectDisposedException">Throw if the <see cref="DisposableManagedObjectBase.IsDisposed"/> property is true.</exception>
+ /// <seealso cref="StartListeningForNotifications"/>
+ /// <seealso cref="DeviceAvailable"/>
+ /// <seealso cref="DeviceUnavailable"/>
+ /// <seealso cref="NotificationFilter"/>
+ void StopListeningForNotifications();
+
+ #endregion
+
+ }
+}
diff --git a/RSSDP/ISsdpDevicePublisher.cs b/RSSDP/ISsdpDevicePublisher.cs
index b6ebc4176..b0924701f 100644
--- a/RSSDP/ISsdpDevicePublisher.cs
+++ b/RSSDP/ISsdpDevicePublisher.cs
@@ -3,35 +3,34 @@ using System.Threading.Tasks;
namespace Rssdp.Infrastructure
{
- /// <summary>
- /// Interface for components that publish the existence of SSDP devices.
- /// </summary>
- /// <remarks>
- /// <para>Publishing a device includes sending notifications (alive and byebye) as well as responding to search requests when appropriate.</para>
- /// </remarks>
- /// <seealso cref="SsdpRootDevice"/>
- /// <seealso cref="ISsdpDeviceLocator"/>
- public interface ISsdpDevicePublisher
- {
- /// <summary>
- /// Adds a device (and it's children) to the list of devices being published by this server, making them discoverable to SSDP clients.
- /// </summary>
- /// <param name="device">The <see cref="SsdpRootDevice"/> instance to add.</param>
- /// <returns>An awaitable <see cref="System.Threading.Tasks.Task"/>.</returns>
- void AddDevice(SsdpRootDevice device);
+ /// <summary>
+ /// Interface for components that publish the existence of SSDP devices.
+ /// </summary>
+ /// <remarks>
+ /// <para>Publishing a device includes sending notifications (alive and byebye) as well as responding to search requests when appropriate.</para>
+ /// </remarks>
+ /// <seealso cref="SsdpRootDevice"/>
+ /// <seealso cref="ISsdpDeviceLocator"/>
+ public interface ISsdpDevicePublisher
+ {
+ /// <summary>
+ /// Adds a device (and it's children) to the list of devices being published by this server, making them discoverable to SSDP clients.
+ /// </summary>
+ /// <param name="device">The <see cref="SsdpRootDevice"/> instance to add.</param>
+ /// <returns>An awaitable <see cref="System.Threading.Tasks.Task"/>.</returns>
+ void AddDevice(SsdpRootDevice device);
- /// <summary>
- /// Removes a device (and it's children) from the list of devices being published by this server, making them undiscoverable.
- /// </summary>
- /// <param name="device">The <see cref="SsdpRootDevice"/> instance to add.</param>
- /// <returns>An awaitable <see cref="System.Threading.Tasks.Task"/>.</returns>
- Task RemoveDevice(SsdpRootDevice device);
+ /// <summary>
+ /// Removes a device (and it's children) from the list of devices being published by this server, making them undiscoverable.
+ /// </summary>
+ /// <param name="device">The <see cref="SsdpRootDevice"/> instance to add.</param>
+ /// <returns>An awaitable <see cref="System.Threading.Tasks.Task"/>.</returns>
+ Task RemoveDevice(SsdpRootDevice device);
- /// <summary>
- /// Returns a read only list of devices being published by this instance.
- /// </summary>
- /// <seealso cref="SsdpDevice"/>
- System.Collections.Generic.IEnumerable<SsdpRootDevice> Devices { get; }
-
- }
+ /// <summary>
+ /// Returns a read only list of devices being published by this instance.
+ /// </summary>
+ /// <seealso cref="SsdpDevice"/>
+ System.Collections.Generic.IEnumerable<SsdpRootDevice> Devices { get; }
+ }
}
diff --git a/RSSDP/Properties/AssemblyInfo.cs b/RSSDP/Properties/AssemblyInfo.cs
index 1ce64b159..7098279b4 100644
--- a/RSSDP/Properties/AssemblyInfo.cs
+++ b/RSSDP/Properties/AssemblyInfo.cs
@@ -1,30 +1,24 @@
-using System.Resources;
using System.Reflection;
-using System.Runtime.CompilerServices;
+using System.Resources;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
-[assembly: AssemblyTitle("RSSDP2")]
+[assembly: AssemblyTitle("RSSDP")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("RSSDP2")]
-[assembly: AssemblyCopyright("Copyright © 2016")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2015 Troy Willmot. Code released under the MIT license. Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/RSSDP/RequestReceivedEventArgs.cs b/RSSDP/RequestReceivedEventArgs.cs
index f4e367760..6a5b0f086 100644
--- a/RSSDP/RequestReceivedEventArgs.cs
+++ b/RSSDP/RequestReceivedEventArgs.cs
@@ -8,54 +8,52 @@ using MediaBrowser.Model.Net;
namespace Rssdp.Infrastructure
{
- /// <summary>
- /// Provides arguments for the <see cref="ISsdpCommunicationsServer.RequestReceived"/> event.
- /// </summary>
- public sealed class RequestReceivedEventArgs : EventArgs
- {
-
- #region Fields
-
- private readonly HttpRequestMessage _Message;
- private readonly IpEndPointInfo _ReceivedFrom;
-
- #endregion
-
- public IpAddressInfo LocalIpAddress { get; private set; }
-
- #region Constructors
-
- /// <summary>
- /// Full constructor.
- /// </summary>
- public RequestReceivedEventArgs(HttpRequestMessage message, IpEndPointInfo receivedFrom, IpAddressInfo localIpAddress)
- {
- _Message = message;
- _ReceivedFrom = receivedFrom;
- LocalIpAddress = localIpAddress;
- }
-
- #endregion
-
- #region Public Properties
-
- /// <summary>
- /// The <see cref="HttpRequestMessage"/> that was received.
- /// </summary>
- public HttpRequestMessage Message
- {
- get { return _Message; }
- }
-
- /// <summary>
- /// The <see cref="UdpEndPoint"/> the request came from.
- /// </summary>
- public IpEndPointInfo ReceivedFrom
- {
- get { return _ReceivedFrom; }
- }
-
- #endregion
-
- }
-} \ No newline at end of file
+ /// <summary>
+ /// Provides arguments for the <see cref="ISsdpCommunicationsServer.RequestReceived"/> event.
+ /// </summary>
+ public sealed class RequestReceivedEventArgs : EventArgs
+ {
+ #region Fields
+
+ private readonly HttpRequestMessage _Message;
+ private readonly IpEndPointInfo _ReceivedFrom;
+
+ #endregion
+
+ public IpAddressInfo LocalIpAddress { get; private set; }
+
+ #region Constructors
+
+ /// <summary>
+ /// Full constructor.
+ /// </summary>
+ public RequestReceivedEventArgs(HttpRequestMessage message, IpEndPointInfo receivedFrom, IpAddressInfo localIpAddress)
+ {
+ _Message = message;
+ _ReceivedFrom = receivedFrom;
+ LocalIpAddress = localIpAddress;
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ /// <summary>
+ /// The <see cref="HttpRequestMessage"/> that was received.
+ /// </summary>
+ public HttpRequestMessage Message
+ {
+ get { return _Message; }
+ }
+
+ /// <summary>
+ /// The <see cref="UdpEndPoint"/> the request came from.
+ /// </summary>
+ public IpEndPointInfo ReceivedFrom
+ {
+ get { return _ReceivedFrom; }
+ }
+
+ #endregion
+ }
+}
diff --git a/RSSDP/ResponseReceivedEventArgs.cs b/RSSDP/ResponseReceivedEventArgs.cs
index f67d5da90..5ec5376df 100644
--- a/RSSDP/ResponseReceivedEventArgs.cs
+++ b/RSSDP/ResponseReceivedEventArgs.cs
@@ -8,53 +8,52 @@ using MediaBrowser.Model.Net;
namespace Rssdp.Infrastructure
{
- /// <summary>
- /// Provides arguments for the <see cref="ISsdpCommunicationsServer.ResponseReceived"/> event.
- /// </summary>
- public sealed class ResponseReceivedEventArgs : EventArgs
- {
+ /// <summary>
+ /// Provides arguments for the <see cref="ISsdpCommunicationsServer.ResponseReceived"/> event.
+ /// </summary>
+ public sealed class ResponseReceivedEventArgs : EventArgs
+ {
public IpAddressInfo LocalIpAddress { get; set; }
#region Fields
private readonly HttpResponseMessage _Message;
- private readonly IpEndPointInfo _ReceivedFrom;
-
- #endregion
-
- #region Constructors
-
- /// <summary>
- /// Full constructor.
- /// </summary>
- public ResponseReceivedEventArgs(HttpResponseMessage message, IpEndPointInfo receivedFrom)
- {
- _Message = message;
- _ReceivedFrom = receivedFrom;
- }
-
- #endregion
-
- #region Public Properties
-
- /// <summary>
- /// The <see cref="HttpResponseMessage"/> that was received.
- /// </summary>
- public HttpResponseMessage Message
- {
- get { return _Message; }
- }
-
- /// <summary>
- /// The <see cref="UdpEndPoint"/> the response came from.
- /// </summary>
- public IpEndPointInfo ReceivedFrom
- {
- get { return _ReceivedFrom; }
- }
-
- #endregion
-
- }
+ private readonly IpEndPointInfo _ReceivedFrom;
+
+ #endregion
+
+ #region Constructors
+
+ /// <summary>
+ /// Full constructor.
+ /// </summary>
+ public ResponseReceivedEventArgs(HttpResponseMessage message, IpEndPointInfo receivedFrom)
+ {
+ _Message = message;
+ _ReceivedFrom = receivedFrom;
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ /// <summary>
+ /// The <see cref="HttpResponseMessage"/> that was received.
+ /// </summary>
+ public HttpResponseMessage Message
+ {
+ get { return _Message; }
+ }
+
+ /// <summary>
+ /// The <see cref="UdpEndPoint"/> the response came from.
+ /// </summary>
+ public IpEndPointInfo ReceivedFrom
+ {
+ get { return _ReceivedFrom; }
+ }
+
+ #endregion
+ }
}
diff --git a/RSSDP/SsdpCommunicationsServer.cs b/RSSDP/SsdpCommunicationsServer.cs
index f52667366..603ba51ef 100644
--- a/RSSDP/SsdpCommunicationsServer.cs
+++ b/RSSDP/SsdpCommunicationsServer.cs
@@ -20,22 +20,19 @@ namespace Rssdp.Infrastructure
#region Fields
- /*
-
- We could technically use one socket listening on port 1900 for everything.
- This should get both multicast (notifications) and unicast (search response) messages, however
- this often doesn't work under Windows because the MS SSDP service is running. If that service
- is running then it will steal the unicast messages and we will never see search responses.
- Since stopping the service would be a bad idea (might not be allowed security wise and might
- break other apps running on the system) the only other work around is to use two sockets.
-
- We use one socket to listen for/receive notifications and search requests (_BroadcastListenSocket).
- We use a second socket, bound to a different local port, to send search requests and listen for
- responses (_SendSocket). The responses are sent to the local port this socket is bound to,
- which isn't port 1900 so the MS service doesn't steal them. While the caller can specify a local
- port to use, we will default to 0 which allows the underlying system to auto-assign a free port.
-
- */
+ /* We could technically use one socket listening on port 1900 for everything.
+ * This should get both multicast (notifications) and unicast (search response) messages, however
+ * this often doesn't work under Windows because the MS SSDP service is running. If that service
+ * is running then it will steal the unicast messages and we will never see search responses.
+ * Since stopping the service would be a bad idea (might not be allowed security wise and might
+ * break other apps running on the system) the only other work around is to use two sockets.
+ *
+ * We use one socket to listen for/receive notifications and search requests (_BroadcastListenSocket).
+ * We use a second socket, bound to a different local port, to send search requests and listen for
+ * responses (_SendSocket). The responses are sent to the local port this socket is bound to,
+ * which isn't port 1900 so the MS service doesn't steal them. While the caller can specify a local
+ * port to use, we will default to 0 which allows the underlying system to auto-assign a free port.
+ */
private object _BroadcastListenSocketSynchroniser = new object();
private ISocket _BroadcastListenSocket;
@@ -89,8 +86,8 @@ namespace Rssdp.Infrastructure
/// <exception cref="System.ArgumentOutOfRangeException">The <paramref name="multicastTimeToLive"/> argument is less than or equal to zero.</exception>
public SsdpCommunicationsServer(ISocketFactory socketFactory, int localPort, int multicastTimeToLive, INetworkManager networkManager, ILogger logger, bool enableMultiSocketBinding)
{
- if (socketFactory == null) throw new ArgumentNullException("socketFactory");
- if (multicastTimeToLive <= 0) throw new ArgumentOutOfRangeException("multicastTimeToLive", "multicastTimeToLive must be greater than zero.");
+ if (socketFactory == null) throw new ArgumentNullException(nameof(socketFactory));
+ if (multicastTimeToLive <= 0) throw new ArgumentOutOfRangeException(nameof(multicastTimeToLive), "multicastTimeToLive must be greater than zero.");
_BroadcastListenSocketSynchroniser = new object();
_SendSocketSynchroniser = new object();
@@ -164,7 +161,7 @@ namespace Rssdp.Infrastructure
/// </summary>
public async Task SendMessage(byte[] messageData, IpEndPointInfo destination, IpAddressInfo fromLocalIpAddress, CancellationToken cancellationToken)
{
- if (messageData == null) throw new ArgumentNullException("messageData");
+ if (messageData == null) throw new ArgumentNullException(nameof(messageData));
ThrowIfDisposed();
@@ -249,7 +246,7 @@ namespace Rssdp.Infrastructure
/// </summary>
public async Task SendMulticastMessage(string message, int sendCount, CancellationToken cancellationToken)
{
- if (message == null) throw new ArgumentNullException("messageData");
+ if (message == null) throw new ArgumentNullException(nameof(message));
byte[] messageData = Encoding.UTF8.GetBytes(message);
@@ -447,7 +444,7 @@ namespace Rssdp.Infrastructure
private void ProcessMessage(string data, IpEndPointInfo endPoint, IpAddressInfo receivedOnLocalIpAddress)
{
//Responses start with the HTTP version, prefixed with HTTP/ while
- //requests start with a method which can vary and might be one we haven't
+ //requests start with a method which can vary and might be one we haven't
//seen/don't know. We'll check if this message is a request or a response
//by checking for the HTTP/ prefix on the start of the message.
if (data.StartsWith("HTTP/", StringComparison.OrdinalIgnoreCase))
diff --git a/RSSDP/SsdpConstants.cs b/RSSDP/SsdpConstants.cs
index 87f01f9e0..ab0ecb0f7 100644
--- a/RSSDP/SsdpConstants.cs
+++ b/RSSDP/SsdpConstants.cs
@@ -5,63 +5,63 @@ using System.Threading.Tasks;
namespace Rssdp.Infrastructure
{
- /// <summary>
- /// Provides constants for common values related to the SSDP protocols.
- /// </summary>
- public static class SsdpConstants
- {
+ /// <summary>
+ /// Provides constants for common values related to the SSDP protocols.
+ /// </summary>
+ public static class SsdpConstants
+ {
- /// <summary>
- /// Multicast IP Address used for SSDP multicast messages. Values is 239.255.255.250.
- /// </summary>
- public const string MulticastLocalAdminAddress = "239.255.255.250";
- /// <summary>
- /// The UDP port used for SSDP multicast messages. Values is 1900.
- /// </summary>
- public const int MulticastPort = 1900;
- /// <summary>
- /// The default multicase TTL for SSDP multicast messages. Value is 4.
- /// </summary>
- public const int SsdpDefaultMulticastTimeToLive = 4;
+ /// <summary>
+ /// Multicast IP Address used for SSDP multicast messages. Values is 239.255.255.250.
+ /// </summary>
+ public const string MulticastLocalAdminAddress = "239.255.255.250";
+ /// <summary>
+ /// The UDP port used for SSDP multicast messages. Values is 1900.
+ /// </summary>
+ public const int MulticastPort = 1900;
+ /// <summary>
+ /// The default multicase TTL for SSDP multicast messages. Value is 4.
+ /// </summary>
+ public const int SsdpDefaultMulticastTimeToLive = 4;
- internal const string MSearchMethod = "M-SEARCH";
+ internal const string MSearchMethod = "M-SEARCH";
- internal const string SsdpDiscoverMessage = "ssdp:discover";
- internal const string SsdpDiscoverAllSTHeader = "ssdp:all";
+ internal const string SsdpDiscoverMessage = "ssdp:discover";
+ internal const string SsdpDiscoverAllSTHeader = "ssdp:all";
- internal const string SsdpDeviceDescriptionXmlNamespace = "urn:schemas-upnp-org:device-1-0";
+ internal const string SsdpDeviceDescriptionXmlNamespace = "urn:schemas-upnp-org:device-1-0";
- /// <summary>
- /// Default buffer size for receiving SSDP broadcasts. Value is 8192 (bytes).
- /// </summary>
- public const int DefaultUdpSocketBufferSize = 8192;
- /// <summary>
- /// The maximum possible buffer size for a UDP message. Value is 65507 (bytes).
- /// </summary>
- public const int MaxUdpSocketBufferSize = 65507; // Max possible UDP packet size on IPv4 without using 'jumbograms'.
+ /// <summary>
+ /// Default buffer size for receiving SSDP broadcasts. Value is 8192 (bytes).
+ /// </summary>
+ public const int DefaultUdpSocketBufferSize = 8192;
+ /// <summary>
+ /// The maximum possible buffer size for a UDP message. Value is 65507 (bytes).
+ /// </summary>
+ public const int MaxUdpSocketBufferSize = 65507; // Max possible UDP packet size on IPv4 without using 'jumbograms'.
- /// <summary>
- /// Namespace/prefix for UPnP device types. Values is schemas-upnp-org.
- /// </summary>
- public const string UpnpDeviceTypeNamespace = "schemas-upnp-org";
- /// <summary>
- /// UPnP Root Device type. Value is upnp:rootdevice.
- /// </summary>
- public const string UpnpDeviceTypeRootDevice = "upnp:rootdevice";
- /// <summary>
- /// The value is used by Windows Explorer for device searches instead of the UPNPDeviceTypeRootDevice constant.
- /// Not sure why (different spec, bug, alternate protocol etc). Used to enable Windows Explorer support.
- /// </summary>
- public const string PnpDeviceTypeRootDevice = "pnp:rootdevice";
- /// <summary>
- /// UPnP Basic Device type. Value is Basic.
- /// </summary>
- public const string UpnpDeviceTypeBasicDevice = "Basic";
+ /// <summary>
+ /// Namespace/prefix for UPnP device types. Values is schemas-upnp-org.
+ /// </summary>
+ public const string UpnpDeviceTypeNamespace = "schemas-upnp-org";
+ /// <summary>
+ /// UPnP Root Device type. Value is upnp:rootdevice.
+ /// </summary>
+ public const string UpnpDeviceTypeRootDevice = "upnp:rootdevice";
+ /// <summary>
+ /// The value is used by Windows Explorer for device searches instead of the UPNPDeviceTypeRootDevice constant.
+ /// Not sure why (different spec, bug, alternate protocol etc). Used to enable Windows Explorer support.
+ /// </summary>
+ public const string PnpDeviceTypeRootDevice = "pnp:rootdevice";
+ /// <summary>
+ /// UPnP Basic Device type. Value is Basic.
+ /// </summary>
+ public const string UpnpDeviceTypeBasicDevice = "Basic";
- internal const string SsdpKeepAliveNotification = "ssdp:alive";
- internal const string SsdpByeByeNotification = "ssdp:byebye";
+ internal const string SsdpKeepAliveNotification = "ssdp:alive";
+ internal const string SsdpByeByeNotification = "ssdp:byebye";
- internal const int UdpResendCount = 3;
+ internal const int UdpResendCount = 3;
- }
+ }
}
diff --git a/RSSDP/SsdpDevice.cs b/RSSDP/SsdpDevice.cs
index ef6869c8b..4508e4f34 100644
--- a/RSSDP/SsdpDevice.cs
+++ b/RSSDP/SsdpDevice.cs
@@ -75,7 +75,7 @@ namespace Rssdp
return rootDevice;
}
-
+
#region Public Properties
#region UPnP Device Description Properties
@@ -281,7 +281,7 @@ namespace Rssdp
/// <seealso cref="DeviceAdded"/>
public void AddDevice(SsdpEmbeddedDevice device)
{
- if (device == null) throw new ArgumentNullException("device");
+ if (device == null) throw new ArgumentNullException(nameof(device));
if (device.RootDevice != null && device.RootDevice != this.ToRootDevice()) throw new InvalidOperationException("This device is already associated with a different root device (has been added as a child in another branch).");
if (device == this) throw new InvalidOperationException("Can't add device to itself.");
@@ -309,7 +309,7 @@ namespace Rssdp
/// <seealso cref="DeviceRemoved"/>
public void RemoveDevice(SsdpEmbeddedDevice device)
{
- if (device == null) throw new ArgumentNullException("device");
+ if (device == null) throw new ArgumentNullException(nameof(device));
bool wasRemoved = false;
lock (_Devices)
@@ -330,7 +330,7 @@ namespace Rssdp
/// </summary>
/// <param name="device">The <see cref="SsdpEmbeddedDevice"/> instance added to the <see cref="Devices"/> collection.</param>
/// <seealso cref="AddDevice"/>
- /// <seealso cref="DeviceAdded"/>
+ /// <seealso cref="DeviceAdded"/>
protected virtual void OnDeviceAdded(SsdpEmbeddedDevice device)
{
var handlers = this.DeviceAdded;
diff --git a/RSSDP/SsdpDeviceLocator.cs b/RSSDP/SsdpDeviceLocator.cs
index 32289822f..0a092e6b0 100644
--- a/RSSDP/SsdpDeviceLocator.cs
+++ b/RSSDP/SsdpDeviceLocator.cs
@@ -39,7 +39,7 @@ namespace Rssdp.Infrastructure
/// </summary>
public SsdpDeviceLocator(ISsdpCommunicationsServer communicationsServer, ITimerFactory timerFactory)
{
- if (communicationsServer == null) throw new ArgumentNullException("communicationsServer");
+ if (communicationsServer == null) throw new ArgumentNullException(nameof(communicationsServer));
_CommunicationsServer = communicationsServer;
_timerFactory = timerFactory;
@@ -53,7 +53,7 @@ namespace Rssdp.Infrastructure
#region Events
/// <summary>
- /// Raised for when
+ /// Raised for when
/// <list type="bullet">
/// <item>An 'alive' notification is received that a device, regardless of whether or not that device is not already in the cache or has previously raised this event.</item>
/// <item>For each item found during a device <see cref="SearchAsync()"/> (cached or not), allowing clients to respond to found devices before the entire search is complete.</item>
@@ -164,8 +164,8 @@ namespace Rssdp.Infrastructure
private Task SearchAsync(string searchTarget, TimeSpan searchWaitTime, CancellationToken cancellationToken)
{
- if (searchTarget == null) throw new ArgumentNullException("searchTarget");
- if (searchTarget.Length == 0) throw new ArgumentException("searchTarget cannot be an empty string.", "searchTarget");
+ if (searchTarget == null) throw new ArgumentNullException(nameof(searchTarget));
+ if (searchTarget.Length == 0) throw new ArgumentException("searchTarget cannot be an empty string.", nameof(searchTarget));
if (searchWaitTime.TotalSeconds < 0) throw new ArgumentException("searchWaitTime must be a positive time.");
if (searchWaitTime.TotalSeconds > 0 && searchWaitTime.TotalSeconds <= 1) throw new ArgumentException("searchWaitTime must be zero (if you are not using the result and relying entirely in the events), or greater than one second.");
diff --git a/RSSDP/SsdpDevicePublisher.cs b/RSSDP/SsdpDevicePublisher.cs
index cee9b7f91..a44dd0c0c 100644
--- a/RSSDP/SsdpDevicePublisher.cs
+++ b/RSSDP/SsdpDevicePublisher.cs
@@ -41,11 +41,11 @@ namespace Rssdp.Infrastructure
/// </summary>
public SsdpDevicePublisher(ISsdpCommunicationsServer communicationsServer, ITimerFactory timerFactory, string osName, string osVersion)
{
- if (communicationsServer == null) throw new ArgumentNullException("communicationsServer");
- if (osName == null) throw new ArgumentNullException("osName");
- if (osName.Length == 0) throw new ArgumentException("osName cannot be an empty string.", "osName");
- if (osVersion == null) throw new ArgumentNullException("osVersion");
- if (osVersion.Length == 0) throw new ArgumentException("osVersion cannot be an empty string.", "osName");
+ if (communicationsServer == null) throw new ArgumentNullException(nameof(communicationsServer));
+ if (osName == null) throw new ArgumentNullException(nameof(osName));
+ if (osName.Length == 0) throw new ArgumentException("osName cannot be an empty string.", nameof(osName));
+ if (osVersion == null) throw new ArgumentNullException(nameof(osVersion));
+ if (osVersion.Length == 0) throw new ArgumentException("osVersion cannot be an empty string.", nameof(osName));
_SupportPnpRootDevice = true;
_timerFactory = timerFactory;
@@ -81,7 +81,7 @@ namespace Rssdp.Infrastructure
[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)
{
- if (device == null) throw new ArgumentNullException("device");
+ if (device == null) throw new ArgumentNullException(nameof(device));
ThrowIfDisposed();
@@ -116,7 +116,7 @@ namespace Rssdp.Infrastructure
/// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception>
public async Task RemoveDevice(SsdpRootDevice device)
{
- if (device == null) throw new ArgumentNullException("device");
+ if (device == null) throw new ArgumentNullException(nameof(device));
bool wasRemoved = false;
TimeSpan minCacheTime = TimeSpan.Zero;
@@ -418,7 +418,7 @@ namespace Rssdp.Infrastructure
var values = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
- // If needed later for non-server devices, these headers will need to be dynamic
+ // If needed later for non-server devices, these headers will need to be dynamic
values["HOST"] = "239.255.255.250:1900";
values["DATE"] = DateTime.UtcNow.ToString("r");
values["CACHE-CONTROL"] = "max-age = " + rootDevice.CacheLifetime.TotalSeconds;
@@ -463,7 +463,7 @@ namespace Rssdp.Infrastructure
var values = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
- // If needed later for non-server devices, these headers will need to be dynamic
+ // If needed later for non-server devices, these headers will need to be dynamic
values["HOST"] = "239.255.255.250:1900";
values["DATE"] = DateTime.UtcNow.ToString("r");
values["SERVER"] = string.Format("{0}/{1} UPnP/1.0 RSSDP/{2}", _OSName, _OSVersion, ServerVersion);
@@ -538,9 +538,9 @@ namespace Rssdp.Infrastructure
//According to SSDP/UPnP spec, ignore message if missing these headers.
// Edit: But some devices do it anyway
//if (!e.Message.Headers.Contains("MX"))
- // WriteTrace("Ignoring search request - missing MX header.");
+ // WriteTrace("Ignoring search request - missing MX header.");
//else if (!e.Message.Headers.Contains("MAN"))
- // WriteTrace("Ignoring search request - missing MAN header.");
+ // WriteTrace("Ignoring search request - missing MAN header.");
//else
ProcessSearchRequest(GetFirstHeaderValue(e.Message.Headers, "MX"), GetFirstHeaderValue(e.Message.Headers, "ST"), e.ReceivedFrom, e.LocalIpAddress, CancellationToken.None);
}
diff --git a/RSSDP/SsdpEmbeddedDevice.cs b/RSSDP/SsdpEmbeddedDevice.cs
index dca1ff5e3..0e02ce33c 100644
--- a/RSSDP/SsdpEmbeddedDevice.cs
+++ b/RSSDP/SsdpEmbeddedDevice.cs
@@ -4,54 +4,52 @@ using System.Text;
namespace Rssdp
{
- /// <summary>
- /// Represents a device that is a descendant of a <see cref="SsdpRootDevice"/> instance.
- /// </summary>
- public class SsdpEmbeddedDevice : SsdpDevice
- {
-
- #region Fields
-
- private SsdpRootDevice _RootDevice;
-
- #endregion
-
- #region Constructors
-
- /// <summary>
- /// Default constructor.
- /// </summary>
- public SsdpEmbeddedDevice()
- {
- }
-
- #endregion
-
- #region Public Properties
-
- /// <summary>
- /// Returns the <see cref="SsdpRootDevice"/> that is this device's first ancestor. If this device is itself an <see cref="SsdpRootDevice"/>, then returns a reference to itself.
- /// </summary>
- public SsdpRootDevice RootDevice
- {
- get
- {
- return _RootDevice;
- }
- internal set
- {
- _RootDevice = value;
- lock (this.Devices)
- {
- foreach (var embeddedDevice in this.Devices)
- {
- ((SsdpEmbeddedDevice)embeddedDevice).RootDevice = _RootDevice;
- }
- }
- }
- }
-
- #endregion
-
- }
-} \ No newline at end of file
+ /// <summary>
+ /// Represents a device that is a descendant of a <see cref="SsdpRootDevice"/> instance.
+ /// </summary>
+ public class SsdpEmbeddedDevice : SsdpDevice
+ {
+
+ #region Fields
+ private SsdpRootDevice _RootDevice;
+
+ #endregion
+
+ #region Constructors
+
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public SsdpEmbeddedDevice()
+ {
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ /// <summary>
+ /// Returns the <see cref="SsdpRootDevice"/> that is this device's first ancestor. If this device is itself an <see cref="SsdpRootDevice"/>, then returns a reference to itself.
+ /// </summary>
+ public SsdpRootDevice RootDevice
+ {
+ get
+ {
+ return _RootDevice;
+ }
+ internal set
+ {
+ _RootDevice = value;
+ lock (this.Devices)
+ {
+ foreach (var embeddedDevice in this.Devices)
+ {
+ ((SsdpEmbeddedDevice)embeddedDevice).RootDevice = _RootDevice;
+ }
+ }
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/RSSDP/SsdpRootDevice.cs b/RSSDP/SsdpRootDevice.cs
index eaf3f6a38..20644535a 100644
--- a/RSSDP/SsdpRootDevice.cs
+++ b/RSSDP/SsdpRootDevice.cs
@@ -6,74 +6,72 @@ using Rssdp.Infrastructure;
namespace Rssdp
{
- /// <summary>
- /// Represents a 'root' device, a device that has no parent. Used for publishing devices and for the root device in a tree of discovered devices.
- /// </summary>
- /// <remarks>
- /// <para>Child (embedded) devices are represented by the <see cref="SsdpDevice"/> in the <see cref="SsdpDevice.Devices"/> property.</para>
- /// <para>Root devices contain some information that applies to the whole device tree and is therefore not present on child devices, such as <see cref="CacheLifetime"/> and <see cref="Location"/>.</para>
- /// </remarks>
- public class SsdpRootDevice : SsdpDevice
- {
-
- #region Fields
+ /// <summary>
+ /// Represents a 'root' device, a device that has no parent. Used for publishing devices and for the root device in a tree of discovered devices.
+ /// </summary>
+ /// <remarks>
+ /// <para>Child (embedded) devices are represented by the <see cref="SsdpDevice"/> in the <see cref="SsdpDevice.Devices"/> property.</para>
+ /// <para>Root devices contain some information that applies to the whole device tree and is therefore not present on child devices, such as <see cref="CacheLifetime"/> and <see cref="Location"/>.</para>
+ /// </remarks>
+ public class SsdpRootDevice : SsdpDevice
+ {
+ #region Fields
- private Uri _UrlBase;
+ private Uri _UrlBase;
- #endregion
+ #endregion
- #region Constructors
+ #region Constructors
- /// <summary>
- /// Default constructor.
- /// </summary>
- public SsdpRootDevice() : base()
- {
- }
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public SsdpRootDevice() : base()
+ {
+ }
- #endregion
+ #endregion
- #region Public Properties
+ #region Public Properties
- /// <summary>
- /// Specifies how long clients can cache this device's details for. Optional but defaults to <see cref="TimeSpan.Zero"/> which means no-caching. Recommended value is half an hour.
- /// </summary>
- /// <remarks>
- /// <para>Specifiy <see cref="TimeSpan.Zero"/> to indicate no caching allowed.</para>
- /// <para>Also used to specify how often to rebroadcast alive notifications.</para>
- /// <para>The UPnP/SSDP specifications indicate this should not be less than 1800 seconds (half an hour), but this is not enforced by this library.</para>
- /// </remarks>
- public TimeSpan CacheLifetime
- {
- get; set;
- }
+ /// <summary>
+ /// Specifies how long clients can cache this device's details for. Optional but defaults to <see cref="TimeSpan.Zero"/> which means no-caching. Recommended value is half an hour.
+ /// </summary>
+ /// <remarks>
+ /// <para>Specifiy <see cref="TimeSpan.Zero"/> to indicate no caching allowed.</para>
+ /// <para>Also used to specify how often to rebroadcast alive notifications.</para>
+ /// <para>The UPnP/SSDP specifications indicate this should not be less than 1800 seconds (half an hour), but this is not enforced by this library.</para>
+ /// </remarks>
+ public TimeSpan CacheLifetime
+ {
+ get; set;
+ }
- /// <summary>
- /// Gets or sets the URL used to retrieve the description document for this device/tree. Required.
- /// </summary>
- public Uri Location { get; set; }
+ /// <summary>
+ /// Gets or sets the URL used to retrieve the description document for this device/tree. Required.
+ /// </summary>
+ public Uri Location { get; set; }
- /// <summary>
- /// The base URL to use for all relative url's provided in other propertise (and those of child devices). Optional.
- /// </summary>
- /// <remarks>
- /// <para>Defines the base URL. Used to construct fully-qualified URLs. All relative URLs that appear elsewhere in the description are combined with this base URL. If URLBase is empty or not given, the base URL is the URL from which the device description was retrieved (which is the preferred implementation; use of URLBase is no longer recommended). Specified by UPnP vendor. Single URL.</para>
- /// </remarks>
- public Uri UrlBase
- {
- get
- {
- return _UrlBase ?? this.Location;
- }
+ /// <summary>
+ /// The base URL to use for all relative url's provided in other propertise (and those of child devices). Optional.
+ /// </summary>
+ /// <remarks>
+ /// <para>Defines the base URL. Used to construct fully-qualified URLs. All relative URLs that appear elsewhere in the description are combined with this base URL. If URLBase is empty or not given, the base URL is the URL from which the device description was retrieved (which is the preferred implementation; use of URLBase is no longer recommended). Specified by UPnP vendor. Single URL.</para>
+ /// </remarks>
+ public Uri UrlBase
+ {
+ get
+ {
+ return _UrlBase ?? this.Location;
+ }
- set
- {
- _UrlBase = value;
- }
- }
+ set
+ {
+ _UrlBase = value;
+ }
+ }
- #endregion
-
- }
+ #endregion
+ }
}
diff --git a/SharedVersion.cs b/SharedVersion.cs
index 963ffad23..a29381f63 100644
--- a/SharedVersion.cs
+++ b/SharedVersion.cs
@@ -1,3 +1,4 @@
-using System.Reflection;
+using System.Reflection;
[assembly: AssemblyVersion("10.0.2")]
+[assembly: AssemblyFileVersion("10.0.2")]
diff --git a/SocketHttpListener/CloseEventArgs.cs b/SocketHttpListener/CloseEventArgs.cs
index b1bb4b196..ff30126bc 100644
--- a/SocketHttpListener/CloseEventArgs.cs
+++ b/SocketHttpListener/CloseEventArgs.cs
@@ -33,10 +33,10 @@ namespace SocketHttpListener
_reason = len > 2
? GetUtf8String(data.SubArray (2, len - 2))
- : String.Empty;
+ : string.Empty;
}
- private string GetUtf8String(byte[] bytes)
+ private static string GetUtf8String(byte[] bytes)
{
return Encoding.UTF8.GetString(bytes, 0, bytes.Length);
}
diff --git a/SocketHttpListener/Ext.cs b/SocketHttpListener/Ext.cs
index 125775180..4404235ba 100644
--- a/SocketHttpListener/Ext.cs
+++ b/SocketHttpListener/Ext.cs
@@ -149,7 +149,7 @@ namespace SocketHttpListener
internal static string CheckIfValidControlData(this byte[] data, string paramName)
{
return data.Length > 125
- ? String.Format("'{0}' length must be less.", paramName)
+ ? string.Format("'{0}' length must be less.", paramName)
: null;
}
@@ -222,7 +222,7 @@ namespace SocketHttpListener
internal static bool EqualsWith(this int value, char c, Action<int> action)
{
if (value < 0 || value > 255)
- throw new ArgumentOutOfRangeException("value");
+ throw new ArgumentOutOfRangeException(nameof(value));
action(value);
return value == c - 0;
@@ -248,7 +248,7 @@ namespace SocketHttpListener
? "WebSocket server got an internal error."
: code == CloseStatusCode.TlsHandshakeFailure
? "An error has occurred while handshaking."
- : String.Empty;
+ : string.Empty;
}
internal static string GetNameInternal(this string nameAndValue, string separator)
@@ -329,7 +329,7 @@ namespace SocketHttpListener
{
return value.IsToken()
? value
- : String.Format("\"{0}\"", value.Replace("\"", "\\\""));
+ : string.Format("\"{0}\"", value.Replace("\"", "\\\""));
}
internal static byte[] ReadBytes(this Stream stream, int length)
@@ -484,13 +484,13 @@ namespace SocketHttpListener
this CompressionMethod method, params string[] parameters)
{
if (method == CompressionMethod.None)
- return String.Empty;
+ return string.Empty;
- var m = String.Format("permessage-{0}", method.ToString().ToLower());
+ var m = string.Format("permessage-{0}", method.ToString().ToLower());
if (parameters == null || parameters.Length == 0)
return m;
- return String.Format("{0}; {1}", m, parameters.ToString("; "));
+ return string.Format("{0}; {1}", m, parameters.ToString("; "));
}
internal static List<TSource> ToList<TSource>(this IEnumerable<TSource> source)
@@ -715,7 +715,7 @@ namespace SocketHttpListener
case 507: return "Insufficient Storage";
}
- return String.Empty;
+ return string.Empty;
}
/// <summary>
@@ -855,7 +855,7 @@ namespace SocketHttpListener
public static byte[] ToHostOrder(this byte[] src, ByteOrder srcOrder)
{
if (src == null)
- throw new ArgumentNullException("src");
+ throw new ArgumentNullException(nameof(src));
return src.Length > 1 && !srcOrder.IsHostOrder()
? src.Reverse()
@@ -886,14 +886,14 @@ namespace SocketHttpListener
public static string ToString<T>(this T[] array, string separator)
{
if (array == null)
- throw new ArgumentNullException("array");
+ throw new ArgumentNullException(nameof(array));
var len = array.Length;
if (len == 0)
- return String.Empty;
+ return string.Empty;
if (separator == null)
- separator = String.Empty;
+ separator = string.Empty;
var buff = new StringBuilder(64);
(len - 1).Times(i => buff.AppendFormat("{0}{1}", array[i].ToString(), separator));
diff --git a/SocketHttpListener/HttpBase.cs b/SocketHttpListener/HttpBase.cs
index 5172ba497..d4ae857ff 100644
--- a/SocketHttpListener/HttpBase.cs
+++ b/SocketHttpListener/HttpBase.cs
@@ -49,7 +49,7 @@ namespace SocketHttpListener
return data != null && data.Length > 0
? getEncoding(_headers["Content-Type"]).GetString(data, 0, data.Length)
- : String.Empty;
+ : string.Empty;
}
}
diff --git a/SocketHttpListener/HttpResponse.cs b/SocketHttpListener/HttpResponse.cs
index 154a3d8e9..535fde031 100644
--- a/SocketHttpListener/HttpResponse.cs
+++ b/SocketHttpListener/HttpResponse.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Specialized;
using System.IO;
using System.Net;
@@ -56,7 +56,7 @@ namespace SocketHttpListener
}
}
- private CookieCollection GetCookies(QueryParamCollection headers, bool response)
+ private static CookieCollection GetCookies(QueryParamCollection headers, bool response)
{
var name = response ? "Set-Cookie" : "Cookie";
return headers == null || !headers.Contains(name)
@@ -156,4 +156,4 @@ namespace SocketHttpListener
#endregion
}
-} \ No newline at end of file
+}
diff --git a/SocketHttpListener/MessageEventArgs.cs b/SocketHttpListener/MessageEventArgs.cs
index 9dbadb9ab..86614c43c 100644
--- a/SocketHttpListener/MessageEventArgs.cs
+++ b/SocketHttpListener/MessageEventArgs.cs
@@ -85,7 +85,7 @@ namespace SocketHttpListener
private static string convertToString (Opcode opcode, byte [] data)
{
return data.Length == 0
- ? String.Empty
+ ? string.Empty
: opcode == Opcode.Text
? Encoding.UTF8.GetString (data, 0, data.Length)
: opcode.ToString ();
diff --git a/SocketHttpListener/Net/ChunkStream.cs b/SocketHttpListener/Net/ChunkStream.cs
index b41285dbc..5cc01614f 100644
--- a/SocketHttpListener/Net/ChunkStream.cs
+++ b/SocketHttpListener/Net/ChunkStream.cs
@@ -14,7 +14,7 @@ namespace SocketHttpListener.Net
// System.Net.ResponseStream
//
// Author:
- // Gonzalo Paniagua Javier (gonzalo@novell.com)
+ // Gonzalo Paniagua Javier (gonzalo@novell.com)
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
@@ -25,10 +25,10 @@ namespace SocketHttpListener.Net
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
- //
+ //
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
- //
+ //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -271,7 +271,7 @@ namespace SocketHttpListener.Net
{
if (_saved.Length > 0)
{
- _chunkSize = Int32.Parse(RemoveChunkExtension(_saved.ToString()), NumberStyles.HexNumber);
+ _chunkSize = int.Parse(RemoveChunkExtension(_saved.ToString()), NumberStyles.HexNumber);
}
}
catch (Exception)
@@ -285,7 +285,7 @@ namespace SocketHttpListener.Net
_chunkRead = 0;
try
{
- _chunkSize = Int32.Parse(RemoveChunkExtension(_saved.ToString()), NumberStyles.HexNumber);
+ _chunkSize = int.Parse(RemoveChunkExtension(_saved.ToString()), NumberStyles.HexNumber);
}
catch (Exception)
{
diff --git a/SocketHttpListener/Net/ChunkedInputStream.cs b/SocketHttpListener/Net/ChunkedInputStream.cs
index 919bd95ea..4d6d96a6c 100644
--- a/SocketHttpListener/Net/ChunkedInputStream.cs
+++ b/SocketHttpListener/Net/ChunkedInputStream.cs
@@ -12,7 +12,7 @@ namespace SocketHttpListener.Net
// System.Net.ResponseStream
//
// Author:
- // Gonzalo Paniagua Javier (gonzalo@novell.com)
+ // Gonzalo Paniagua Javier (gonzalo@novell.com)
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
@@ -23,10 +23,10 @@ namespace SocketHttpListener.Net
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
- //
+ //
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
- //
+ //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
diff --git a/SocketHttpListener/Net/CookieHelper.cs b/SocketHttpListener/Net/CookieHelper.cs
index a32131956..6c1764e09 100644
--- a/SocketHttpListener/Net/CookieHelper.cs
+++ b/SocketHttpListener/Net/CookieHelper.cs
@@ -36,7 +36,7 @@ namespace SocketHttpListener.Net
if (pair.StartsWith("version", StringComparison.OrdinalIgnoreCase))
{
if (cookie != null)
- cookie.Version = Int32.Parse(pair.GetValueInternal("=").Trim('"'));
+ cookie.Version = int.Parse(pair.GetValueInternal("=").Trim('"'));
}
else if (pair.StartsWith("expires", StringComparison.OrdinalIgnoreCase))
{
@@ -58,7 +58,7 @@ namespace SocketHttpListener.Net
}
else if (pair.StartsWith("max-age", StringComparison.OrdinalIgnoreCase))
{
- var max = Int32.Parse(pair.GetValueInternal("=").Trim('"'));
+ var max = int.Parse(pair.GetValueInternal("=").Trim('"'));
var expires = DateTime.Now.AddSeconds((double)max);
if (cookie != null)
cookie.Expires = expires;
@@ -113,7 +113,7 @@ namespace SocketHttpListener.Net
cookies.Add(cookie);
string name;
- string val = String.Empty;
+ string val = string.Empty;
var pos = pair.IndexOf('=');
if (pos == -1)
diff --git a/SocketHttpListener/Net/HttpEndPointListener.cs b/SocketHttpListener/Net/HttpEndPointListener.cs
index fb093314c..a108e7dd4 100644
--- a/SocketHttpListener/Net/HttpEndPointListener.cs
+++ b/SocketHttpListener/Net/HttpEndPointListener.cs
@@ -168,6 +168,7 @@ namespace SocketHttpListener.Net
}
catch (ObjectDisposedException)
{
+ // TODO Investigate or properly fix.
}
catch (Exception ex)
{
@@ -177,9 +178,9 @@ namespace SocketHttpListener.Net
}
}
- // This method is the callback method associated with Socket.AcceptAsync
- // operations and is invoked when an accept operation is complete
- //
+ // This method is the callback method associated with Socket.AcceptAsync
+ // operations and is invoked when an accept operation is complete
+ //
private static void OnAccept(object sender, SocketAsyncEventArgs e)
{
ProcessAccept(e);
diff --git a/SocketHttpListener/Net/HttpListener.cs b/SocketHttpListener/Net/HttpListener.cs
index 941b99f35..a159cd273 100644
--- a/SocketHttpListener/Net/HttpListener.cs
+++ b/SocketHttpListener/Net/HttpListener.cs
@@ -35,7 +35,7 @@ namespace SocketHttpListener.Net
bool listening;
bool disposed;
- Dictionary<HttpListenerContext, HttpListenerContext> registry; // Dictionary<HttpListenerContext,HttpListenerContext>
+ Dictionary<HttpListenerContext, HttpListenerContext> registry; // Dictionary<HttpListenerContext,HttpListenerContext>
Dictionary<HttpConnection, HttpConnection> connections;
private ILogger _logger;
private X509Certificate _certificate;
@@ -248,7 +248,7 @@ namespace SocketHttpListener.Net
internal void CheckDisposed()
{
if (disposed)
- throw new ObjectDisposedException(GetType().ToString());
+ throw new ObjectDisposedException(GetType().Name);
}
internal void RegisterContext(HttpListenerContext context)
diff --git a/SocketHttpListener/Net/HttpListenerBasicIdentity.cs b/SocketHttpListener/Net/HttpListenerBasicIdentity.cs
index faa26693d..d20e72777 100644
--- a/SocketHttpListener/Net/HttpListenerBasicIdentity.cs
+++ b/SocketHttpListener/Net/HttpListenerBasicIdentity.cs
@@ -26,7 +26,7 @@ namespace SocketHttpListener.Net
public GenericIdentity(string name)
{
if (name == null)
- throw new System.ArgumentNullException("name");
+ throw new System.ArgumentNullException(nameof(name));
m_name = name;
m_type = "";
@@ -35,9 +35,9 @@ namespace SocketHttpListener.Net
public GenericIdentity(string name, string type)
{
if (name == null)
- throw new System.ArgumentNullException("name");
+ throw new System.ArgumentNullException(nameof(name));
if (type == null)
- throw new System.ArgumentNullException("type");
+ throw new System.ArgumentNullException(nameof(type));
m_name = name;
m_type = type;
diff --git a/SocketHttpListener/Net/HttpListenerContext.cs b/SocketHttpListener/Net/HttpListenerContext.cs
index 0aaac1ad5..e3e6eb906 100644
--- a/SocketHttpListener/Net/HttpListenerContext.cs
+++ b/SocketHttpListener/Net/HttpListenerContext.cs
@@ -49,7 +49,7 @@ namespace SocketHttpListener.Net
public GenericPrincipal(IIdentity identity, string[] roles)
{
if (identity == null)
- throw new ArgumentNullException("identity");
+ throw new ArgumentNullException(nameof(identity));
m_identity = identity;
if (roles != null)
@@ -81,7 +81,7 @@ namespace SocketHttpListener.Net
for (int i = 0; i < m_roles.Length; ++i)
{
- if (m_roles[i] != null && String.Compare(m_roles[i], role, StringComparison.OrdinalIgnoreCase) == 0)
+ if (m_roles[i] != null && string.Compare(m_roles[i], role, StringComparison.OrdinalIgnoreCase) == 0)
return true;
}
return false;
diff --git a/SocketHttpListener/Net/HttpListenerPrefixCollection.cs b/SocketHttpListener/Net/HttpListenerPrefixCollection.cs
index ed99af1a6..f0e496a5a 100644
--- a/SocketHttpListener/Net/HttpListenerPrefixCollection.cs
+++ b/SocketHttpListener/Net/HttpListenerPrefixCollection.cs
@@ -85,7 +85,7 @@ namespace SocketHttpListener.Net
{
listener.CheckDisposed();
if (uriPrefix == null)
- throw new ArgumentNullException("uriPrefix");
+ throw new ArgumentNullException(nameof(uriPrefix));
bool result = prefixes.Remove(uriPrefix);
if (result && listener.IsListening)
diff --git a/SocketHttpListener/Net/HttpListenerRequest.Managed.cs b/SocketHttpListener/Net/HttpListenerRequest.Managed.cs
index 47a6dfcfd..8b68afe33 100644
--- a/SocketHttpListener/Net/HttpListenerRequest.Managed.cs
+++ b/SocketHttpListener/Net/HttpListenerRequest.Managed.cs
@@ -183,14 +183,14 @@ namespace SocketHttpListener.Net
}
}
- if (String.Compare(Headers[HttpKnownHeaderNames.Expect], "100-continue", StringComparison.OrdinalIgnoreCase) == 0)
+ if (string.Compare(Headers[HttpKnownHeaderNames.Expect], "100-continue", StringComparison.OrdinalIgnoreCase) == 0)
{
HttpResponseStream output = _context.Connection.GetResponseStream();
output.InternalWrite(s_100continue, 0, s_100continue.Length);
}
}
- internal static string Unquote(String str)
+ internal static string Unquote(string str)
{
int start = str.IndexOf('\"');
int end = str.LastIndexOf('\"');
diff --git a/SocketHttpListener/Net/HttpListenerRequest.cs b/SocketHttpListener/Net/HttpListenerRequest.cs
index 1b369dfa8..16e245611 100644
--- a/SocketHttpListener/Net/HttpListenerRequest.cs
+++ b/SocketHttpListener/Net/HttpListenerRequest.cs
@@ -27,7 +27,7 @@ namespace SocketHttpListener.Net
public string[] UserLanguages => Helpers.ParseMultivalueHeader(Headers[HttpKnownHeaderNames.AcceptLanguage]);
- private CookieCollection ParseCookies(Uri uri, string setCookieHeader)
+ private static CookieCollection ParseCookies(Uri uri, string setCookieHeader)
{
CookieCollection cookies = new CookieCollection();
return cookies;
diff --git a/SocketHttpListener/Net/HttpListenerRequestUriBuilder.cs b/SocketHttpListener/Net/HttpListenerRequestUriBuilder.cs
index 34b5eaf74..63790d796 100644
--- a/SocketHttpListener/Net/HttpListenerRequestUriBuilder.cs
+++ b/SocketHttpListener/Net/HttpListenerRequestUriBuilder.cs
@@ -28,11 +28,11 @@ namespace SocketHttpListener.Net
// The raw path is parsed by looping through all characters from left to right. 'rawOctets'
// is used to store consecutive percent encoded octets as actual byte values: e.g. for path /pa%C3%84th%2F/
// rawOctets will be set to { 0xC3, 0x84 } when we reach character 't' and it will be { 0x2F } when
- // we reach the final '/'. I.e. after a sequence of percent encoded octets ends, we use rawOctets as
+ // we reach the final '/'. I.e. after a sequence of percent encoded octets ends, we use rawOctets as
// input to the encoding and percent encode the resulting string into UTF-8 octets.
//
// When parsing ANSI (Latin 1) encoded path '/pa%C4th/', %C4 will be added to rawOctets and when
- // we reach 't', the content of rawOctets { 0xC4 } will be fed into the ANSI encoding. The resulting
+ // we reach 't', the content of rawOctets { 0xC4 } will be fed into the ANSI encoding. The resulting
// string 'Ä' will be percent encoded into UTF-8 octets and appended to requestUriString. The final
// path will be '/pa%C3%84th/', where '%C3%84' is the UTF-8 percent encoded character 'Ä'.
private List<byte> _rawOctets;
@@ -146,7 +146,7 @@ namespace SocketHttpListener.Net
if (!Uri.TryCreate(_requestUriString.ToString(), UriKind.Absolute, out _requestUri))
{
- // If we can't create a Uri from the string, this is an invalid string and it doesn't make
+ // If we can't create a Uri from the string, this is an invalid string and it doesn't make
// sense to try another encoding.
result = ParsingResult.InvalidString;
}
@@ -196,7 +196,7 @@ namespace SocketHttpListener.Net
}
else
{
- // We found '%', but not followed by 'u', i.e. we have a percent encoded octed: %XX
+ // We found '%', but not followed by 'u', i.e. we have a percent encoded octed: %XX
if (!AddPercentEncodedOctetToRawOctetsList(encoding, _rawPath.Substring(index, 2)))
{
return ParsingResult.InvalidString;
@@ -207,7 +207,7 @@ namespace SocketHttpListener.Net
else
{
// We found a non-'%' character: decode the content of rawOctets into percent encoded
- // UTF-8 characters and append it to the result.
+ // UTF-8 characters and append it to the result.
if (!EmptyDecodeAndAppendRawOctetsList(encoding))
{
return ParsingResult.EncodingError;
@@ -402,7 +402,7 @@ namespace SocketHttpListener.Net
// Find end of path: The path is terminated by
// - the first '?' character
- // - the first '#' character: This is never the case here, since http.sys won't accept
+ // - the first '#' character: This is never the case here, since http.sys won't accept
// Uris containing fragments. Also, RFC2616 doesn't allow fragments in request Uris.
// - end of Uri string
int queryIndex = uriString.IndexOf('?');
diff --git a/SocketHttpListener/Net/HttpListenerResponse.Managed.cs b/SocketHttpListener/Net/HttpListenerResponse.Managed.cs
index 34953b569..8fb4518a1 100644
--- a/SocketHttpListener/Net/HttpListenerResponse.Managed.cs
+++ b/SocketHttpListener/Net/HttpListenerResponse.Managed.cs
@@ -207,13 +207,13 @@ namespace SocketHttpListener.Net
}
/* Apache forces closing the connection for these status codes:
- * HttpStatusCode.BadRequest 400
- * HttpStatusCode.RequestTimeout 408
- * HttpStatusCode.LengthRequired 411
- * HttpStatusCode.RequestEntityTooLarge 413
- * HttpStatusCode.RequestUriTooLong 414
- * HttpStatusCode.InternalServerError 500
- * HttpStatusCode.ServiceUnavailable 503
+ * HttpStatusCode.BadRequest 400
+ * HttpStatusCode.RequestTimeout 408
+ * HttpStatusCode.LengthRequired 411
+ * HttpStatusCode.RequestEntityTooLarge 413
+ * HttpStatusCode.RequestUriTooLong 414
+ * HttpStatusCode.InternalServerError 500
+ * HttpStatusCode.ServiceUnavailable 503
*/
bool conn_close = (_statusCode == (int)HttpStatusCode.BadRequest || _statusCode == (int)HttpStatusCode.RequestTimeout
|| _statusCode == (int)HttpStatusCode.LengthRequired || _statusCode == (int)HttpStatusCode.RequestEntityTooLarge
diff --git a/SocketHttpListener/Net/HttpListenerResponse.cs b/SocketHttpListener/Net/HttpListenerResponse.cs
index 1cbd6165e..351a206ee 100644
--- a/SocketHttpListener/Net/HttpListenerResponse.cs
+++ b/SocketHttpListener/Net/HttpListenerResponse.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
@@ -71,7 +71,7 @@ namespace SocketHttpListener.Net
public bool SendChunked
{
- get { return EntitySendFormat == EntitySendFormat.Chunked; ; }
+ get { return EntitySendFormat == EntitySendFormat.Chunked; }
set { EntitySendFormat = value ? EntitySendFormat.Chunked : EntitySendFormat.ContentLength; }
}
@@ -104,7 +104,7 @@ namespace SocketHttpListener.Net
}
else
{
- throw new ArgumentOutOfRangeException("net_clsmall");
+ throw new ArgumentOutOfRangeException(nameof(value));
}
}
}
diff --git a/SocketHttpListener/Net/HttpRequestStream.Managed.cs b/SocketHttpListener/Net/HttpRequestStream.Managed.cs
index c9c148b15..493e2673b 100644
--- a/SocketHttpListener/Net/HttpRequestStream.Managed.cs
+++ b/SocketHttpListener/Net/HttpRequestStream.Managed.cs
@@ -13,7 +13,7 @@ namespace SocketHttpListener.Net
// System.Net.ResponseStream
//
// Author:
- // Gonzalo Paniagua Javier (gonzalo@novell.com)
+ // Gonzalo Paniagua Javier (gonzalo@novell.com)
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
@@ -24,10 +24,10 @@ namespace SocketHttpListener.Net
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
- //
+ //
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
- //
+ //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
diff --git a/SocketHttpListener/Net/HttpRequestStream.cs b/SocketHttpListener/Net/HttpRequestStream.cs
index f10c04a4f..c9a1d5a2d 100644
--- a/SocketHttpListener/Net/HttpRequestStream.cs
+++ b/SocketHttpListener/Net/HttpRequestStream.cs
@@ -13,7 +13,7 @@ namespace SocketHttpListener.Net
// System.Net.ResponseStream
//
// Author:
- // Gonzalo Paniagua Javier (gonzalo@novell.com)
+ // Gonzalo Paniagua Javier (gonzalo@novell.com)
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
@@ -24,10 +24,10 @@ namespace SocketHttpListener.Net
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
- //
+ //
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
- //
+ //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
diff --git a/SocketHttpListener/Net/HttpResponseStream.Managed.cs b/SocketHttpListener/Net/HttpResponseStream.Managed.cs
index e727f1b4a..719dfcc12 100644
--- a/SocketHttpListener/Net/HttpResponseStream.Managed.cs
+++ b/SocketHttpListener/Net/HttpResponseStream.Managed.cs
@@ -19,7 +19,7 @@ namespace SocketHttpListener.Net
// System.Net.ResponseStream
//
// Author:
- // Gonzalo Paniagua Javier (gonzalo@novell.com)
+ // Gonzalo Paniagua Javier (gonzalo@novell.com)
//
// Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
//
@@ -30,10 +30,10 @@ namespace SocketHttpListener.Net
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
- //
+ //
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
- //
+ //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -157,7 +157,7 @@ namespace SocketHttpListener.Net
private static byte[] s_crlf = new byte[] { 13, 10 };
private static byte[] GetChunkSizeBytes(int size, bool final)
{
- string str = String.Format("{0:x}\r\n{1}", size, final ? "\r\n" : "");
+ string str = string.Format("{0:x}\r\n{1}", size, final ? "\r\n" : "");
return Encoding.ASCII.GetBytes(str);
}
diff --git a/SocketHttpListener/Net/WebHeaderCollection.cs b/SocketHttpListener/Net/WebHeaderCollection.cs
index 4bed81404..ed3cb921c 100644
--- a/SocketHttpListener/Net/WebHeaderCollection.cs
+++ b/SocketHttpListener/Net/WebHeaderCollection.cs
@@ -23,69 +23,69 @@ namespace SocketHttpListener.Net
}
static readonly bool[] allowed_chars = {
- false, false, false, false, false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, true, false, true, true, true, true, false, false, false, true,
- true, false, true, true, false, true, true, true, true, true, true, true, true, true, true, false,
- false, false, false, false, false, false, true, true, true, true, true, true, true, true, true,
- true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
- false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true,
- true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
- false, true, false
- };
+ false, false, false, false, false, false, false, false, false, false, false, false, false, false,
+ false, false, false, false, false, false, false, false, false, false, false, false, false, false,
+ false, false, false, false, false, true, false, true, true, true, true, false, false, false, true,
+ true, false, true, true, false, true, true, true, true, true, true, true, true, true, true, false,
+ false, false, false, false, false, false, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
+ false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
+ false, true, false
+ };
static readonly Dictionary<string, HeaderInfo> headers;
static WebHeaderCollection()
{
headers = new Dictionary<string, HeaderInfo>(StringComparer.OrdinalIgnoreCase) {
- { "Allow", HeaderInfo.MultiValue },
- { "Accept", HeaderInfo.Request | HeaderInfo.MultiValue },
- { "Accept-Charset", HeaderInfo.MultiValue },
- { "Accept-Encoding", HeaderInfo.MultiValue },
- { "Accept-Language", HeaderInfo.MultiValue },
- { "Accept-Ranges", HeaderInfo.MultiValue },
- { "Age", HeaderInfo.Response },
- { "Authorization", HeaderInfo.MultiValue },
- { "Cache-Control", HeaderInfo.MultiValue },
- { "Cookie", HeaderInfo.MultiValue },
- { "Connection", HeaderInfo.Request | HeaderInfo.MultiValue },
- { "Content-Encoding", HeaderInfo.MultiValue },
- { "Content-Length", HeaderInfo.Request | HeaderInfo.Response },
- { "Content-Type", HeaderInfo.Request },
- { "Content-Language", HeaderInfo.MultiValue },
- { "Date", HeaderInfo.Request },
- { "Expect", HeaderInfo.Request | HeaderInfo.MultiValue},
- { "Host", HeaderInfo.Request },
- { "If-Match", HeaderInfo.MultiValue },
- { "If-Modified-Since", HeaderInfo.Request },
- { "If-None-Match", HeaderInfo.MultiValue },
- { "Keep-Alive", HeaderInfo.Response },
- { "Pragma", HeaderInfo.MultiValue },
- { "Proxy-Authenticate", HeaderInfo.MultiValue },
- { "Proxy-Authorization", HeaderInfo.MultiValue },
- { "Proxy-Connection", HeaderInfo.Request | HeaderInfo.MultiValue },
- { "Range", HeaderInfo.Request | HeaderInfo.MultiValue },
- { "Referer", HeaderInfo.Request },
- { "Set-Cookie", HeaderInfo.MultiValue },
- { "Set-Cookie2", HeaderInfo.MultiValue },
- { "Server", HeaderInfo.Response },
- { "TE", HeaderInfo.MultiValue },
- { "Trailer", HeaderInfo.MultiValue },
- { "Transfer-Encoding", HeaderInfo.Request | HeaderInfo.Response | HeaderInfo.MultiValue },
- { "Translate", HeaderInfo.Request | HeaderInfo.Response },
- { "Upgrade", HeaderInfo.MultiValue },
- { "User-Agent", HeaderInfo.Request },
- { "Vary", HeaderInfo.MultiValue },
- { "Via", HeaderInfo.MultiValue },
- { "Warning", HeaderInfo.MultiValue },
- { "WWW-Authenticate", HeaderInfo.Response | HeaderInfo. MultiValue },
- { "SecWebSocketAccept", HeaderInfo.Response },
- { "SecWebSocketExtensions", HeaderInfo.Request | HeaderInfo.Response | HeaderInfo. MultiValue },
- { "SecWebSocketKey", HeaderInfo.Request },
- { "Sec-WebSocket-Protocol", HeaderInfo.Request | HeaderInfo.Response | HeaderInfo. MultiValue },
- { "SecWebSocketVersion", HeaderInfo.Response | HeaderInfo. MultiValue }
- };
+ { "Allow", HeaderInfo.MultiValue },
+ { "Accept", HeaderInfo.Request | HeaderInfo.MultiValue },
+ { "Accept-Charset", HeaderInfo.MultiValue },
+ { "Accept-Encoding", HeaderInfo.MultiValue },
+ { "Accept-Language", HeaderInfo.MultiValue },
+ { "Accept-Ranges", HeaderInfo.MultiValue },
+ { "Age", HeaderInfo.Response },
+ { "Authorization", HeaderInfo.MultiValue },
+ { "Cache-Control", HeaderInfo.MultiValue },
+ { "Cookie", HeaderInfo.MultiValue },
+ { "Connection", HeaderInfo.Request | HeaderInfo.MultiValue },
+ { "Content-Encoding", HeaderInfo.MultiValue },
+ { "Content-Length", HeaderInfo.Request | HeaderInfo.Response },
+ { "Content-Type", HeaderInfo.Request },
+ { "Content-Language", HeaderInfo.MultiValue },
+ { "Date", HeaderInfo.Request },
+ { "Expect", HeaderInfo.Request | HeaderInfo.MultiValue},
+ { "Host", HeaderInfo.Request },
+ { "If-Match", HeaderInfo.MultiValue },
+ { "If-Modified-Since", HeaderInfo.Request },
+ { "If-None-Match", HeaderInfo.MultiValue },
+ { "Keep-Alive", HeaderInfo.Response },
+ { "Pragma", HeaderInfo.MultiValue },
+ { "Proxy-Authenticate", HeaderInfo.MultiValue },
+ { "Proxy-Authorization", HeaderInfo.MultiValue },
+ { "Proxy-Connection", HeaderInfo.Request | HeaderInfo.MultiValue },
+ { "Range", HeaderInfo.Request | HeaderInfo.MultiValue },
+ { "Referer", HeaderInfo.Request },
+ { "Set-Cookie", HeaderInfo.MultiValue },
+ { "Set-Cookie2", HeaderInfo.MultiValue },
+ { "Server", HeaderInfo.Response },
+ { "TE", HeaderInfo.MultiValue },
+ { "Trailer", HeaderInfo.MultiValue },
+ { "Transfer-Encoding", HeaderInfo.Request | HeaderInfo.Response | HeaderInfo.MultiValue },
+ { "Translate", HeaderInfo.Request | HeaderInfo.Response },
+ { "Upgrade", HeaderInfo.MultiValue },
+ { "User-Agent", HeaderInfo.Request },
+ { "Vary", HeaderInfo.MultiValue },
+ { "Via", HeaderInfo.MultiValue },
+ { "Warning", HeaderInfo.MultiValue },
+ { "WWW-Authenticate", HeaderInfo.Response | HeaderInfo. MultiValue },
+ { "SecWebSocketAccept", HeaderInfo.Response },
+ { "SecWebSocketExtensions", HeaderInfo.Request | HeaderInfo.Response | HeaderInfo. MultiValue },
+ { "SecWebSocketKey", HeaderInfo.Request },
+ { "Sec-WebSocket-Protocol", HeaderInfo.Request | HeaderInfo.Response | HeaderInfo. MultiValue },
+ { "SecWebSocketVersion", HeaderInfo.Response | HeaderInfo. MultiValue }
+ };
}
// Methods
@@ -93,10 +93,10 @@ namespace SocketHttpListener.Net
public void Add(string header)
{
if (header == null)
- throw new ArgumentNullException("header");
+ throw new ArgumentNullException(nameof(header));
int pos = header.IndexOf(':');
if (pos == -1)
- throw new ArgumentException("no colon found", "header");
+ throw new ArgumentException("no colon found", nameof(header));
this.Add(header.Substring(0, pos), header.Substring(pos + 1));
}
@@ -104,7 +104,7 @@ namespace SocketHttpListener.Net
public override void Add(string name, string value)
{
if (name == null)
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
this.AddWithoutValidate(name, value);
}
@@ -112,13 +112,13 @@ namespace SocketHttpListener.Net
protected void AddWithoutValidate(string headerName, string headerValue)
{
if (!IsHeaderName(headerName))
- throw new ArgumentException("invalid header name: " + headerName, "headerName");
+ throw new ArgumentException("invalid header name: " + headerName, nameof(headerName));
if (headerValue == null)
- headerValue = String.Empty;
+ headerValue = string.Empty;
else
headerValue = headerValue.Trim();
if (!IsHeaderValue(headerValue))
- throw new ArgumentException("invalid header value: " + headerValue, "headerValue");
+ throw new ArgumentException("invalid header value: " + headerValue, nameof(headerValue));
AddValue(headerName, headerValue);
}
@@ -131,7 +131,7 @@ namespace SocketHttpListener.Net
internal List<string> GetValues_internal(string header, bool split)
{
if (header == null)
- throw new ArgumentNullException("header");
+ throw new ArgumentNullException(nameof(header));
var values = base.GetValues(header);
if (values == null || values.Count == 0)
@@ -205,10 +205,10 @@ namespace SocketHttpListener.Net
public static bool IsRestricted(string headerName, bool response)
{
if (headerName == null)
- throw new ArgumentNullException("headerName");
+ throw new ArgumentNullException(nameof(headerName));
if (headerName.Length == 0)
- throw new ArgumentException("empty string", "headerName");
+ throw new ArgumentException("empty string", nameof(headerName));
if (!IsHeaderName(headerName))
throw new ArgumentException("Invalid character in header");
@@ -224,11 +224,11 @@ namespace SocketHttpListener.Net
public override void Set(string name, string value)
{
if (name == null)
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
if (!IsHeaderName(name))
throw new ArgumentException("invalid header name");
if (value == null)
- value = String.Empty;
+ value = string.Empty;
else
value = value.Trim();
if (!IsHeaderValue(value))
@@ -288,7 +288,7 @@ namespace SocketHttpListener.Net
{
int pos = header.IndexOf(':');
if (pos == -1)
- throw new ArgumentException("no colon found", "header");
+ throw new ArgumentException("no colon found", nameof(header));
SetInternal(header.Substring(0, pos), header.Substring(pos + 1));
}
@@ -296,7 +296,7 @@ namespace SocketHttpListener.Net
internal void SetInternal(string name, string value)
{
if (value == null)
- value = String.Empty;
+ value = string.Empty;
else
value = value.Trim();
if (!IsHeaderValue(value))
diff --git a/SocketHttpListener/Net/WebSockets/HttpWebSocket.cs b/SocketHttpListener/Net/WebSockets/HttpWebSocket.cs
index 9dc9143f8..f72a139f3 100644
--- a/SocketHttpListener/Net/WebSockets/HttpWebSocket.cs
+++ b/SocketHttpListener/Net/WebSockets/HttpWebSocket.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics.CodeAnalysis;
@@ -30,7 +30,7 @@ namespace SocketHttpListener.Net.WebSockets
return retVal;
}
- // return value here signifies if a Sec-WebSocket-Protocol header should be returned by the server.
+ // return value here signifies if a Sec-WebSocket-Protocol header should be returned by the server.
internal static bool ProcessWebSocketProtocolHeader(string clientSecWebSocketProtocol,
string subProtocol,
out string acceptProtocol)
@@ -44,7 +44,7 @@ namespace SocketHttpListener.Net.WebSockets
// If the server specified _anything_ this isn't valid.
throw new WebSocketException("UnsupportedProtocol");
}
- // Treat empty and null from the server as the same thing here, server should not send headers.
+ // Treat empty and null from the server as the same thing here, server should not send headers.
return false;
}
@@ -52,7 +52,7 @@ namespace SocketHttpListener.Net.WebSockets
if (subProtocol == null)
{
- // client specified some protocols, server specified 'null'. So server should send headers.
+ // client specified some protocols, server specified 'null'. So server should send headers.
return true;
}
@@ -63,8 +63,8 @@ namespace SocketHttpListener.Net.WebSockets
StringSplitOptions.RemoveEmptyEntries);
acceptProtocol = subProtocol;
- // client specified protocols, serverOptions has exactly 1 non-empty entry. Check that
- // this exists in the list the client specified.
+ // client specified protocols, serverOptions has exactly 1 non-empty entry. Check that
+ // this exists in the list the client specified.
for (int i = 0; i < requestProtocols.Length; i++)
{
string currentRequestProtocol = requestProtocols[i].Trim();
@@ -86,27 +86,27 @@ namespace SocketHttpListener.Net.WebSockets
if (receiveBufferSize < MinReceiveBufferSize)
{
- throw new ArgumentOutOfRangeException("net_WebSockets_ArgumentOutOfRange_TooSmall");
+ throw new ArgumentOutOfRangeException(nameof(receiveBufferSize), "The receiveBufferSize was too small.");
}
if (sendBufferSize < MinSendBufferSize)
{
- throw new ArgumentOutOfRangeException("net_WebSockets_ArgumentOutOfRange_TooSmall");
+ throw new ArgumentOutOfRangeException(nameof(sendBufferSize), "The sendBufferSize was too small.");
}
if (receiveBufferSize > MaxBufferSize)
{
- throw new ArgumentOutOfRangeException("net_WebSockets_ArgumentOutOfRange_TooBig");
+ throw new ArgumentOutOfRangeException(nameof(receiveBufferSize), "The receiveBufferSize was too large.");
}
if (sendBufferSize > MaxBufferSize)
{
- throw new ArgumentOutOfRangeException("net_WebSockets_ArgumentOutOfRange_TooBig");
+ throw new ArgumentOutOfRangeException(nameof(sendBufferSize), "The sendBufferSize was too large.");
}
if (keepAliveInterval < Timeout.InfiniteTimeSpan) // -1 millisecond
{
- throw new ArgumentOutOfRangeException("net_WebSockets_ArgumentOutOfRange_TooSmall");
+ throw new ArgumentOutOfRangeException(nameof(keepAliveInterval), "The keepAliveInterval was too small.");
}
}
diff --git a/SocketHttpListener/Net/WebSockets/WebSocketCloseStatus.cs b/SocketHttpListener/Net/WebSockets/WebSocketCloseStatus.cs
index 0f43b7b80..b83b6cd0f 100644
--- a/SocketHttpListener/Net/WebSockets/WebSocketCloseStatus.cs
+++ b/SocketHttpListener/Net/WebSockets/WebSocketCloseStatus.cs
@@ -22,9 +22,9 @@ namespace SocketHttpListener.Net.WebSockets
// 0 - 999 Status codes in the range 0-999 are not used.
// 1000 - 1999 Status codes in the range 1000-1999 are reserved for definition by this protocol.
// 2000 - 2999 Status codes in the range 2000-2999 are reserved for use by extensions.
- // 3000 - 3999 Status codes in the range 3000-3999 MAY be used by libraries and frameworks. The
- // interpretation of these codes is undefined by this protocol. End applications MUST
- // NOT use status codes in this range.
+ // 3000 - 3999 Status codes in the range 3000-3999 MAY be used by libraries and frameworks. The
+ // interpretation of these codes is undefined by this protocol. End applications MUST
+ // NOT use status codes in this range.
// 4000 - 4999 Status codes in the range 4000-4999 MAY be used by application code. The interpretation
// of these codes is undefined by this protocol.
}
diff --git a/SocketHttpListener/Properties/AssemblyInfo.cs b/SocketHttpListener/Properties/AssemblyInfo.cs
index 8876cea4f..a69bd176f 100644
--- a/SocketHttpListener/Properties/AssemblyInfo.cs
+++ b/SocketHttpListener/Properties/AssemblyInfo.cs
@@ -1,34 +1,21 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
+using System.Reflection;
+using System.Resources;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SocketHttpListener")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("SocketHttpListener")]
-[assembly: AssemblyCopyright("Copyright © 2017")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright © 2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("1d74413b-e7cf-455b-b021-f52bdf881542")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
diff --git a/SocketHttpListener/WebSocket.cs b/SocketHttpListener/WebSocket.cs
index 7d61850e6..d926a58c9 100644
--- a/SocketHttpListener/WebSocket.cs
+++ b/SocketHttpListener/WebSocket.cs
@@ -740,7 +740,7 @@ namespace SocketHttpListener
{
if (data == null)
{
- throw new ArgumentNullException("data");
+ throw new ArgumentNullException(nameof(data));
}
var msg = _readyState.CheckIfOpen();
@@ -765,7 +765,7 @@ namespace SocketHttpListener
{
if (data == null)
{
- throw new ArgumentNullException("data");
+ throw new ArgumentNullException(nameof(data));
}
var msg = _readyState.CheckIfOpen();
diff --git a/build-deb.sh b/build-deb.sh
deleted file mode 100755
index fd14fc17d..000000000
--- a/build-deb.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env sh
-
-# Build a Jellyfin .deb file with Docker on Linux
-# Places the output .deb file in the parent directory
-
-set -o errexit
-set -o xtrace
-set -o nounset
-
-package_temporary_dir="`mktemp -d`"
-current_user="`whoami`"
-image_name="jellyfin-debuild"
-
-cleanup() {
- set +o errexit
- docker image rm $image_name --force
- rm -rf "$package_temporary_dir"
-}
-trap cleanup EXIT INT
-
-docker build . -t "$image_name" -f ./Dockerfile.debian_package
-docker run --rm -v "$package_temporary_dir:/temp" "$image_name" cp -r /dist /temp/
-sudo chown -R "$current_user" "$package_temporary_dir"
-mv "$package_temporary_dir"/dist/*.deb ../
diff --git a/debian/source/options b/debian/source/options
deleted file mode 100644
index 45bef4764..000000000
--- a/debian/source/options
+++ /dev/null
@@ -1 +0,0 @@
-tar-ignore = ".git*"
diff --git a/deployment/README.md b/deployment/README.md
new file mode 100644
index 000000000..3400fd840
--- /dev/null
+++ b/deployment/README.md
@@ -0,0 +1,8 @@
+# Build scripts
+
+All `build.sh` and `package.sh` scripts are for *nix platforms (or WSL on Windows 10).
+
+After running both, check the `*/pkg-dist/` folders for the archives and packages.
+
+`build_all.sh` will invoke every build and package script.
+Use `collect_all.sh` to copy all artifact to one directory for easy uploading.
diff --git a/deployment/clean.sh b/deployment/clean.sh
new file mode 100755
index 000000000..7517cf849
--- /dev/null
+++ b/deployment/clean.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+set -e
+
+# Execute every clean.sh scripts in every folder.
+echo "Running for platforms '$@'."
+for directory in */ ; do
+ platform=`basename "${directory}"`
+ if [[ $@ == *"$platform"* || $@ = *"all"* ]]; then
+ echo "Processing ${platform}"
+ pushd "$platform"
+ if [ -f clean.sh ]; then
+ echo ./clean.sh
+ fi
+ popd
+ else
+ echo "Skipping $platform."
+ fi
+done
+
+rm -rf ./collect-dist
diff --git a/deployment/collect_all.sh b/deployment/collect_all.sh
new file mode 100755
index 000000000..69babe55e
--- /dev/null
+++ b/deployment/collect_all.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+source common.build.sh
+
+VERSION=`get_version ..`
+
+COLLECT_DIR="./collect-dist"
+
+mkdir -p ./collect-dist
+
+DIRS=`find . -type d -name "pkg-dist"`
+
+while read directory
+do
+ echo "Collecting everything from '$directory'.."
+ PLATFORM=$(basename "$(dirname "$directory")")
+ # Copy all artifacts with extensions tar.gz, deb, exe, zip, rpm and add the platform name to resolve any duplicates.
+ find $directory \( -name "jellyfin*.tar.gz" -o -name "jellyfin*.deb" -o -name "jellyfin*.rpm" -o -name "jellyfin*.zip" -o -name "jellyfin*.exe" \) -exec sh -c 'cp "$1" "'${COLLECT_DIR}'/jellyfin_'${PLATFORM}'_${1#*jellyfin}"' _ {} \;
+
+done <<< "${DIRS}"
diff --git a/deployment/common.build.sh b/deployment/common.build.sh
new file mode 100755
index 000000000..a368928ba
--- /dev/null
+++ b/deployment/common.build.sh
@@ -0,0 +1,108 @@
+#!/usr/bin/env bash
+
+set -o errexit
+set -o nounset
+
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+CYAN='\033[0;36m'
+NC='\033[0m' # No Color
+
+DEFAULT_BUILD_CONTEXT="../.."
+DEFAULT_ROOT="."
+DEFAULT_DOTNETRUNTIME="framework"
+DEFAULT_CONFIG="Release"
+DEFAULT_OUTPUT_DIR="dist/jellyfin-git"
+DEFAULT_PKG_DIR="pkg-dist"
+DEFAULT_DOCKERFILE="Dockerfile"
+DEFAULT_IMAGE_TAG="jellyfin:"`git rev-parse --abbrev-ref HEAD`
+
+# Run a build
+build_jellyfin()
+(
+ ROOT=${1-$DEFAULT_ROOT}
+ CONFIG=${2-$DEFAULT_CONFIG}
+ DOTNETRUNTIME=${3-$DEFAULT_DOTNETRUNTIME}
+ OUTPUT_DIR=${4-$DEFAULT_OUTPUT_DIR}
+
+ echo -e "${CYAN}Building jellyfin in '${ROOT}' for ${DOTNETRUNTIME} with configuration ${CONFIG} and output directory '${OUTPUT_DIR}'.${NC}"
+ if [[ $DOTNETRUNTIME == 'framework' ]]; then
+ dotnet publish "${ROOT}" --configuration "${CONFIG}" --output="${OUTPUT_DIR}"
+ else
+ dotnet publish "${ROOT}" --configuration "${CONFIG}" --output="${OUTPUT_DIR}" --self-contained --runtime ${DOTNETRUNTIME}
+ fi
+ EXIT_CODE=$?
+ if [ $EXIT_CODE -eq 0 ]; then
+ echo -e "${GREEN}[DONE] Build jellyfin in '${ROOT}' for ${DOTNETRUNTIME} with configuration ${CONFIG} and output directory '${OUTPUT_DIR}' complete.${NC}"
+ else
+ echo -e "${RED}[FAIL] Build jellyfin in '${ROOT}' for ${DOTNETRUNTIME} with configuration ${CONFIG} and output directory '${OUTPUT_DIR}' FAILED.${NC}"
+ fi
+)
+
+# Run a docker
+build_jellyfin_docker()
+(
+ BUILD_CONTEXT=${1-$DEFAULT_BUILD_CONTEXT}
+ DOCKERFILE=${2-$DEFAULT_DOCKERFILE}
+ IMAGE_TAG=${3-$DEFAULT_IMAGE_TAG}
+
+ echo -e "${CYAN}Building jellyfin docker image in '${BUILD_CONTEXT}' with Dockerfile '${DOCKERFILE}' and tag '${IMAGE_TAG}'.${NC}"
+ docker build -t ${IMAGE_TAG} -f ${DOCKERFILE} ${BUILD_CONTEXT}
+ EXIT_CODE=$?
+ if [ $EXIT_CODE -eq 0 ]; then
+ echo -e "${GREEN}[DONE] Building jellyfin docker image in '${BUILD_CONTEXT}' with Dockerfile '${DOCKERFILE}' and tag '${IMAGE_TAG}' complete.${NC}"
+ else
+ echo -e "${RED}[FAIL] Building jellyfin docker image in '${BUILD_CONTEXT}' with Dockerfile '${DOCKERFILE}' and tag '${IMAGE_TAG}' FAILED.${NC}"
+ fi
+)
+
+# Clean a build
+clean_jellyfin()
+(
+ local ROOT=${1-$DEFAULT_ROOT}
+ local CONFIG=${2-$DEFAULT_CONFIG}
+ local OUTPUT_DIR=${3-$DEFAULT_OUTPUT_DIR}
+ local PKG_DIR=${4-$DEFAULT_PKG_DIR}
+ echo -e "${CYAN}Cleaning jellyfin in '${ROOT}'' with configuration ${CONFIG} and output directory '${OUTPUT_DIR}'.${NC}"
+ echo -e "${CYAN}Deleting '${OUTPUT_DIR}'${NC}"
+ rm -rf "$OUTPUT_DIR"
+ echo -e "${CYAN}Deleting '${PKG_DIR}'${NC}"
+ rm -rf "$PKG_DIR"
+ dotnet clean "${ROOT}" -maxcpucount:1 --configuration ${CONFIG}
+ local EXIT_CODE=$?
+ if [ $EXIT_CODE -eq 0 ]; then
+ echo -e "${GREEN}[DONE] Clean jellyfin in '${ROOT}' with configuration ${CONFIG} and output directory '${OUTPUT_DIR}' complete.${NC}"
+ else
+ echo -e "${RED}[FAIL] Clean jellyfin in '${ROOT}' with configuration ${CONFIG} and output directory '${OUTPUT_DIR}' failed.${NC}"
+ fi
+)
+
+# Parse the version from the AssemblyVersion
+get_version()
+(
+ local ROOT=${1-$DEFAULT_ROOT}
+ grep "AssemblyVersion" ${ROOT}/SharedVersion.cs | sed -E 's/\[assembly: ?AssemblyVersion\("([0-9\.]+)"\)\]/\1/' | sed -E 's/.0$//'
+)
+
+# Packages the output folder into an archive.
+package_portable()
+(
+ local ROOT=${1-$DEFAULT_ROOT}
+ local OUTPUT_DIR=${2-$DEFAULT_OUTPUT_DIR}
+ local PKG_DIR=${3-$DEFAULT_PKG_DIR}
+ # Package portable build result
+ if [ -d ${OUTPUT_DIR} ]; then
+ echo -e "${CYAN}Packaging build in '${OUTPUT_DIR}' for `basename "${OUTPUT_DIR}"` to '${PKG_DIR}' with root '${ROOT}'.${NC}"
+ mkdir -p ${PKG_DIR}
+ tar -zcvf "${PKG_DIR}/`basename "${OUTPUT_DIR}"`.portable.tar.gz" -C "`dirname "${OUTPUT_DIR}"`" "`basename "${OUTPUT_DIR}"`"
+ local EXIT_CODE=$?
+ if [ $EXIT_CODE -eq 0 ]; then
+ echo -e "${GREEN}[DONE] Packaging build in '${OUTPUT_DIR}' for `basename "${OUTPUT_DIR}"` to '${PKG_DIR}' with root '${ROOT}' complete.${NC}"
+ else
+ echo -e "${RED}[FAIL] Packaging build in '${OUTPUT_DIR}' for `basename "${OUTPUT_DIR}"` to '${PKG_DIR}' with root '${ROOT}' FAILED.${NC}"
+ fi
+ else
+ echo -e "${RED}[FAIL] Build artifacts do not exist for ${OUTPUT_DIR}. Run build.sh first.${NC}"
+ fi
+)
+
diff --git a/Dockerfile.debian_package b/deployment/debian-package-x64/Dockerfile
index c5c631b71..2afe6c1d3 100644
--- a/Dockerfile.debian_package
+++ b/deployment/debian-package-x64/Dockerfile
@@ -1,4 +1,6 @@
FROM debian:9
+ARG SOURCEDIR=/repo
+ENV DEB_BUILD_OPTIONS=noddebs
# https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current
RUN apt-get update \
@@ -11,12 +13,11 @@ RUN apt-get update \
&& chown root:root /etc/apt/sources.list.d/microsoft-prod.list \
&& apt-get update
-WORKDIR /repo
+WORKDIR ${SOURCEDIR}
COPY . .
+COPY ./deployment/debian-package-x64/pkg-src ./debian
-RUN yes|mk-build-deps -i \
- && dpkg-buildpackage -us -uc \
- && mkdir /dist \
- && mv /jellyfin*deb /dist
+RUN yes | mk-build-deps -i debian/control \
+ && dpkg-buildpackage -us -uc
-WORKDIR /dist
+WORKDIR /
diff --git a/deployment/debian-package-x64/clean.sh b/deployment/debian-package-x64/clean.sh
new file mode 100755
index 000000000..3df2d7796
--- /dev/null
+++ b/deployment/debian-package-x64/clean.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/debian-package-x64/package.sh b/deployment/debian-package-x64/package.sh
new file mode 100755
index 000000000..dec953961
--- /dev/null
+++ b/deployment/debian-package-x64/package.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+# TODO get the version in the package automatically. And using the changelog to decide the debian package suffix version.
+
+# Build a Jellyfin .deb file with Docker on Linux
+# Places the output .deb file in the parent directory
+
+package_temporary_dir="`pwd`/pkg-dist-tmp"
+output_dir="`pwd`/pkg-dist"
+current_user="`whoami`"
+image_name="jellyfin-debuild"
+
+cleanup() {
+ set +o errexit
+ docker image rm $image_name --force
+ rm -rf "$package_temporary_dir"
+}
+trap cleanup EXIT INT
+
+docker build ../.. -t "$image_name" -f ./Dockerfile --build-arg SOURCEDIR="/jellyfin-${VERSION}"
+mkdir -p "$package_temporary_dir"
+mkdir -p "$output_dir"
+docker run --rm -v "$package_temporary_dir:/temp" "$image_name" sh -c 'find / -maxdepth 1 -type f -name "jellyfin*" -exec mv {} /temp \;'
+chown -R "$current_user" "$package_temporary_dir" \
+|| sudo chown -R "$current_user" "$package_temporary_dir"
+
+mv "$package_temporary_dir"/* "$output_dir"
diff --git a/debian/bin/jellyfin-sudoers b/deployment/debian-package-x64/pkg-src/bin/jellyfin-sudoers
index 4eb91366b..4eb91366b 100644
--- a/debian/bin/jellyfin-sudoers
+++ b/deployment/debian-package-x64/pkg-src/bin/jellyfin-sudoers
diff --git a/debian/bin/restart.sh b/deployment/debian-package-x64/pkg-src/bin/restart.sh
index a6f4632ba..a6f4632ba 100644
--- a/debian/bin/restart.sh
+++ b/deployment/debian-package-x64/pkg-src/bin/restart.sh
diff --git a/debian/changelog b/deployment/debian-package-x64/pkg-src/changelog
index f7a1994b7..f7a1994b7 100644
--- a/debian/changelog
+++ b/deployment/debian-package-x64/pkg-src/changelog
diff --git a/debian/compat b/deployment/debian-package-x64/pkg-src/compat
index 45a4fb75d..45a4fb75d 100644
--- a/debian/compat
+++ b/deployment/debian-package-x64/pkg-src/compat
diff --git a/debian/conf/jellyfin b/deployment/debian-package-x64/pkg-src/conf/jellyfin
index 861865aae..861865aae 100644
--- a/debian/conf/jellyfin
+++ b/deployment/debian-package-x64/pkg-src/conf/jellyfin
diff --git a/debian/conf/jellyfin.service.conf b/deployment/debian-package-x64/pkg-src/conf/jellyfin.service.conf
index 1b69dd74e..1b69dd74e 100644
--- a/debian/conf/jellyfin.service.conf
+++ b/deployment/debian-package-x64/pkg-src/conf/jellyfin.service.conf
diff --git a/debian/conf/logging.json b/deployment/debian-package-x64/pkg-src/conf/logging.json
index 5d98484cd..5d98484cd 100644
--- a/debian/conf/logging.json
+++ b/deployment/debian-package-x64/pkg-src/conf/logging.json
diff --git a/debian/control b/deployment/debian-package-x64/pkg-src/control
index 74bebeaf1..74bebeaf1 100644
--- a/debian/control
+++ b/deployment/debian-package-x64/pkg-src/control
diff --git a/debian/copyright b/deployment/debian-package-x64/pkg-src/copyright
index 0d7a2a600..0d7a2a600 100644
--- a/debian/copyright
+++ b/deployment/debian-package-x64/pkg-src/copyright
diff --git a/debian/gbp.conf b/deployment/debian-package-x64/pkg-src/gbp.conf
index f131b973c..60b3d2872 100644
--- a/debian/gbp.conf
+++ b/deployment/debian-package-x64/pkg-src/gbp.conf
@@ -3,4 +3,4 @@ pristine-tar = False
cleaner = fakeroot debian/rules clean
[import-orig]
-filter = [ ".git*", ".hg*" ]
+filter = [ ".git*", ".hg*", ".vs*", ".vscode*" ]
diff --git a/debian/install b/deployment/debian-package-x64/pkg-src/install
index adaff7b26..adaff7b26 100644
--- a/debian/install
+++ b/deployment/debian-package-x64/pkg-src/install
diff --git a/debian/jellyfin.init b/deployment/debian-package-x64/pkg-src/jellyfin.init
index d103fb0f1..d103fb0f1 100644
--- a/debian/jellyfin.init
+++ b/deployment/debian-package-x64/pkg-src/jellyfin.init
diff --git a/debian/jellyfin.service b/deployment/debian-package-x64/pkg-src/jellyfin.service
index c17422029..c17422029 100644
--- a/debian/jellyfin.service
+++ b/deployment/debian-package-x64/pkg-src/jellyfin.service
diff --git a/debian/jellyfin.upstart b/deployment/debian-package-x64/pkg-src/jellyfin.upstart
index ef5bc9bca..ef5bc9bca 100644
--- a/debian/jellyfin.upstart
+++ b/deployment/debian-package-x64/pkg-src/jellyfin.upstart
diff --git a/debian/po/POTFILES.in b/deployment/debian-package-x64/pkg-src/po/POTFILES.in
index cef83a340..cef83a340 100644
--- a/debian/po/POTFILES.in
+++ b/deployment/debian-package-x64/pkg-src/po/POTFILES.in
diff --git a/debian/po/templates.pot b/deployment/debian-package-x64/pkg-src/po/templates.pot
index 2cdcae417..2cdcae417 100644
--- a/debian/po/templates.pot
+++ b/deployment/debian-package-x64/pkg-src/po/templates.pot
diff --git a/debian/postinst b/deployment/debian-package-x64/pkg-src/postinst
index 3690d20ba..3690d20ba 100644
--- a/debian/postinst
+++ b/deployment/debian-package-x64/pkg-src/postinst
diff --git a/debian/postrm b/deployment/debian-package-x64/pkg-src/postrm
index 690f5d587..690f5d587 100644
--- a/debian/postrm
+++ b/deployment/debian-package-x64/pkg-src/postrm
diff --git a/debian/preinst b/deployment/debian-package-x64/pkg-src/preinst
index 0063e0e63..0063e0e63 100644
--- a/debian/preinst
+++ b/deployment/debian-package-x64/pkg-src/preinst
diff --git a/debian/prerm b/deployment/debian-package-x64/pkg-src/prerm
index 4770c03c4..4770c03c4 100644
--- a/debian/prerm
+++ b/deployment/debian-package-x64/pkg-src/prerm
diff --git a/debian/rules b/deployment/debian-package-x64/pkg-src/rules
index 10a3a8486..ce98cb8f8 100755..100644
--- a/debian/rules
+++ b/deployment/debian-package-x64/pkg-src/rules
@@ -2,7 +2,7 @@
CONFIG := Release
TERM := xterm
SHELL := /bin/bash
-DOTNETRUNTIME := linux-x64
+DOTNETRUNTIME := debian-x64
export DH_VERBOSE=1
export DOTNET_CLI_TELEMETRY_OPTOUT=1
@@ -16,8 +16,8 @@ override_dh_auto_test:
override_dh_clistrip:
override_dh_auto_build:
- dotnet publish --configuration $(CONFIG) --output='$(CURDIR)/usr/lib/jellyfin/bin' --self-contained --runtime $(DOTNETRUNTIME)
+ dotnet publish --configuration $(CONFIG) --output='$(CURDIR)/usr/lib/jellyfin/bin' --self-contained --runtime $(DOTNETRUNTIME) Jellyfin.Server
override_dh_auto_clean:
- dotnet clean -maxcpucount:1 --configuration $(CONFIG) || true
+ dotnet clean -maxcpucount:1 --configuration $(CONFIG) Jellyfin.Server || true
rm -rf '$(CURDIR)/usr'
diff --git a/debian/source.lintian-overrides b/deployment/debian-package-x64/pkg-src/source.lintian-overrides
index aeb332f13..aeb332f13 100644
--- a/debian/source.lintian-overrides
+++ b/deployment/debian-package-x64/pkg-src/source.lintian-overrides
diff --git a/debian/source/format b/deployment/debian-package-x64/pkg-src/source/format
index d3827e75a..d3827e75a 100644
--- a/debian/source/format
+++ b/deployment/debian-package-x64/pkg-src/source/format
diff --git a/deployment/debian-package-x64/pkg-src/source/options b/deployment/debian-package-x64/pkg-src/source/options
new file mode 100644
index 000000000..17b5373d5
--- /dev/null
+++ b/deployment/debian-package-x64/pkg-src/source/options
@@ -0,0 +1,11 @@
+tar-ignore='.git*'
+tar-ignore='**/.git'
+tar-ignore='**/.hg'
+tar-ignore='**/.vs'
+tar-ignore='**/.vscode'
+tar-ignore='deployment'
+tar-ignore='**/bin'
+tar-ignore='**/obj'
+tar-ignore='**/.nuget'
+tar-ignore='*.deb'
+tar-ignore='ThirdParty'
diff --git a/deployment/debian-x64/build.sh b/deployment/debian-x64/build.sh
new file mode 100755
index 000000000..47cfb5327
--- /dev/null
+++ b/deployment/debian-x64/build.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+build_jellyfin ../../Jellyfin.Server Release debian-x64 `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/debian-x64/clean.sh b/deployment/debian-x64/clean.sh
new file mode 100755
index 000000000..3df2d7796
--- /dev/null
+++ b/deployment/debian-x64/clean.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/debian-x64/package.sh b/deployment/debian-x64/package.sh
new file mode 100755
index 000000000..13b943ea8
--- /dev/null
+++ b/deployment/debian-x64/package.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+package_portable ../.. `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/docker/build.sh b/deployment/docker/build.sh
new file mode 100755
index 000000000..444208c85
--- /dev/null
+++ b/deployment/docker/build.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+build_jellyfin_docker ../.. ../../Dockerfile jellyfin:amd64-${VERSION}
+
+build_jellyfin_docker ../.. ../../Dockerfile.arm jellyfin:arm-${VERSION}
+
+#build_jellyfin_docker ../.. ../../Dockerfile.arm64v8 jellyfin:arm64v8-${VERSION}
+#build_jellyfin_docker ../.. ../../Dockerfile.arm32v7 jellyfin:arm32v7-${VERSION}
diff --git a/deployment/docker/package.sh b/deployment/docker/package.sh
new file mode 100755
index 000000000..d74426e2f
--- /dev/null
+++ b/deployment/docker/package.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+docker manifest create jellyfin:${VERSION} jellyfin:amd64-${VERSION} jellyfin:arm32v7-${VERSION} jellyfin:arm64v8-${VERSION}
+docker manifest annotate jellyfin:amd64-${VERSION} --os linux --arch amd64
+#docker manifest annotate jellyfin:arm32v7-${VERSION} --os linux --arch arm --variant armv7
+#docker manifest annotate jellyfin:arm64v8-${VERSION} --os linux --arch arm64 --variant armv8
+
+#TODO publish.sh - docker manifest push jellyfin:${VERSION}
diff --git a/deployment/fedora-package-x64/Dockerfile b/deployment/fedora-package-x64/Dockerfile
new file mode 100644
index 000000000..e5deac29f
--- /dev/null
+++ b/deployment/fedora-package-x64/Dockerfile
@@ -0,0 +1,15 @@
+FROM fedora:29
+ARG HOME=/build
+RUN mkdir /build && \
+ dnf install -y @buildsys-build rpmdevtools dnf-plugins-core && \
+ dnf copr enable -y @dotnet-sig/dotnet && \
+ rpmdev-setuptree
+
+WORKDIR /build/rpmbuild
+COPY ./deployment/fedora-package-x64/pkg-src/jellyfin.spec SPECS
+COPY ./deployment/fedora-package-x64/pkg-src/ SOURCES
+
+RUN spectool -g -R SPECS/jellyfin.spec && \
+ rpmbuild -bs SPECS/jellyfin.spec && \
+ dnf build-dep -y SRPMS/jellyfin-*.src.rpm && \
+ rpmbuild -bb SPECS/jellyfin.spec; \ No newline at end of file
diff --git a/deployment/fedora-package-x64/clean.sh b/deployment/fedora-package-x64/clean.sh
new file mode 100755
index 000000000..3df2d7796
--- /dev/null
+++ b/deployment/fedora-package-x64/clean.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/fedora-package-x64/package.sh b/deployment/fedora-package-x64/package.sh
new file mode 100755
index 000000000..416c8213b
--- /dev/null
+++ b/deployment/fedora-package-x64/package.sh
@@ -0,0 +1,83 @@
+#!/usr/bin/env sh
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+# TODO get the version in the package automatically. And using the changelog to decide the debian package suffix version.
+
+# Build a Jellyfin .rpm file with Docker on Linux
+# Places the output .rpm file in the parent directory
+
+set -o errexit
+set -o xtrace
+set -o nounset
+
+package_temporary_dir="`pwd`/pkg-dist-tmp"
+output_dir="`pwd`/pkg-dist"
+pkg_src_dir="`pwd`/pkg-src"
+current_user="`whoami`"
+image_name="jellyfin-rpmbuild"
+
+cleanup() {
+ set +o errexit
+ docker image rm $image_name --force
+ rm -rf "$package_temporary_dir"
+ rm -rf "$pkg_src_dir/jellyfin-${VERSION}.tar.gz"
+}
+trap cleanup EXIT INT
+GNU_TAR=1
+mkdir -p "$package_temporary_dir"
+echo "Bundling all sources for RPM build."
+tar \
+--transform "s,^\.,jellyfin-${VERSION}" \
+--exclude='.git*' \
+--exclude='**/.git' \
+--exclude='**/.hg' \
+--exclude='**/.vs' \
+--exclude='**/.vscode' \
+--exclude='deployment' \
+--exclude='**/bin' \
+--exclude='**/obj' \
+--exclude='**/.nuget' \
+--exclude='*.deb' \
+--exclude='*.rpm' \
+-Jcvf \
+"$package_temporary_dir/jellyfin-${VERSION}.tar.xz" \
+-C "../.." \
+./ || true && GNU_TAR=0
+
+if [ $GNU_TAR -eq 0 ]; then
+ echo "The installed tar binary did not support --transform. Using workaround."
+ mkdir -p "$package_temporary_dir/jellyfin-${VERSION}"
+ # Not GNU tar
+ tar \
+ --exclude='.git*' \
+ --exclude='**/.git' \
+ --exclude='**/.hg' \
+ --exclude='**/.vs' \
+ --exclude='**/.vscode' \
+ --exclude='deployment' \
+ --exclude='**/bin' \
+ --exclude='**/obj' \
+ --exclude='**/.nuget' \
+ --exclude='*.deb' \
+ --exclude='*.rpm' \
+ -zcf \
+ "$package_temporary_dir/jellyfin-${VERSION}/jellyfin.tar.gz" \
+ -C "../.." \
+ ./
+ echo "Extracting filtered package."
+ tar -xzf "$package_temporary_dir/jellyfin-${VERSION}/jellyfin.tar.gz" -C "$package_temporary_dir/jellyfin-${VERSION}"
+ echo "Removing filtered package."
+ rm "$package_temporary_dir/jellyfin-${VERSION}/jellyfin.tar.gz"
+ echo "Repackaging package into final tarball."
+ tar -zcf "$pkg_src_dir/jellyfin-${VERSION}.tar.gz" -C "$package_temporary_dir" "jellyfin-${VERSION}"
+fi
+
+docker build ../.. -t "$image_name" -f ./Dockerfile
+mkdir -p "$output_dir"
+docker run --rm -v "$package_temporary_dir:/temp" "$image_name" sh -c 'find /build/rpmbuild -maxdepth 3 -type f -name "jellyfin*.rpm" -exec mv {} /temp \;'
+chown -R "$current_user" "$package_temporary_dir" \
+|| sudo chown -R "$current_user" "$package_temporary_dir"
+mv "$package_temporary_dir"/*.rpm "$output_dir"
diff --git a/deployment/fedora-package-x64/pkg-src/.gitignore b/deployment/fedora-package-x64/pkg-src/.gitignore
new file mode 100644
index 000000000..6019b98c2
--- /dev/null
+++ b/deployment/fedora-package-x64/pkg-src/.gitignore
@@ -0,0 +1,3 @@
+*.rpm
+*.zip
+*.tar.gz \ No newline at end of file
diff --git a/deployment/fedora-package-x64/pkg-src/README.md b/deployment/fedora-package-x64/pkg-src/README.md
new file mode 100644
index 000000000..7ed6f7efc
--- /dev/null
+++ b/deployment/fedora-package-x64/pkg-src/README.md
@@ -0,0 +1,43 @@
+# Jellyfin RPM
+
+## Build Fedora Package with docker
+
+Change into this directory `cd rpm-package`
+Run the build script `./build-fedora-rpm.sh`.
+Resulting RPM and src.rpm will be in `../../jellyfin-*.rpm`
+
+## ffmpeg
+
+The RPM package for Fedora/CentOS requires some additional repositories as ffmpeg is not in the main repositories.
+
+```shell
+# ffmpeg from RPMfusion free
+# Fedora
+$ sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
+# CentOS 7
+$ sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
+```
+
+## ISO mounting
+
+To allow Jellyfin to mount/umount ISO files uncomment these two lines in `/etc/sudoers.d/jellyfin-sudoers`
+```
+# %jellyfin ALL=(ALL) NOPASSWD: /bin/mount
+# %jellyfin ALL=(ALL) NOPASSWD: /bin/umount
+```
+
+## Building with dotnet
+
+Jellyfin is build with `--self-contained` so no dotnet required for runtime.
+
+```shell
+# dotnet required for building the RPM
+# Fedora
+$ sudo dnf copr enable @dotnet-sig/dotnet
+# CentOS
+$ sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
+```
+
+## TODO
+
+- [ ] OpenSUSE \ No newline at end of file
diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin-firewalld.xml b/deployment/fedora-package-x64/pkg-src/jellyfin-firewalld.xml
new file mode 100644
index 000000000..062db370d
--- /dev/null
+++ b/deployment/fedora-package-x64/pkg-src/jellyfin-firewalld.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<service>
+ <short>Jellyfin</short>
+ <description>The Free Software Media System.</description>
+ <port protocol="tcp" port="8096"/>
+ <port protocol="tcp" port="8920"/>
+ <port protocol="udp" port="1900"/>
+ <port protocol="udp" port="7359"/>
+</service> \ No newline at end of file
diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.env b/deployment/fedora-package-x64/pkg-src/jellyfin.env
new file mode 100644
index 000000000..827a33f46
--- /dev/null
+++ b/deployment/fedora-package-x64/pkg-src/jellyfin.env
@@ -0,0 +1,27 @@
+# Jellyfin default configuration options
+
+# Use this file to override the default configurations; add additional
+# options with JELLYFIN_ADD_OPTS.
+
+# To override the user or this config file's location, use
+# /etc/systemd/system/jellyfin.service.d/override.conf
+
+#
+# This is a POSIX shell fragment
+#
+
+#
+# General options
+#
+
+# Tell jellyfin wich ffmpeg/ffprobe to use
+# JELLYFIN_FFMPEG="-ffmpeg /usr/bin/ffmpeg -ffprobe /usr/bin/ffprobe"
+
+# Program directories
+JELLYFIN_DATA_DIRECTORY="/var/lib/jellyfin"
+JELLYFIN_CONFIG_DIRECTORY="/etc/jellyfin"
+JELLYFIN_LOG_DIRECTORY="/var/log/jellyfin"
+# In-App service control
+JELLYFIN_RESTART_OPT="-restartpath /usr/libexec/jellyfin/restart.sh"
+# Additional options for the binary
+JELLYFIN_ADD_OPTS="" \ No newline at end of file
diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.override.conf b/deployment/fedora-package-x64/pkg-src/jellyfin.override.conf
new file mode 100644
index 000000000..8652450bb
--- /dev/null
+++ b/deployment/fedora-package-x64/pkg-src/jellyfin.override.conf
@@ -0,0 +1,7 @@
+# Jellyfin systemd configuration options
+
+# Use this file to override the user or environment file location.
+
+[Service]
+#User = jellyfin
+#EnvironmentFile = /etc/sysconfig/jellyfin
diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.service b/deployment/fedora-package-x64/pkg-src/jellyfin.service
new file mode 100644
index 000000000..0ece5b57f
--- /dev/null
+++ b/deployment/fedora-package-x64/pkg-src/jellyfin.service
@@ -0,0 +1,15 @@
+[Unit]
+After=network.target
+Description=Jellyfin is a free software media system that puts you in control of managing and streaming your media.
+
+[Service]
+EnvironmentFile=/etc/sysconfig/jellyfin
+WorkingDirectory=/var/lib/jellyfin
+ExecStart=/usr/bin/jellyfin -programdata ${JELLYFIN_DATA_DIRECTORY} -configdir ${JELLYFIN_CONFIG_DIRECTORY} -logdir ${JELLYFIN_LOG_DIRECTORY} ${JELLYFIN_RESTART_OPT} ${JELLYFIN_ADD_OPTS} ${JELLYFIN_FFMPEG}
+TimeoutSec=15
+Restart=on-failure
+User=jellyfin
+Group=jellyfin
+
+[Install]
+WantedBy=multi-user.target
diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.spec b/deployment/fedora-package-x64/pkg-src/jellyfin.spec
new file mode 100644
index 000000000..acab6b13b
--- /dev/null
+++ b/deployment/fedora-package-x64/pkg-src/jellyfin.spec
@@ -0,0 +1,139 @@
+%global debug_package %{nil}
+# jellyfin tag to package
+%global gittag v10.0.1
+# Taglib-sharp commit of the submodule since github archive doesn't include submodules
+%global taglib_commit ee5ab21742b71fd1b87ee24895582327e9e04776
+%global taglib_shortcommit %(c=%{taglib_commit}; echo ${c:0:7})
+
+AutoReq: no
+Name: jellyfin
+Version: 10.0.1
+Release: 1%{?dist}
+Summary: The Free Software Media Browser
+License: GPLv2
+URL: https://jellyfin.media
+Source0: %{name}-%{version}.tar.gz
+Source1: jellyfin.service
+Source2: jellyfin.env
+Source3: jellyfin.sudoers
+Source4: restart.sh
+Source5: jellyfin.override.conf
+Source6: jellyfin-firewalld.xml
+
+%{?systemd_requires}
+BuildRequires: systemd
+Requires(pre): shadow-utils
+BuildRequires: libcurl-devel, fontconfig-devel, freetype-devel, openssl-devel, glibc-devel, libicu-devel
+Requires: libcurl, fontconfig, freetype, openssl, glibc libicu
+# Requirements not packaged in main repos
+# COPR @dotnet-sig/dotnet
+BuildRequires: dotnet-sdk-2.2
+# RPMfusion free
+Requires: ffmpeg
+
+# For the update-db-paths.sh script to fix emby paths to jellyfin
+%{?fedora:Recommends: sqlite}
+
+# Fedora has openssl1.1 which is incompatible with dotnet
+%{?fedora:Requires: compat-openssl10}
+# Disable Automatic Dependency Processing for Centos
+%{?el7:AutoReqProv: no}
+
+%description
+Jellyfin is a free software media system that puts you in control of managing and streaming your media.
+
+
+%prep
+%autosetup -n %{name}-%{version}
+
+%build
+
+%install
+export DOTNET_CLI_TELEMETRY_OPTOUT=1
+export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
+dotnet publish --configuration Release --output='%{buildroot}%{_libdir}/jellyfin' --self-contained --runtime fedora-x64 Jellyfin.Server
+%{__install} -D -m 0644 LICENSE %{buildroot}%{_datadir}/licenses/%{name}/LICENSE
+%{__install} -D -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/systemd/system/%{name}.service.d/override.conf
+%{__install} -D -m 0644 Jellyfin.Server/Resources/Configuration/logging.json %{buildroot}%{_sysconfdir}/%{name}/logging.json
+%{__mkdir} -p %{buildroot}%{_bindir}
+tee %{buildroot}%{_bindir}/jellyfin << EOF
+#!/bin/sh
+exec %{_libdir}/%{name}/%{name} \${@}
+EOF
+%{__mkdir} -p %{buildroot}%{_sharedstatedir}/jellyfin
+%{__mkdir} -p %{buildroot}%{_sysconfdir}/%{name}
+%{__mkdir} -p %{buildroot}%{_var}/log/jellyfin
+
+%{__install} -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
+%{__install} -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
+%{__install} -D -m 0600 %{SOURCE3} %{buildroot}%{_sysconfdir}/sudoers.d/%{name}-sudoers
+%{__install} -D -m 0755 %{SOURCE4} %{buildroot}%{_libexecdir}/%{name}/restart.sh
+%{__install} -D -m 0644 %{SOURCE6} %{buildroot}%{_prefix}/lib/firewalld/service/%{name}.xml
+
+%files
+%{_libdir}/%{name}/jellyfin-web/*
+%attr(755,root,root) %{_bindir}/%{name}
+%{_libdir}/%{name}/*.json
+%{_libdir}/%{name}/*.pdb
+%{_libdir}/%{name}/*.dll
+%{_libdir}/%{name}/*.so
+%{_libdir}/%{name}/*.a
+%{_libdir}/%{name}/createdump
+# Needs 755 else only root can run it since binary build by dotnet is 722
+%attr(755,root,root) %{_libdir}/%{name}/jellyfin
+%{_libdir}/%{name}/sosdocsunix.txt
+%{_unitdir}/%{name}.service
+%{_libexecdir}/%{name}/restart.sh
+%{_prefix}/lib/firewalld/service/%{name}.xml
+%attr(755,jellyfin,jellyfin) %dir %{_sysconfdir}/%{name}
+%config %{_sysconfdir}/sysconfig/%{name}
+%config(noreplace) %attr(600,root,root) %{_sysconfdir}/sudoers.d/%{name}-sudoers
+%config(noreplace) %{_sysconfdir}/systemd/system/%{name}.service.d/override.conf
+%config(noreplace) %attr(644,jellyfin,jellyfin) %{_sysconfdir}/%{name}/logging.json
+%attr(-,jellyfin,jellyfin) %dir %{_sharedstatedir}/jellyfin
+%attr(-,jellyfin,jellyfin) %dir %{_var}/log/jellyfin
+%if 0%{?fedora}
+%license LICENSE
+%else
+%{_datadir}/licenses/%{name}/LICENSE
+%endif
+
+%pre
+getent group jellyfin >/dev/null || groupadd -r jellyfin
+getent passwd jellyfin >/dev/null || \
+ useradd -r -g jellyfin -d %{_sharedstatedir}/jellyfin -s /sbin/nologin \
+ -c "Jellyfin default user" jellyfin
+exit 0
+
+%post
+# Move existing configuration to /etc/jellyfin and symlink config to /etc/jellyfin
+if [ $1 -gt 1 ] ; then
+ service_state=$(systemctl is-active jellyfin.service)
+ if [ "${service_state}" = "active" ]; then
+ systemctl stop jellyfin.service
+ fi
+ if [ ! -L %{_sharedstatedir}/%{name}/config ]; then
+ mv %{_sharedstatedir}/%{name}/config/* %{_sysconfdir}/%{name}/
+ rmdir %{_sharedstatedir}/%{name}/config
+ ln -sf %{_sysconfdir}/%{name} %{_sharedstatedir}/%{name}/config
+ fi
+ if [ ! -L %{_sharedstatedir}/%{name}/logs ]; then
+ mv %{_sharedstatedir}/%{name}/logs/* %{_var}/log/jellyfin
+ rmdir %{_sharedstatedir}/%{name}/logs
+ ln -sf %{_var}/log/jellyfin %{_sharedstatedir}/%{name}/logs
+ fi
+ if [ "${service_state}" = "active" ]; then
+ systemctl start jellyfin.service
+ fi
+fi
+%systemd_post jellyfin.service
+
+%preun
+%systemd_preun jellyfin.service
+
+%postun
+%systemd_postun_with_restart jellyfin.service
+
+%changelog
+* Fri Jan 11 2019 Thomas Büttner <thomas@vergesslicher.tech> - 10.0.2-1
+- TODO Changelog for 10.0.2
diff --git a/deployment/fedora-package-x64/pkg-src/jellyfin.sudoers b/deployment/fedora-package-x64/pkg-src/jellyfin.sudoers
new file mode 100644
index 000000000..b31d52f7e
--- /dev/null
+++ b/deployment/fedora-package-x64/pkg-src/jellyfin.sudoers
@@ -0,0 +1,19 @@
+# Allow jellyfin group to start, stop and restart itself
+Cmnd_Alias RESTARTSERVER_SYSTEMD = /usr/bin/systemctl restart jellyfin, /bin/systemctl restart jellyfin
+Cmnd_Alias STARTSERVER_SYSTEMD = /usr/bin/systemctl start jellyfin, /bin/systemctl start jellyfin
+Cmnd_Alias STOPSERVER_SYSTEMD = /usr/bin/systemctl stop jellyfin, /bin/systemctl stop jellyfin
+
+
+%jellyfin ALL=(ALL) NOPASSWD: RESTARTSERVER_SYSTEMD
+%jellyfin ALL=(ALL) NOPASSWD: STARTSERVER_SYSTEMD
+%jellyfin ALL=(ALL) NOPASSWD: STOPSERVER_SYSTEMD
+
+Defaults!RESTARTSERVER_SYSTEMD !requiretty
+Defaults!STARTSERVER_SYSTEMD !requiretty
+Defaults!STOPSERVER_SYSTEMD !requiretty
+
+# Uncomment to allow the server to mount iso images
+# %jellyfin ALL=(ALL) NOPASSWD: /bin/mount
+# %jellyfin ALL=(ALL) NOPASSWD: /bin/umount
+
+Defaults:%jellyfin !requiretty
diff --git a/deployment/fedora-package-x64/pkg-src/restart.sh b/deployment/fedora-package-x64/pkg-src/restart.sh
new file mode 100644
index 000000000..e84dca587
--- /dev/null
+++ b/deployment/fedora-package-x64/pkg-src/restart.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+NAME=jellyfin
+restart_cmd="/usr/bin/systemctl restart ${NAME}"
+echo "sleep 2; sudo $restart_cmd > /dev/null 2>&1" | at now > /dev/null 2>&1
+exit 0 \ No newline at end of file
diff --git a/deployment/framework/build.sh b/deployment/framework/build.sh
new file mode 100755
index 000000000..4f2e6363e
--- /dev/null
+++ b/deployment/framework/build.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+#Magic word framework will create a non self contained build
+build_jellyfin ../../Jellyfin.Server Release framework `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/framework/clean.sh b/deployment/framework/clean.sh
new file mode 100755
index 000000000..3df2d7796
--- /dev/null
+++ b/deployment/framework/clean.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/framework/package.sh b/deployment/framework/package.sh
new file mode 100755
index 000000000..13b943ea8
--- /dev/null
+++ b/deployment/framework/package.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+package_portable ../.. `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/linux-x64/build.sh b/deployment/linux-x64/build.sh
new file mode 100755
index 000000000..1f0fb62d3
--- /dev/null
+++ b/deployment/linux-x64/build.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+build_jellyfin ../../Jellyfin.Server Release linux-x64 `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/linux-x64/clean.sh b/deployment/linux-x64/clean.sh
new file mode 100755
index 000000000..3df2d7796
--- /dev/null
+++ b/deployment/linux-x64/clean.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/linux-x64/package.sh b/deployment/linux-x64/package.sh
new file mode 100755
index 000000000..13b943ea8
--- /dev/null
+++ b/deployment/linux-x64/package.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+package_portable ../.. `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/make.sh b/deployment/make.sh
new file mode 100755
index 000000000..6b8d8de08
--- /dev/null
+++ b/deployment/make.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+
+git submodule update --init --recursive
+
+pushd ../Jellyfin.Versioning
+./update-version
+popd
+
+#TODO enabled proper flag parsing for enabling and disabling building, signing, packaging and publishing
+
+# Execute all build.sh, package.sh, sign.sh and publish.sh scripts in every folder. In that order. Script should check for artifacts themselves.
+echo "Running for platforms '$@'."
+for directory in */ ; do
+ platform=`basename "${directory}"`
+ if [[ $@ == *"$platform"* || $@ = *"all"* ]]; then
+ echo "Processing ${platform}"
+ pushd "$platform"
+ if [ -f build.sh ]; then
+ ./build.sh
+ fi
+ if [ -f package.sh ]; then
+ ./package.sh
+ fi
+ if [ -f sign.sh ]; then
+ ./sign.sh
+ fi
+ if [ -f publish.sh ]; then
+ ./publish.sh
+ fi
+ popd
+ else
+ echo "Skipping $platform."
+ fi
+done
diff --git a/deployment/osx-x64/build.sh b/deployment/osx-x64/build.sh
new file mode 100755
index 000000000..d6bfb9f5e
--- /dev/null
+++ b/deployment/osx-x64/build.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+build_jellyfin ../../Jellyfin.Server Release osx-x64 `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/osx-x64/clean.sh b/deployment/osx-x64/clean.sh
new file mode 100755
index 000000000..3df2d7796
--- /dev/null
+++ b/deployment/osx-x64/clean.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/osx-x64/package.sh b/deployment/osx-x64/package.sh
new file mode 100755
index 000000000..13b943ea8
--- /dev/null
+++ b/deployment/osx-x64/package.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+package_portable ../.. `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/ubuntu-x64/build.sh b/deployment/ubuntu-x64/build.sh
new file mode 100755
index 000000000..870bac780
--- /dev/null
+++ b/deployment/ubuntu-x64/build.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+build_jellyfin ../../Jellyfin.Server Release ubuntu-x64 `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/ubuntu-x64/clean.sh b/deployment/ubuntu-x64/clean.sh
new file mode 100755
index 000000000..3df2d7796
--- /dev/null
+++ b/deployment/ubuntu-x64/clean.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/ubuntu-x64/package.sh b/deployment/ubuntu-x64/package.sh
new file mode 100755
index 000000000..13b943ea8
--- /dev/null
+++ b/deployment/ubuntu-x64/package.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+package_portable ../.. `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/unraid/docker-templates/README.md b/deployment/unraid/docker-templates/README.md
new file mode 100644
index 000000000..2c268e8b3
--- /dev/null
+++ b/deployment/unraid/docker-templates/README.md
@@ -0,0 +1,15 @@
+# docker-templates
+
+### Installation:
+
+Open unRaid GUI (at least unRaid 6.5)
+
+Click on the Docker tab
+
+Add the following line under "Template Repositories"
+
+https://github.com/jellyfin/jellyfin/blob/master/deployment/unraid/docker-templates
+
+Click save than click on Add Container and select jellyfin.
+
+Adjust to your paths to your liking and off you go!
diff --git a/deployment/unraid/docker-templates/jellyfin.xml b/deployment/unraid/docker-templates/jellyfin.xml
new file mode 100644
index 000000000..be1188424
--- /dev/null
+++ b/deployment/unraid/docker-templates/jellyfin.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Containers>
+ <TemplateURL>https://raw.githubusercontent.com/jellyfin/jellyfin/deployment/unraid/docker-templates/jellyfin.xml</TemplateURL>
+ <Beta>False</Beta>
+ <Category>MediaApp:Video MediaApp:Music MediaApp:Photos MediaServer:Video MediaServer:Music MediaServer:Photos</Category>
+ <Name>JellyFin</Name>
+ <Description>
+ JellyFin is The Free Software Media Browser Converted By Community Applications Always verify this template (and values) against the dockerhub support page for the container!![br][br]
+ You can add as many mount points as needed for recordings, movies ,etc. [br][br]
+ [b][span style='color: #E80000;']Directions:[/span][/b][br]
+ [b]/config[/b] : this is where Jellyfin will store it's databases and configuration.[br][br]
+ [b]Port[/b] : This is the default port for Jellyfin. (Will add ssl port later)[br][br]
+ [b]Media[/b] : This is the mounting point of your media. When you access it in Jellyfin it will be /media or whatever you chose for a mount point
+ [b]Tip:[/b] You can add more volume mappings if you wish Jellyfin has access to it.
+ </Description>
+ <Overview>
+ Jellyfin Server is a home media server built on top of other popular open source technologies such as Service Stack, jQuery, jQuery mobile, and Mono and will remain completely free!
+ </Overview>
+ <Support>https://www.reddit.com/r/jellyfin/</Support>
+ <Registry>https://hub.docker.com/r/jellyfin/jellyfin/</Registry>
+ <GitHub>https://github.com/jellyfin/jellyfin/></GitHub>
+ <Repository>jellyfin/jellyfin</Repository>
+ <Project>https://jellyfin.media/</Project>
+ <BindTime>true</BindTime>
+ <Privileged>false</Privileged>
+ <Networking>
+ <Mode>host</Mode>
+ <Publish>
+ <Port>
+ <HostPort>8096</HostPort>
+ <ContainerPort>8096</ContainerPort>
+ <Protocol>tcp</Protocol>
+ </Port>
+ </Publish>
+ </Networking>
+ <Data>
+ <Volume>
+ <HostDir>/mnt/cache/appdata/config</HostDir>
+ <ContainerDir>/config</ContainerDir>
+ <Mode>rw</Mode>
+ </Volume>
+ <Volume>
+ <HostDir>/mnt/user</HostDir>
+ <ContainerDir>/media</ContainerDir>
+ <Mode>rw</Mode>
+ </Volume>
+ </Data>
+ <WebUI>http://[IP]:[PORT:8096]/</WebUI>
+ <Icon>https://raw.githubusercontent.com/binhex/docker-templates/master/binhex/images/emby-icon.png</Icon>
+ <ExtraParams></ExtraParams>
+</Containers>
diff --git a/build-jellyfin.ps1 b/deployment/win-generic/build-jellyfin.ps1
index 224716621..4f0f92525 100644
--- a/build-jellyfin.ps1
+++ b/deployment/win-generic/build-jellyfin.ps1
@@ -1,110 +1,110 @@
-[CmdletBinding()]
-param(
- [switch]$InstallFFMPEG,
- [switch]$InstallNSSM,
- [switch]$GenerateZip,
- [string]$InstallLocation = "$Env:AppData/Jellyfin-Server/",
- [ValidateSet('Debug','Release')][string]$BuildType = 'Release',
- [ValidateSet('Quiet','Minimal', 'Normal')][string]$DotNetVerbosity = 'Minimal',
- [ValidateSet('win','win7', 'win8','win81','win10')][string]$WindowsVersion = 'win',
- [ValidateSet('x64','x86', 'arm', 'arm64')][string]$Architecture = 'x64'
-)
-
-#PowershellCore and *nix check to make determine which temp dir to use.
-if(($PSVersionTable.PSEdition -eq 'Core') -and (-not $IsWindows)){
- $TempDir = mktemp -d
-}else{
- $TempDir = $env:Temp
-}
-
-function Build-JellyFin {
- if(($Architecture -eq 'arm64') -and ($WindowsVersion -ne 'win10')){
- Write-Error "arm64 only supported with Windows10 Version"
- exit
- }
- if(($Architecture -eq 'arm') -and ($WindowsVersion -notin @('win10','win81','win8'))){
- Write-Error "arm only supported with Windows 8 or higher"
- exit
- }
- dotnet publish -c $BuildType -r "$windowsversion-$Architecture" MediaBrowser.sln -o $InstallLocation -v $DotNetVerbosity
-}
-
-function Install-FFMPEG {
- param(
- [string]$InstallLocation,
- [string]$Architecture
- )
- Write-Verbose "Checking Architecture"
- if($Architecture -notin @('x86','x64')){
- Write-Warning "No builds available for your selected architecture of $Architecture"
- Write-Warning "FFMPEG will not be installed"
- }elseif($Architecture -eq 'x64'){
- Write-Verbose "Downloading 64 bit FFMPEG"
- Invoke-WebRequest -Uri https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-4.1-win64-static.zip -UseBasicParsing -OutFile "$tempdir/fmmpeg.zip" | Write-Verbose
- }else{
- Write-Verbose "Downloading 32 bit FFMPEG"
- Invoke-WebRequest -Uri https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-4.1-win32-static.zip -UseBasicParsing -OutFile "$tempdir/fmmpeg.zip" | Write-Verbose
- }
-
- Expand-Archive "$tempdir/fmmpeg.zip" -DestinationPath "$tempdir/ffmpeg/" | Write-Verbose
- if($Architecture -eq 'x64'){
- Write-Verbose "Copying Binaries to Jellyfin location"
- Get-ChildItem "$tempdir/ffmpeg/ffmpeg-4.1-win64-static/bin" | ForEach-Object {
- Copy-Item $_.FullName -Destination $installLocation | Write-Verbose
- }
- }else{
- Write-Verbose "Copying Binaries to Jellyfin location"
- Get-ChildItem "$tempdir/ffmpeg/ffmpeg-4.1-win32-static/bin" | ForEach-Object {
- Copy-Item $_.FullName -Destination $installLocation | Write-Verbose
- }
- }
- Remove-Item "$tempdir/ffmpeg/" -Recurse -Force -ErrorAction Continue | Write-Verbose
- Remove-Item "$tempdir/fmmpeg.zip" -Force -ErrorAction Continue | Write-Verbose
-}
-
-function Install-NSSM {
- param(
- [string]$InstallLocation,
- [string]$Architecture
- )
- Write-Verbose "Checking Architecture"
- if($Architecture -notin @('x86','x64')){
- Write-Warning "No builds available for your selected architecture of $Architecture"
- Write-Warning "NSSM will not be installed"
- }else{
- Write-Verbose "Downloading NSSM"
- Invoke-WebRequest -Uri https://nssm.cc/ci/nssm-2.24-101-g897c7ad.zip -UseBasicParsing -OutFile "$tempdir/nssm.zip" | Write-Verbose
- }
-
- Expand-Archive "$tempdir/nssm.zip" -DestinationPath "$tempdir/nssm/" | Write-Verbose
- if($Architecture -eq 'x64'){
- Write-Verbose "Copying Binaries to Jellyfin location"
- Get-ChildItem "$tempdir/nssm/nssm-2.24-101-g897c7ad/win64" | ForEach-Object {
- Copy-Item $_.FullName -Destination $installLocation | Write-Verbose
- }
- }else{
- Write-Verbose "Copying Binaries to Jellyfin location"
- Get-ChildItem "$tempdir/nssm/nssm-2.24-101-g897c7ad/win32" | ForEach-Object {
- Copy-Item $_.FullName -Destination $installLocation | Write-Verbose
- }
- }
- Remove-Item "$tempdir/nssm/" -Recurse -Force -ErrorAction Continue | Write-Verbose
- Remove-Item "$tempdir/nssm.zip" -Force -ErrorAction Continue | Write-Verbose
-}
-
-Write-Verbose "Starting Build Process: Selected Environment is $WindowsVersion-$Architecture"
-Build-JellyFin
-if($InstallFFMPEG.IsPresent -or ($InstallFFMPEG -eq $true)){
- Write-Verbose "Starting FFMPEG Install"
- Install-FFMPEG $InstallLocation $Architecture
-}
-if($InstallNSSM.IsPresent -or ($InstallNSSM -eq $true)){
- Write-Verbose "Starting NSSM Install"
- Install-NSSM $InstallLocation $Architecture
-}
-Copy-Item .\install-jellyfin.ps1 $InstallLocation\install-jellyfin.ps1
-Copy-Item .\install.bat $InstallLocation\install.bat
-if($GenerateZip.IsPresent -or ($GenerateZip -eq $true)){
- Compress-Archive -Path $InstallLocation -DestinationPath "$InstallLocation/jellyfin.zip" -Force
-}
-Write-Verbose "Finished"
+[CmdletBinding()]
+param(
+ [switch]$InstallFFMPEG,
+ [switch]$InstallNSSM,
+ [switch]$GenerateZip,
+ [string]$InstallLocation = "$Env:AppData/Jellyfin-Server/",
+ [ValidateSet('Debug','Release')][string]$BuildType = 'Release',
+ [ValidateSet('Quiet','Minimal', 'Normal')][string]$DotNetVerbosity = 'Minimal',
+ [ValidateSet('win','win7', 'win8','win81','win10')][string]$WindowsVersion = 'win',
+ [ValidateSet('x64','x86', 'arm', 'arm64')][string]$Architecture = 'x64'
+)
+
+#PowershellCore and *nix check to make determine which temp dir to use.
+if(($PSVersionTable.PSEdition -eq 'Core') -and (-not $IsWindows)){
+ $TempDir = mktemp -d
+}else{
+ $TempDir = $env:Temp
+}
+
+function Build-JellyFin {
+ if(($Architecture -eq 'arm64') -and ($WindowsVersion -ne 'win10')){
+ Write-Error "arm64 only supported with Windows10 Version"
+ exit
+ }
+ if(($Architecture -eq 'arm') -and ($WindowsVersion -notin @('win10','win81','win8'))){
+ Write-Error "arm only supported with Windows 8 or higher"
+ exit
+ }
+ dotnet publish -c $BuildType -r "$windowsversion-$Architecture" MediaBrowser.sln -o $InstallLocation -v $DotNetVerbosity
+}
+
+function Install-FFMPEG {
+ param(
+ [string]$InstallLocation,
+ [string]$Architecture
+ )
+ Write-Verbose "Checking Architecture"
+ if($Architecture -notin @('x86','x64')){
+ Write-Warning "No builds available for your selected architecture of $Architecture"
+ Write-Warning "FFMPEG will not be installed"
+ }elseif($Architecture -eq 'x64'){
+ Write-Verbose "Downloading 64 bit FFMPEG"
+ Invoke-WebRequest -Uri https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-4.1-win64-static.zip -UseBasicParsing -OutFile "$tempdir/fmmpeg.zip" | Write-Verbose
+ }else{
+ Write-Verbose "Downloading 32 bit FFMPEG"
+ Invoke-WebRequest -Uri https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-4.1-win32-static.zip -UseBasicParsing -OutFile "$tempdir/fmmpeg.zip" | Write-Verbose
+ }
+
+ Expand-Archive "$tempdir/fmmpeg.zip" -DestinationPath "$tempdir/ffmpeg/" | Write-Verbose
+ if($Architecture -eq 'x64'){
+ Write-Verbose "Copying Binaries to Jellyfin location"
+ Get-ChildItem "$tempdir/ffmpeg/ffmpeg-4.1-win64-static/bin" | ForEach-Object {
+ Copy-Item $_.FullName -Destination $installLocation | Write-Verbose
+ }
+ }else{
+ Write-Verbose "Copying Binaries to Jellyfin location"
+ Get-ChildItem "$tempdir/ffmpeg/ffmpeg-4.1-win32-static/bin" | ForEach-Object {
+ Copy-Item $_.FullName -Destination $installLocation | Write-Verbose
+ }
+ }
+ Remove-Item "$tempdir/ffmpeg/" -Recurse -Force -ErrorAction Continue | Write-Verbose
+ Remove-Item "$tempdir/fmmpeg.zip" -Force -ErrorAction Continue | Write-Verbose
+}
+
+function Install-NSSM {
+ param(
+ [string]$InstallLocation,
+ [string]$Architecture
+ )
+ Write-Verbose "Checking Architecture"
+ if($Architecture -notin @('x86','x64')){
+ Write-Warning "No builds available for your selected architecture of $Architecture"
+ Write-Warning "NSSM will not be installed"
+ }else{
+ Write-Verbose "Downloading NSSM"
+ Invoke-WebRequest -Uri https://nssm.cc/ci/nssm-2.24-101-g897c7ad.zip -UseBasicParsing -OutFile "$tempdir/nssm.zip" | Write-Verbose
+ }
+
+ Expand-Archive "$tempdir/nssm.zip" -DestinationPath "$tempdir/nssm/" | Write-Verbose
+ if($Architecture -eq 'x64'){
+ Write-Verbose "Copying Binaries to Jellyfin location"
+ Get-ChildItem "$tempdir/nssm/nssm-2.24-101-g897c7ad/win64" | ForEach-Object {
+ Copy-Item $_.FullName -Destination $installLocation | Write-Verbose
+ }
+ }else{
+ Write-Verbose "Copying Binaries to Jellyfin location"
+ Get-ChildItem "$tempdir/nssm/nssm-2.24-101-g897c7ad/win32" | ForEach-Object {
+ Copy-Item $_.FullName -Destination $installLocation | Write-Verbose
+ }
+ }
+ Remove-Item "$tempdir/nssm/" -Recurse -Force -ErrorAction Continue | Write-Verbose
+ Remove-Item "$tempdir/nssm.zip" -Force -ErrorAction Continue | Write-Verbose
+}
+
+Write-Verbose "Starting Build Process: Selected Environment is $WindowsVersion-$Architecture"
+Build-JellyFin
+if($InstallFFMPEG.IsPresent -or ($InstallFFMPEG -eq $true)){
+ Write-Verbose "Starting FFMPEG Install"
+ Install-FFMPEG $InstallLocation $Architecture
+}
+if($InstallNSSM.IsPresent -or ($InstallNSSM -eq $true)){
+ Write-Verbose "Starting NSSM Install"
+ Install-NSSM $InstallLocation $Architecture
+}
+Copy-Item .\install-jellyfin.ps1 $InstallLocation\install-jellyfin.ps1
+Copy-Item .\install.bat $InstallLocation\install.bat
+if($GenerateZip.IsPresent -or ($GenerateZip -eq $true)){
+ Compress-Archive -Path $InstallLocation -DestinationPath "$InstallLocation/jellyfin.zip" -Force
+}
+Write-Verbose "Finished"
diff --git a/install-jellyfin.ps1 b/deployment/win-generic/install-jellyfin.ps1
index 56c098462..56c098462 100644
--- a/install-jellyfin.ps1
+++ b/deployment/win-generic/install-jellyfin.ps1
diff --git a/install.bat b/deployment/win-generic/install.bat
index e21479a79..e21479a79 100644
--- a/install.bat
+++ b/deployment/win-generic/install.bat
diff --git a/deployment/win-x64/build.sh b/deployment/win-x64/build.sh
new file mode 100755
index 000000000..0b3046203
--- /dev/null
+++ b/deployment/win-x64/build.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+build_jellyfin ../../Jellyfin.Server Release win-x64 `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/win-x64/clean.sh b/deployment/win-x64/clean.sh
new file mode 100755
index 000000000..3df2d7796
--- /dev/null
+++ b/deployment/win-x64/clean.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/win-x64/package.sh b/deployment/win-x64/package.sh
new file mode 100755
index 000000000..e8410e8c2
--- /dev/null
+++ b/deployment/win-x64/package.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+package_portable ../.. `pwd`/dist/jellyfin_${VERSION}
+
+#TODO setup and maybe change above code to produce the Windows native zip format.
diff --git a/deployment/win-x86/build.sh b/deployment/win-x86/build.sh
new file mode 100755
index 000000000..610db356a
--- /dev/null
+++ b/deployment/win-x86/build.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+build_jellyfin ../../Jellyfin.Server Release win-x86 `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/win-x86/clean.sh b/deployment/win-x86/clean.sh
new file mode 100755
index 000000000..3df2d7796
--- /dev/null
+++ b/deployment/win-x86/clean.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+clean_jellyfin ../.. Release `pwd`/dist/jellyfin_${VERSION}
diff --git a/deployment/win-x86/package.sh b/deployment/win-x86/package.sh
new file mode 100755
index 000000000..e8410e8c2
--- /dev/null
+++ b/deployment/win-x86/package.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+source ../common.build.sh
+
+VERSION=`get_version ../..`
+
+package_portable ../.. `pwd`/dist/jellyfin_${VERSION}
+
+#TODO setup and maybe change above code to produce the Windows native zip format.