Bläddra i källkod

Merge branch 'master' into h265

Joshua M. Boniface 5 år sedan
förälder
incheckning
d95c04787c
100 ändrade filer med 4624 tillägg och 5498 borttagningar
  1. 46 41
      .ci/azure-pipelines.yml
  2. 2 0
      .gitattributes
  3. 0 20
      .github/ISSUE_TEMPLATE/enhancement-request.md
  4. 0 14
      .github/ISSUE_TEMPLATE/feature_request.md
  5. 32 0
      .github/ISSUE_TEMPLATE/media_playback.md
  6. 22 0
      .github/stale.yml
  7. 1 6
      .gitignore
  8. 1 0
      BDInfo/BDInfo.csproj
  9. 5 1
      CONTRIBUTORS.md
  10. 3 3
      Dockerfile
  11. 5 9
      Dockerfile.arm
  12. 5 10
      Dockerfile.arm64
  13. 2565 2565
      Doxyfile
  14. 1 0
      DvdLib/DvdLib.csproj
  15. 7 27
      Emby.Dlna/Didl/DidlBuilder.cs
  16. 3 2
      Emby.Dlna/DlnaManager.cs
  17. 1 0
      Emby.Dlna/Emby.Dlna.csproj
  18. 1 1
      Emby.Dlna/Eventing/EventManager.cs
  19. 4 2
      Emby.Dlna/Main/DlnaEntryPoint.cs
  20. 5 4
      Emby.Dlna/PlayTo/PlayToManager.cs
  21. 30 33
      Emby.Dlna/PlayTo/SsdpHttpClient.cs
  22. 1 1
      Emby.Dlna/Profiles/DishHopperJoeyProfile.cs
  23. 1 1
      Emby.Dlna/Profiles/Xml/Dish Hopper-Joey.xml
  24. 7 0
      Emby.Drawing/Emby.Drawing.csproj
  25. 64 99
      Emby.Drawing/ImageProcessor.cs
  26. 19 15
      Emby.Drawing/NullImageEncoder.cs
  27. 3 0
      Emby.IsoMounting/IsoMounter/Configuration/PluginConfiguration.cs
  28. 13 0
      Emby.IsoMounting/IsoMounter/IsoMounter.csproj
  29. 149 328
      Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs
  30. 24 49
      Emby.IsoMounting/IsoMounter/LinuxMount.cs
  31. 14 11
      Emby.IsoMounting/IsoMounter/Plugin.cs
  32. 14 12
      Emby.Naming/Audio/AlbumParser.cs
  33. 2 0
      Emby.Naming/Audio/MultiPartResult.cs
  34. 25 4
      Emby.Naming/AudioBook/AudioBookFileInfo.cs
  35. 7 6
      Emby.Naming/AudioBook/AudioBookFilePathParser.cs
  36. 2 0
      Emby.Naming/AudioBook/AudioBookFilePathParserResult.cs
  37. 14 7
      Emby.Naming/AudioBook/AudioBookInfo.cs
  38. 1 1
      Emby.Naming/AudioBook/AudioBookListResolver.cs
  39. 6 5
      Emby.Naming/AudioBook/AudioBookResolver.cs
  40. 14 3
      Emby.Naming/Common/EpisodeExpression.cs
  41. 2 0
      Emby.Naming/Common/MediaType.cs
  42. 39 36
      Emby.Naming/Common/NamingOptions.cs
  43. 13 1
      Emby.Naming/Emby.Naming.csproj
  44. 1 0
      Emby.Naming/Extensions/StringExtensions.cs
  45. 0 30
      Emby.Naming/StringExtensions.cs
  46. 3 0
      Emby.Naming/Subtitles/SubtitleInfo.cs
  47. 11 0
      Emby.Naming/TV/EpisodeInfo.cs
  48. 23 28
      Emby.Naming/TV/EpisodePathParser.cs
  49. 7 0
      Emby.Naming/TV/EpisodePathParserResult.cs
  50. 9 3
      Emby.Naming/TV/EpisodeResolver.cs
  51. 20 22
      Emby.Naming/TV/SeasonPathParser.cs
  52. 2 0
      Emby.Naming/TV/SeasonPathParserResult.cs
  53. 10 10
      Emby.Naming/Video/CleanDateTimeParser.cs
  54. 0 2
      Emby.Naming/Video/ExtraResolver.cs
  55. 2 2
      Emby.Naming/Video/FileStack.cs
  56. 7 3
      Emby.Naming/Video/Format3DParser.cs
  57. 7 5
      Emby.Naming/Video/Format3DResult.cs
  58. 13 6
      Emby.Naming/Video/StackResolver.cs
  59. 20 12
      Emby.Naming/Video/StubResolver.cs
  60. 1 0
      Emby.Naming/Video/StubResult.cs
  61. 1 0
      Emby.Naming/Video/StubTypeRule.cs
  62. 11 1
      Emby.Naming/Video/VideoFileInfo.cs
  63. 4 0
      Emby.Naming/Video/VideoInfo.cs
  64. 18 22
      Emby.Naming/Video/VideoListResolver.cs
  65. 7 5
      Emby.Naming/Video/VideoResolver.cs
  66. 1 0
      Emby.Notifications/Emby.Notifications.csproj
  67. 4 3
      Emby.Notifications/NotificationManager.cs
  68. 2 1
      Emby.Photos/Emby.Photos.csproj
  69. 25 14
      Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
  70. 11 16
      Emby.Server.Implementations/Activity/ActivityRepository.cs
  71. 20 17
      Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs
  72. 51 41
      Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
  73. 120 128
      Emby.Server.Implementations/ApplicationHost.cs
  74. 9 17
      Emby.Server.Implementations/Channels/ChannelManager.cs
  75. 2 1
      Emby.Server.Implementations/Collections/CollectionManager.cs
  76. 2 2
      Emby.Server.Implementations/ConfigurationOptions.cs
  77. 49 37
      Emby.Server.Implementations/Cryptography/CryptographyProvider.cs
  78. 172 263
      Emby.Server.Implementations/Data/BaseSqliteRepository.cs
  79. 23 24
      Emby.Server.Implementations/Data/ManagedConnection.cs
  80. 37 56
      Emby.Server.Implementations/Data/SqliteDisplayPreferencesRepository.cs
  81. 3 6
      Emby.Server.Implementations/Data/SqliteExtensions.cs
  82. 264 316
      Emby.Server.Implementations/Data/SqliteItemRepository.cs
  83. 33 57
      Emby.Server.Implementations/Data/SqliteUserDataRepository.cs
  84. 67 93
      Emby.Server.Implementations/Data/SqliteUserRepository.cs
  85. 2 2
      Emby.Server.Implementations/Devices/DeviceId.cs
  86. 2 2
      Emby.Server.Implementations/Devices/DeviceManager.cs
  87. 20 25
      Emby.Server.Implementations/Dto/DtoService.cs
  88. 10 8
      Emby.Server.Implementations/Emby.Server.Implementations.csproj
  89. 8 8
      Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
  90. 1 3
      Emby.Server.Implementations/EntryPoints/RefreshUsersMetadata.cs
  91. 2 1
      Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs
  92. 3 3
      Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
  93. 0 18
      Emby.Server.Implementations/HttpClientManager/HttpClientInfo.cs
  94. 104 555
      Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
  95. 107 67
      Emby.Server.Implementations/HttpServer/FileWriter.cs
  96. 65 182
      Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
  97. 15 11
      Emby.Server.Implementations/HttpServer/ResponseFilter.cs
  98. 23 25
      Emby.Server.Implementations/HttpServer/Security/AuthService.cs
  99. 9 17
      Emby.Server.Implementations/IO/IsoManager.cs
  100. 8 11
      Emby.Server.Implementations/IO/ManagedFileSystem.cs

+ 46 - 41
.ci/azure-pipelines.yml

@@ -16,7 +16,7 @@ jobs:
   - job: main_build
   - job: main_build
     displayName: Main Build
     displayName: Main Build
     pool:
     pool:
-      vmImage: ubuntu-16.04
+      vmImage: ubuntu-latest
     strategy:
     strategy:
       matrix:
       matrix:
         release:
         release:
@@ -35,12 +35,14 @@ jobs:
       inputs:
       inputs:
         command: restore
         command: restore
         projects: '$(RestoreBuildProjects)'
         projects: '$(RestoreBuildProjects)'
+      enabled: false
 
 
     - task: DotNetCoreCLI@2
     - task: DotNetCoreCLI@2
       displayName: Build
       displayName: Build
       inputs:
       inputs:
         projects: '$(RestoreBuildProjects)'
         projects: '$(RestoreBuildProjects)'
         arguments: '--configuration $(BuildConfiguration)'
         arguments: '--configuration $(BuildConfiguration)'
+      enabled: false
 
 
     - task: DotNetCoreCLI@2
     - task: DotNetCoreCLI@2
       displayName: Test
       displayName: Test
@@ -66,40 +68,40 @@ jobs:
     #     artifactName: 'jellyfin-build-$(BuildConfiguration)'
     #     artifactName: 'jellyfin-build-$(BuildConfiguration)'
     #     zipAfterPublish: true
     #     zipAfterPublish: true
 
 
-    - task: PublishBuildArtifacts@1
+    - task: PublishPipelineArtifact@0
       displayName: 'Publish Artifact Naming'
       displayName: 'Publish Artifact Naming'
       condition: and(eq(variables['BuildConfiguration'], 'Release'), succeeded())
       condition: and(eq(variables['BuildConfiguration'], 'Release'), succeeded())
       inputs:
       inputs:
-        PathtoPublish: '$(build.artifactstagingdirectory)/Jellyfin.Server/Emby.Naming.dll'
+        targetPath: '$(build.artifactstagingdirectory)/Jellyfin.Server/Emby.Naming.dll'
         artifactName: 'Jellyfin.Naming'
         artifactName: 'Jellyfin.Naming'
 
 
-    - task: PublishBuildArtifacts@1
+    - task: PublishPipelineArtifact@0
       displayName: 'Publish Artifact Controller'
       displayName: 'Publish Artifact Controller'
       condition: and(eq(variables['BuildConfiguration'], 'Release'), succeeded())
       condition: and(eq(variables['BuildConfiguration'], 'Release'), succeeded())
       inputs:
       inputs:
-        PathtoPublish: '$(build.artifactstagingdirectory)/Jellyfin.Server/MediaBrowser.Controller.dll'
+        targetPath: '$(build.artifactstagingdirectory)/Jellyfin.Server/MediaBrowser.Controller.dll'
         artifactName: 'Jellyfin.Controller'
         artifactName: 'Jellyfin.Controller'
 
 
-    - task: PublishBuildArtifacts@1
+    - task: PublishPipelineArtifact@0
       displayName: 'Publish Artifact Model'
       displayName: 'Publish Artifact Model'
       condition: and(eq(variables['BuildConfiguration'], 'Release'), succeeded())
       condition: and(eq(variables['BuildConfiguration'], 'Release'), succeeded())
       inputs:
       inputs:
-        PathtoPublish: '$(build.artifactstagingdirectory)/Jellyfin.Server/MediaBrowser.Model.dll'
+        targetPath: '$(build.artifactstagingdirectory)/Jellyfin.Server/MediaBrowser.Model.dll'
         artifactName: 'Jellyfin.Model'
         artifactName: 'Jellyfin.Model'
 
 
-    - task: PublishBuildArtifacts@1
+    - task: PublishPipelineArtifact@0
       displayName: 'Publish Artifact Common'
       displayName: 'Publish Artifact Common'
       condition: and(eq(variables['BuildConfiguration'], 'Release'), succeeded())
       condition: and(eq(variables['BuildConfiguration'], 'Release'), succeeded())
       inputs:
       inputs:
-        PathtoPublish: '$(build.artifactstagingdirectory)/Jellyfin.Server/MediaBrowser.Common.dll'
+        targetPath: '$(build.artifactstagingdirectory)/Jellyfin.Server/MediaBrowser.Common.dll'
         artifactName: 'Jellyfin.Common'
         artifactName: 'Jellyfin.Common'
 
 
   - job: dotnet_compat
   - job: dotnet_compat
     displayName: Compatibility Check
     displayName: Compatibility Check
     pool:
     pool:
-      vmImage: ubuntu-16.04
+      vmImage: ubuntu-latest
     dependsOn: main_build
     dependsOn: main_build
-    condition: false #and(succeeded(), variables['System.PullRequest.PullRequestNumber']) # Only execute if the pullrequest numer is defined. (So not for normal CI builds)
+    condition: and(succeeded(), variables['System.PullRequest.PullRequestNumber']) # Only execute if the pullrequest numer is defined. (So not for normal CI builds)
     strategy:
     strategy:
       matrix:
       matrix:
         Naming:
         Naming:
@@ -118,49 +120,52 @@ jobs:
     steps:
     steps:
     - checkout: none
     - checkout: none
 
 
-    - task: DownloadBuildArtifacts@0
-      displayName: Download the Reference Assembly Build Artifact
+    - task: DownloadPipelineArtifact@2
+      displayName: Download the New Assembly Build Artifact
       inputs:
       inputs:
-        buildType: 'specific' # Options: current, specific
-        project: $(System.TeamProjectId) # Required when buildType == Specific
-        pipeline: $(System.DefinitionId) # Required when buildType == Specific, not sure if this will take a name too
-        #specificBuildWithTriggering: false # Optional
-        buildVersionToDownload: 'latestFromBranch' # Required when buildType == Specific# Options: latest, latestFromBranch, specific
-        allowPartiallySucceededBuilds: false # Optional
-        branchName: '$(System.PullRequest.TargetBranch)' # Required when buildType == Specific && BuildVersionToDownload == LatestFromBranch
-        #buildId: # Required when buildType == Specific && BuildVersionToDownload == Specific
+        source: 'current' # Options: current, specific
+        #preferTriggeringPipeline: false # Optional
         #tags: # Optional
         #tags: # Optional
-        downloadType: 'single' # Options: single, specific
-        artifactName: '$(NugetPackageName)'# Required when downloadType == Single
-        #itemPattern: '**' # Optional
-        downloadPath: '$(System.ArtifactsDirectory)/current-artifacts'
-        #parallelizationLimit: '8' # Optional
+        artifact: '$(NugetPackageName)' # Optional
+        #patterns: '**' # Optional
+        path: '$(System.ArtifactsDirectory)/new-artifacts'
+        #project: # Required when source == Specific
+        #pipeline: # Required when source == Specific
+        runVersion: 'latest' # Required when source == Specific. Options: latest, latestFromBranch, specific
+        #runBranch: 'refs/heads/master' # Required when source == Specific && runVersion == LatestFromBranch
+        #runId: # Required when source == Specific && runVersion == Specific
 
 
     - task: CopyFiles@2
     - task: CopyFiles@2
-      displayName: Copy Nuget Assembly to current-release folder
+      displayName: Copy New Assembly to new-release folder
       inputs:
       inputs:
-        sourceFolder: $(System.ArtifactsDirectory)/current-artifacts # Optional
+        sourceFolder: $(System.ArtifactsDirectory)/new-artifacts # Optional
         contents: '**/*.dll'
         contents: '**/*.dll'
-        targetFolder: $(System.ArtifactsDirectory)/current-release
+        targetFolder: $(System.ArtifactsDirectory)/new-release
         cleanTargetFolder: true # Optional
         cleanTargetFolder: true # Optional
         overWrite: true # Optional
         overWrite: true # Optional
         flattenFolders: true # Optional
         flattenFolders: true # Optional
 
 
-    - task: DownloadBuildArtifacts@0
-      displayName: Download the New Assembly Build Artifact
+    - task: DownloadPipelineArtifact@2
+      displayName: Download the Reference Assembly Build Artifact
       inputs:
       inputs:
-        buildType: 'current' # Options: current, specific
-        allowPartiallySucceededBuilds: false # Optional
-        downloadType: 'single' # Options: single, specific
-        artifactName: '$(NugetPackageName)' # Required when downloadType == Single
-        downloadPath: '$(System.ArtifactsDirectory)/new-artifacts'
+        source: 'specific' # Options: current, specific
+        #preferTriggeringPipeline: false # Optional
+        #tags: # Optional
+        artifact: '$(NugetPackageName)' # Optional
+        #patterns: '**' # Optional
+        path: '$(System.ArtifactsDirectory)/current-artifacts'
+        project: '$(System.TeamProjectId)' # Required when source == Specific
+        pipeline: '$(System.DefinitionId)' # Required when source == Specific
+        runVersion: 'latestFromBranch' # Required when source == Specific. Options: latest, latestFromBranch, specific
+        runBranch: 'refs/heads/$(System.PullRequest.TargetBranch)' # Required when source == Specific && runVersion == LatestFromBranch
+        #runId: # Required when source == Specific && runVersion == Specific
 
 
     - task: CopyFiles@2
     - task: CopyFiles@2
-      displayName: Copy Artifact Assembly to new-release folder
+      displayName: Copy Reference Assembly to current-release folder
       inputs:
       inputs:
-        sourceFolder: $(System.ArtifactsDirectory)/new-artifacts # Optional
+        sourceFolder: $(System.ArtifactsDirectory)/current-artifacts # Optional
         contents: '**/*.dll'
         contents: '**/*.dll'
-        targetFolder: $(System.ArtifactsDirectory)/new-release
+        targetFolder: $(System.ArtifactsDirectory)/current-release
         cleanTargetFolder: true # Optional
         cleanTargetFolder: true # Optional
         overWrite: true # Optional
         overWrite: true # Optional
         flattenFolders: true # Optional
         flattenFolders: true # Optional
@@ -168,7 +173,7 @@ jobs:
     - task: DownloadGitHubRelease@0
     - task: DownloadGitHubRelease@0
       displayName: Download ABI compatibility check tool from GitHub
       displayName: Download ABI compatibility check tool from GitHub
       inputs:
       inputs:
-        connection: Jellyfin GitHub
+        connection: Jellyfin Release Download
         userRepository: EraYaN/dotnet-compatibility
         userRepository: EraYaN/dotnet-compatibility
         defaultVersionType: 'latest' # Options: latest, specificVersion, specificTag
         defaultVersionType: 'latest' # Options: latest, specificVersion, specificTag
         #version: # Required when defaultVersionType != Latest
         #version: # Required when defaultVersionType != Latest
@@ -185,7 +190,7 @@ jobs:
     - task: CmdLine@2
     - task: CmdLine@2
       displayName: Execute ABI compatibility check tool
       displayName: Execute ABI compatibility check tool
       inputs:
       inputs:
-        script: 'dotnet tools/CompatibilityCheckerCoreCLI.dll current-release/$(AssemblyFileName) new-release/$(AssemblyFileName)'
+        script: 'dotnet tools/CompatibilityCheckerCoreCLI.dll current-release/$(AssemblyFileName) new-release/$(AssemblyFileName) --azure-pipelines'
         workingDirectory: $(System.ArtifactsDirectory) # Optional
         workingDirectory: $(System.ArtifactsDirectory) # Optional
         #failOnStderr: false # Optional
         #failOnStderr: false # Optional
 
 

+ 2 - 0
.gitattributes

@@ -1 +1,3 @@
+* text=auto eol=lf
+
 CONTRIBUTORS.md merge=union
 CONTRIBUTORS.md merge=union

+ 0 - 20
.github/ISSUE_TEMPLATE/enhancement-request.md

@@ -1,20 +0,0 @@
----
-name: Enhancement request
-about: Suggest an modification to an existing feature
-title: ''
-labels: enhancement
-assignees: ''
-
----
-
-**Is your feature request related to a problem? Please describe.**
-<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
-
-**Describe the solution you'd like**
-<!-- A clear and concise description of what you want to happen. -->
-
-**Describe alternatives you've considered**
-<!-- A clear and concise description of any alternative solutions or features you've considered. -->
-
-**Additional context**
-<!-- Add any other context or screenshots about the feature request here. -->

+ 0 - 14
.github/ISSUE_TEMPLATE/feature_request.md

@@ -1,14 +0,0 @@
----
-name: Feature request
-about: Suggest a new feature
-title: ''
-labels: feature
-assignees: ''
-
----
-
-**Describe the feature you'd like**
-<!-- A clear and concise description of what you want to happen. -->
-
-**Additional context**
-<!-- Add any other context or screenshots about the feature request here. -->

+ 32 - 0
.github/ISSUE_TEMPLATE/media_playback.md

@@ -0,0 +1,32 @@
+---
+name: Media playback issue
+about: Create a media playback issue report
+title: ''
+labels: mediaplayback
+assignees: ''
+
+---
+
+**Media Info of the file**
+<!-- Use the Media Info tool (set to text format, download here: https://mediaarea.net/en/MediaInfo) or copy the info from the web ui for the file with the playback issue. -->
+
+**Logs**
+<!-- Please paste any log message from during the playback issue, for example the ffmpeg command line can be very useful. -->
+
+**Stats for Nerds Screenshots**
+<!-- If available, add screenshots of the stats for nerds screen to help show the issue problem. -->
+
+**Server System (please complete the following information):**
+ - OS: [e.g. Docker on Linux, Docker on Windows, Debian, Windows]
+ - Jellyfin Version: [e.g. 10.0.1]
+ - Hardware settings & device: [e.g. NVENC on GTX1060, VAAPI on Intel i7 8700K]
+ - Reverse proxy: [e.g. no, nginx, apache, etc.]
+ - Other hardware notes: [e.g. Media mounted in CIFS/SMB share, Media mounted from Google Drive]
+ 
+**Client System (please complete the following information):**
+ - Device: [e.g. Apple iPhone XS, Xbox One S, LG OLED55C8, Samsung Galaxy Note9, Custom HTPC]
+ - OS: [e.g. iOS, Android, Windows, macOS]
+ - Client: [e.g. Web/Browser, webOS, Android, Android TV, Electron]
+ - Browser (if Web client): [e.g. Firefox, Chrome, Safari]
+ - Client and Browser Version: [e.g. 10.3.4 and 68.0]
+

+ 22 - 0
.github/stale.yml

@@ -0,0 +1,22 @@
+# Number of days of inactivity before an issue becomes stale
+daysUntilStale: 90
+# Number of days of inactivity before a stale issue is closed
+daysUntilClose: 14
+# Issues with these labels will never be considered stale
+exemptLabels:
+  - regression
+  - security
+  - dotnet-3.0-future
+  - roadmap
+  - future
+  - feature
+  - enhancement
+# Label to use when marking an issue as stale
+staleLabel: stale
+# Comment to post when marking an issue as stale. Set to `false` to disable
+markComment: >
+  Issues go stale after 90d of inactivity. Mark the issue as fresh by adding a comment or commit. Stale issues close after an additional 14d of inactivity.
+  If this issue is safe to close now please do so.
+  If you have any questions you can reach us on [Matrix or Social Media](https://jellyfin.readthedocs.io/en/latest/getting-help/).
+# Comment to post when closing a stale issue. Set to `false` to disable
+closeComment: false

+ 1 - 6
.gitignore

@@ -239,11 +239,6 @@ pip-log.txt
 ##########
 ##########
 .idea/
 .idea/
 
 
-##########
-# Visual Studio Code
-##########
-.vscode/
-
 #########################
 #########################
 # Build artifacts
 # Build artifacts
 #########################
 #########################
@@ -268,4 +263,4 @@ jellyfin_version.ini
 ci/
 ci/
 
 
 # Doxygen
 # Doxygen
-doc/
+doc/

+ 1 - 0
BDInfo/BDInfo.csproj

@@ -11,6 +11,7 @@
   <PropertyGroup>
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
     <TargetFramework>netstandard2.0</TargetFramework>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+    <GenerateDocumentationFile>true</GenerateDocumentationFile>
   </PropertyGroup>
   </PropertyGroup>
 
 
 </Project>
 </Project>

+ 5 - 1
CONTRIBUTORS.md

@@ -23,7 +23,11 @@
  - [fruhnow](https://github.com/fruhnow)
  - [fruhnow](https://github.com/fruhnow)
  - [Lynxy](https://github.com/Lynxy)
  - [Lynxy](https://github.com/Lynxy)
  - [fasheng](https://github.com/fasheng)
  - [fasheng](https://github.com/fasheng)
- - [ploughpuff](https://github.com/ploughpuff) 
+ - [ploughpuff](https://github.com/ploughpuff)
+ - [pjeanjean](https://github.com/pjeanjean)
+ - [DrPandemic](https://github.com/drpandemic)
+ - [joern-h](https://github.com/joern-h)
+ - [Khinenw](https://github.com/HelloWorld017)
  - [fhriley](https://github.com/fhriley)
  - [fhriley](https://github.com/fhriley)
 
 
 # Emby Contributors
 # Emby Contributors

+ 3 - 3
Dockerfile

@@ -21,10 +21,10 @@ RUN apt-get update \
 COPY --from=ffmpeg / /
 COPY --from=ffmpeg / /
 COPY --from=builder /jellyfin /jellyfin
 COPY --from=builder /jellyfin /jellyfin
 
 
-ARG JELLYFIN_WEB_VERSION=10.3.3
-RUN curl -L https://github.com/jellyfin/jellyfin-web/archive/v${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \
+ARG JELLYFIN_WEB_VERSION=v10.3.7
+RUN curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \
  && rm -rf /jellyfin/jellyfin-web \
  && rm -rf /jellyfin/jellyfin-web \
- && mv jellyfin-web-${JELLYFIN_WEB_VERSION} /jellyfin/jellyfin-web
+ && mv jellyfin-web-* /jellyfin/jellyfin-web
 
 
 EXPOSE 8096
 EXPOSE 8096
 VOLUME /cache /config /media
 VOLUME /cache /config /media

+ 5 - 9
Dockerfile.arm

@@ -3,11 +3,6 @@
 ARG DOTNET_VERSION=3.0
 ARG DOTNET_VERSION=3.0
 
 
 
 
-FROM multiarch/qemu-user-static:x86_64-arm as qemu
-FROM alpine as qemu_extract
-COPY --from=qemu /usr/bin qemu-arm-static.tar.gz
-RUN tar -xzvf qemu-arm-static.tar.gz
-
 FROM mcr.microsoft.com/dotnet/core/sdk:${DOTNET_VERSION} as builder
 FROM mcr.microsoft.com/dotnet/core/sdk:${DOTNET_VERSION} as builder
 WORKDIR /repo
 WORKDIR /repo
 COPY . .
 COPY . .
@@ -21,8 +16,9 @@ RUN bash -c "source deployment/common.build.sh && \
     build_jellyfin Jellyfin.Server Release linux-arm /jellyfin"
     build_jellyfin Jellyfin.Server Release linux-arm /jellyfin"
 
 
 
 
+FROM multiarch/qemu-user-static:x86_64-arm as qemu
 FROM mcr.microsoft.com/dotnet/core/runtime:${DOTNET_VERSION}-stretch-slim-arm32v7
 FROM mcr.microsoft.com/dotnet/core/runtime:${DOTNET_VERSION}-stretch-slim-arm32v7
-COPY --from=qemu_extract qemu-arm-static /usr/bin
+COPY --from=qemu /usr/bin/qemu-arm-static /usr/bin
 RUN apt-get update \
 RUN apt-get update \
  && apt-get install --no-install-recommends --no-install-suggests -y ffmpeg \
  && apt-get install --no-install-recommends --no-install-suggests -y ffmpeg \
  && rm -rf /var/lib/apt/lists/* \
  && rm -rf /var/lib/apt/lists/* \
@@ -30,10 +26,10 @@ RUN apt-get update \
  && chmod 777 /cache /config /media
  && chmod 777 /cache /config /media
 COPY --from=builder /jellyfin /jellyfin
 COPY --from=builder /jellyfin /jellyfin
 
 
-ARG JELLYFIN_WEB_VERSION=10.3.3
-RUN curl -L https://github.com/jellyfin/jellyfin-web/archive/v${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \
+ARG JELLYFIN_WEB_VERSION=v10.3.7
+RUN curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \
  && rm -rf /jellyfin/jellyfin-web \
  && rm -rf /jellyfin/jellyfin-web \
- && mv jellyfin-web-${JELLYFIN_WEB_VERSION} /jellyfin/jellyfin-web
+ && mv jellyfin-web-* /jellyfin/jellyfin-web
 
 
 EXPOSE 8096
 EXPOSE 8096
 VOLUME /cache /config /media
 VOLUME /cache /config /media

+ 5 - 10
Dockerfile.arm64

@@ -3,12 +3,6 @@
 ARG DOTNET_VERSION=3.0
 ARG DOTNET_VERSION=3.0
 
 
 
 
-FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu
-FROM alpine as qemu_extract
-COPY --from=qemu /usr/bin qemu-aarch64-static.tar.gz
-RUN tar -xzvf qemu-aarch64-static.tar.gz
-
-
 FROM mcr.microsoft.com/dotnet/core/sdk:${DOTNET_VERSION} as builder
 FROM mcr.microsoft.com/dotnet/core/sdk:${DOTNET_VERSION} as builder
 WORKDIR /repo
 WORKDIR /repo
 COPY . .
 COPY . .
@@ -22,8 +16,9 @@ RUN bash -c "source deployment/common.build.sh && \
     build_jellyfin Jellyfin.Server Release linux-arm64 /jellyfin"
     build_jellyfin Jellyfin.Server Release linux-arm64 /jellyfin"
 
 
 
 
+FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu
 FROM mcr.microsoft.com/dotnet/core/runtime:${DOTNET_VERSION}-stretch-slim-arm64v8
 FROM mcr.microsoft.com/dotnet/core/runtime:${DOTNET_VERSION}-stretch-slim-arm64v8
-COPY --from=qemu_extract qemu-aarch64-static /usr/bin
+COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin
 RUN apt-get update \
 RUN apt-get update \
  && apt-get install --no-install-recommends --no-install-suggests -y ffmpeg \
  && apt-get install --no-install-recommends --no-install-suggests -y ffmpeg \
  && rm -rf /var/lib/apt/lists/* \
  && rm -rf /var/lib/apt/lists/* \
@@ -31,10 +26,10 @@ RUN apt-get update \
  && chmod 777 /cache /config /media
  && chmod 777 /cache /config /media
 COPY --from=builder /jellyfin /jellyfin
 COPY --from=builder /jellyfin /jellyfin
 
 
-ARG JELLYFIN_WEB_VERSION=10.3.3
-RUN curl -L https://github.com/jellyfin/jellyfin-web/archive/v${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \
+ARG JELLYFIN_WEB_VERSION=v10.3.7
+RUN curl -L https://github.com/jellyfin/jellyfin-web/archive/${JELLYFIN_WEB_VERSION}.tar.gz | tar zxf - \
  && rm -rf /jellyfin/jellyfin-web \
  && rm -rf /jellyfin/jellyfin-web \
- && mv jellyfin-web-${JELLYFIN_WEB_VERSION} /jellyfin/jellyfin-web
+ && mv jellyfin-web-* /jellyfin/jellyfin-web
 
 
 EXPOSE 8096
 EXPOSE 8096
 VOLUME /cache /config /media
 VOLUME /cache /config /media

+ 2565 - 2565
Doxyfile

@@ -1,2565 +1,2565 @@
-# Doxyfile 1.8.15
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project.
-#
-# All text after a double hash (##) is considered a comment and is placed in
-# front of the TAG it is preceding.
-#
-# All text after a single hash (#) is considered a comment and will be ignored.
-# The format is:
-# TAG = value [value, ...]
-# For lists, items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (\" \").
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the configuration
-# file that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# https://www.gnu.org/software/libiconv/ for the list of possible encodings.
-# The default value is: UTF-8.
-
-DOXYFILE_ENCODING      = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
-# double-quotes, unless you are using Doxywizard) that should identify the
-# project for which the documentation is generated. This name is used in the
-# title of most generated pages and in a few other places.
-# The default value is: My Project.
-
-PROJECT_NAME           = Jellyfin
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
-# could be handy for archiving the generated documentation or if some version
-# control system is used.
-
-PROJECT_NUMBER         =
-
-# Using the PROJECT_BRIEF tag one can provide an optional one line description
-# for a project that appears at the top of each page and should give viewer a
-# quick idea about the purpose of the project. Keep the description short.
-
-PROJECT_BRIEF          = "The Free Software Media System"
-
-# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
-# in the documentation. The maximum height of the logo should not exceed 55
-# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
-# the logo to the output directory.
-
-PROJECT_LOGO           =
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
-# into which the generated documentation will be written. If a relative path is
-# entered, it will be relative to the location where doxygen was started. If
-# left blank the current directory will be used.
-
-OUTPUT_DIRECTORY       = doc
-
-# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
-# directories (in 2 levels) under the output directory of each output format and
-# will distribute the generated files over these directories. Enabling this
-# option can be useful when feeding doxygen a huge amount of source files, where
-# putting all generated files in the same directory would otherwise causes
-# performance problems for the file system.
-# The default value is: NO.
-
-CREATE_SUBDIRS         = NO
-
-# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
-# characters to appear in the names of generated files. If set to NO, non-ASCII
-# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
-# U+3044.
-# The default value is: NO.
-
-ALLOW_UNICODE_NAMES    = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
-# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
-# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
-# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
-# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
-# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
-# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
-# Ukrainian and Vietnamese.
-# The default value is: English.
-
-OUTPUT_LANGUAGE        = English
-
-# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all generated output in the proper direction.
-# Possible values are: None, LTR, RTL and Context.
-# The default value is: None.
-
-OUTPUT_TEXT_DIRECTION  = None
-
-# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
-# descriptions after the members that are listed in the file and class
-# documentation (similar to Javadoc). Set to NO to disable this.
-# The default value is: YES.
-
-BRIEF_MEMBER_DESC      = YES
-
-# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
-# description of a member or function before the detailed description
-#
-# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-# The default value is: YES.
-
-REPEAT_BRIEF           = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator that is
-# used to form the text in various listings. Each string in this list, if found
-# as the leading text of the brief description, will be stripped from the text
-# and the result, after processing the whole list, is used as the annotated
-# text. Otherwise, the brief description is used as-is. If left blank, the
-# following values are used ($name is automatically replaced with the name of
-# the entity):The $name class, The $name widget, The $name file, is, provides,
-# specifies, contains, represents, a, an and the.
-
-ABBREVIATE_BRIEF       = "The $name class" \
-                         "The $name widget" \
-                         "The $name file" \
-                         is \
-                         provides \
-                         specifies \
-                         contains \
-                         represents \
-                         a \
-                         an \
-                         the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# doxygen will generate a detailed section even if there is only a brief
-# description.
-# The default value is: NO.
-
-ALWAYS_DETAILED_SEC    = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-# The default value is: NO.
-
-INLINE_INHERITED_MEMB  = NO
-
-# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path
-# before files name in the file list and in the header files. If set to NO the
-# shortest path that makes the file name unique will be used
-# The default value is: YES.
-
-FULL_PATH_NAMES        = YES
-
-# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
-# Stripping is only done if one of the specified strings matches the left-hand
-# part of the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the path to
-# strip.
-#
-# Note that you can specify absolute paths here, but also relative paths, which
-# will be relative from the directory where doxygen is started.
-# This tag requires that the tag FULL_PATH_NAMES is set to YES.
-
-STRIP_FROM_PATH        =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
-# path mentioned in the documentation of a class, which tells the reader which
-# header file to include in order to use a class. If left blank only the name of
-# the header file containing the class definition is used. Otherwise one should
-# specify the list of include paths that are normally passed to the compiler
-# using the -I flag.
-
-STRIP_FROM_INC_PATH    =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
-# less readable) file names. This can be useful is your file systems doesn't
-# support long names like on DOS, Mac, or CD-ROM.
-# The default value is: NO.
-
-SHORT_NAMES            = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
-# first line (until the first dot) of a Javadoc-style comment as the brief
-# description. If set to NO, the Javadoc-style will behave just like regular Qt-
-# style comments (thus requiring an explicit @brief command for a brief
-# description.)
-# The default value is: NO.
-
-JAVADOC_AUTOBRIEF      = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
-# line (until the first dot) of a Qt-style comment as the brief description. If
-# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
-# requiring an explicit \brief command for a brief description.)
-# The default value is: NO.
-
-QT_AUTOBRIEF           = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
-# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
-# a brief description. This used to be the default behavior. The new default is
-# to treat a multi-line C++ comment block as a detailed description. Set this
-# tag to YES if you prefer the old behavior instead.
-#
-# Note that setting this tag to YES also means that rational rose comments are
-# not recognized any more.
-# The default value is: NO.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
-# documentation from any documented member that it re-implements.
-# The default value is: YES.
-
-INHERIT_DOCS           = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
-# page for each member. If set to NO, the documentation of a member will be part
-# of the file/class/namespace that contains it.
-# The default value is: NO.
-
-SEPARATE_MEMBER_PAGES  = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
-# uses this value to replace tabs by spaces in code fragments.
-# Minimum value: 1, maximum value: 16, default value: 4.
-
-TAB_SIZE               = 4
-
-# This tag can be used to specify a number of aliases that act as commands in
-# the documentation. An alias has the form:
-# name=value
-# For example adding
-# "sideeffect=@par Side Effects:\n"
-# will allow you to put the command \sideeffect (or @sideeffect) in the
-# documentation, which will result in a user-defined paragraph with heading
-# "Side Effects:". You can put \n's in the value part of an alias to insert
-# newlines (in the resulting output). You can put ^^ in the value part of an
-# alias to insert a newline as if a physical newline was in the original file.
-# When you need a literal { or } or , in the value part of an alias you have to
-# escape them by means of a backslash (\), this can lead to conflicts with the
-# commands \{ and \} for these it is advised to use the version @{ and @} or use
-# a double escape (\\{ and \\})
-
-ALIASES                =
-
-# This tag can be used to specify a number of word-keyword mappings (TCL only).
-# A mapping has the form "name=value". For example adding "class=itcl::class"
-# will allow you to use the command class in the itcl::class meaning.
-
-TCL_SUBST              =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
-# only. Doxygen will then generate output that is more tailored for C. For
-# instance, some of the names that are used will be different. The list of all
-# members will be omitted, etc.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_FOR_C  = NO
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
-# Python sources only. Doxygen will then generate output that is more tailored
-# for that language. For instance, namespaces will be presented as packages,
-# qualified scopes will look different, etc.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_JAVA   = YES
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources. Doxygen will then generate output that is tailored for Fortran.
-# The default value is: NO.
-
-OPTIMIZE_FOR_FORTRAN   = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for VHDL.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_VHDL   = NO
-
-# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice
-# sources only. Doxygen will then generate output that is more tailored for that
-# language. For instance, namespaces will be presented as modules, types will be
-# separated into more groups, etc.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_SLICE  = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it
-# parses. With this tag you can assign which parser to use for a given
-# extension. Doxygen has a built-in mapping, but you can override or extend it
-# using this tag. The format is ext=language, where ext is a file extension, and
-# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
-# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice,
-# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
-# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
-# tries to guess whether the code is fixed or free formatted code, this is the
-# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat
-# .inc files as Fortran files (default is PHP), and .f files as C (default is
-# Fortran), use: inc=Fortran f=C.
-#
-# Note: For files without extension you can use no_extension as a placeholder.
-#
-# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
-# the files are not read by doxygen.
-
-EXTENSION_MAPPING      =
-
-# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
-# according to the Markdown format, which allows for more readable
-# documentation. See https://daringfireball.net/projects/markdown/ for details.
-# The output of markdown processing is further processed by doxygen, so you can
-# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
-# case of backward compatibilities issues.
-# The default value is: YES.
-
-MARKDOWN_SUPPORT       = YES
-
-# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
-# to that level are automatically included in the table of contents, even if
-# they do not have an id attribute.
-# Note: This feature currently applies only to Markdown headings.
-# Minimum value: 0, maximum value: 99, default value: 0.
-# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
-
-TOC_INCLUDE_HEADINGS   = 0
-
-# When enabled doxygen tries to link words that correspond to documented
-# classes, or namespaces to their corresponding documentation. Such a link can
-# be prevented in individual cases by putting a % sign in front of the word or
-# globally by setting AUTOLINK_SUPPORT to NO.
-# The default value is: YES.
-
-AUTOLINK_SUPPORT       = YES
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should set this
-# tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string);
-# versus func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-# The default value is: NO.
-
-BUILTIN_STL_SUPPORT    = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-# The default value is: NO.
-
-CPP_CLI_SUPPORT        = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
-# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen
-# will parse them like normal C++ but will assume all classes use public instead
-# of private inheritance when no explicit protection keyword is present.
-# The default value is: NO.
-
-SIP_SUPPORT            = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate
-# getter and setter methods for a property. Setting this option to YES will make
-# doxygen to replace the get and set methods by a property in the documentation.
-# This will only work if the methods are indeed getting or setting a simple
-# type. If this is not the case, or you want to show the methods anyway, you
-# should set this option to NO.
-# The default value is: YES.
-
-IDL_PROPERTY_SUPPORT   = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-# The default value is: NO.
-
-DISTRIBUTE_GROUP_DOC   = NO
-
-# If one adds a struct or class to a group and this option is enabled, then also
-# any nested class or struct is added to the same group. By default this option
-# is disabled and one has to add nested compounds explicitly via \ingroup.
-# The default value is: NO.
-
-GROUP_NESTED_COMPOUNDS = NO
-
-# Set the SUBGROUPING tag to YES to allow class member groups of the same type
-# (for instance a group of public functions) to be put as a subgroup of that
-# type (e.g. under the Public Functions section). Set it to NO to prevent
-# subgrouping. Alternatively, this can be done per class using the
-# \nosubgrouping command.
-# The default value is: YES.
-
-SUBGROUPING            = YES
-
-# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
-# are shown inside the group in which they are included (e.g. using \ingroup)
-# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
-# and RTF).
-#
-# Note that this feature does not work in combination with
-# SEPARATE_MEMBER_PAGES.
-# The default value is: NO.
-
-INLINE_GROUPED_CLASSES = NO
-
-# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
-# with only public data fields or simple typedef fields will be shown inline in
-# the documentation of the scope in which they are defined (i.e. file,
-# namespace, or group documentation), provided this scope is documented. If set
-# to NO, structs, classes, and unions are shown on a separate page (for HTML and
-# Man pages) or section (for LaTeX and RTF).
-# The default value is: NO.
-
-INLINE_SIMPLE_STRUCTS  = NO
-
-# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
-# enum is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically be
-# useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-# The default value is: NO.
-
-TYPEDEF_HIDES_STRUCT   = NO
-
-# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
-# cache is used to resolve symbols given their name and scope. Since this can be
-# an expensive process and often the same symbol appears multiple times in the
-# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
-# doxygen will become slower. If the cache is too large, memory is wasted. The
-# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
-# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
-# symbols. At the end of a run doxygen will report the cache usage and suggest
-# the optimal cache size from a speed point of view.
-# Minimum value: 0, maximum value: 9, default value: 0.
-
-LOOKUP_CACHE_SIZE      = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in
-# documentation are documented, even if no documentation was available. Private
-# class members and static file members will be hidden unless the
-# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
-# Note: This will also disable the warnings about undocumented members that are
-# normally produced when WARNINGS is set to YES.
-# The default value is: NO.
-
-EXTRACT_ALL            = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
-# be included in the documentation.
-# The default value is: NO.
-
-EXTRACT_PRIVATE        = NO
-
-# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
-# scope will be included in the documentation.
-# The default value is: NO.
-
-EXTRACT_PACKAGE        = NO
-
-# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
-# included in the documentation.
-# The default value is: NO.
-
-EXTRACT_STATIC         = NO
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
-# locally in source files will be included in the documentation. If set to NO,
-# only classes defined in header files are included. Does not have any effect
-# for Java sources.
-# The default value is: YES.
-
-EXTRACT_LOCAL_CLASSES  = YES
-
-# This flag is only useful for Objective-C code. If set to YES, local methods,
-# which are defined in the implementation section but not in the interface are
-# included in the documentation. If set to NO, only methods in the interface are
-# included.
-# The default value is: NO.
-
-EXTRACT_LOCAL_METHODS  = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base name of
-# the file that contains the anonymous namespace. By default anonymous namespace
-# are hidden.
-# The default value is: NO.
-
-EXTRACT_ANON_NSPACES   = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
-# undocumented members inside documented classes or files. If set to NO these
-# members will be included in the various overviews, but no documentation
-# section is generated. This option has no effect if EXTRACT_ALL is enabled.
-# The default value is: NO.
-
-HIDE_UNDOC_MEMBERS     = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy. If set
-# to NO, these classes will be included in the various overviews. This option
-# has no effect if EXTRACT_ALL is enabled.
-# The default value is: NO.
-
-HIDE_UNDOC_CLASSES     = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
-# (class|struct|union) declarations. If set to NO, these declarations will be
-# included in the documentation.
-# The default value is: NO.
-
-HIDE_FRIEND_COMPOUNDS  = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
-# documentation blocks found inside the body of a function. If set to NO, these
-# blocks will be appended to the function's detailed documentation block.
-# The default value is: NO.
-
-HIDE_IN_BODY_DOCS      = NO
-
-# The INTERNAL_DOCS tag determines if documentation that is typed after a
-# \internal command is included. If the tag is set to NO then the documentation
-# will be excluded. Set it to YES to include the internal documentation.
-# The default value is: NO.
-
-INTERNAL_DOCS          = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
-# names in lower-case letters. If set to YES, upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-# The default value is: system dependent.
-
-CASE_SENSE_NAMES       = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
-# their full class and namespace scopes in the documentation. If set to YES, the
-# scope will be hidden.
-# The default value is: NO.
-
-HIDE_SCOPE_NAMES       = NO
-
-# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
-# append additional text to a page's title, such as Class Reference. If set to
-# YES the compound reference will be hidden.
-# The default value is: NO.
-
-HIDE_COMPOUND_REFERENCE= NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
-# the files that are included by a file in the documentation of that file.
-# The default value is: YES.
-
-SHOW_INCLUDE_FILES     = YES
-
-# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
-# grouped member an include statement to the documentation, telling the reader
-# which file to include in order to use the member.
-# The default value is: NO.
-
-SHOW_GROUPED_MEMB_INC  = NO
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
-# files with double quotes in the documentation rather than with sharp brackets.
-# The default value is: NO.
-
-FORCE_LOCAL_INCLUDES   = NO
-
-# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
-# documentation for inline members.
-# The default value is: YES.
-
-INLINE_INFO            = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
-# (detailed) documentation of file and class members alphabetically by member
-# name. If set to NO, the members will appear in declaration order.
-# The default value is: YES.
-
-SORT_MEMBER_DOCS       = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
-# descriptions of file, namespace and class members alphabetically by member
-# name. If set to NO, the members will appear in declaration order. Note that
-# this will also influence the order of the classes in the class list.
-# The default value is: NO.
-
-SORT_BRIEF_DOCS        = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
-# (brief and detailed) documentation of class members so that constructors and
-# destructors are listed first. If set to NO the constructors will appear in the
-# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
-# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
-# member documentation.
-# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
-# detailed member documentation.
-# The default value is: NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
-# of group names into alphabetical order. If set to NO the group names will
-# appear in their defined order.
-# The default value is: NO.
-
-SORT_GROUP_NAMES       = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
-# fully-qualified names, including namespaces. If set to NO, the class list will
-# be sorted only by class name, not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the alphabetical
-# list.
-# The default value is: NO.
-
-SORT_BY_SCOPE_NAME     = NO
-
-# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
-# type resolution of all parameters of a function it will reject a match between
-# the prototype and the implementation of a member function even if there is
-# only one candidate or it is obvious which candidate to choose by doing a
-# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
-# accept a match between prototype and implementation in such cases.
-# The default value is: NO.
-
-STRICT_PROTO_MATCHING  = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo
-# list. This list is created by putting \todo commands in the documentation.
-# The default value is: YES.
-
-GENERATE_TODOLIST      = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
-# list. This list is created by putting \test commands in the documentation.
-# The default value is: YES.
-
-GENERATE_TESTLIST      = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug
-# list. This list is created by putting \bug commands in the documentation.
-# The default value is: YES.
-
-GENERATE_BUGLIST       = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)
-# the deprecated list. This list is created by putting \deprecated commands in
-# the documentation.
-# The default value is: YES.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional documentation
-# sections, marked by \if <section_label> ... \endif and \cond <section_label>
-# ... \endcond blocks.
-
-ENABLED_SECTIONS       =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
-# initial value of a variable or macro / define can have for it to appear in the
-# documentation. If the initializer consists of more lines than specified here
-# it will be hidden. Use a value of 0 to hide initializers completely. The
-# appearance of the value of individual variables and macros / defines can be
-# controlled using \showinitializer or \hideinitializer command in the
-# documentation regardless of this setting.
-# Minimum value: 0, maximum value: 10000, default value: 30.
-
-MAX_INITIALIZER_LINES  = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
-# the bottom of the documentation of classes and structs. If set to YES, the
-# list will mention the files that were used to generate the documentation.
-# The default value is: YES.
-
-SHOW_USED_FILES        = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
-# will remove the Files entry from the Quick Index and from the Folder Tree View
-# (if specified).
-# The default value is: YES.
-
-SHOW_FILES             = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
-# page. This will remove the Namespaces entry from the Quick Index and from the
-# Folder Tree View (if specified).
-# The default value is: YES.
-
-SHOW_NAMESPACES        = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command command input-file, where command is the value of the
-# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
-# by doxygen. Whatever the program writes to standard output is used as the file
-# version. For an example see the documentation.
-
-FILE_VERSION_FILTER    =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
-# by doxygen. The layout file controls the global structure of the generated
-# output files in an output format independent way. To create the layout file
-# that represents doxygen's defaults, run doxygen with the -l option. You can
-# optionally specify a file name after the option, if omitted DoxygenLayout.xml
-# will be used as the name of the layout file.
-#
-# Note that if you run doxygen from a directory containing a file called
-# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
-# tag is left empty.
-
-LAYOUT_FILE            =
-
-# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
-# the reference definitions. This must be a list of .bib files. The .bib
-# extension is automatically appended if omitted. This requires the bibtex tool
-# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info.
-# For LaTeX the style of the bibliography can be controlled using
-# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
-# search path. See also \cite for info how to create references.
-
-CITE_BIB_FILES         =
-
-#---------------------------------------------------------------------------
-# Configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated to
-# standard output by doxygen. If QUIET is set to YES this implies that the
-# messages are off.
-# The default value is: NO.
-
-QUIET                  = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
-# this implies that the warnings are on.
-#
-# Tip: Turn warnings on while writing the documentation.
-# The default value is: YES.
-
-WARNINGS               = YES
-
-# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
-# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
-# will automatically be disabled.
-# The default value is: YES.
-
-WARN_IF_UNDOCUMENTED   = YES
-
-# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some parameters
-# in a documented function, or documenting parameters that don't exist or using
-# markup commands wrongly.
-# The default value is: YES.
-
-WARN_IF_DOC_ERROR      = YES
-
-# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
-# are documented, but have no documentation for their parameters or return
-# value. If set to NO, doxygen will only warn about wrong or incomplete
-# parameter documentation, but not about the absence of documentation. If
-# EXTRACT_ALL is set to YES then this flag will automatically be disabled.
-# The default value is: NO.
-
-WARN_NO_PARAMDOC       = NO
-
-# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
-# a warning is encountered.
-# The default value is: NO.
-
-WARN_AS_ERROR          = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that doxygen
-# can produce. The string should contain the $file, $line, and $text tags, which
-# will be replaced by the file and line number from which the warning originated
-# and the warning text. Optionally the format may contain $version, which will
-# be replaced by the version of the file (if it could be obtained via
-# FILE_VERSION_FILTER)
-# The default value is: $file:$line: $text.
-
-WARN_FORMAT            = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning and error
-# messages should be written. If left blank the output is written to standard
-# error (stderr).
-
-WARN_LOGFILE           =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag is used to specify the files and/or directories that contain
-# documented source files. You may enter file names like myfile.cpp or
-# directories like /usr/src/myproject. Separate the files or directories with
-# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
-# Note: If this tag is empty the current directory is searched.
-
-INPUT                  =
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
-# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
-# documentation (see: https://www.gnu.org/software/libiconv/) for the list of
-# possible encodings.
-# The default value is: UTF-8.
-
-INPUT_ENCODING         = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
-# *.h) to filter out the source-files in the directories.
-#
-# Note that for custom extensions or not directly supported extensions you also
-# need to set EXTENSION_MAPPING for the extension otherwise the files are not
-# read by doxygen.
-#
-# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
-# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
-# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
-# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
-# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice.
-
-FILE_PATTERNS          = *.c \
-                         *.cc \
-                         *.cxx \
-                         *.cpp \
-                         *.c++ \
-                         *.java \
-                         *.ii \
-                         *.ixx \
-                         *.ipp \
-                         *.i++ \
-                         *.inl \
-                         *.idl \
-                         *.ddl \
-                         *.odl \
-                         *.h \
-                         *.hh \
-                         *.hxx \
-                         *.hpp \
-                         *.h++ \
-                         *.cs \
-                         *.d \
-                         *.php \
-                         *.php4 \
-                         *.php5 \
-                         *.phtml \
-                         *.inc \
-                         *.m \
-                         *.markdown \
-                         *.md \
-                         *.mm \
-                         *.dox \
-                         *.py \
-                         *.pyw \
-                         *.f90 \
-                         *.f95 \
-                         *.f03 \
-                         *.f08 \
-                         *.f \
-                         *.for \
-                         *.tcl \
-                         *.vhd \
-                         *.vhdl \
-                         *.ucf \
-                         *.qsf \
-                         *.ice
-
-# The RECURSIVE tag can be used to specify whether or not subdirectories should
-# be searched for input files as well.
-# The default value is: NO.
-
-RECURSIVE              = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should be
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-#
-# Note that relative paths are relative to the directory from which doxygen is
-# run.
-
-EXCLUDE                =
-
-# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
-# directories that are symbolic links (a Unix file system feature) are excluded
-# from the input.
-# The default value is: NO.
-
-EXCLUDE_SYMLINKS       = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories.
-#
-# Note that the wildcards are matched against the file with absolute path, so to
-# exclude all test directories for example use the pattern */test/*
-
-EXCLUDE_PATTERNS       =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-#
-# Note that the wildcards are matched against the file with absolute path, so to
-# exclude all test directories use the pattern */test/*
-
-EXCLUDE_SYMBOLS        =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or directories
-# that contain example code fragments that are included (see the \include
-# command).
-
-EXAMPLE_PATH           =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
-# *.h) to filter out the source-files in the directories. If left blank all
-# files are included.
-
-EXAMPLE_PATTERNS       = *
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude commands
-# irrespective of the value of the RECURSIVE tag.
-# The default value is: NO.
-
-EXAMPLE_RECURSIVE      = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or directories
-# that contain images that are to be included in the documentation (see the
-# \image command).
-
-IMAGE_PATH             =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command:
-#
-# <filter> <input-file>
-#
-# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
-# name of an input file. Doxygen will then use the output that the filter
-# program writes to standard output. If FILTER_PATTERNS is specified, this tag
-# will be ignored.
-#
-# Note that the filter must not add or remove lines; it is applied before the
-# code is scanned, but not when the output code is generated. If lines are added
-# or removed, the anchors will not be placed correctly.
-#
-# Note that for custom extensions or not directly supported extensions you also
-# need to set EXTENSION_MAPPING for the extension otherwise the files are not
-# properly processed by doxygen.
-
-INPUT_FILTER           =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form: pattern=filter
-# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
-# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
-# patterns match the file name, INPUT_FILTER is applied.
-#
-# Note that for custom extensions or not directly supported extensions you also
-# need to set EXTENSION_MAPPING for the extension otherwise the files are not
-# properly processed by doxygen.
-
-FILTER_PATTERNS        =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will also be used to filter the input files that are used for
-# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
-# The default value is: NO.
-
-FILTER_SOURCE_FILES    = NO
-
-# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
-# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
-# it is also possible to disable source filtering for a specific pattern using
-# *.ext= (so without naming a filter).
-# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
-
-FILTER_SOURCE_PATTERNS =
-
-# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
-# is part of the input, its contents will be placed on the main page
-# (index.html). This can be useful if you have a project on for instance GitHub
-# and want to reuse the introduction page also for the doxygen output.
-
-USE_MDFILE_AS_MAINPAGE = ./README.md
-
-#---------------------------------------------------------------------------
-# Configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
-# generated. Documented entities will be cross-referenced with these sources.
-#
-# Note: To get rid of all source code in the generated output, make sure that
-# also VERBATIM_HEADERS is set to NO.
-# The default value is: NO.
-
-SOURCE_BROWSER         = YES
-
-# Setting the INLINE_SOURCES tag to YES will include the body of functions,
-# classes and enums directly into the documentation.
-# The default value is: NO.
-
-INLINE_SOURCES         = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
-# special comment blocks from generated source code fragments. Normal C, C++ and
-# Fortran comments will always remain visible.
-# The default value is: YES.
-
-STRIP_CODE_COMMENTS    = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
-# entity all documented functions referencing it will be listed.
-# The default value is: NO.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES then for each documented function
-# all documented entities called/used by that function will be listed.
-# The default value is: NO.
-
-REFERENCES_RELATION    = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
-# to YES then the hyperlinks from functions in REFERENCES_RELATION and
-# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
-# link to the documentation.
-# The default value is: YES.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
-# source code will show a tooltip with additional information such as prototype,
-# brief description and links to the definition and documentation. Since this
-# will make the HTML file larger and loading of large files a bit slower, you
-# can opt to disable this feature.
-# The default value is: YES.
-# This tag requires that the tag SOURCE_BROWSER is set to YES.
-
-SOURCE_TOOLTIPS        = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code will
-# point to the HTML generated by the htags(1) tool instead of doxygen built-in
-# source browser. The htags tool is part of GNU's global source tagging system
-# (see https://www.gnu.org/software/global/global.html). You will need version
-# 4.8.6 or higher.
-#
-# To use it do the following:
-# - Install the latest version of global
-# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file
-# - Make sure the INPUT points to the root of the source tree
-# - Run doxygen as normal
-#
-# Doxygen will invoke htags (and that will in turn invoke gtags), so these
-# tools must be available from the command line (i.e. in the search path).
-#
-# The result: instead of the source browser generated by doxygen, the links to
-# source code will now point to the output of htags.
-# The default value is: NO.
-# This tag requires that the tag SOURCE_BROWSER is set to YES.
-
-USE_HTAGS              = NO
-
-# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
-# verbatim copy of the header file for each class for which an include is
-# specified. Set to NO to disable this.
-# See also: Section \class.
-# The default value is: YES.
-
-VERBATIM_HEADERS       = YES
-
-# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
-# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
-# cost of reduced performance. This can be particularly helpful with template
-# rich C++ code for which doxygen's built-in parser lacks the necessary type
-# information.
-# Note: The availability of this option depends on whether or not doxygen was
-# generated with the -Duse_libclang=ON option for CMake.
-# The default value is: NO.
-
-CLANG_ASSISTED_PARSING = NO
-
-# If clang assisted parsing is enabled you can provide the compiler with command
-# line options that you would normally use when invoking the compiler. Note that
-# the include paths will already be set by doxygen for the files and directories
-# specified with INPUT and INCLUDE_PATH.
-# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
-
-CLANG_OPTIONS          =
-
-# If clang assisted parsing is enabled you can provide the clang parser with the
-# path to the compilation database (see:
-# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files
-# were built. This is equivalent to specifying the "-p" option to a clang tool,
-# such as clang-check. These options will then be passed to the parser.
-# Note: The availability of this option depends on whether or not doxygen was
-# generated with the -Duse_libclang=ON option for CMake.
-
-CLANG_DATABASE_PATH    =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
-# compounds will be generated. Enable this if the project contains a lot of
-# classes, structs, unions or interfaces.
-# The default value is: YES.
-
-ALPHABETICAL_INDEX     = YES
-
-# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
-# which the alphabetical index list will be split.
-# Minimum value: 1, maximum value: 20, default value: 5.
-# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-
-COLS_IN_ALPHA_INDEX    = 5
-
-# In case all classes in a project start with a common prefix, all classes will
-# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
-# can be used to specify a prefix (or a list of prefixes) that should be ignored
-# while generating the index headers.
-# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-
-IGNORE_PREFIX          =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
-# The default value is: YES.
-
-GENERATE_HTML          = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: html.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_OUTPUT            = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
-# generated HTML page (for example: .htm, .php, .asp).
-# The default value is: .html.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_FILE_EXTENSION    = .html
-
-# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
-# each generated HTML page. If the tag is left blank doxygen will generate a
-# standard header.
-#
-# To get valid HTML the header file that includes any scripts and style sheets
-# that doxygen needs, which is dependent on the configuration options used (e.g.
-# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
-# default header using
-# doxygen -w html new_header.html new_footer.html new_stylesheet.css
-# YourConfigFile
-# and then modify the file new_header.html. See also section "Doxygen usage"
-# for information on how to generate the default header that doxygen normally
-# uses.
-# Note: The header is subject to change so you typically have to regenerate the
-# default header when upgrading to a newer version of doxygen. For a description
-# of the possible markers and block names see the documentation.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_HEADER            =
-
-# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
-# generated HTML page. If the tag is left blank doxygen will generate a standard
-# footer. See HTML_HEADER for more information on how to generate a default
-# footer and what special commands can be used inside the footer. See also
-# section "Doxygen usage" for information on how to generate the default footer
-# that doxygen normally uses.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_FOOTER            =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
-# sheet that is used by each HTML page. It can be used to fine-tune the look of
-# the HTML output. If left blank doxygen will generate a default style sheet.
-# See also section "Doxygen usage" for information on how to generate the style
-# sheet that doxygen normally uses.
-# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
-# it is more robust and this tag (HTML_STYLESHEET) will in the future become
-# obsolete.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_STYLESHEET        =
-
-# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
-# cascading style sheets that are included after the standard style sheets
-# created by doxygen. Using this option one can overrule certain style aspects.
-# This is preferred over using HTML_STYLESHEET since it does not replace the
-# standard style sheet and is therefore more robust against future updates.
-# Doxygen will copy the style sheet files to the output directory.
-# Note: The order of the extra style sheet files is of importance (e.g. the last
-# style sheet in the list overrules the setting of the previous ones in the
-# list). For an example see the documentation.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_EXTRA_STYLESHEET  =
-
-# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
-# other source files which should be copied to the HTML output directory. Note
-# that these files will be copied to the base HTML output directory. Use the
-# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
-# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
-# files will be copied as-is; there are no commands or markers available.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_EXTRA_FILES       =
-
-# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
-# will adjust the colors in the style sheet and background images according to
-# this color. Hue is specified as an angle on a colorwheel, see
-# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
-# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
-# purple, and 360 is red again.
-# Minimum value: 0, maximum value: 359, default value: 220.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_HUE    = 195
-
-# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
-# in the HTML output. For a value of 0 the output will use grayscales only. A
-# value of 255 will produce the most vivid colors.
-# Minimum value: 0, maximum value: 255, default value: 100.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_SAT    = 100
-
-# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
-# luminance component of the colors in the HTML output. Values below 100
-# gradually make the output lighter, whereas values above 100 make the output
-# darker. The value divided by 100 is the actual gamma applied, so 80 represents
-# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
-# change the gamma.
-# Minimum value: 40, maximum value: 240, default value: 80.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_GAMMA  = 86
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting this
-# to YES can help to show when doxygen was last run and thus if the
-# documentation is up to date.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_TIMESTAMP         = NO
-
-# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
-# documentation will contain a main index with vertical navigation menus that
-# are dynamically created via Javascript. If disabled, the navigation index will
-# consists of multiple levels of tabs that are statically embedded in every HTML
-# page. Disable this option to support browsers that do not have Javascript,
-# like the Qt help browser.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_DYNAMIC_MENUS     = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_DYNAMIC_SECTIONS  = NO
-
-# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
-# shown in the various tree structured indices initially; the user can expand
-# and collapse entries dynamically later on. Doxygen will expand the tree to
-# such a level that at most the specified number of entries are visible (unless
-# a fully collapsed tree already exceeds this amount). So setting the number of
-# entries 1 will produce a full collapsed tree by default. 0 is a special value
-# representing an infinite number of entries and will result in a full expanded
-# tree by default.
-# Minimum value: 0, maximum value: 9999, default value: 100.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_INDEX_NUM_ENTRIES = 100
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files will be
-# generated that can be used as input for Apple's Xcode 3 integrated development
-# environment (see: https://developer.apple.com/xcode/), introduced with OSX
-# 10.5 (Leopard). To create a documentation set, doxygen will generate a
-# Makefile in the HTML output directory. Running make will produce the docset in
-# that directory and running make install will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
-# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy
-# genXcode/_index.html for more information.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_DOCSET        = NO
-
-# This tag determines the name of the docset feed. A documentation feed provides
-# an umbrella under which multiple documentation sets from a single provider
-# (such as a company or product suite) can be grouped.
-# The default value is: Doxygen generated docs.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_FEEDNAME        = "Doxygen generated docs"
-
-# This tag specifies a string that should uniquely identify the documentation
-# set bundle. This should be a reverse domain-name style string, e.g.
-# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_BUNDLE_ID       = org.doxygen.Project
-
-# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
-# the documentation publisher. This should be a reverse domain-name style
-# string, e.g. com.mycompany.MyDocSet.documentation.
-# The default value is: org.doxygen.Publisher.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
-
-# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
-# The default value is: Publisher.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_PUBLISHER_NAME  = Publisher
-
-# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
-# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
-# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
-# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on
-# Windows.
-#
-# The HTML Help Workshop contains a compiler that can convert all HTML output
-# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
-# files are now used as the Windows 98 help format, and will replace the old
-# Windows help format (.hlp) on all Windows platforms in the future. Compressed
-# HTML files also contain an index, a table of contents, and you can search for
-# words in the documentation. The HTML workshop also contains a viewer for
-# compressed HTML files.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_HTMLHELP      = NO
-
-# The CHM_FILE tag can be used to specify the file name of the resulting .chm
-# file. You can add a path in front of the file if the result should not be
-# written to the html output directory.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-CHM_FILE               =
-
-# The HHC_LOCATION tag can be used to specify the location (absolute path
-# including file name) of the HTML help compiler (hhc.exe). If non-empty,
-# doxygen will try to run the HTML help compiler on the generated index.hhp.
-# The file has to be specified with full path.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-HHC_LOCATION           =
-
-# The GENERATE_CHI flag controls if a separate .chi index file is generated
-# (YES) or that it should be included in the master .chm file (NO).
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-GENERATE_CHI           = NO
-
-# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc)
-# and project file content.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-CHM_INDEX_ENCODING     =
-
-# The BINARY_TOC flag controls whether a binary table of contents is generated
-# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
-# enables the Previous and Next buttons.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-BINARY_TOC             = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members to
-# the table of contents of the HTML help documentation and to the tree view.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-TOC_EXPAND             = NO
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
-# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
-# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
-# (.qch) of the generated HTML documentation.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_QHP           = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
-# the file name of the resulting .qch file. The path specified is relative to
-# the HTML output folder.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QCH_FILE               =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
-# Project output. For more information please see Qt Help Project / Namespace
-# (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_NAMESPACE          = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
-# Help Project output. For more information please see Qt Help Project / Virtual
-# Folders (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-
-# folders).
-# The default value is: doc.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_VIRTUAL_FOLDER     = doc
-
-# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
-# filter to add. For more information please see Qt Help Project / Custom
-# Filters (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
-# filters).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_CUST_FILTER_NAME   =
-
-# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
-# custom filter to add. For more information please see Qt Help Project / Custom
-# Filters (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
-# filters).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_CUST_FILTER_ATTRS  =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
-# project's filter section matches. Qt Help Project / Filter Attributes (see:
-# http://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_SECT_FILTER_ATTRS  =
-
-# The QHG_LOCATION tag can be used to specify the location of Qt's
-# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
-# generated .qhp file.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHG_LOCATION           =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
-# generated, together with the HTML files, they form an Eclipse help plugin. To
-# install this plugin and make it available under the help contents menu in
-# Eclipse, the contents of the directory containing the HTML and XML files needs
-# to be copied into the plugins directory of eclipse. The name of the directory
-# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
-# After copying Eclipse needs to be restarted before the help appears.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_ECLIPSEHELP   = NO
-
-# A unique identifier for the Eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have this
-# name. Each documentation set should have its own identifier.
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
-
-ECLIPSE_DOC_ID         = org.doxygen.Project
-
-# If you want full control over the layout of the generated HTML pages it might
-# be necessary to disable the index and replace it with your own. The
-# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
-# of each HTML page. A value of NO enables the index and the value YES disables
-# it. Since the tabs in the index contain the same information as the navigation
-# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-DISABLE_INDEX          = NO
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information. If the tag
-# value is set to YES, a side panel will be generated containing a tree-like
-# index structure (just like the one that is generated for HTML Help). For this
-# to work a browser that supports JavaScript, DHTML, CSS and frames is required
-# (i.e. any modern browser). Windows users are probably better off using the
-# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
-# further fine-tune the look of the index. As an example, the default style
-# sheet generated by doxygen has an example that shows how to put an image at
-# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
-# the same information as the tab index, you could consider setting
-# DISABLE_INDEX to YES when enabling this option.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_TREEVIEW      = YES
-
-# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
-# doxygen will group on one line in the generated HTML documentation.
-#
-# Note that a value of 0 will completely suppress the enum values from appearing
-# in the overview section.
-# Minimum value: 0, maximum value: 20, default value: 4.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-ENUM_VALUES_PER_LINE   = 4
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
-# to set the initial width (in pixels) of the frame in which the tree is shown.
-# Minimum value: 0, maximum value: 1500, default value: 250.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-TREEVIEW_WIDTH         = 250
-
-# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
-# external symbols imported via tag files in a separate window.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-EXT_LINKS_IN_WINDOW    = NO
-
-# Use this tag to change the font size of LaTeX formulas included as images in
-# the HTML documentation. When you change the font size after a successful
-# doxygen run you need to manually remove any form_*.png images from the HTML
-# output directory to force them to be regenerated.
-# Minimum value: 8, maximum value: 50, default value: 10.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-FORMULA_FONTSIZE       = 10
-
-# Use the FORMULA_TRANSPARENT tag to determine whether or not the images
-# generated for formulas are transparent PNGs. Transparent PNGs are not
-# supported properly for IE 6.0, but are supported on all modern browsers.
-#
-# Note that when changing this option you need to delete any form_*.png files in
-# the HTML output directory before the changes have effect.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-FORMULA_TRANSPARENT    = YES
-
-# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
-# https://www.mathjax.org) which uses client side Javascript for the rendering
-# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
-# installed or if you want to formulas look prettier in the HTML output. When
-# enabled you may also need to install MathJax separately and configure the path
-# to it using the MATHJAX_RELPATH option.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-USE_MATHJAX            = NO
-
-# When MathJax is enabled you can set the default output format to be used for
-# the MathJax output. See the MathJax site (see:
-# http://docs.mathjax.org/en/latest/output.html) for more details.
-# Possible values are: HTML-CSS (which is slower, but has the best
-# compatibility), NativeMML (i.e. MathML) and SVG.
-# The default value is: HTML-CSS.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_FORMAT         = HTML-CSS
-
-# When MathJax is enabled you need to specify the location relative to the HTML
-# output directory using the MATHJAX_RELPATH option. The destination directory
-# should contain the MathJax.js script. For instance, if the mathjax directory
-# is located at the same level as the HTML output directory, then
-# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
-# Content Delivery Network so you can quickly see the result without installing
-# MathJax. However, it is strongly recommended to install a local copy of
-# MathJax from https://www.mathjax.org before deployment.
-# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_RELPATH        = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/
-
-# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
-# extension names that should be enabled during MathJax rendering. For example
-# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_EXTENSIONS     =
-
-# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
-# of code that will be used on startup of the MathJax code. See the MathJax site
-# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
-# example see the documentation.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_CODEFILE       =
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
-# the HTML output. The underlying search engine uses javascript and DHTML and
-# should work on any modern browser. Note that when using HTML help
-# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
-# there is already a search function so this one should typically be disabled.
-# For large projects the javascript based search engine can be slow, then
-# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
-# search using the keyboard; to jump to the search box use <access key> + S
-# (what the <access key> is depends on the OS and browser, but it is typically
-# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
-# key> to jump into the search results window, the results can be navigated
-# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
-# the search. The filter options can be selected when the cursor is inside the
-# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
-# to select a filter and <Enter> or <escape> to activate or cancel the filter
-# option.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-SEARCHENGINE           = YES
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
-# implemented using a web server instead of a web client using Javascript. There
-# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
-# setting. When disabled, doxygen will generate a PHP script for searching and
-# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
-# and searching needs to be provided by external tools. See the section
-# "External Indexing and Searching" for details.
-# The default value is: NO.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SERVER_BASED_SEARCH    = NO
-
-# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
-# script for searching. Instead the search results are written to an XML file
-# which needs to be processed by an external indexer. Doxygen will invoke an
-# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
-# search results.
-#
-# Doxygen ships with an example indexer (doxyindexer) and search engine
-# (doxysearch.cgi) which are based on the open source search engine library
-# Xapian (see: https://xapian.org/).
-#
-# See the section "External Indexing and Searching" for details.
-# The default value is: NO.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTERNAL_SEARCH        = NO
-
-# The SEARCHENGINE_URL should point to a search engine hosted by a web server
-# which will return the search results when EXTERNAL_SEARCH is enabled.
-#
-# Doxygen ships with an example indexer (doxyindexer) and search engine
-# (doxysearch.cgi) which are based on the open source search engine library
-# Xapian (see: https://xapian.org/). See the section "External Indexing and
-# Searching" for details.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SEARCHENGINE_URL       =
-
-# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
-# search data is written to a file for indexing by an external tool. With the
-# SEARCHDATA_FILE tag the name of this file can be specified.
-# The default file is: searchdata.xml.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SEARCHDATA_FILE        = searchdata.xml
-
-# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
-# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
-# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
-# projects and redirect the results back to the right project.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTERNAL_SEARCH_ID     =
-
-# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
-# projects other than the one defined by this configuration file, but that are
-# all added to the same external search index. Each project needs to have a
-# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
-# to a relative location where the documentation can be found. The format is:
-# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTRA_SEARCH_MAPPINGS  =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
-# The default value is: YES.
-
-GENERATE_LATEX         = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: latex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_OUTPUT           = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked.
-#
-# Note that when not enabling USE_PDFLATEX the default is latex when enabling
-# USE_PDFLATEX the default is pdflatex and when in the later case latex is
-# chosen this is overwritten by pdflatex. For specific output languages the
-# default can have been set differently, this depends on the implementation of
-# the output language.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_CMD_NAME         =
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
-# index for LaTeX.
-# Note: This tag is used in the Makefile / make.bat.
-# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file
-# (.tex).
-# The default file is: makeindex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-MAKEINDEX_CMD_NAME     = makeindex
-
-# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to
-# generate index for LaTeX.
-# Note: This tag is used in the generated output file (.tex).
-# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat.
-# The default value is: \makeindex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_MAKEINDEX_CMD    = \makeindex
-
-# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
-# documents. This may be useful for small projects and may help to save some
-# trees in general.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-COMPACT_LATEX          = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used by the
-# printer.
-# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
-# 14 inches) and executive (7.25 x 10.5 inches).
-# The default value is: a4.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-PAPER_TYPE             = a4
-
-# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
-# that should be included in the LaTeX output. The package can be specified just
-# by its name or with the correct syntax as to be used with the LaTeX
-# \usepackage command. To get the times font for instance you can specify :
-# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times}
-# To use the option intlimits with the amsmath package you can specify:
-# EXTRA_PACKAGES=[intlimits]{amsmath}
-# If left blank no extra packages will be included.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-EXTRA_PACKAGES         =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
-# generated LaTeX document. The header should contain everything until the first
-# chapter. If it is left blank doxygen will generate a standard header. See
-# section "Doxygen usage" for information on how to let doxygen write the
-# default header to a separate file.
-#
-# Note: Only use a user-defined header if you know what you are doing! The
-# following commands have a special meaning inside the header: $title,
-# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
-# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
-# string, for the replacement values of the other commands the user is referred
-# to HTML_HEADER.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_HEADER           =
-
-# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
-# generated LaTeX document. The footer should contain everything after the last
-# chapter. If it is left blank doxygen will generate a standard footer. See
-# LATEX_HEADER for more information on how to generate a default footer and what
-# special commands can be used inside the footer.
-#
-# Note: Only use a user-defined footer if you know what you are doing!
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_FOOTER           =
-
-# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
-# LaTeX style sheets that are included after the standard style sheets created
-# by doxygen. Using this option one can overrule certain style aspects. Doxygen
-# will copy the style sheet files to the output directory.
-# Note: The order of the extra style sheet files is of importance (e.g. the last
-# style sheet in the list overrules the setting of the previous ones in the
-# list).
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_EXTRA_STYLESHEET =
-
-# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
-# other source files which should be copied to the LATEX_OUTPUT output
-# directory. Note that the files will be copied as-is; there are no commands or
-# markers available.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_EXTRA_FILES      =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
-# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
-# contain links (just like the HTML output) instead of page references. This
-# makes the output suitable for online browsing using a PDF viewer.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-PDF_HYPERLINKS         = YES
-
-# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
-# the PDF file directly from the LaTeX files. Set this option to YES, to get a
-# higher quality PDF documentation.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-USE_PDFLATEX           = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
-# command to the generated LaTeX files. This will instruct LaTeX to keep running
-# if errors occur, instead of asking the user for help. This option is also used
-# when generating formulas in HTML.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_BATCHMODE        = NO
-
-# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
-# index chapters (such as File Index, Compound Index, etc.) in the output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_HIDE_INDICES     = NO
-
-# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
-# code with syntax highlighting in the LaTeX output.
-#
-# Note that which sources are shown also depends on other settings such as
-# SOURCE_BROWSER.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_SOURCE_CODE      = NO
-
-# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
-# bibliography, e.g. plainnat, or ieeetr. See
-# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
-# The default value is: plain.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_BIB_STYLE        = plain
-
-# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
-# page will contain the date and time when the page was generated. Setting this
-# to NO can help when comparing the output of multiple runs.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_TIMESTAMP        = NO
-
-# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)
-# path from which the emoji images will be read. If a relative path is entered,
-# it will be relative to the LATEX_OUTPUT directory. If left blank the
-# LATEX_OUTPUT directory will be used.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_EMOJI_DIRECTORY  =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The
-# RTF output is optimized for Word 97 and may not look too pretty with other RTF
-# readers/editors.
-# The default value is: NO.
-
-GENERATE_RTF           = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: rtf.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_OUTPUT             = rtf
-
-# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF
-# documents. This may be useful for small projects and may help to save some
-# trees in general.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-COMPACT_RTF            = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
-# contain hyperlink fields. The RTF file will contain links (just like the HTML
-# output) instead of page references. This makes the output suitable for online
-# browsing using Word or some other Word compatible readers that support those
-# fields.
-#
-# Note: WordPad (write) and others do not support links.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_HYPERLINKS         = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# configuration file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-#
-# See also section "Doxygen usage" for information on how to generate the
-# default style sheet that doxygen normally uses.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_STYLESHEET_FILE    =
-
-# Set optional variables used in the generation of an RTF document. Syntax is
-# similar to doxygen's configuration file. A template extensions file can be
-# generated using doxygen -e rtf extensionFile.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_EXTENSIONS_FILE    =
-
-# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
-# with syntax highlighting in the RTF output.
-#
-# Note that which sources are shown also depends on other settings such as
-# SOURCE_BROWSER.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_SOURCE_CODE        = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for
-# classes and files.
-# The default value is: NO.
-
-GENERATE_MAN           = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it. A directory man3 will be created inside the directory specified by
-# MAN_OUTPUT.
-# The default directory is: man.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_OUTPUT             = man
-
-# The MAN_EXTENSION tag determines the extension that is added to the generated
-# man pages. In case the manual section does not start with a number, the number
-# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
-# optional.
-# The default value is: .3.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_EXTENSION          = .3
-
-# The MAN_SUBDIR tag determines the name of the directory created within
-# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
-# MAN_EXTENSION with the initial . removed.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_SUBDIR             =
-
-# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
-# will generate one additional man file for each entity documented in the real
-# man page(s). These additional files only source the real man page, but without
-# them the man command would be unable to find the correct page.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_LINKS              = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that
-# captures the structure of the code including all documentation.
-# The default value is: NO.
-
-GENERATE_XML           = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: xml.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_OUTPUT             = xml
-
-# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
-# listings (including syntax highlighting and cross-referencing information) to
-# the XML output. Note that enabling this will significantly increase the size
-# of the XML output.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_PROGRAMLISTING     = YES
-
-# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include
-# namespace members in file scope as well, matching the HTML output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_NS_MEMB_FILE_SCOPE = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the DOCBOOK output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files
-# that can be used to generate PDF.
-# The default value is: NO.
-
-GENERATE_DOCBOOK       = NO
-
-# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
-# front of it.
-# The default directory is: docbook.
-# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
-
-DOCBOOK_OUTPUT         = docbook
-
-# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
-# program listings (including syntax highlighting and cross-referencing
-# information) to the DOCBOOK output. Note that enabling this will significantly
-# increase the size of the DOCBOOK output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
-
-DOCBOOK_PROGRAMLISTING = NO
-
-#---------------------------------------------------------------------------
-# Configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
-# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures
-# the structure of the code including all documentation. Note that this feature
-# is still experimental and incomplete at the moment.
-# The default value is: NO.
-
-GENERATE_AUTOGEN_DEF   = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module
-# file that captures the structure of the code including all documentation.
-#
-# Note that this feature is still experimental and incomplete at the moment.
-# The default value is: NO.
-
-GENERATE_PERLMOD       = NO
-
-# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary
-# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
-# output from the Perl module output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_LATEX          = NO
-
-# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely
-# formatted so it can be parsed by a human reader. This is useful if you want to
-# understand what is going on. On the other hand, if this tag is set to NO, the
-# size of the Perl module output will be much smaller and Perl will parse it
-# just the same.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_PRETTY         = YES
-
-# The names of the make variables in the generated doxyrules.make file are
-# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
-# so different doxyrules.make files included by the same Makefile don't
-# overwrite each other's variables.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
-# C-preprocessor directives found in the sources and include files.
-# The default value is: YES.
-
-ENABLE_PREPROCESSING   = YES
-
-# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
-# in the source code. If set to NO, only conditional compilation will be
-# performed. Macro expansion can be done in a controlled way by setting
-# EXPAND_ONLY_PREDEF to YES.
-# The default value is: NO.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-MACRO_EXPANSION        = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
-# the macro expansion is limited to the macros specified with the PREDEFINED and
-# EXPAND_AS_DEFINED tags.
-# The default value is: NO.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-EXPAND_ONLY_PREDEF     = NO
-
-# If the SEARCH_INCLUDES tag is set to YES, the include files in the
-# INCLUDE_PATH will be searched if a #include is found.
-# The default value is: YES.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-SEARCH_INCLUDES        = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by the
-# preprocessor.
-# This tag requires that the tag SEARCH_INCLUDES is set to YES.
-
-INCLUDE_PATH           =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will be
-# used.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-INCLUDE_FILE_PATTERNS  =
-
-# The PREDEFINED tag can be used to specify one or more macro names that are
-# defined before the preprocessor is started (similar to the -D option of e.g.
-# gcc). The argument of the tag is a list of macros of the form: name or
-# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
-# is assumed. To prevent a macro definition from being undefined via #undef or
-# recursively expanded use the := operator instead of the = operator.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-PREDEFINED             =
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
-# tag can be used to specify a list of macro names that should be expanded. The
-# macro definition that is found in the sources will be used. Use the PREDEFINED
-# tag if you want to use a different macro definition that overrules the
-# definition found in the source code.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-EXPAND_AS_DEFINED      =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
-# remove all references to function-like macros that are alone on a line, have
-# an all uppercase name, and do not end with a semicolon. Such function macros
-# are typically used for boiler-plate code, and will confuse the parser if not
-# removed.
-# The default value is: YES.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-SKIP_FUNCTION_MACROS   = YES
-
-#---------------------------------------------------------------------------
-# Configuration options related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES tag can be used to specify one or more tag files. For each tag
-# file the location of the external documentation should be added. The format of
-# a tag file without this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where loc1 and loc2 can be relative or absolute paths or URLs. See the
-# section "Linking to external documentation" for more information about the use
-# of tag files.
-# Note: Each tag file must have a unique name (where the name does NOT include
-# the path). If a tag file is not located in the directory in which doxygen is
-# run, you must also specify the path to the tagfile here.
-
-TAGFILES               =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
-# tag file that is based on the input files it reads. See section "Linking to
-# external documentation" for more information about the usage of tag files.
-
-GENERATE_TAGFILE       =
-
-# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
-# the class index. If set to NO, only the inherited external classes will be
-# listed.
-# The default value is: NO.
-
-ALLEXTERNALS           = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will be
-# listed.
-# The default value is: YES.
-
-EXTERNAL_GROUPS        = YES
-
-# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in
-# the related pages index. If set to NO, only the current project's pages will
-# be listed.
-# The default value is: YES.
-
-EXTERNAL_PAGES         = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of 'which perl').
-# The default file (with absolute path) is: /usr/bin/perl.
-
-PERL_PATH              = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
-# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
-# NO turns the diagrams off. Note that this option also works with HAVE_DOT
-# disabled, but it is recommended to install and use dot, since it yields more
-# powerful graphs.
-# The default value is: YES.
-
-CLASS_DIAGRAMS         = YES
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see:
-# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH            =
-
-# You can include diagrams made with dia in doxygen documentation. Doxygen will
-# then run dia to produce the diagram and insert it in the documentation. The
-# DIA_PATH tag allows you to specify the directory where the dia binary resides.
-# If left empty dia is assumed to be found in the default search path.
-
-DIA_PATH               =
-
-# If set to YES the inheritance and collaboration graphs will hide inheritance
-# and usage relations if the target is undocumented or is not a class.
-# The default value is: YES.
-
-HIDE_UNDOC_RELATIONS   = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz (see:
-# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
-# Bell Labs. The other options in this section have no effect if this option is
-# set to NO
-# The default value is: NO.
-
-HAVE_DOT               = NO
-
-# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
-# to run in parallel. When set to 0 doxygen will base this on the number of
-# processors available in the system. You can set it explicitly to a value
-# larger than 0 to get control over the balance between CPU load and processing
-# speed.
-# Minimum value: 0, maximum value: 32, default value: 0.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_NUM_THREADS        = 0
-
-# When you want a differently looking font in the dot files that doxygen
-# generates you can specify the font name using DOT_FONTNAME. You need to make
-# sure dot is able to find the font, which can be done by putting it in a
-# standard location or by setting the DOTFONTPATH environment variable or by
-# setting DOT_FONTPATH to the directory containing the font.
-# The default value is: Helvetica.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_FONTNAME           = Helvetica
-
-# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
-# dot graphs.
-# Minimum value: 4, maximum value: 24, default value: 10.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_FONTSIZE           = 10
-
-# By default doxygen will tell dot to use the default font as specified with
-# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
-# the path where dot can find it using this tag.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_FONTPATH           =
-
-# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
-# each documented class showing the direct and indirect inheritance relations.
-# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-CLASS_GRAPH            = YES
-
-# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
-# graph for each documented class showing the direct and indirect implementation
-# dependencies (inheritance, containment, and class references variables) of the
-# class with other documented classes.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-COLLABORATION_GRAPH    = YES
-
-# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
-# groups, showing the direct groups dependencies.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-GROUP_GRAPHS           = YES
-
-# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-UML_LOOK               = NO
-
-# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
-# class node. If there are many fields or methods and many nodes the graph may
-# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
-# number of items for each type to make the size more manageable. Set this to 0
-# for no limit. Note that the threshold may be exceeded by 50% before the limit
-# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
-# but if the number exceeds 15, the total amount of fields shown is limited to
-# 10.
-# Minimum value: 0, maximum value: 100, default value: 10.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-UML_LIMIT_NUM_FIELDS   = 10
-
-# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
-# collaboration graphs will show the relations between templates and their
-# instances.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-TEMPLATE_RELATIONS     = NO
-
-# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
-# YES then doxygen will generate a graph for each documented file showing the
-# direct and indirect include dependencies of the file with other documented
-# files.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-INCLUDE_GRAPH          = YES
-
-# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
-# set to YES then doxygen will generate a graph for each documented file showing
-# the direct and indirect include dependencies of the file with other documented
-# files.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-INCLUDED_BY_GRAPH      = YES
-
-# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
-# dependency graph for every global function or class method.
-#
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable call graphs for selected
-# functions only using the \callgraph command. Disabling a call graph can be
-# accomplished by means of the command \hidecallgraph.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-CALL_GRAPH             = NO
-
-# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
-# dependency graph for every global function or class method.
-#
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable caller graphs for selected
-# functions only using the \callergraph command. Disabling a caller graph can be
-# accomplished by means of the command \hidecallergraph.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-CALLER_GRAPH           = NO
-
-# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
-# hierarchy of all classes instead of a textual one.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-GRAPHICAL_HIERARCHY    = YES
-
-# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
-# dependencies a directory has on other directories in a graphical way. The
-# dependency relations are determined by the #include relations between the
-# files in the directories.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DIRECTORY_GRAPH        = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. For an explanation of the image formats see the section
-# output formats in the documentation of the dot tool (Graphviz (see:
-# http://www.graphviz.org/)).
-# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
-# to make the SVG files visible in IE 9+ (other browsers do not have this
-# requirement).
-# Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo,
-# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
-# png:gdiplus:gdiplus.
-# The default value is: png.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_IMAGE_FORMAT       = png
-
-# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
-# enable generation of interactive SVG images that allow zooming and panning.
-#
-# Note that this requires a modern browser other than Internet Explorer. Tested
-# and working are Firefox, Chrome, Safari, and Opera.
-# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
-# the SVG files visible. Older versions of IE do not have SVG support.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-INTERACTIVE_SVG        = NO
-
-# The DOT_PATH tag can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_PATH               =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the \dotfile
-# command).
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOTFILE_DIRS           =
-
-# The MSCFILE_DIRS tag can be used to specify one or more directories that
-# contain msc files that are included in the documentation (see the \mscfile
-# command).
-
-MSCFILE_DIRS           =
-
-# The DIAFILE_DIRS tag can be used to specify one or more directories that
-# contain dia files that are included in the documentation (see the \diafile
-# command).
-
-DIAFILE_DIRS           =
-
-# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
-# path where java can find the plantuml.jar file. If left blank, it is assumed
-# PlantUML is not used or called during a preprocessing step. Doxygen will
-# generate a warning when it encounters a \startuml command in this case and
-# will not generate output for the diagram.
-
-PLANTUML_JAR_PATH      =
-
-# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
-# configuration file for plantuml.
-
-PLANTUML_CFG_FILE      =
-
-# When using plantuml, the specified paths are searched for files specified by
-# the !include statement in a plantuml block.
-
-PLANTUML_INCLUDE_PATH  =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
-# that will be shown in the graph. If the number of nodes in a graph becomes
-# larger than this value, doxygen will truncate the graph, which is visualized
-# by representing a node as a red box. Note that doxygen if the number of direct
-# children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
-# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-# Minimum value: 0, maximum value: 10000, default value: 50.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_GRAPH_MAX_NODES    = 50
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
-# generated by dot. A depth value of 3 means that only nodes reachable from the
-# root by following a path via at most 3 edges will be shown. Nodes that lay
-# further from the root node will be omitted. Note that setting this option to 1
-# or 2 may greatly reduce the computation time needed for large code bases. Also
-# note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-# Minimum value: 0, maximum value: 1000, default value: 0.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-MAX_DOT_GRAPH_DEPTH    = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not seem
-# to support this out of the box.
-#
-# Warning: Depending on the platform used, enabling this option may lead to
-# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
-# read).
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_TRANSPARENT        = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10) support
-# this, this feature is disabled by default.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_MULTI_TARGETS      = NO
-
-# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
-# explaining the meaning of the various boxes and arrows in the dot generated
-# graphs.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-GENERATE_LEGEND        = YES
-
-# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
-# files that are used to generate the various graphs.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_CLEANUP            = YES
+# Doxyfile 1.8.15
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the configuration
+# file that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# https://www.gnu.org/software/libiconv/ for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME           = Jellyfin
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER         =
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          = "The Free Software Media System"
+
+# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
+# in the documentation. The maximum height of the logo should not exceed 55
+# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
+# the logo to the output directory.
+
+PROJECT_LOGO           =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = doc
+
+# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS         = NO
+
+# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
+# characters to appear in the names of generated files. If set to NO, non-ASCII
+# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
+# U+3044.
+# The default value is: NO.
+
+ALLOW_UNICODE_NAMES    = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE        = English
+
+# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all generated output in the proper direction.
+# Possible values are: None, LTR, RTL and Context.
+# The default value is: None.
+
+OUTPUT_TEXT_DIRECTION  = None
+
+# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES        = YES
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH        =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH    =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
+# page for each member. If set to NO, the documentation of a member will be part
+# of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE               = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines (in the resulting output). You can put ^^ in the value part of an
+# alias to insert a newline as if a physical newline was in the original file.
+# When you need a literal { or } or , in the value part of an alias you have to
+# escape them by means of a backslash (\), this can lead to conflicts with the
+# commands \{ and \} for these it is advised to use the version @{ and @} or use
+# a double escape (\\{ and \\})
+
+ALIASES                =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST              =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA   = YES
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice
+# sources only. Doxygen will then generate output that is more tailored for that
+# language. For instance, namespaces will be presented as modules, types will be
+# separated into more groups, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_SLICE  = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice,
+# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
+# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
+# tries to guess whether the code is fixed or free formatted code, this is the
+# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat
+# .inc files as Fortran files (default is PHP), and .f files as C (default is
+# Fortran), use: inc=Fortran f=C.
+#
+# Note: For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING      =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See https://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT       = YES
+
+# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
+# to that level are automatically included in the table of contents, even if
+# they do not have an id attribute.
+# Note: This feature currently applies only to Markdown headings.
+# Minimum value: 0, maximum value: 99, default value: 0.
+# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
+
+TOC_INCLUDE_HEADINGS   = 0
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by putting a % sign in front of the word or
+# globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT       = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# If one adds a struct or class to a group and this option is enabled, then also
+# any nested class or struct is added to the same group. By default this option
+# is disabled and one has to add nested compounds explicitly via \ingroup.
+# The default value is: NO.
+
+GROUP_NESTED_COMPOUNDS = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING            = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS  = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO,
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. If set to YES, local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO, only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO, these classes will be included in the various overviews. This option
+# has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO, these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO, these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES, upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES       = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES, the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
+# append additional text to a page's title, such as Class Reference. If set to
+# YES the compound reference will be hidden.
+# The default value is: NO.
+
+HIDE_COMPOUND_REFERENCE= NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC  = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo
+# list. This list is created by putting \todo commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
+# list. This list is created by putting \test commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES, the
+# list will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES        = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE            =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. See also \cite for info how to create references.
+
+CITE_BIB_FILES         =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS               = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO, doxygen will only warn about wrong or incomplete
+# parameter documentation, but not about the absence of documentation. If
+# EXTRACT_ALL is set to YES then this flag will automatically be disabled.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC       = NO
+
+# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
+# a warning is encountered.
+# The default value is: NO.
+
+WARN_AS_ERROR          = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE           =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
+# Note: If this tag is empty the current directory is searched.
+
+INPUT                  =
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: https://www.gnu.org/software/libiconv/) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# read by doxygen.
+#
+# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
+# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
+# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
+# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
+# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice.
+
+FILE_PATTERNS          = *.c \
+                         *.cc \
+                         *.cxx \
+                         *.cpp \
+                         *.c++ \
+                         *.java \
+                         *.ii \
+                         *.ixx \
+                         *.ipp \
+                         *.i++ \
+                         *.inl \
+                         *.idl \
+                         *.ddl \
+                         *.odl \
+                         *.h \
+                         *.hh \
+                         *.hxx \
+                         *.hpp \
+                         *.h++ \
+                         *.cs \
+                         *.d \
+                         *.php \
+                         *.php4 \
+                         *.php5 \
+                         *.phtml \
+                         *.inc \
+                         *.m \
+                         *.markdown \
+                         *.md \
+                         *.mm \
+                         *.dox \
+                         *.py \
+                         *.pyw \
+                         *.f90 \
+                         *.f95 \
+                         *.f03 \
+                         *.f08 \
+                         *.f \
+                         *.for \
+                         *.tcl \
+                         *.vhd \
+                         *.vhdl \
+                         *.ucf \
+                         *.qsf \
+                         *.ice
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE                =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS        =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH           =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS       = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# properly processed by doxygen.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# properly processed by doxygen.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE = ./README.md
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# entity all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS        = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see https://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS       = YES
+
+# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
+# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
+# cost of reduced performance. This can be particularly helpful with template
+# rich C++ code for which doxygen's built-in parser lacks the necessary type
+# information.
+# Note: The availability of this option depends on whether or not doxygen was
+# generated with the -Duse_libclang=ON option for CMake.
+# The default value is: NO.
+
+CLANG_ASSISTED_PARSING = NO
+
+# If clang assisted parsing is enabled you can provide the compiler with command
+# line options that you would normally use when invoking the compiler. Note that
+# the include paths will already be set by doxygen for the files and directories
+# specified with INPUT and INCLUDE_PATH.
+# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
+
+CLANG_OPTIONS          =
+
+# If clang assisted parsing is enabled you can provide the clang parser with the
+# path to the compilation database (see:
+# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files
+# were built. This is equivalent to specifying the "-p" option to a clang tool,
+# such as clang-check. These options will then be passed to the parser.
+# Note: The availability of this option depends on whether or not doxygen was
+# generated with the -Duse_libclang=ON option for CMake.
+
+CLANG_DATABASE_PATH    =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX     = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER            =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET        =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
+# cascading style sheets that are included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefore more robust against future updates.
+# Doxygen will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list). For an example see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET  =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES       =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the style sheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, see
+# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE    = 195
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA  = 86
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to YES can help to show when doxygen was last run and thus if the
+# documentation is up to date.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP         = NO
+
+# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
+# documentation will contain a main index with vertical navigation menus that
+# are dynamically created via Javascript. If disabled, the navigation index will
+# consists of multiple levels of tabs that are statically embedded in every HTML
+# page. Disable this option to support browsers that do not have Javascript,
+# like the Qt help browser.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_MENUS     = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: https://developer.apple.com/xcode/), introduced with OSX
+# 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy
+# genXcode/_index.html for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET        = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP      = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE               =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler (hhc.exe). If non-empty,
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION           =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated
+# (YES) or that it should be included in the master .chm file (NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI           = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING     =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated
+# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
+# enables the Previous and Next buttons.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# http://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX          = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW      = YES
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH         = 250
+
+# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANSPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# https://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX            = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT         = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from https://www.mathjax.org before deployment.
+# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH        = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS     =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE       =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
+# setting. When disabled, doxygen will generate a PHP script for searching and
+# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
+# and searching needs to be provided by external tools. See the section
+# "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH    = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: https://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH        = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: https://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL       =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE        = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID     =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS  =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when not enabling USE_PDFLATEX the default is latex when enabling
+# USE_PDFLATEX the default is pdflatex and when in the later case latex is
+# chosen this is overwritten by pdflatex. For specific output languages the
+# default can have been set differently, this depends on the implementation of
+# the output language.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME         =
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# Note: This tag is used in the Makefile / make.bat.
+# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file
+# (.tex).
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to
+# generate index for LaTeX.
+# Note: This tag is used in the generated output file (.tex).
+# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat.
+# The default value is: \makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_MAKEINDEX_CMD    = \makeindex
+
+# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE             = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. The package can be specified just
+# by its name or with the correct syntax as to be used with the LaTeX
+# \usepackage command. To get the times font for instance you can specify :
+# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times}
+# To use the option intlimits with the amsmath package you can specify:
+# EXTRA_PACKAGES=[intlimits]{amsmath}
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES         =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
+# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
+# string, for the replacement values of the other commands the user is referred
+# to HTML_HEADER.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER           =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer. See
+# LATEX_HEADER for more information on how to generate a default footer and what
+# special commands can be used inside the footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER           =
+
+# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
+# LaTeX style sheets that are included after the standard style sheets created
+# by doxygen. Using this option one can overrule certain style aspects. Doxygen
+# will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_STYLESHEET =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES      =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES, to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE        = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES     = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE      = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE        = plain
+
+# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_TIMESTAMP        = NO
+
+# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)
+# path from which the emoji images will be read. If a relative path is entered,
+# it will be relative to the LATEX_OUTPUT directory. If left blank the
+# LATEX_OUTPUT directory will be used.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EMOJI_DIRECTORY  =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# configuration file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's configuration file. A template extensions file can be
+# generated using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE    =
+
+# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
+# with syntax highlighting in the RTF output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_SOURCE_CODE        = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION          = .3
+
+# The MAN_SUBDIR tag determines the name of the directory created within
+# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
+# MAN_EXTENSION with the initial . removed.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_SUBDIR             =
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT             = xml
+
+# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING     = YES
+
+# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include
+# namespace members in file scope as well, matching the HTML output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_NS_MEMB_FILE_SCOPE = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK       = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT         = docbook
+
+# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
+# program listings (including syntax highlighting and cross-referencing
+# information) to the DOCBOOK output. Note that enabling this will significantly
+# increase the size of the DOCBOOK output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_PROGRAMLISTING = NO
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
+# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures
+# the structure of the code including all documentation. Note that this feature
+# is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO, the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
+# in the source code. If set to NO, only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES, the include files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED             =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED      =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all references to function-like macros that are alone on a line, have
+# an all uppercase name, and do not end with a semicolon. Such function macros
+# are typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have a unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
+# the class index. If set to NO, only the inherited external classes will be
+# listed.
+# The default value is: NO.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS        = YES
+
+# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES         = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of 'which perl').
+# The default file (with absolute path) is: /usr/bin/perl.
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see:
+# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH            =
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH               =
+
+# If set to YES the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: NO.
+
+HAVE_DOT               = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS        = 0
+
+# When you want a differently looking font in the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME           = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH           =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK               = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH          = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command. Disabling a call graph can be
+# accomplished by means of the command \hidecallgraph.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command. Disabling a caller graph can be
+# accomplished by means of the command \hidecallergraph.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. For an explanation of the image formats see the section
+# output formats in the documentation of the dot tool (Graphviz (see:
+# http://www.graphviz.org/)).
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo,
+# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
+# png:gdiplus:gdiplus.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT       = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG        = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH               =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS           =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS           =
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_DIRS           =
+
+# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
+# path where java can find the plantuml.jar file. If left blank, it is assumed
+# PlantUML is not used or called during a preprocessing step. Doxygen will
+# generate a warning when it encounters a \startuml command in this case and
+# will not generate output for the diagram.
+
+PLANTUML_JAR_PATH      =
+
+# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
+# configuration file for plantuml.
+
+PLANTUML_CFG_FILE      =
+
+# When using plantuml, the specified paths are searched for files specified by
+# the !include statement in a plantuml block.
+
+PLANTUML_INCLUDE_PATH  =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP            = YES

+ 1 - 0
DvdLib/DvdLib.csproj

@@ -11,6 +11,7 @@
   <PropertyGroup>
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
     <TargetFramework>netstandard2.0</TargetFramework>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+    <GenerateDocumentationFile>true</GenerateDocumentationFile>
   </PropertyGroup>
   </PropertyGroup>
 
 
 </Project>
 </Project>

+ 7 - 27
Emby.Dlna/Didl/DidlBuilder.cs

@@ -181,19 +181,6 @@ namespace Emby.Dlna.Didl
             writer.WriteFullEndElement();
             writer.WriteFullEndElement();
         }
         }
 
 
-        private string GetMimeType(string input)
-        {
-            var mime = MimeTypes.GetMimeType(input);
-
-            // TODO: Instead of being hard-coded here, this should probably be moved into all of the existing profiles
-            if (string.Equals(mime, "video/mp2t", StringComparison.OrdinalIgnoreCase))
-            {
-                mime = "video/mpeg";
-            }
-
-            return mime;
-        }
-
         private void AddVideoResource(DlnaOptions options, XmlWriter writer, BaseItem video, string deviceId, Filter filter, StreamInfo streamInfo = null)
         private void AddVideoResource(DlnaOptions options, XmlWriter writer, BaseItem video, string deviceId, Filter filter, StreamInfo streamInfo = null)
         {
         {
             if (streamInfo == null)
             if (streamInfo == null)
@@ -384,7 +371,7 @@ namespace Emby.Dlna.Didl
             var filename = url.Substring(0, url.IndexOf('?'));
             var filename = url.Substring(0, url.IndexOf('?'));
 
 
             var mimeType = mediaProfile == null || string.IsNullOrEmpty(mediaProfile.MimeType)
             var mimeType = mediaProfile == null || string.IsNullOrEmpty(mediaProfile.MimeType)
-               ? GetMimeType(filename)
+               ? MimeTypes.GetMimeType(filename)
                : mediaProfile.MimeType;
                : mediaProfile.MimeType;
 
 
             writer.WriteAttributeString("protocolInfo", string.Format(
             writer.WriteAttributeString("protocolInfo", string.Format(
@@ -520,7 +507,7 @@ namespace Emby.Dlna.Didl
             var filename = url.Substring(0, url.IndexOf('?'));
             var filename = url.Substring(0, url.IndexOf('?'));
 
 
             var mimeType = mediaProfile == null || string.IsNullOrEmpty(mediaProfile.MimeType)
             var mimeType = mediaProfile == null || string.IsNullOrEmpty(mediaProfile.MimeType)
-                ? GetMimeType(filename)
+                ? MimeTypes.GetMimeType(filename)
                 : mediaProfile.MimeType;
                 : mediaProfile.MimeType;
 
 
             var contentFeatures = new ContentFeatureBuilder(_profile).BuildAudioHeader(streamInfo.Container,
             var contentFeatures = new ContentFeatureBuilder(_profile).BuildAudioHeader(streamInfo.Container,
@@ -545,17 +532,10 @@ namespace Emby.Dlna.Didl
         }
         }
 
 
         public static bool IsIdRoot(string id)
         public static bool IsIdRoot(string id)
-        {
-            if (string.IsNullOrWhiteSpace(id)
+            => string.IsNullOrWhiteSpace(id)
                 || string.Equals(id, "0", StringComparison.OrdinalIgnoreCase)
                 || string.Equals(id, "0", StringComparison.OrdinalIgnoreCase)
                 // Samsung sometimes uses 1 as root
                 // Samsung sometimes uses 1 as root
-                || string.Equals(id, "1", StringComparison.OrdinalIgnoreCase))
-            {
-                return true;
-            }
-
-            return false;
-        }
+                || string.Equals(id, "1", StringComparison.OrdinalIgnoreCase);
 
 
         public void WriteFolderElement(XmlWriter writer, BaseItem folder, StubType? stubType, BaseItem context, int childCount, Filter filter, string requestedId = null)
         public void WriteFolderElement(XmlWriter writer, BaseItem folder, StubType? stubType, BaseItem context, int childCount, Filter filter, string requestedId = null)
         {
         {
@@ -971,7 +951,7 @@ namespace Emby.Dlna.Didl
 
 
             writer.WriteAttributeString("protocolInfo", string.Format(
             writer.WriteAttributeString("protocolInfo", string.Format(
                 "http-get:*:{0}:{1}",
                 "http-get:*:{0}:{1}",
-                GetMimeType("file." + format),
+                MimeTypes.GetMimeType("file." + format),
                 contentFeatures
                 contentFeatures
                 ));
                 ));
 
 
@@ -1102,7 +1082,7 @@ namespace Emby.Dlna.Didl
 
 
         public static string GetClientId(Guid idValue, StubType? stubType)
         public static string GetClientId(Guid idValue, StubType? stubType)
         {
         {
-            var id = idValue.ToString("N");
+            var id = idValue.ToString("N", CultureInfo.InvariantCulture);
 
 
             if (stubType.HasValue)
             if (stubType.HasValue)
             {
             {
@@ -1116,7 +1096,7 @@ namespace Emby.Dlna.Didl
         {
         {
             var url = string.Format("{0}/Items/{1}/Images/{2}/0/{3}/{4}/{5}/{6}/0/0",
             var url = string.Format("{0}/Items/{1}/Images/{2}/0/{3}/{4}/{5}/{6}/0/0",
                 _serverAddress,
                 _serverAddress,
-                info.ItemId.ToString("N"),
+                info.ItemId.ToString("N", CultureInfo.InvariantCulture),
                 info.Type,
                 info.Type,
                 info.ImageTag,
                 info.ImageTag,
                 format,
                 format,

+ 3 - 2
Emby.Dlna/DlnaManager.cs

@@ -1,5 +1,6 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Globalization;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
 using System.Reflection;
 using System.Reflection;
@@ -300,7 +301,7 @@ namespace Emby.Dlna
 
 
                     profile = ReserializeProfile(tempProfile);
                     profile = ReserializeProfile(tempProfile);
 
 
-                    profile.Id = path.ToLowerInvariant().GetMD5().ToString("N");
+                    profile.Id = path.ToLowerInvariant().GetMD5().ToString("N", CultureInfo.InvariantCulture);
 
 
                     _profiles[path] = new Tuple<InternalProfileInfo, DeviceProfile>(GetInternalProfileInfo(_fileSystem.GetFileInfo(path), type), profile);
                     _profiles[path] = new Tuple<InternalProfileInfo, DeviceProfile>(GetInternalProfileInfo(_fileSystem.GetFileInfo(path), type), profile);
 
 
@@ -352,7 +353,7 @@ namespace Emby.Dlna
 
 
                 Info = new DeviceProfileInfo
                 Info = new DeviceProfileInfo
                 {
                 {
-                    Id = file.FullName.ToLowerInvariant().GetMD5().ToString("N"),
+                    Id = file.FullName.ToLowerInvariant().GetMD5().ToString("N", CultureInfo.InvariantCulture),
                     Name = _fileSystem.GetFileNameWithoutExtension(file),
                     Name = _fileSystem.GetFileNameWithoutExtension(file),
                     Type = type
                     Type = type
                 }
                 }

+ 1 - 0
Emby.Dlna/Emby.Dlna.csproj

@@ -14,6 +14,7 @@
   <PropertyGroup>
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
     <TargetFramework>netstandard2.0</TargetFramework>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+    <GenerateDocumentationFile>true</GenerateDocumentationFile>
   </PropertyGroup>
   </PropertyGroup>
 
 
   <ItemGroup>
   <ItemGroup>

+ 1 - 1
Emby.Dlna/Eventing/EventManager.cs

@@ -55,7 +55,7 @@ namespace Emby.Dlna.Eventing
         public EventSubscriptionResponse CreateEventSubscription(string notificationType, string requestedTimeoutString, string callbackUrl)
         public EventSubscriptionResponse CreateEventSubscription(string notificationType, string requestedTimeoutString, string callbackUrl)
         {
         {
             var timeout = ParseTimeout(requestedTimeoutString) ?? 300;
             var timeout = ParseTimeout(requestedTimeoutString) ?? 300;
-            var id = "uuid:" + Guid.NewGuid().ToString("N");
+            var id = "uuid:" + Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
 
 
             // Remove logging for now because some devices are sending this very frequently
             // Remove logging for now because some devices are sending this very frequently
             // TODO re-enable with dlna debug logging setting
             // TODO re-enable with dlna debug logging setting

+ 4 - 2
Emby.Dlna/Main/DlnaEntryPoint.cs

@@ -1,4 +1,6 @@
 using System;
 using System;
+using System.Net.Sockets;
+using System.Globalization;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using Emby.Dlna.PlayTo;
 using Emby.Dlna.PlayTo;
@@ -247,7 +249,7 @@ namespace Emby.Dlna.Main
 
 
             foreach (var address in addresses)
             foreach (var address in addresses)
             {
             {
-                if (address.AddressFamily == IpAddressFamily.InterNetworkV6)
+                if (address.AddressFamily == AddressFamily.InterNetworkV6)
                 {
                 {
                    // Not support IPv6 right now
                    // Not support IPv6 right now
                    continue;
                    continue;
@@ -306,7 +308,7 @@ namespace Emby.Dlna.Main
             {
             {
                 guid = text.GetMD5();
                 guid = text.GetMD5();
             }
             }
-            return guid.ToString("N");
+            return guid.ToString("N", CultureInfo.InvariantCulture);
         }
         }
 
 
         private void SetProperies(SsdpDevice device, string fullDeviceType)
         private void SetProperies(SsdpDevice device, string fullDeviceType)

+ 5 - 4
Emby.Dlna/PlayTo/PlayToManager.cs

@@ -1,5 +1,7 @@
 using System;
 using System;
+using System.Globalization;
 using System.Linq;
 using System.Linq;
+using System.Net;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using MediaBrowser.Common.Extensions;
 using MediaBrowser.Common.Extensions;
@@ -14,7 +16,6 @@ using MediaBrowser.Controller.Session;
 using MediaBrowser.Model.Dlna;
 using MediaBrowser.Model.Dlna;
 using MediaBrowser.Model.Events;
 using MediaBrowser.Model.Events;
 using MediaBrowser.Model.Globalization;
 using MediaBrowser.Model.Globalization;
-using MediaBrowser.Model.Net;
 using MediaBrowser.Model.Session;
 using MediaBrowser.Model.Session;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Logging;
 
 
@@ -141,7 +142,7 @@ namespace Emby.Dlna.PlayTo
                 return usn;
                 return usn;
             }
             }
 
 
-            return usn.GetMD5().ToString("N");
+            return usn.GetMD5().ToString("N", CultureInfo.InvariantCulture);
         }
         }
 
 
         private async Task AddDevice(UpnpDeviceInfo info, string location, CancellationToken cancellationToken)
         private async Task AddDevice(UpnpDeviceInfo info, string location, CancellationToken cancellationToken)
@@ -156,7 +157,7 @@ namespace Emby.Dlna.PlayTo
             }
             }
             else
             else
             {
             {
-                uuid = location.GetMD5().ToString("N");
+                uuid = location.GetMD5().ToString("N", CultureInfo.InvariantCulture);
             }
             }
 
 
             var sessionInfo = _sessionManager.LogSessionActivity("DLNA", _appHost.ApplicationVersion, uuid, null, uri.OriginalString, null);
             var sessionInfo = _sessionManager.LogSessionActivity("DLNA", _appHost.ApplicationVersion, uuid, null, uri.OriginalString, null);
@@ -172,7 +173,7 @@ namespace Emby.Dlna.PlayTo
                 _sessionManager.UpdateDeviceName(sessionInfo.Id, deviceName);
                 _sessionManager.UpdateDeviceName(sessionInfo.Id, deviceName);
 
 
                 string serverAddress;
                 string serverAddress;
-                if (info.LocalIpAddress == null || info.LocalIpAddress.Equals(IpAddressInfo.Any) || info.LocalIpAddress.Equals(IpAddressInfo.IPv6Any))
+                if (info.LocalIpAddress == null || info.LocalIpAddress.Equals(IPAddress.Any) || info.LocalIpAddress.Equals(IPAddress.IPv6Any))
                 {
                 {
                     serverAddress = await _appHost.GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
                     serverAddress = await _appHost.GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
                 }
                 }

+ 30 - 33
Emby.Dlna/PlayTo/SsdpHttpClient.cs

@@ -16,6 +16,8 @@ namespace Emby.Dlna.PlayTo
         private const string USERAGENT = "Microsoft-Windows/6.2 UPnP/1.0 Microsoft-DLNA DLNADOC/1.50";
         private const string USERAGENT = "Microsoft-Windows/6.2 UPnP/1.0 Microsoft-DLNA DLNADOC/1.50";
         private const string FriendlyName = "Jellyfin";
         private const string FriendlyName = "Jellyfin";
 
 
+        private readonly CultureInfo _usCulture = new CultureInfo("en-US");
+
         private readonly IHttpClient _httpClient;
         private readonly IHttpClient _httpClient;
         private readonly IServerConfigurationManager _config;
         private readonly IServerConfigurationManager _config;
 
 
@@ -25,7 +27,8 @@ namespace Emby.Dlna.PlayTo
             _config = config;
             _config = config;
         }
         }
 
 
-        public async Task<XDocument> SendCommandAsync(string baseUrl,
+        public async Task<XDocument> SendCommandAsync(
+            string baseUrl,
             DeviceService service,
             DeviceService service,
             string command,
             string command,
             string postData,
             string postData,
@@ -34,16 +37,21 @@ namespace Emby.Dlna.PlayTo
         {
         {
             var cancellationToken = CancellationToken.None;
             var cancellationToken = CancellationToken.None;
 
 
-            using (var response = await PostSoapDataAsync(NormalizeServiceUrl(baseUrl, service.ControlUrl), "\"" + service.ServiceType + "#" + command + "\"", postData, header, logRequest, cancellationToken)
+            var url = NormalizeServiceUrl(baseUrl, service.ControlUrl);
+            using (var response = await PostSoapDataAsync(
+                url,
+                $"\"{service.ServiceType}#{command}\"",
+                postData,
+                header,
+                logRequest,
+                cancellationToken)
                 .ConfigureAwait(false))
                 .ConfigureAwait(false))
+            using (var stream = response.Content)
+            using (var reader = new StreamReader(stream, Encoding.UTF8))
             {
             {
-                using (var stream = response.Content)
-                {
-                    using (var reader = new StreamReader(stream, Encoding.UTF8))
-                    {
-                        return XDocument.Parse(reader.ReadToEnd(), LoadOptions.PreserveWhitespace);
-                    }
-                }
+                return XDocument.Parse(
+                    await reader.ReadToEndAsync().ConfigureAwait(false),
+                    LoadOptions.PreserveWhitespace);
             }
             }
         }
         }
 
 
@@ -61,9 +69,8 @@ namespace Emby.Dlna.PlayTo
             return baseUrl + serviceUrl;
             return baseUrl + serviceUrl;
         }
         }
 
 
-        private readonly CultureInfo _usCulture = new CultureInfo("en-US");
-
-        public async Task SubscribeAsync(string url,
+        public async Task SubscribeAsync(
+            string url,
             string ip,
             string ip,
             int port,
             int port,
             string localIp,
             string localIp,
@@ -76,9 +83,6 @@ namespace Emby.Dlna.PlayTo
                 UserAgent = USERAGENT,
                 UserAgent = USERAGENT,
                 LogErrorResponseBody = true,
                 LogErrorResponseBody = true,
                 BufferContent = false,
                 BufferContent = false,
-
-                // The periodic requests may keep some devices awake
-                LogRequestAsDebug = true
             };
             };
 
 
             options.RequestHeaders["HOST"] = ip + ":" + port.ToString(_usCulture);
             options.RequestHeaders["HOST"] = ip + ":" + port.ToString(_usCulture);
@@ -101,47 +105,41 @@ namespace Emby.Dlna.PlayTo
                 LogErrorResponseBody = true,
                 LogErrorResponseBody = true,
                 BufferContent = false,
                 BufferContent = false,
 
 
-                // The periodic requests may keep some devices awake
-                LogRequestAsDebug = true,
-
                 CancellationToken = cancellationToken
                 CancellationToken = cancellationToken
             };
             };
 
 
             options.RequestHeaders["FriendlyName.DLNA.ORG"] = FriendlyName;
             options.RequestHeaders["FriendlyName.DLNA.ORG"] = FriendlyName;
 
 
             using (var response = await _httpClient.SendAsync(options, "GET").ConfigureAwait(false))
             using (var response = await _httpClient.SendAsync(options, "GET").ConfigureAwait(false))
+            using (var stream = response.Content)
+            using (var reader = new StreamReader(stream, Encoding.UTF8))
             {
             {
-                using (var stream = response.Content)
-                {
-                    using (var reader = new StreamReader(stream, Encoding.UTF8))
-                    {
-                        return XDocument.Parse(reader.ReadToEnd(), LoadOptions.PreserveWhitespace);
-                    }
-                }
+                return XDocument.Parse(
+                    await reader.ReadToEndAsync().ConfigureAwait(false),
+                    LoadOptions.PreserveWhitespace);
             }
             }
         }
         }
 
 
-        private Task<HttpResponseInfo> PostSoapDataAsync(string url,
+        private Task<HttpResponseInfo> PostSoapDataAsync(
+            string url,
             string soapAction,
             string soapAction,
             string postData,
             string postData,
             string header,
             string header,
             bool logRequest,
             bool logRequest,
             CancellationToken cancellationToken)
             CancellationToken cancellationToken)
         {
         {
-            if (!soapAction.StartsWith("\""))
-                soapAction = "\"" + soapAction + "\"";
+            if (soapAction[0] != '\"')
+            {
+                soapAction = $"\"{soapAction}\"";
+            }
 
 
             var options = new HttpRequestOptions
             var options = new HttpRequestOptions
             {
             {
                 Url = url,
                 Url = url,
                 UserAgent = USERAGENT,
                 UserAgent = USERAGENT,
-                LogRequest = logRequest || _config.GetDlnaConfiguration().EnableDebugLog,
                 LogErrorResponseBody = true,
                 LogErrorResponseBody = true,
                 BufferContent = false,
                 BufferContent = false,
 
 
-                // The periodic requests may keep some devices awake
-                LogRequestAsDebug = true,
-
                 CancellationToken = cancellationToken
                 CancellationToken = cancellationToken
             };
             };
 
 
@@ -155,7 +153,6 @@ namespace Emby.Dlna.PlayTo
             }
             }
 
 
             options.RequestContentType = "text/xml";
             options.RequestContentType = "text/xml";
-            options.AppendCharsetToMimeType = true;
             options.RequestContent = postData;
             options.RequestContent = postData;
 
 
             return _httpClient.Post(options);
             return _httpClient.Post(options);

+ 1 - 1
Emby.Dlna/Profiles/DishHopperJoeyProfile.cs

@@ -9,7 +9,7 @@ namespace Emby.Dlna.Profiles
         {
         {
             Name = "Dish Hopper-Joey";
             Name = "Dish Hopper-Joey";
 
 
-            ProtocolInfo = "http-get:*:video/mp2t:*,http-get:*:video/MP1S:*,http-get:*:video/mpeg2:*,http-get:*:video/mp4:*,http-get:*:video/x-matroska:*,http-get:*:audio/mpeg:*,http-get:*:audio/mpeg3:*,http-get:*:audio/mp3:*,http-get:*:audio/mp4:*,http-get:*:audio/mp4a-latm:*,http-get:*:image/jpeg:*";
+            ProtocolInfo = "http-get:*:video/mp2t:*,http-get:*:video/mpeg:*,http-get:*:video/MP1S:*,http-get:*:video/mpeg2:*,http-get:*:video/mp4:*,http-get:*:video/x-matroska:*,http-get:*:audio/mpeg:*,http-get:*:audio/mpeg3:*,http-get:*:audio/mp3:*,http-get:*:audio/mp4:*,http-get:*:audio/mp4a-latm:*,http-get:*:image/jpeg:*";
 
 
             Identification = new DeviceIdentification
             Identification = new DeviceIdentification
             {
             {

+ 1 - 1
Emby.Dlna/Profiles/Xml/Dish Hopper-Joey.xml

@@ -28,7 +28,7 @@
   <MaxStaticBitrate>140000000</MaxStaticBitrate>
   <MaxStaticBitrate>140000000</MaxStaticBitrate>
   <MusicStreamingTranscodingBitrate>192000</MusicStreamingTranscodingBitrate>
   <MusicStreamingTranscodingBitrate>192000</MusicStreamingTranscodingBitrate>
   <MaxStaticMusicBitrate xsi:nil="true" />
   <MaxStaticMusicBitrate xsi:nil="true" />
-  <ProtocolInfo>http-get:*:video/mp2t:*,http-get:*:video/MP1S:*,http-get:*:video/mpeg2:*,http-get:*:video/mp4:*,http-get:*:video/x-matroska:*,http-get:*:audio/mpeg:*,http-get:*:audio/mpeg3:*,http-get:*:audio/mp3:*,http-get:*:audio/mp4:*,http-get:*:audio/mp4a-latm:*,http-get:*:image/jpeg:*</ProtocolInfo>
+  <ProtocolInfo>http-get:*:video/mp2t:http-get:*:video/mpeg:*,http-get:*:video/MP1S:*,http-get:*:video/mpeg2:*,http-get:*:video/mp4:*,http-get:*:video/x-matroska:*,http-get:*:audio/mpeg:*,http-get:*:audio/mpeg3:*,http-get:*:audio/mp3:*,http-get:*:audio/mp4:*,http-get:*:audio/mp4a-latm:*,http-get:*:image/jpeg:*</ProtocolInfo>
   <TimelineOffsetSeconds>0</TimelineOffsetSeconds>
   <TimelineOffsetSeconds>0</TimelineOffsetSeconds>
   <RequiresPlainVideoItems>false</RequiresPlainVideoItems>
   <RequiresPlainVideoItems>false</RequiresPlainVideoItems>
   <RequiresPlainFolders>false</RequiresPlainFolders>
   <RequiresPlainFolders>false</RequiresPlainFolders>

+ 7 - 0
Emby.Drawing/Emby.Drawing.csproj

@@ -3,6 +3,8 @@
   <PropertyGroup>
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
     <TargetFramework>netstandard2.0</TargetFramework>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+    <GenerateDocumentationFile>true</GenerateDocumentationFile>
+    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
   </PropertyGroup>
   </PropertyGroup>
 
 
   <ItemGroup>
   <ItemGroup>
@@ -15,4 +17,9 @@
     <Compile Include="..\SharedVersion.cs" />
     <Compile Include="..\SharedVersion.cs" />
   </ItemGroup>
   </ItemGroup>
 
 
+  <PropertyGroup>
+      <!-- We need at least C# 7.1 for the "default literal" feature-->
+    <LangVersion>latest</LangVersion>
+  </PropertyGroup>
+
 </Project>
 </Project>

+ 64 - 99
Emby.Drawing/ImageProcessor.cs

@@ -22,42 +22,47 @@ using Microsoft.Extensions.Logging;
 namespace Emby.Drawing
 namespace Emby.Drawing
 {
 {
     /// <summary>
     /// <summary>
-    /// Class ImageProcessor
+    /// Class ImageProcessor.
     /// </summary>
     /// </summary>
     public class ImageProcessor : IImageProcessor, IDisposable
     public class ImageProcessor : IImageProcessor, IDisposable
     {
     {
-        /// <summary>
-        /// The us culture
-        /// </summary>
-        protected readonly CultureInfo UsCulture = new CultureInfo("en-US");
+        // Increment this when there's a change requiring caches to be invalidated
+        private const string Version = "3";
 
 
-        /// <summary>
-        /// Gets the list of currently registered image processors
-        /// Image processors are specialized metadata providers that run after the normal ones
-        /// </summary>
-        /// <value>The image enhancers.</value>
-        public IImageEnhancer[] ImageEnhancers { get; private set; }
+        private static readonly HashSet<string> _transparentImageTypes
+            = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { ".png", ".webp", ".gif" };
 
 
         /// <summary>
         /// <summary>
         /// The _logger
         /// The _logger
         /// </summary>
         /// </summary>
         private readonly ILogger _logger;
         private readonly ILogger _logger;
-
         private readonly IFileSystem _fileSystem;
         private readonly IFileSystem _fileSystem;
         private readonly IServerApplicationPaths _appPaths;
         private readonly IServerApplicationPaths _appPaths;
         private IImageEncoder _imageEncoder;
         private IImageEncoder _imageEncoder;
         private readonly Func<ILibraryManager> _libraryManager;
         private readonly Func<ILibraryManager> _libraryManager;
         private readonly Func<IMediaEncoder> _mediaEncoder;
         private readonly Func<IMediaEncoder> _mediaEncoder;
 
 
+        private readonly Dictionary<string, LockInfo> _locks = new Dictionary<string, LockInfo>();
+        private bool _disposed = false;
+
+        /// <summary>
+        ///
+        /// </summary>
+        /// <param name="logger"></param>
+        /// <param name="appPaths"></param>
+        /// <param name="fileSystem"></param>
+        /// <param name="imageEncoder"></param>
+        /// <param name="libraryManager"></param>
+        /// <param name="mediaEncoder"></param>
         public ImageProcessor(
         public ImageProcessor(
-            ILoggerFactory loggerFactory,
+            ILogger<ImageProcessor> logger,
             IServerApplicationPaths appPaths,
             IServerApplicationPaths appPaths,
             IFileSystem fileSystem,
             IFileSystem fileSystem,
             IImageEncoder imageEncoder,
             IImageEncoder imageEncoder,
             Func<ILibraryManager> libraryManager,
             Func<ILibraryManager> libraryManager,
             Func<IMediaEncoder> mediaEncoder)
             Func<IMediaEncoder> mediaEncoder)
         {
         {
-            _logger = loggerFactory.CreateLogger(nameof(ImageProcessor));
+            _logger = logger;
             _fileSystem = fileSystem;
             _fileSystem = fileSystem;
             _imageEncoder = imageEncoder;
             _imageEncoder = imageEncoder;
             _libraryManager = libraryManager;
             _libraryManager = libraryManager;
@@ -69,20 +74,11 @@ namespace Emby.Drawing
             ImageHelper.ImageProcessor = this;
             ImageHelper.ImageProcessor = this;
         }
         }
 
 
-        public IImageEncoder ImageEncoder
-        {
-            get => _imageEncoder;
-            set
-            {
-                if (value == null)
-                {
-                    throw new ArgumentNullException(nameof(value));
-                }
+        private string ResizedImageCachePath => Path.Combine(_appPaths.ImageCachePath, "resized-images");
 
 
-                _imageEncoder = value;
-            }
-        }
+        private string EnhancedImageCachePath => Path.Combine(_appPaths.ImageCachePath, "enhanced-images");
 
 
+        /// <inheritdoc />
         public IReadOnlyCollection<string> SupportedInputFormats =>
         public IReadOnlyCollection<string> SupportedInputFormats =>
             new HashSet<string>(StringComparer.OrdinalIgnoreCase)
             new HashSet<string>(StringComparer.OrdinalIgnoreCase)
             {
             {
@@ -115,18 +111,20 @@ namespace Emby.Drawing
                 "wbmp"
                 "wbmp"
             };
             };
 
 
+        /// <inheritdoc />
+        public IReadOnlyCollection<IImageEnhancer> ImageEnhancers { get; set; }
 
 
+        /// <inheritdoc />
         public bool SupportsImageCollageCreation => _imageEncoder.SupportsImageCollageCreation;
         public bool SupportsImageCollageCreation => _imageEncoder.SupportsImageCollageCreation;
 
 
-        private string ResizedImageCachePath => Path.Combine(_appPaths.ImageCachePath, "resized-images");
-
-        private string EnhancedImageCachePath => Path.Combine(_appPaths.ImageCachePath, "enhanced-images");
-
-        public void AddParts(IEnumerable<IImageEnhancer> enhancers)
+        /// <inheritdoc />
+        public IImageEncoder ImageEncoder
         {
         {
-            ImageEnhancers = enhancers.ToArray();
+            get => _imageEncoder;
+            set => _imageEncoder = value ?? throw new ArgumentNullException(nameof(value));
         }
         }
 
 
+        /// <inheritdoc />
         public async Task ProcessImage(ImageProcessingOptions options, Stream toStream)
         public async Task ProcessImage(ImageProcessingOptions options, Stream toStream)
         {
         {
             var file = await ProcessImage(options).ConfigureAwait(false);
             var file = await ProcessImage(options).ConfigureAwait(false);
@@ -137,15 +135,15 @@ namespace Emby.Drawing
             }
             }
         }
         }
 
 
+        /// <inheritdoc />
         public IReadOnlyCollection<ImageFormat> GetSupportedImageOutputFormats()
         public IReadOnlyCollection<ImageFormat> GetSupportedImageOutputFormats()
             => _imageEncoder.SupportedOutputFormats;
             => _imageEncoder.SupportedOutputFormats;
 
 
-        private static readonly HashSet<string> TransparentImageTypes
-            = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { ".png", ".webp", ".gif" };
-
+        /// <inheritdoc />
         public bool SupportsTransparency(string path)
         public bool SupportsTransparency(string path)
-            => TransparentImageTypes.Contains(Path.GetExtension(path));
+            => _transparentImageTypes.Contains(Path.GetExtension(path));
 
 
+        /// <inheritdoc />
         public async Task<(string path, string mimeType, DateTime dateModified)> ProcessImage(ImageProcessingOptions options)
         public async Task<(string path, string mimeType, DateTime dateModified)> ProcessImage(ImageProcessingOptions options)
         {
         {
             if (options == null)
             if (options == null)
@@ -187,9 +185,9 @@ namespace Emby.Drawing
             }
             }
 
 
             dateModified = supportedImageInfo.dateModified;
             dateModified = supportedImageInfo.dateModified;
-            bool requiresTransparency = TransparentImageTypes.Contains(Path.GetExtension(originalImagePath));
+            bool requiresTransparency = _transparentImageTypes.Contains(Path.GetExtension(originalImagePath));
 
 
-            if (options.Enhancers.Length > 0)
+            if (options.Enhancers.Count > 0)
             {
             {
                 if (item == null)
                 if (item == null)
                 {
                 {
@@ -279,7 +277,7 @@ namespace Emby.Drawing
             }
             }
         }
         }
 
 
-        private ImageFormat GetOutputFormat(ImageFormat[] clientSupportedFormats, bool requiresTransparency)
+        private ImageFormat GetOutputFormat(IReadOnlyCollection<ImageFormat> clientSupportedFormats, bool requiresTransparency)
         {
         {
             var serverFormats = GetSupportedImageOutputFormats();
             var serverFormats = GetSupportedImageOutputFormats();
 
 
@@ -320,11 +318,6 @@ namespace Emby.Drawing
             }
             }
         }
         }
 
 
-        /// <summary>
-        /// Increment this when there's a change requiring caches to be invalidated
-        /// </summary>
-        private const string Version = "3";
-
         /// <summary>
         /// <summary>
         /// Gets the cache file path based on a set of parameters
         /// Gets the cache file path based on a set of parameters
         /// </summary>
         /// </summary>
@@ -372,9 +365,11 @@ namespace Emby.Drawing
             return GetCachePath(ResizedImageCachePath, filename, "." + format.ToString().ToLowerInvariant());
             return GetCachePath(ResizedImageCachePath, filename, "." + format.ToString().ToLowerInvariant());
         }
         }
 
 
+        /// <inheritdoc />
         public ImageDimensions GetImageDimensions(BaseItem item, ItemImageInfo info)
         public ImageDimensions GetImageDimensions(BaseItem item, ItemImageInfo info)
             => GetImageDimensions(item, info, true);
             => GetImageDimensions(item, info, true);
 
 
+        /// <inheritdoc />
         public ImageDimensions GetImageDimensions(BaseItem item, ItemImageInfo info, bool updateItem)
         public ImageDimensions GetImageDimensions(BaseItem item, ItemImageInfo info, bool updateItem)
         {
         {
             int width = info.Width;
             int width = info.Width;
@@ -400,26 +395,19 @@ namespace Emby.Drawing
             return size;
             return size;
         }
         }
 
 
-        /// <summary>
-        /// Gets the size of the image.
-        /// </summary>
+        /// <inheritdoc />
         public ImageDimensions GetImageDimensions(string path)
         public ImageDimensions GetImageDimensions(string path)
             => _imageEncoder.GetImageSize(path);
             => _imageEncoder.GetImageSize(path);
 
 
-        /// <summary>
-        /// Gets the image cache tag.
-        /// </summary>
-        /// <param name="item">The item.</param>
-        /// <param name="image">The image.</param>
-        /// <returns>Guid.</returns>
-        /// <exception cref="ArgumentNullException">item</exception>
+        /// <inheritdoc />
         public string GetImageCacheTag(BaseItem item, ItemImageInfo image)
         public string GetImageCacheTag(BaseItem item, ItemImageInfo image)
         {
         {
-            var supportedEnhancers = GetSupportedEnhancers(item, image.Type);
+            var supportedEnhancers = GetSupportedEnhancers(item, image.Type).ToArray();
 
 
             return GetImageCacheTag(item, image, supportedEnhancers);
             return GetImageCacheTag(item, image, supportedEnhancers);
         }
         }
 
 
+        /// <inheritdoc />
         public string GetImageCacheTag(BaseItem item, ChapterInfo chapter)
         public string GetImageCacheTag(BaseItem item, ChapterInfo chapter)
         {
         {
             try
             try
@@ -437,31 +425,24 @@ namespace Emby.Drawing
             }
             }
         }
         }
 
 
-        /// <summary>
-        /// Gets the image cache tag.
-        /// </summary>
-        /// <param name="item">The item.</param>
-        /// <param name="image">The image.</param>
-        /// <param name="imageEnhancers">The image enhancers.</param>
-        /// <returns>Guid.</returns>
-        /// <exception cref="ArgumentNullException">item</exception>
-        public string GetImageCacheTag(BaseItem item, ItemImageInfo image, IImageEnhancer[] imageEnhancers)
+        /// <inheritdoc />
+        public string GetImageCacheTag(BaseItem item, ItemImageInfo image, IReadOnlyCollection<IImageEnhancer> imageEnhancers)
         {
         {
             string originalImagePath = image.Path;
             string originalImagePath = image.Path;
             DateTime dateModified = image.DateModified;
             DateTime dateModified = image.DateModified;
             ImageType imageType = image.Type;
             ImageType imageType = image.Type;
 
 
             // Optimization
             // Optimization
-            if (imageEnhancers.Length == 0)
+            if (imageEnhancers.Count == 0)
             {
             {
-                return (originalImagePath + dateModified.Ticks).GetMD5().ToString("N");
+                return (originalImagePath + dateModified.Ticks).GetMD5().ToString("N", CultureInfo.InvariantCulture);
             }
             }
 
 
             // Cache name is created with supported enhancers combined with the last config change so we pick up new config changes
             // Cache name is created with supported enhancers combined with the last config change so we pick up new config changes
             var cacheKeys = imageEnhancers.Select(i => i.GetConfigurationCacheKey(item, imageType)).ToList();
             var cacheKeys = imageEnhancers.Select(i => i.GetConfigurationCacheKey(item, imageType)).ToList();
             cacheKeys.Add(originalImagePath + dateModified.Ticks);
             cacheKeys.Add(originalImagePath + dateModified.Ticks);
 
 
-            return string.Join("|", cacheKeys).GetMD5().ToString("N");
+            return string.Join("|", cacheKeys).GetMD5().ToString("N", CultureInfo.InvariantCulture);
         }
         }
 
 
         private async Task<(string path, DateTime dateModified)> GetSupportedImage(string originalImagePath, DateTime dateModified)
         private async Task<(string path, DateTime dateModified)> GetSupportedImage(string originalImagePath, DateTime dateModified)
@@ -480,7 +461,7 @@ namespace Emby.Drawing
             {
             {
                 try
                 try
                 {
                 {
-                    string filename = (originalImagePath + dateModified.Ticks.ToString(UsCulture)).GetMD5().ToString("N");
+                    string filename = (originalImagePath + dateModified.Ticks.ToString(CultureInfo.InvariantCulture)).GetMD5().ToString("N", CultureInfo.InvariantCulture);
 
 
                     string cacheExtension = _mediaEncoder().SupportsEncoder("libwebp") ? ".webp" : ".png";
                     string cacheExtension = _mediaEncoder().SupportsEncoder("libwebp") ? ".webp" : ".png";
                     var outputPath = Path.Combine(_appPaths.ImageCachePath, "converted-images", filename + cacheExtension);
                     var outputPath = Path.Combine(_appPaths.ImageCachePath, "converted-images", filename + cacheExtension);
@@ -507,16 +488,10 @@ namespace Emby.Drawing
             return (originalImagePath, dateModified);
             return (originalImagePath, dateModified);
         }
         }
 
 
-        /// <summary>
-        /// Gets the enhanced image.
-        /// </summary>
-        /// <param name="item">The item.</param>
-        /// <param name="imageType">Type of the image.</param>
-        /// <param name="imageIndex">Index of the image.</param>
-        /// <returns>Task{System.String}.</returns>
+        /// <inheritdoc />
         public async Task<string> GetEnhancedImage(BaseItem item, ImageType imageType, int imageIndex)
         public async Task<string> GetEnhancedImage(BaseItem item, ImageType imageType, int imageIndex)
         {
         {
-            var enhancers = GetSupportedEnhancers(item, imageType);
+            var enhancers = GetSupportedEnhancers(item, imageType).ToArray();
 
 
             ItemImageInfo imageInfo = item.GetImageInfo(imageType, imageIndex);
             ItemImageInfo imageInfo = item.GetImageInfo(imageType, imageIndex);
 
 
@@ -532,7 +507,7 @@ namespace Emby.Drawing
             bool inputImageSupportsTransparency,
             bool inputImageSupportsTransparency,
             BaseItem item,
             BaseItem item,
             int imageIndex,
             int imageIndex,
-            IImageEnhancer[] enhancers,
+            IReadOnlyCollection<IImageEnhancer> enhancers,
             CancellationToken cancellationToken)
             CancellationToken cancellationToken)
         {
         {
             var originalImagePath = image.Path;
             var originalImagePath = image.Path;
@@ -573,6 +548,7 @@ namespace Emby.Drawing
         /// <param name="imageIndex">Index of the image.</param>
         /// <param name="imageIndex">Index of the image.</param>
         /// <param name="supportedEnhancers">The supported enhancers.</param>
         /// <param name="supportedEnhancers">The supported enhancers.</param>
         /// <param name="cacheGuid">The cache unique identifier.</param>
         /// <param name="cacheGuid">The cache unique identifier.</param>
+        /// <param name="cancellationToken">The cancellation token.</param>
         /// <returns>Task&lt;System.String&gt;.</returns>
         /// <returns>Task&lt;System.String&gt;.</returns>
         /// <exception cref="ArgumentNullException">
         /// <exception cref="ArgumentNullException">
         /// originalImagePath
         /// originalImagePath
@@ -584,9 +560,9 @@ namespace Emby.Drawing
             BaseItem item,
             BaseItem item,
             ImageType imageType,
             ImageType imageType,
             int imageIndex,
             int imageIndex,
-            IImageEnhancer[] supportedEnhancers,
+            IReadOnlyCollection<IImageEnhancer> supportedEnhancers,
             string cacheGuid,
             string cacheGuid,
-            CancellationToken cancellationToken)
+            CancellationToken cancellationToken = default)
         {
         {
             if (string.IsNullOrEmpty(originalImagePath))
             if (string.IsNullOrEmpty(originalImagePath))
             {
             {
@@ -680,6 +656,7 @@ namespace Emby.Drawing
             {
             {
                 throw new ArgumentNullException(nameof(path));
                 throw new ArgumentNullException(nameof(path));
             }
             }
+
             if (string.IsNullOrEmpty(uniqueName))
             if (string.IsNullOrEmpty(uniqueName))
             {
             {
                 throw new ArgumentNullException(nameof(uniqueName));
                 throw new ArgumentNullException(nameof(uniqueName));
@@ -722,6 +699,7 @@ namespace Emby.Drawing
             return Path.Combine(path, prefix, filename);
             return Path.Combine(path, prefix, filename);
         }
         }
 
 
+        /// <inheritdoc />
         public void CreateImageCollage(ImageCollageOptions options)
         public void CreateImageCollage(ImageCollageOptions options)
         {
         {
             _logger.LogInformation("Creating image collage and saving to {Path}", options.OutputPath);
             _logger.LogInformation("Creating image collage and saving to {Path}", options.OutputPath);
@@ -731,38 +709,25 @@ namespace Emby.Drawing
             _logger.LogInformation("Completed creation of image collage and saved to {Path}", options.OutputPath);
             _logger.LogInformation("Completed creation of image collage and saved to {Path}", options.OutputPath);
         }
         }
 
 
-        public IImageEnhancer[] GetSupportedEnhancers(BaseItem item, ImageType imageType)
+        /// <inheritdoc />
+        public IEnumerable<IImageEnhancer> GetSupportedEnhancers(BaseItem item, ImageType imageType)
         {
         {
-            List<IImageEnhancer> list = null;
-
             foreach (var i in ImageEnhancers)
             foreach (var i in ImageEnhancers)
             {
             {
-                try
-                {
-                    if (i.Supports(item, imageType))
-                    {
-                        if (list == null)
-                        {
-                            list = new List<IImageEnhancer>();
-                        }
-                        list.Add(i);
-                    }
-                }
-                catch (Exception ex)
+                if (i.Supports(item, imageType))
                 {
                 {
-                    _logger.LogError(ex, "Error in image enhancer: {0}", i.GetType().Name);
+                    yield return i;
                 }
                 }
             }
             }
-
-            return list == null ? Array.Empty<IImageEnhancer>() : list.ToArray();
         }
         }
 
 
-        private Dictionary<string, LockInfo> _locks = new Dictionary<string, LockInfo>();
+
         private class LockInfo
         private class LockInfo
         {
         {
             public SemaphoreSlim Lock = new SemaphoreSlim(1, 1);
             public SemaphoreSlim Lock = new SemaphoreSlim(1, 1);
             public int Count = 1;
             public int Count = 1;
         }
         }
+
         private LockInfo GetLock(string key)
         private LockInfo GetLock(string key)
         {
         {
             lock (_locks)
             lock (_locks)
@@ -795,7 +760,7 @@ namespace Emby.Drawing
             }
             }
         }
         }
 
 
-        private bool _disposed;
+        /// <inheritdoc />
         public void Dispose()
         public void Dispose()
         {
         {
             _disposed = true;
             _disposed = true;

+ 19 - 15
Emby.Drawing/NullImageEncoder.cs

@@ -5,36 +5,40 @@ using MediaBrowser.Model.Drawing;
 
 
 namespace Emby.Drawing
 namespace Emby.Drawing
 {
 {
+    /// <summary>
+    /// A fallback implementation of <see cref="IImageEncoder" />.
+    /// </summary>
     public class NullImageEncoder : IImageEncoder
     public class NullImageEncoder : IImageEncoder
     {
     {
+        /// <inheritdoc />
         public IReadOnlyCollection<string> SupportedInputFormats
         public IReadOnlyCollection<string> SupportedInputFormats
             => new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "png", "jpeg", "jpg" };
             => new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "png", "jpeg", "jpg" };
 
 
+        /// <inheritdoc />
         public IReadOnlyCollection<ImageFormat> SupportedOutputFormats
         public IReadOnlyCollection<ImageFormat> SupportedOutputFormats
         => new HashSet<ImageFormat>() { ImageFormat.Jpg, ImageFormat.Png };
         => new HashSet<ImageFormat>() { ImageFormat.Jpg, ImageFormat.Png };
 
 
-        public void CropWhiteSpace(string inputPath, string outputPath)
-        {
-            throw new NotImplementedException();
-        }
-
-        public string EncodeImage(string inputPath, DateTime dateModified, string outputPath, bool autoOrient, ImageOrientation? orientation, int quality, ImageProcessingOptions options, ImageFormat selectedOutputFormat)
-        {
-            throw new NotImplementedException();
-        }
-
-        public void CreateImageCollage(ImageCollageOptions options)
-        {
-            throw new NotImplementedException();
-        }
-
+        /// <inheritdoc />
         public string Name => "Null Image Encoder";
         public string Name => "Null Image Encoder";
 
 
+        /// <inheritdoc />
         public bool SupportsImageCollageCreation => false;
         public bool SupportsImageCollageCreation => false;
 
 
+        /// <inheritdoc />
         public bool SupportsImageEncoding => false;
         public bool SupportsImageEncoding => false;
 
 
+        /// <inheritdoc />
         public ImageDimensions GetImageSize(string path)
         public ImageDimensions GetImageSize(string path)
+            => throw new NotImplementedException();
+
+        /// <inheritdoc />
+        public string EncodeImage(string inputPath, DateTime dateModified, string outputPath, bool autoOrient, ImageOrientation? orientation, int quality, ImageProcessingOptions options, ImageFormat selectedOutputFormat)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <inheritdoc />
+        public void CreateImageCollage(ImageCollageOptions options)
         {
         {
             throw new NotImplementedException();
             throw new NotImplementedException();
         }
         }

+ 3 - 0
Emby.IsoMounting/IsoMounter/Configuration/PluginConfiguration.cs

@@ -2,6 +2,9 @@ using MediaBrowser.Model.Plugins;
 
 
 namespace IsoMounter.Configuration
 namespace IsoMounter.Configuration
 {
 {
+    /// <summary>
+    /// Class PluginConfiguration.
+    /// </summary>
     public class PluginConfiguration : BasePluginConfiguration
     public class PluginConfiguration : BasePluginConfiguration
     {
     {
     }
     }

+ 13 - 0
Emby.IsoMounting/IsoMounter/IsoMounter.csproj

@@ -12,6 +12,19 @@
   <PropertyGroup>
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
     <TargetFramework>netstandard2.0</TargetFramework>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+    <GenerateDocumentationFile>true</GenerateDocumentationFile>
+    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+  </PropertyGroup>
+
+  <!-- Code analysers-->
+  <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.4" />
+    <PackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
+    <PackageReference Include="SerilogAnalyzer" Version="0.15.0" />
+  </ItemGroup>
+
+  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <CodeAnalysisRuleSet>../../jellyfin.ruleset</CodeAnalysisRuleSet>
   </PropertyGroup>
   </PropertyGroup>
 
 
 </Project>
 </Project>

+ 149 - 328
Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs

@@ -1,9 +1,10 @@
 using System;
 using System;
+using System.Diagnostics;
+using System.Globalization;
 using System.IO;
 using System.IO;
 using System.Runtime.InteropServices;
 using System.Runtime.InteropServices;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
-using MediaBrowser.Model.Diagnostics;
 using MediaBrowser.Model.IO;
 using MediaBrowser.Model.IO;
 using MediaBrowser.Model.System;
 using MediaBrowser.Model.System;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Logging;
@@ -11,441 +12,274 @@ using OperatingSystem = MediaBrowser.Common.System.OperatingSystem;
 
 
 namespace IsoMounter
 namespace IsoMounter
 {
 {
+    /// <summary>
+    /// The ISO manager implementation for Linux.
+    /// </summary>
     public class LinuxIsoManager : IIsoMounter
     public class LinuxIsoManager : IIsoMounter
     {
     {
-        [DllImport("libc", SetLastError = true)]
-        static extern uint getuid();
+        private const string MountCommand = "mount";
+        private const string UnmountCommand = "umount";
+        private const string SudoCommand = "sudo";
 
 
-        #region Private Fields
-
-        private readonly bool ExecutablesAvailable;
         private readonly ILogger _logger;
         private readonly ILogger _logger;
-        private readonly string MountCommand;
-        private readonly string MountPointRoot;
-        private readonly IProcessFactory ProcessFactory;
-        private readonly string SudoCommand;
-        private readonly string UmountCommand;
-
-        #endregion
+        private readonly string _mountPointRoot;
 
 
-        #region Constructor(s)
-
-        public LinuxIsoManager(ILogger logger, IProcessFactory processFactory)
+        /// <summary>
+        /// Initializes a new instance of the <see cref="LinuxIsoManager" /> class.
+        /// </summary>
+        /// <param name="logger">The logger.</param>
+        public LinuxIsoManager(ILogger logger)
         {
         {
             _logger = logger;
             _logger = logger;
-            ProcessFactory = processFactory;
 
 
-            MountPointRoot = Path.DirectorySeparatorChar + "tmp" + Path.DirectorySeparatorChar + "Emby";
+            _mountPointRoot = Path.DirectorySeparatorChar + "tmp" + Path.DirectorySeparatorChar + "Emby";
 
 
             _logger.LogDebug(
             _logger.LogDebug(
                 "[{0}] System PATH is currently set to [{1}].",
                 "[{0}] System PATH is currently set to [{1}].",
                 Name,
                 Name,
-                Environment.GetEnvironmentVariable("PATH") ?? ""
-            );
+                Environment.GetEnvironmentVariable("PATH") ?? string.Empty);
 
 
             _logger.LogDebug(
             _logger.LogDebug(
                 "[{0}] System path separator is [{1}].",
                 "[{0}] System path separator is [{1}].",
                 Name,
                 Name,
-                Path.PathSeparator
-            );
+                Path.PathSeparator);
 
 
             _logger.LogDebug(
             _logger.LogDebug(
                 "[{0}] Mount point root is [{1}].",
                 "[{0}] Mount point root is [{1}].",
                 Name,
                 Name,
-                MountPointRoot
-            );
-
-            //
-            // Get the location of the executables we need to support mounting/unmounting ISO images.
-            //
-
-            SudoCommand = GetFullPathForExecutable("sudo");
-
-            _logger.LogInformation(
-                "[{0}] Using version of [sudo] located at [{1}].",
-                Name,
-                SudoCommand
-            );
-
-            MountCommand = GetFullPathForExecutable("mount");
-
-            _logger.LogInformation(
-                "[{0}] Using version of [mount] located at [{1}].",
-                Name,
-                MountCommand
-            );
-
-            UmountCommand = GetFullPathForExecutable("umount");
-
-            _logger.LogInformation(
-                "[{0}] Using version of [umount] located at [{1}].",
-                Name,
-                UmountCommand
-            );
-
-            if (!string.IsNullOrEmpty(SudoCommand) && !string.IsNullOrEmpty(MountCommand) && !string.IsNullOrEmpty(UmountCommand))
-            {
-                ExecutablesAvailable = true;
-            }
-            else
-            {
-                ExecutablesAvailable = false;
-            }
-
+                _mountPointRoot);
         }
         }
 
 
-        #endregion
-
-        #region Interface Implementation for IIsoMounter
-
-        public bool IsInstalled => true;
-
+        /// <inheritdoc />
         public string Name => "LinuxMount";
         public string Name => "LinuxMount";
 
 
-        public bool RequiresInstallation => false;
+#pragma warning disable SA1300
+#pragma warning disable SA1400
+        [DllImport("libc", SetLastError = true)]
+        static extern uint getuid();
+
+#pragma warning restore SA1300
+#pragma warning restore SA1400
 
 
+        /// <inheritdoc />
         public bool CanMount(string path)
         public bool CanMount(string path)
         {
         {
-
             if (OperatingSystem.Id != OperatingSystemId.Linux)
             if (OperatingSystem.Id != OperatingSystemId.Linux)
             {
             {
                 return false;
                 return false;
             }
             }
+
             _logger.LogInformation(
             _logger.LogInformation(
-                "[{0}] Checking we can attempt to mount [{1}], Extension = [{2}], Operating System = [{3}], Executables Available = [{4}].",
+                "[{0}] Checking we can attempt to mount [{1}], Extension = [{2}], Operating System = [{3}].",
                 Name,
                 Name,
                 path,
                 path,
                 Path.GetExtension(path),
                 Path.GetExtension(path),
-                OperatingSystem.Name,
-                ExecutablesAvailable
-            );
+                OperatingSystem.Name);
 
 
-            if (ExecutablesAvailable)
-            {
-                return string.Equals(Path.GetExtension(path), ".iso", StringComparison.OrdinalIgnoreCase);
-            }
-            else
-            {
-                return false;
-            }
-        }
-
-        public Task Install(CancellationToken cancellationToken)
-        {
-            return Task.FromResult(false);
+            return string.Equals(Path.GetExtension(path), ".iso", StringComparison.OrdinalIgnoreCase);
         }
         }
 
 
+        /// <inheritdoc />
         public Task<IIsoMount> Mount(string isoPath, CancellationToken cancellationToken)
         public Task<IIsoMount> Mount(string isoPath, CancellationToken cancellationToken)
         {
         {
-            if (MountISO(isoPath, out LinuxMount mountedISO))
-            {
-                return Task.FromResult<IIsoMount>(mountedISO);
-            }
-            else
+            string cmdArguments;
+            string cmdFilename;
+            string mountPoint = Path.Combine(_mountPointRoot, Guid.NewGuid().ToString());
+
+            if (string.IsNullOrEmpty(isoPath))
             {
             {
-                throw new IOException(string.Format(
-                    "An error occurred trying to mount image [$0].",
-                    isoPath
-                ));
+                throw new ArgumentNullException(nameof(isoPath));
             }
             }
-        }
 
 
-        #endregion
-
-        #region Interface Implementation for IDisposable
-
-        // Flag: Has Dispose already been called?
-        private bool disposed = false;
-
-        public void Dispose()
-        {
-
-            // Dispose of unmanaged resources.
-            Dispose(true);
-
-            // Suppress finalization.
-            GC.SuppressFinalize(this);
+            _logger.LogInformation(
+                "[{Name}] Attempting to mount [{Path}].",
+                Name,
+                isoPath);
 
 
-        }
+            _logger.LogDebug(
+                "[{Name}] ISO will be mounted at [{Path}].",
+                Name,
+                mountPoint);
 
 
-        protected virtual void Dispose(bool disposing)
-        {
+            try
+            {
+                Directory.CreateDirectory(mountPoint);
+            }
+            catch (UnauthorizedAccessException ex)
+            {
+                throw new IOException("Unable to create mount point(Permission denied) for " + isoPath, ex);
+            }
+            catch (Exception ex)
+            {
+                throw new IOException("Unable to create mount point for " + isoPath, ex);
+            }
 
 
-            if (disposed)
+            if (GetUID() == 0)
+            {
+                cmdFilename = MountCommand;
+                cmdArguments = string.Format(
+                    CultureInfo.InvariantCulture,
+                    "\"{0}\" \"{1}\"",
+                    isoPath,
+                    mountPoint);
+            }
+            else
             {
             {
-                return;
+                cmdFilename = SudoCommand;
+                cmdArguments = string.Format(
+                    CultureInfo.InvariantCulture,
+                    "\"{0}\" \"{1}\" \"{2}\"",
+                    MountCommand,
+                    isoPath,
+                    mountPoint);
             }
             }
 
 
-            _logger.LogInformation(
-                "[{0}] Disposing [{1}].",
+            _logger.LogDebug(
+                "[{0}] Mount command [{1}], mount arguments [{2}].",
                 Name,
                 Name,
-                disposing
-            );
+                cmdFilename,
+                cmdArguments);
 
 
-            if (disposing)
+            int exitcode = ExecuteCommand(cmdFilename, cmdArguments);
+            if (exitcode == 0)
             {
             {
+                _logger.LogInformation(
+                    "[{0}] ISO mount completed successfully.",
+                    Name);
 
 
-                //
-                // Free managed objects here.
-                //
-
+                return Task.FromResult<IIsoMount>(new LinuxMount(this, isoPath, mountPoint));
             }
             }
 
 
-            //
-            // Free any unmanaged objects here.
-            //
-
-            disposed = true;
-
-        }
-
-        #endregion
-
-        #region Private Methods
-
-        private string GetFullPathForExecutable(string name)
-        {
+            _logger.LogInformation(
+                "[{0}] ISO mount completed with errors.",
+                Name);
 
 
-            foreach (string test in (Environment.GetEnvironmentVariable("PATH") ?? "").Split(Path.PathSeparator))
+            try
             {
             {
-                string path = test.Trim();
-
-                if (!string.IsNullOrEmpty(path) && File.Exists(path = Path.Combine(path, name)))
-                {
-                    return Path.GetFullPath(path);
-                }
+                Directory.Delete(mountPoint, false);
+            }
+            catch (Exception ex)
+            {
+                _logger.LogError(ex, "[{Name}] Unhandled exception removing mount point.", Name);
+                throw;
             }
             }
 
 
-            return string.Empty;
+            throw new ExternalException("Mount command failed", exitcode);
         }
         }
 
 
         private uint GetUID()
         private uint GetUID()
         {
         {
-
             var uid = getuid();
             var uid = getuid();
 
 
             _logger.LogDebug(
             _logger.LogDebug(
                 "[{0}] GetUserId() returned [{2}].",
                 "[{0}] GetUserId() returned [{2}].",
                 Name,
                 Name,
-                uid
-            );
+                uid);
 
 
             return uid;
             return uid;
-
         }
         }
 
 
-        private bool ExecuteCommand(string cmdFilename, string cmdArguments)
+        private int ExecuteCommand(string cmdFilename, string cmdArguments)
         {
         {
-
-            bool processFailed = false;
-
-            var process = ProcessFactory.Create(
-                new ProcessOptions
-                {
-                    CreateNoWindow = true,
-                    RedirectStandardOutput = true,
-                    RedirectStandardError = true,
-                    UseShellExecute = false,
-                    FileName = cmdFilename,
-                    Arguments = cmdArguments,
-                    IsHidden = true,
-                    ErrorDialog = false,
-                    EnableRaisingEvents = true
-                }
-            );
+            var startInfo = new ProcessStartInfo
+            {
+                FileName = cmdFilename,
+                Arguments = cmdArguments,
+                UseShellExecute = false,
+                CreateNoWindow = true,
+                ErrorDialog = false,
+                RedirectStandardOutput = true,
+                RedirectStandardError = true
+            };
+
+            var process = new Process()
+            {
+                StartInfo = startInfo
+            };
 
 
             try
             try
             {
             {
                 process.Start();
                 process.Start();
 
 
-                //StreamReader outputReader = process.StandardOutput.;
-                //StreamReader errorReader = process.StandardError;
-
                 _logger.LogDebug(
                 _logger.LogDebug(
                     "[{Name}] Standard output from process is [{Error}].",
                     "[{Name}] Standard output from process is [{Error}].",
                     Name,
                     Name,
-                    process.StandardOutput.ReadToEnd()
-                );
+                    process.StandardOutput.ReadToEnd());
 
 
                 _logger.LogDebug(
                 _logger.LogDebug(
                     "[{Name}] Standard error from process is [{Error}].",
                     "[{Name}] Standard error from process is [{Error}].",
                     Name,
                     Name,
-                    process.StandardError.ReadToEnd()
-                );
+                    process.StandardError.ReadToEnd());
+
+                return process.ExitCode;
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
-                processFailed = true;
                 _logger.LogDebug(ex, "[{Name}] Unhandled exception executing command.", Name);
                 _logger.LogDebug(ex, "[{Name}] Unhandled exception executing command.", Name);
+                throw;
             }
             }
-
-            if (!processFailed && process.ExitCode == 0)
+            finally
             {
             {
-                return true;
+                process?.Dispose();
             }
             }
-            else
-            {
-                return false;
-            }
-
         }
         }
 
 
-        private bool MountISO(string isoPath, out LinuxMount mountedISO)
+        /// <summary>
+        /// Unmounts the specified mount.
+        /// </summary>
+        /// <param name="mount">The mount.</param>
+        internal void OnUnmount(LinuxMount mount)
         {
         {
-
-            string cmdArguments;
-            string cmdFilename;
-            string mountPoint = Path.Combine(MountPointRoot, Guid.NewGuid().ToString());
-
-            if (!string.IsNullOrEmpty(isoPath))
-            {
-
-                _logger.LogInformation(
-                    "[{Name}] Attempting to mount [{Path}].",
-                    Name,
-                    isoPath
-                );
-
-                _logger.LogDebug(
-                    "[{Name}] ISO will be mounted at [{Path}].",
-                    Name,
-                    mountPoint
-                );
-
-            }
-            else
+            if (mount == null)
             {
             {
-
-                throw new ArgumentNullException(nameof(isoPath));
-
-            }
-
-            try
-            {
-                Directory.CreateDirectory(mountPoint);
-            }
-            catch (UnauthorizedAccessException)
-            {
-                throw new IOException("Unable to create mount point(Permission denied) for " + isoPath);
-            }
-            catch (Exception)
-            {
-                throw new IOException("Unable to create mount point for " + isoPath);
-            }
-
-            if (GetUID() == 0)
-            {
-                cmdFilename = MountCommand;
-                cmdArguments = string.Format("\"{0}\" \"{1}\"", isoPath, mountPoint);
-            }
-            else
-            {
-                cmdFilename = SudoCommand;
-                cmdArguments = string.Format("\"{0}\" \"{1}\" \"{2}\"", MountCommand, isoPath, mountPoint);
+                throw new ArgumentNullException(nameof(mount));
             }
             }
 
 
-            _logger.LogDebug(
-                "[{0}] Mount command [{1}], mount arguments [{2}].",
+            _logger.LogInformation(
+                "[{0}] Attempting to unmount ISO [{1}] mounted on [{2}].",
                 Name,
                 Name,
-                cmdFilename,
-                cmdArguments
-            );
-
-            if (ExecuteCommand(cmdFilename, cmdArguments))
-            {
-
-                _logger.LogInformation(
-                    "[{0}] ISO mount completed successfully.",
-                    Name
-                );
-
-                mountedISO = new LinuxMount(this, isoPath, mountPoint);
-
-            }
-            else
-            {
-
-                _logger.LogInformation(
-                    "[{0}] ISO mount completed with errors.",
-                    Name
-                );
-
-                try
-                {
-                    Directory.Delete(mountPoint, false);
-                }
-                catch (Exception ex)
-                {
-                    _logger.LogInformation(ex, "[{Name}] Unhandled exception removing mount point.", Name);
-                }
-
-                mountedISO = null;
-
-            }
-
-            return mountedISO != null;
-
-        }
-
-        private void UnmountISO(LinuxMount mount)
-        {
+                mount.IsoPath,
+                mount.MountedPath);
 
 
             string cmdArguments;
             string cmdArguments;
             string cmdFilename;
             string cmdFilename;
 
 
-            if (mount != null)
-            {
-
-                _logger.LogInformation(
-                    "[{0}] Attempting to unmount ISO [{1}] mounted on [{2}].",
-                    Name,
-                    mount.IsoPath,
-                    mount.MountedPath
-                );
-
-            }
-            else
-            {
-
-                throw new ArgumentNullException(nameof(mount));
-
-            }
-
             if (GetUID() == 0)
             if (GetUID() == 0)
             {
             {
-                cmdFilename = UmountCommand;
-                cmdArguments = string.Format("\"{0}\"", mount.MountedPath);
+                cmdFilename = UnmountCommand;
+                cmdArguments = string.Format(
+                    CultureInfo.InvariantCulture,
+                    "\"{0}\"",
+                    mount.MountedPath);
             }
             }
             else
             else
             {
             {
                 cmdFilename = SudoCommand;
                 cmdFilename = SudoCommand;
-                cmdArguments = string.Format("\"{0}\" \"{1}\"", UmountCommand, mount.MountedPath);
+                cmdArguments = string.Format(
+                    CultureInfo.InvariantCulture,
+                    "\"{0}\" \"{1}\"",
+                    UnmountCommand,
+                    mount.MountedPath);
             }
             }
 
 
             _logger.LogDebug(
             _logger.LogDebug(
                 "[{0}] Umount command [{1}], umount arguments [{2}].",
                 "[{0}] Umount command [{1}], umount arguments [{2}].",
                 Name,
                 Name,
                 cmdFilename,
                 cmdFilename,
-                cmdArguments
-            );
+                cmdArguments);
 
 
-            if (ExecuteCommand(cmdFilename, cmdArguments))
+            int exitcode = ExecuteCommand(cmdFilename, cmdArguments);
+            if (exitcode == 0)
             {
             {
-
                 _logger.LogInformation(
                 _logger.LogInformation(
                     "[{0}] ISO unmount completed successfully.",
                     "[{0}] ISO unmount completed successfully.",
-                    Name
-                );
-
+                    Name);
             }
             }
             else
             else
             {
             {
-
                 _logger.LogInformation(
                 _logger.LogInformation(
                     "[{0}] ISO unmount completed with errors.",
                     "[{0}] ISO unmount completed with errors.",
-                    Name
-                );
-
+                    Name);
             }
             }
 
 
             try
             try
@@ -454,24 +288,11 @@ namespace IsoMounter
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
-                _logger.LogInformation(ex, "[{Name}] Unhandled exception removing mount point.", Name);
+                _logger.LogError(ex, "[{Name}] Unhandled exception removing mount point.", Name);
+                throw;
             }
             }
-        }
-
-        #endregion
-
-        #region Internal Methods
-
-        internal void OnUnmount(LinuxMount mount)
-        {
-
-            UnmountISO(mount);
 
 
+            throw new ExternalException("Mount command failed", exitcode);
         }
         }
-
-        #endregion
-
     }
     }
-
 }
 }
-

+ 24 - 49
Emby.IsoMounting/IsoMounter/LinuxMount.cs

@@ -3,81 +3,56 @@ using MediaBrowser.Model.IO;
 
 
 namespace IsoMounter
 namespace IsoMounter
 {
 {
+    /// <summary>
+    /// Class LinuxMount.
+    /// </summary>
     internal class LinuxMount : IIsoMount
     internal class LinuxMount : IIsoMount
     {
     {
+        private readonly LinuxIsoManager _linuxIsoManager;
 
 
-        #region Private Fields
-
-        private readonly LinuxIsoManager linuxIsoManager;
-
-        #endregion
-
-        #region Constructor(s)
+        private bool _disposed = false;
 
 
+        /// <summary>
+        /// Initializes a new instance of the <see cref="LinuxMount" /> class.
+        /// </summary>
+        /// <param name="isoManager">The ISO manager that mounted this ISO file.</param>
+        /// <param name="isoPath">The path to the ISO file.</param>
+        /// <param name="mountFolder">The folder the ISO is mounted in.</param>
         internal LinuxMount(LinuxIsoManager isoManager, string isoPath, string mountFolder)
         internal LinuxMount(LinuxIsoManager isoManager, string isoPath, string mountFolder)
         {
         {
-
-            linuxIsoManager = isoManager;
+            _linuxIsoManager = isoManager;
 
 
             IsoPath = isoPath;
             IsoPath = isoPath;
             MountedPath = mountFolder;
             MountedPath = mountFolder;
-
         }
         }
 
 
-        #endregion
-
-        #region Interface Implementation for IDisposable
+        /// <inheritdoc />
+        public string IsoPath { get; }
 
 
-        // Flag: Has Dispose already been called?
-        private bool disposed = false;
+        /// <inheritdoc />
+        public string MountedPath { get; }
 
 
+        /// <inheritdoc />
         public void Dispose()
         public void Dispose()
         {
         {
-
-            // Dispose of unmanaged resources.
             Dispose(true);
             Dispose(true);
-
-            // Suppress finalization.
             GC.SuppressFinalize(this);
             GC.SuppressFinalize(this);
-
         }
         }
 
 
+        /// <summary>
+        /// Releases the unmanaged resources and disposes of the managed resources used.
+        /// </summary>
+        /// <param name="disposing">Whether or not the managed resources should be disposed.</param>
         protected virtual void Dispose(bool disposing)
         protected virtual void Dispose(bool disposing)
         {
         {
-
-            if (disposed)
+            if (_disposed)
             {
             {
                 return;
                 return;
             }
             }
 
 
-            if (disposing)
-            {
-
-                //
-                // Free managed objects here.
-                //
-
-                linuxIsoManager.OnUnmount(this);
-
-            }
-
-            //
-            // Free any unmanaged objects here.
-            //
-
-            disposed = true;
+            _linuxIsoManager.OnUnmount(this);
 
 
+            _disposed = true;
         }
         }
-
-        #endregion
-
-        #region Interface Implementation for IIsoMount
-
-        public string IsoPath { get; private set; }
-        public string MountedPath { get; private set; }
-
-        #endregion
-
     }
     }
-
 }
 }

+ 14 - 11
Emby.IsoMounting/IsoMounter/Plugin.cs

@@ -6,25 +6,28 @@ using MediaBrowser.Model.Serialization;
 
 
 namespace IsoMounter
 namespace IsoMounter
 {
 {
+    /// <summary>
+    /// The LinuxMount plugin class.
+    /// </summary>
     public class Plugin : BasePlugin<PluginConfiguration>
     public class Plugin : BasePlugin<PluginConfiguration>
     {
     {
-        public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer) : base(applicationPaths, xmlSerializer)
+        /// <summary>
+        /// Initializes a new instance of the <see cref="Plugin" /> class.
+        /// </summary>
+        /// <param name="applicationPaths">The application paths.</param>
+        /// <param name="xmlSerializer">The XML serializer.</param>
+        public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer)
+            : base(applicationPaths, xmlSerializer)
         {
         {
         }
         }
 
 
-        private Guid _id = new Guid("4682DD4C-A675-4F1B-8E7C-79ADF137A8F8");
-        public override Guid Id => _id;
+        /// <inheritdoc />
+        public override Guid Id { get; } = new Guid("4682DD4C-A675-4F1B-8E7C-79ADF137A8F8");
 
 
-        /// <summary>
-        /// Gets the name of the plugin
-        /// </summary>
-        /// <value>The name.</value>
+        /// <inheritdoc />
         public override string Name => "Iso Mounter";
         public override string Name => "Iso Mounter";
 
 
-        /// <summary>
-        /// Gets the description.
-        /// </summary>
-        /// <value>The description.</value>
+        /// <inheritdoc />
         public override string Description => "Mount and stream ISO contents";
         public override string Description => "Mount and stream ISO contents";
     }
     }
 }
 }

+ 14 - 12
Emby.Naming/Audio/AlbumParser.cs

@@ -33,27 +33,29 @@ namespace Emby.Naming.Audio
 
 
             // Normalize
             // Normalize
             // Remove whitespace
             // Remove whitespace
-            filename = filename.Replace("-", " ");
-            filename = filename.Replace(".", " ");
-            filename = filename.Replace("(", " ");
-            filename = filename.Replace(")", " ");
+            filename = filename.Replace('-', ' ');
+            filename = filename.Replace('.', ' ');
+            filename = filename.Replace('(', ' ');
+            filename = filename.Replace(')', ' ');
             filename = Regex.Replace(filename, @"\s+", " ");
             filename = Regex.Replace(filename, @"\s+", " ");
 
 
             filename = filename.TrimStart();
             filename = filename.TrimStart();
 
 
             foreach (var prefix in _options.AlbumStackingPrefixes)
             foreach (var prefix in _options.AlbumStackingPrefixes)
             {
             {
-                if (filename.IndexOf(prefix, StringComparison.OrdinalIgnoreCase) == 0)
+                if (filename.IndexOf(prefix, StringComparison.OrdinalIgnoreCase) != 0)
                 {
                 {
-                    var tmp = filename.Substring(prefix.Length);
+                    continue;
+                }
+
+                var tmp = filename.Substring(prefix.Length);
 
 
-                    tmp = tmp.Trim().Split(' ').FirstOrDefault() ?? string.Empty;
+                tmp = tmp.Trim().Split(' ').FirstOrDefault() ?? string.Empty;
 
 
-                    if (int.TryParse(tmp, NumberStyles.Integer, CultureInfo.InvariantCulture, out var val))
-                    {
-                        result.IsMultiPart = true;
-                        break;
-                    }
+                if (int.TryParse(tmp, NumberStyles.Integer, CultureInfo.InvariantCulture, out _))
+                {
+                    result.IsMultiPart = true;
+                    break;
                 }
                 }
             }
             }
 
 

+ 2 - 0
Emby.Naming/Audio/MultiPartResult.cs

@@ -7,11 +7,13 @@ namespace Emby.Naming.Audio
         /// </summary>
         /// </summary>
         /// <value>The name.</value>
         /// <value>The name.</value>
         public string Name { get; set; }
         public string Name { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the part.
         /// Gets or sets the part.
         /// </summary>
         /// </summary>
         /// <value>The part.</value>
         /// <value>The part.</value>
         public string Part { get; set; }
         public string Part { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets a value indicating whether this instance is multi part.
         /// Gets or sets a value indicating whether this instance is multi part.
         /// </summary>
         /// </summary>

+ 25 - 4
Emby.Naming/AudioBook/AudioBookFileInfo.cs

@@ -12,35 +12,56 @@ namespace Emby.Naming.AudioBook
         /// </summary>
         /// </summary>
         /// <value>The path.</value>
         /// <value>The path.</value>
         public string Path { get; set; }
         public string Path { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the container.
         /// Gets or sets the container.
         /// </summary>
         /// </summary>
         /// <value>The container.</value>
         /// <value>The container.</value>
         public string Container { get; set; }
         public string Container { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the part number.
         /// Gets or sets the part number.
         /// </summary>
         /// </summary>
         /// <value>The part number.</value>
         /// <value>The part number.</value>
         public int? PartNumber { get; set; }
         public int? PartNumber { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the chapter number.
         /// Gets or sets the chapter number.
         /// </summary>
         /// </summary>
         /// <value>The chapter number.</value>
         /// <value>The chapter number.</value>
         public int? ChapterNumber { get; set; }
         public int? ChapterNumber { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the type.
         /// Gets or sets the type.
         /// </summary>
         /// </summary>
         /// <value>The type.</value>
         /// <value>The type.</value>
         public bool IsDirectory { get; set; }
         public bool IsDirectory { get; set; }
 
 
+        /// <inheritdoc/>
         public int CompareTo(AudioBookFileInfo other)
         public int CompareTo(AudioBookFileInfo other)
         {
         {
-            if (ReferenceEquals(this, other)) return 0;
-            if (ReferenceEquals(null, other)) return 1;
+            if (ReferenceEquals(this, other))
+            {
+                return 0;
+            }
+
+            if (ReferenceEquals(null, other))
+            {
+                return 1;
+            }
+
             var chapterNumberComparison = Nullable.Compare(ChapterNumber, other.ChapterNumber);
             var chapterNumberComparison = Nullable.Compare(ChapterNumber, other.ChapterNumber);
-            if (chapterNumberComparison != 0) return chapterNumberComparison;
+            if (chapterNumberComparison != 0)
+            {
+                return chapterNumberComparison;
+            }
+
             var partNumberComparison = Nullable.Compare(PartNumber, other.PartNumber);
             var partNumberComparison = Nullable.Compare(PartNumber, other.PartNumber);
-            if (partNumberComparison != 0) return partNumberComparison;
+            if (partNumberComparison != 0)
+            {
+                return partNumberComparison;
+            }
+
             return string.Compare(Path, other.Path, StringComparison.Ordinal);
             return string.Compare(Path, other.Path, StringComparison.Ordinal);
         }
         }
     }
     }

+ 7 - 6
Emby.Naming/AudioBook/AudioBookFilePathParser.cs

@@ -1,3 +1,4 @@
+using System;
 using System.Globalization;
 using System.Globalization;
 using System.IO;
 using System.IO;
 using System.Text.RegularExpressions;
 using System.Text.RegularExpressions;
@@ -14,14 +15,13 @@ namespace Emby.Naming.AudioBook
             _options = options;
             _options = options;
         }
         }
 
 
-        public AudioBookFilePathParserResult Parse(string path, bool IsDirectory)
+        public AudioBookFilePathParserResult Parse(string path)
         {
         {
-            var result = Parse(path);
-            return !result.Success ? new AudioBookFilePathParserResult() : result;
-        }
+            if (path == null)
+            {
+                throw new ArgumentNullException(nameof(path));
+            }
 
 
-        private AudioBookFilePathParserResult Parse(string path)
-        {
             var result = new AudioBookFilePathParserResult();
             var result = new AudioBookFilePathParserResult();
             var fileName = Path.GetFileNameWithoutExtension(path);
             var fileName = Path.GetFileNameWithoutExtension(path);
             foreach (var expression in _options.AudioBookPartsExpressions)
             foreach (var expression in _options.AudioBookPartsExpressions)
@@ -40,6 +40,7 @@ namespace Emby.Naming.AudioBook
                             }
                             }
                         }
                         }
                     }
                     }
+
                     if (!result.PartNumber.HasValue)
                     if (!result.PartNumber.HasValue)
                     {
                     {
                         var value = match.Groups["part"];
                         var value = match.Groups["part"];

+ 2 - 0
Emby.Naming/AudioBook/AudioBookFilePathParserResult.cs

@@ -3,7 +3,9 @@ namespace Emby.Naming.AudioBook
     public class AudioBookFilePathParserResult
     public class AudioBookFilePathParserResult
     {
     {
         public int? PartNumber { get; set; }
         public int? PartNumber { get; set; }
+
         public int? ChapterNumber { get; set; }
         public int? ChapterNumber { get; set; }
+
         public bool Success { get; set; }
         public bool Success { get; set; }
     }
     }
 }
 }

+ 14 - 7
Emby.Naming/AudioBook/AudioBookInfo.cs

@@ -7,33 +7,40 @@ namespace Emby.Naming.AudioBook
     /// </summary>
     /// </summary>
     public class AudioBookInfo
     public class AudioBookInfo
     {
     {
+        public AudioBookInfo()
+        {
+            Files = new List<AudioBookFileInfo>();
+            Extras = new List<AudioBookFileInfo>();
+            AlternateVersions = new List<AudioBookFileInfo>();
+        }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the name.
         /// Gets or sets the name.
         /// </summary>
         /// </summary>
         /// <value>The name.</value>
         /// <value>The name.</value>
         public string Name { get; set; }
         public string Name { get; set; }
+
+        /// <summary>
+        /// Gets or sets the year.
+        /// </summary>
         public int? Year { get; set; }
         public int? Year { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the files.
         /// Gets or sets the files.
         /// </summary>
         /// </summary>
         /// <value>The files.</value>
         /// <value>The files.</value>
         public List<AudioBookFileInfo> Files { get; set; }
         public List<AudioBookFileInfo> Files { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the extras.
         /// Gets or sets the extras.
         /// </summary>
         /// </summary>
         /// <value>The extras.</value>
         /// <value>The extras.</value>
         public List<AudioBookFileInfo> Extras { get; set; }
         public List<AudioBookFileInfo> Extras { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the alternate versions.
         /// Gets or sets the alternate versions.
         /// </summary>
         /// </summary>
         /// <value>The alternate versions.</value>
         /// <value>The alternate versions.</value>
         public List<AudioBookFileInfo> AlternateVersions { get; set; }
         public List<AudioBookFileInfo> AlternateVersions { get; set; }
-
-        public AudioBookInfo()
-        {
-            Files = new List<AudioBookFileInfo>();
-            Extras = new List<AudioBookFileInfo>();
-            AlternateVersions = new List<AudioBookFileInfo>();
-        }
     }
     }
 }
 }

+ 1 - 1
Emby.Naming/AudioBook/AudioBookListResolver.cs

@@ -15,7 +15,7 @@ namespace Emby.Naming.AudioBook
             _options = options;
             _options = options;
         }
         }
 
 
-        public IEnumerable<AudioBookInfo> Resolve(List<FileSystemMetadata> files)
+        public IEnumerable<AudioBookInfo> Resolve(IEnumerable<FileSystemMetadata> files)
         {
         {
             var audioBookResolver = new AudioBookResolver(_options);
             var audioBookResolver = new AudioBookResolver(_options);
 
 

+ 6 - 5
Emby.Naming/AudioBook/AudioBookResolver.cs

@@ -24,19 +24,21 @@ namespace Emby.Naming.AudioBook
             return Resolve(path, true);
             return Resolve(path, true);
         }
         }
 
 
-        public AudioBookFileInfo Resolve(string path, bool IsDirectory = false)
+        public AudioBookFileInfo Resolve(string path, bool isDirectory = false)
         {
         {
             if (string.IsNullOrEmpty(path))
             if (string.IsNullOrEmpty(path))
             {
             {
                 throw new ArgumentNullException(nameof(path));
                 throw new ArgumentNullException(nameof(path));
             }
             }
 
 
-            if (IsDirectory) // TODO
+            // TODO
+            if (isDirectory)
             {
             {
                 return null;
                 return null;
             }
             }
 
 
             var extension = Path.GetExtension(path);
             var extension = Path.GetExtension(path);
+
             // Check supported extensions
             // Check supported extensions
             if (!_options.AudioFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
             if (!_options.AudioFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
             {
             {
@@ -45,8 +47,7 @@ namespace Emby.Naming.AudioBook
 
 
             var container = extension.TrimStart('.');
             var container = extension.TrimStart('.');
 
 
-            var parsingResult = new AudioBookFilePathParser(_options)
-                .Parse(path, IsDirectory);
+            var parsingResult = new AudioBookFilePathParser(_options).Parse(path);
 
 
             return new AudioBookFileInfo
             return new AudioBookFileInfo
             {
             {
@@ -54,7 +55,7 @@ namespace Emby.Naming.AudioBook
                 Container = container,
                 Container = container,
                 PartNumber = parsingResult.PartNumber,
                 PartNumber = parsingResult.PartNumber,
                 ChapterNumber = parsingResult.ChapterNumber,
                 ChapterNumber = parsingResult.ChapterNumber,
-                IsDirectory = IsDirectory
+                IsDirectory = isDirectory
             };
             };
         }
         }
     }
     }

+ 14 - 3
Emby.Naming/Common/EpisodeExpression.cs

@@ -6,17 +6,28 @@ namespace Emby.Naming.Common
     public class EpisodeExpression
     public class EpisodeExpression
     {
     {
         private string _expression;
         private string _expression;
-        public string Expression { get => _expression;
-            set { _expression = value; _regex = null; } }
+        private Regex _regex;
+
+        public string Expression
+        {
+            get => _expression;
+            set
+            {
+                _expression = value;
+                _regex = null;
+            }
+        }
 
 
         public bool IsByDate { get; set; }
         public bool IsByDate { get; set; }
+
         public bool IsOptimistic { get; set; }
         public bool IsOptimistic { get; set; }
+
         public bool IsNamed { get; set; }
         public bool IsNamed { get; set; }
+
         public bool SupportsAbsoluteEpisodeNumbers { get; set; }
         public bool SupportsAbsoluteEpisodeNumbers { get; set; }
 
 
         public string[] DateTimeFormats { get; set; }
         public string[] DateTimeFormats { get; set; }
 
 
-        private Regex _regex;
         public Regex Regex => _regex ?? (_regex = new Regex(Expression, RegexOptions.IgnoreCase | RegexOptions.Compiled));
         public Regex Regex => _regex ?? (_regex = new Regex(Expression, RegexOptions.IgnoreCase | RegexOptions.Compiled));
 
 
         public EpisodeExpression(string expression, bool byDate)
         public EpisodeExpression(string expression, bool byDate)

+ 2 - 0
Emby.Naming/Common/MediaType.cs

@@ -6,10 +6,12 @@ namespace Emby.Naming.Common
         /// The audio
         /// The audio
         /// </summary>
         /// </summary>
         Audio = 0,
         Audio = 0,
+
         /// <summary>
         /// <summary>
         /// The photo
         /// The photo
         /// </summary>
         /// </summary>
         Photo = 1,
         Photo = 1,
+
         /// <summary>
         /// <summary>
         /// The video
         /// The video
         /// </summary>
         /// </summary>

+ 39 - 36
Emby.Naming/Common/NamingOptions.cs

@@ -8,19 +8,25 @@ namespace Emby.Naming.Common
     public class NamingOptions
     public class NamingOptions
     {
     {
         public string[] AudioFileExtensions { get; set; }
         public string[] AudioFileExtensions { get; set; }
+
         public string[] AlbumStackingPrefixes { get; set; }
         public string[] AlbumStackingPrefixes { get; set; }
 
 
         public string[] SubtitleFileExtensions { get; set; }
         public string[] SubtitleFileExtensions { get; set; }
+
         public char[] SubtitleFlagDelimiters { get; set; }
         public char[] SubtitleFlagDelimiters { get; set; }
 
 
         public string[] SubtitleForcedFlags { get; set; }
         public string[] SubtitleForcedFlags { get; set; }
+
         public string[] SubtitleDefaultFlags { get; set; }
         public string[] SubtitleDefaultFlags { get; set; }
 
 
         public EpisodeExpression[] EpisodeExpressions { get; set; }
         public EpisodeExpression[] EpisodeExpressions { get; set; }
+
         public string[] EpisodeWithoutSeasonExpressions { get; set; }
         public string[] EpisodeWithoutSeasonExpressions { get; set; }
+
         public string[] EpisodeMultiPartExpressions { get; set; }
         public string[] EpisodeMultiPartExpressions { get; set; }
 
 
         public string[] VideoFileExtensions { get; set; }
         public string[] VideoFileExtensions { get; set; }
+
         public string[] StubFileExtensions { get; set; }
         public string[] StubFileExtensions { get; set; }
 
 
         public string[] AudioBookPartsExpressions { get; set; }
         public string[] AudioBookPartsExpressions { get; set; }
@@ -28,12 +34,14 @@ namespace Emby.Naming.Common
         public StubTypeRule[] StubTypes { get; set; }
         public StubTypeRule[] StubTypes { get; set; }
 
 
         public char[] VideoFlagDelimiters { get; set; }
         public char[] VideoFlagDelimiters { get; set; }
+
         public Format3DRule[] Format3DRules { get; set; }
         public Format3DRule[] Format3DRules { get; set; }
 
 
         public string[] VideoFileStackingExpressions { get; set; }
         public string[] VideoFileStackingExpressions { get; set; }
+
         public string[] CleanDateTimes { get; set; }
         public string[] CleanDateTimes { get; set; }
-        public string[] CleanStrings { get; set; }
 
 
+        public string[] CleanStrings { get; set; }
 
 
         public EpisodeExpression[] MultipleEpisodeExpressions { get; set; }
         public EpisodeExpression[] MultipleEpisodeExpressions { get; set; }
 
 
@@ -41,7 +49,7 @@ namespace Emby.Naming.Common
 
 
         public NamingOptions()
         public NamingOptions()
         {
         {
-            VideoFileExtensions = new string[]
+            VideoFileExtensions = new[]
             {
             {
                 ".m4v",
                 ".m4v",
                 ".3gp",
                 ".3gp",
@@ -106,53 +114,53 @@ namespace Emby.Naming.Common
             {
             {
                 new StubTypeRule
                 new StubTypeRule
                 {
                 {
-                     StubType = "dvd",
-                     Token = "dvd"
+                    StubType = "dvd",
+                    Token = "dvd"
                 },
                 },
                 new StubTypeRule
                 new StubTypeRule
                 {
                 {
-                     StubType = "hddvd",
-                     Token = "hddvd"
+                    StubType = "hddvd",
+                    Token = "hddvd"
                 },
                 },
                 new StubTypeRule
                 new StubTypeRule
                 {
                 {
-                     StubType = "bluray",
-                     Token = "bluray"
+                    StubType = "bluray",
+                    Token = "bluray"
                 },
                 },
                 new StubTypeRule
                 new StubTypeRule
                 {
                 {
-                     StubType = "bluray",
-                     Token = "brrip"
+                    StubType = "bluray",
+                    Token = "brrip"
                 },
                 },
                 new StubTypeRule
                 new StubTypeRule
                 {
                 {
-                     StubType = "bluray",
-                     Token = "bd25"
+                    StubType = "bluray",
+                    Token = "bd25"
                 },
                 },
                 new StubTypeRule
                 new StubTypeRule
                 {
                 {
-                     StubType = "bluray",
-                     Token = "bd50"
+                    StubType = "bluray",
+                    Token = "bd50"
                 },
                 },
                 new StubTypeRule
                 new StubTypeRule
                 {
                 {
-                     StubType = "vhs",
-                     Token = "vhs"
+                    StubType = "vhs",
+                    Token = "vhs"
                 },
                 },
                 new StubTypeRule
                 new StubTypeRule
                 {
                 {
-                     StubType = "tv",
-                     Token = "HDTV"
+                    StubType = "tv",
+                    Token = "HDTV"
                 },
                 },
                 new StubTypeRule
                 new StubTypeRule
                 {
                 {
-                     StubType = "tv",
-                     Token = "PDTV"
+                    StubType = "tv",
+                    Token = "PDTV"
                 },
                 },
                 new StubTypeRule
                 new StubTypeRule
                 {
                 {
-                     StubType = "tv",
-                     Token = "DSR"
+                    StubType = "tv",
+                    Token = "DSR"
                 }
                 }
             };
             };
 
 
@@ -286,7 +294,7 @@ namespace Emby.Naming.Common
                 new EpisodeExpression(@"[\._ -]()[Ee][Pp]_?([0-9]+)([^\\/]*)$"),
                 new EpisodeExpression(@"[\._ -]()[Ee][Pp]_?([0-9]+)([^\\/]*)$"),
                 new EpisodeExpression("([0-9]{4})[\\.-]([0-9]{2})[\\.-]([0-9]{2})", true)
                 new EpisodeExpression("([0-9]{4})[\\.-]([0-9]{2})[\\.-]([0-9]{2})", true)
                 {
                 {
-                    DateTimeFormats = new []
+                    DateTimeFormats = new[]
                     {
                     {
                         "yyyy.MM.dd",
                         "yyyy.MM.dd",
                         "yyyy-MM-dd",
                         "yyyy-MM-dd",
@@ -295,7 +303,7 @@ namespace Emby.Naming.Common
                 },
                 },
                 new EpisodeExpression("([0-9]{2})[\\.-]([0-9]{2})[\\.-]([0-9]{4})", true)
                 new EpisodeExpression("([0-9]{2})[\\.-]([0-9]{2})[\\.-]([0-9]{4})", true)
                 {
                 {
-                    DateTimeFormats = new []
+                    DateTimeFormats = new[]
                     {
                     {
                         "dd.MM.yyyy",
                         "dd.MM.yyyy",
                         "dd-MM-yyyy",
                         "dd-MM-yyyy",
@@ -348,9 +356,7 @@ namespace Emby.Naming.Common
                 },
                 },
 
 
                 // "1-12 episode title"
                 // "1-12 episode title"
-                new EpisodeExpression(@"([0-9]+)-([0-9]+)")
-                {
-                },
+                new EpisodeExpression(@"([0-9]+)-([0-9]+)"),
 
 
                 // "01 - blah.avi", "01-blah.avi"
                 // "01 - blah.avi", "01-blah.avi"
                 new EpisodeExpression(@".*(\\|\/)(?<epnumber>\d{1,3})(-(?<endingepnumber>\d{2,3}))*\s?-\s?[^\\\/]*$")
                 new EpisodeExpression(@".*(\\|\/)(?<epnumber>\d{1,3})(-(?<endingepnumber>\d{2,3}))*\s?-\s?[^\\\/]*$")
@@ -427,7 +433,7 @@ namespace Emby.Naming.Common
                     Token = "_trailer",
                     Token = "_trailer",
                     MediaType = MediaType.Video
                     MediaType = MediaType.Video
                 },
                 },
-                 new ExtraRule
+                new ExtraRule
                 {
                 {
                     ExtraType = "trailer",
                     ExtraType = "trailer",
                     RuleType = ExtraRuleType.Suffix,
                     RuleType = ExtraRuleType.Suffix,
@@ -462,7 +468,7 @@ namespace Emby.Naming.Common
                     Token = "_sample",
                     Token = "_sample",
                     MediaType = MediaType.Video
                     MediaType = MediaType.Video
                 },
                 },
-                 new ExtraRule
+                new ExtraRule
                 {
                 {
                     ExtraType = "sample",
                     ExtraType = "sample",
                     RuleType = ExtraRuleType.Suffix,
                     RuleType = ExtraRuleType.Suffix,
@@ -476,7 +482,6 @@ namespace Emby.Naming.Common
                     Token = "theme",
                     Token = "theme",
                     MediaType = MediaType.Audio
                     MediaType = MediaType.Audio
                 },
                 },
-
                 new ExtraRule
                 new ExtraRule
                 {
                 {
                     ExtraType = "scene",
                     ExtraType = "scene",
@@ -526,8 +531,8 @@ namespace Emby.Naming.Common
                     Token = "-short",
                     Token = "-short",
                     MediaType = MediaType.Video
                     MediaType = MediaType.Video
                 }
                 }
-
             };
             };
+
             Format3DRules = new[]
             Format3DRules = new[]
             {
             {
                 // Kodi rules:
                 // Kodi rules:
@@ -648,12 +653,10 @@ namespace Emby.Naming.Common
                 @".*(\\|\/)(?<seriesname>((?![sS]?\d{1,4}[xX]\d{1,3})[^\\\/])*)?([sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3}))(-[xX]?[eE]?(?<endingepnumber>\d{1,3}))+[^\\\/]*$",
                 @".*(\\|\/)(?<seriesname>((?![sS]?\d{1,4}[xX]\d{1,3})[^\\\/])*)?([sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3}))(-[xX]?[eE]?(?<endingepnumber>\d{1,3}))+[^\\\/]*$",
                 @".*(\\|\/)(?<seriesname>[^\\\/]*)[sS](?<seasonnumber>\d{1,4})[xX\.]?[eE](?<epnumber>\d{1,3})((-| - )?[xXeE](?<endingepnumber>\d{1,3}))+[^\\\/]*$",
                 @".*(\\|\/)(?<seriesname>[^\\\/]*)[sS](?<seasonnumber>\d{1,4})[xX\.]?[eE](?<epnumber>\d{1,3})((-| - )?[xXeE](?<endingepnumber>\d{1,3}))+[^\\\/]*$",
                 @".*(\\|\/)(?<seriesname>[^\\\/]*)[sS](?<seasonnumber>\d{1,4})[xX\.]?[eE](?<epnumber>\d{1,3})(-[xX]?[eE]?(?<endingepnumber>\d{1,3}))+[^\\\/]*$"
                 @".*(\\|\/)(?<seriesname>[^\\\/]*)[sS](?<seasonnumber>\d{1,4})[xX\.]?[eE](?<epnumber>\d{1,3})(-[xX]?[eE]?(?<endingepnumber>\d{1,3}))+[^\\\/]*$"
-
             }.Select(i => new EpisodeExpression(i)
             }.Select(i => new EpisodeExpression(i)
-            {
-                IsNamed = true
-
-            }).ToArray();
+                {
+                    IsNamed = true
+                }).ToArray();
 
 
             VideoFileExtensions = extensions
             VideoFileExtensions = extensions
                 .Distinct(StringComparer.OrdinalIgnoreCase)
                 .Distinct(StringComparer.OrdinalIgnoreCase)

+ 13 - 1
Emby.Naming/Emby.Naming.csproj

@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
 
 
   <PropertyGroup>
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
     <TargetFramework>netstandard2.0</TargetFramework>
@@ -18,6 +18,18 @@
     <PackageId>Jellyfin.Naming</PackageId>
     <PackageId>Jellyfin.Naming</PackageId>
     <PackageLicenseUrl>https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt</PackageLicenseUrl>
     <PackageLicenseUrl>https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt</PackageLicenseUrl>
     <RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
     <RepositoryUrl>https://github.com/jellyfin/jellyfin</RepositoryUrl>
+    <GenerateDocumentationFile>true</GenerateDocumentationFile>
+  </PropertyGroup>
+
+  <!-- Code analysers-->
+  <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.4" />
+    <PackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
+    <PackageReference Include="SerilogAnalyzer" Version="0.15.0" />
+  </ItemGroup>
+
+  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
   </PropertyGroup>
   </PropertyGroup>
 
 
 </Project>
 </Project>

+ 1 - 0
Emby.Naming/Extensions/StringExtensions.cs

@@ -5,6 +5,7 @@ namespace Emby.Naming.Extensions
 {
 {
     public static class StringExtensions
     public static class StringExtensions
     {
     {
+        // TODO: @bond remove this when moving to netstandard2.1
         public static string Replace(this string str, string oldValue, string newValue, StringComparison comparison)
         public static string Replace(this string str, string oldValue, string newValue, StringComparison comparison)
         {
         {
             var sb = new StringBuilder();
             var sb = new StringBuilder();

+ 0 - 30
Emby.Naming/StringExtensions.cs

@@ -1,30 +0,0 @@
-using System;
-using System.Text;
-
-namespace Emby.Naming
-{
-    internal static class StringExtensions
-    {
-        public static string Replace(this string str, string oldValue, string newValue, StringComparison comparison)
-        {
-            var sb = new StringBuilder();
-
-            var previousIndex = 0;
-            var index = str.IndexOf(oldValue, comparison);
-
-            while (index != -1)
-            {
-                sb.Append(str.Substring(previousIndex, index - previousIndex));
-                sb.Append(newValue);
-                index += oldValue.Length;
-
-                previousIndex = index;
-                index = str.IndexOf(oldValue, index, comparison);
-            }
-
-            sb.Append(str.Substring(previousIndex));
-
-            return sb.ToString();
-        }
-    }
-}

+ 3 - 0
Emby.Naming/Subtitles/SubtitleInfo.cs

@@ -7,16 +7,19 @@ namespace Emby.Naming.Subtitles
         /// </summary>
         /// </summary>
         /// <value>The path.</value>
         /// <value>The path.</value>
         public string Path { get; set; }
         public string Path { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the language.
         /// Gets or sets the language.
         /// </summary>
         /// </summary>
         /// <value>The language.</value>
         /// <value>The language.</value>
         public string Language { get; set; }
         public string Language { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets a value indicating whether this instance is default.
         /// Gets or sets a value indicating whether this instance is default.
         /// </summary>
         /// </summary>
         /// <value><c>true</c> if this instance is default; otherwise, <c>false</c>.</value>
         /// <value><c>true</c> if this instance is default; otherwise, <c>false</c>.</value>
         public bool IsDefault { get; set; }
         public bool IsDefault { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets a value indicating whether this instance is forced.
         /// Gets or sets a value indicating whether this instance is forced.
         /// </summary>
         /// </summary>

+ 11 - 0
Emby.Naming/TV/EpisodeInfo.cs

@@ -7,31 +7,37 @@ namespace Emby.Naming.TV
         /// </summary>
         /// </summary>
         /// <value>The path.</value>
         /// <value>The path.</value>
         public string Path { get; set; }
         public string Path { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the container.
         /// Gets or sets the container.
         /// </summary>
         /// </summary>
         /// <value>The container.</value>
         /// <value>The container.</value>
         public string Container { get; set; }
         public string Container { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the name of the series.
         /// Gets or sets the name of the series.
         /// </summary>
         /// </summary>
         /// <value>The name of the series.</value>
         /// <value>The name of the series.</value>
         public string SeriesName { get; set; }
         public string SeriesName { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the format3 d.
         /// Gets or sets the format3 d.
         /// </summary>
         /// </summary>
         /// <value>The format3 d.</value>
         /// <value>The format3 d.</value>
         public string Format3D { get; set; }
         public string Format3D { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets a value indicating whether [is3 d].
         /// Gets or sets a value indicating whether [is3 d].
         /// </summary>
         /// </summary>
         /// <value><c>true</c> if [is3 d]; otherwise, <c>false</c>.</value>
         /// <value><c>true</c> if [is3 d]; otherwise, <c>false</c>.</value>
         public bool Is3D { get; set; }
         public bool Is3D { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets a value indicating whether this instance is stub.
         /// Gets or sets a value indicating whether this instance is stub.
         /// </summary>
         /// </summary>
         /// <value><c>true</c> if this instance is stub; otherwise, <c>false</c>.</value>
         /// <value><c>true</c> if this instance is stub; otherwise, <c>false</c>.</value>
         public bool IsStub { get; set; }
         public bool IsStub { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the type of the stub.
         /// Gets or sets the type of the stub.
         /// </summary>
         /// </summary>
@@ -39,12 +45,17 @@ namespace Emby.Naming.TV
         public string StubType { get; set; }
         public string StubType { get; set; }
 
 
         public int? SeasonNumber { get; set; }
         public int? SeasonNumber { get; set; }
+
         public int? EpisodeNumber { get; set; }
         public int? EpisodeNumber { get; set; }
+
         public int? EndingEpsiodeNumber { get; set; }
         public int? EndingEpsiodeNumber { get; set; }
 
 
         public int? Year { get; set; }
         public int? Year { get; set; }
+
         public int? Month { get; set; }
         public int? Month { get; set; }
+
         public int? Day { get; set; }
         public int? Day { get; set; }
+
         public bool IsByDate { get; set; }
         public bool IsByDate { get; set; }
     }
     }
 }
 }

+ 23 - 28
Emby.Naming/TV/EpisodePathParser.cs

@@ -15,12 +15,12 @@ namespace Emby.Naming.TV
             _options = options;
             _options = options;
         }
         }
 
 
-        public EpisodePathParserResult Parse(string path, bool IsDirectory, bool? isNamed = null, bool? isOptimistic = null, bool? supportsAbsoluteNumbers = null, bool fillExtendedInfo = true)
+        public EpisodePathParserResult Parse(string path, bool isDirectory, bool? isNamed = null, bool? isOptimistic = null, bool? supportsAbsoluteNumbers = null, bool fillExtendedInfo = true)
         {
         {
             // Added to be able to use regex patterns which require a file extension.
             // Added to be able to use regex patterns which require a file extension.
             // There were no failed tests without this block, but to be safe, we can keep it until
             // There were no failed tests without this block, but to be safe, we can keep it until
             // the regex which require file extensions are modified so that they don't need them.
             // the regex which require file extensions are modified so that they don't need them.
-            if (IsDirectory)
+            if (isDirectory)
             {
             {
                 path += ".mp4";
                 path += ".mp4";
             }
             }
@@ -29,28 +29,20 @@ namespace Emby.Naming.TV
 
 
             foreach (var expression in _options.EpisodeExpressions)
             foreach (var expression in _options.EpisodeExpressions)
             {
             {
-                if (supportsAbsoluteNumbers.HasValue)
+                if (supportsAbsoluteNumbers.HasValue
+                    && expression.SupportsAbsoluteEpisodeNumbers != supportsAbsoluteNumbers.Value)
                 {
                 {
-                    if (expression.SupportsAbsoluteEpisodeNumbers != supportsAbsoluteNumbers.Value)
-                    {
-                        continue;
-                    }
+                    continue;
                 }
                 }
 
 
-                if (isNamed.HasValue)
+                if (isNamed.HasValue && expression.IsNamed != isNamed.Value)
                 {
                 {
-                    if (expression.IsNamed != isNamed.Value)
-                    {
-                        continue;
-                    }
+                    continue;
                 }
                 }
 
 
-                if (isOptimistic.HasValue)
+                if (isOptimistic.HasValue && expression.IsOptimistic != isOptimistic.Value)
                 {
                 {
-                    if (expression.IsOptimistic != isOptimistic.Value)
-                    {
-                        continue;
-                    }
+                    continue;
                 }
                 }
 
 
                 var currentResult = Parse(path, expression);
                 var currentResult = Parse(path, expression);
@@ -97,7 +89,8 @@ namespace Emby.Naming.TV
                     DateTime date;
                     DateTime date;
                     if (expression.DateTimeFormats.Length > 0)
                     if (expression.DateTimeFormats.Length > 0)
                     {
                     {
-                        if (DateTime.TryParseExact(match.Groups[0].Value,
+                        if (DateTime.TryParseExact(
+                            match.Groups[0].Value,
                             expression.DateTimeFormats,
                             expression.DateTimeFormats,
                             CultureInfo.InvariantCulture,
                             CultureInfo.InvariantCulture,
                             DateTimeStyles.None,
                             DateTimeStyles.None,
@@ -109,15 +102,12 @@ namespace Emby.Naming.TV
                             result.Success = true;
                             result.Success = true;
                         }
                         }
                     }
                     }
-                    else
+                    else if (DateTime.TryParse(match.Groups[0].Value, out date))
                     {
                     {
-                        if (DateTime.TryParse(match.Groups[0].Value, out date))
-                        {
-                            result.Year = date.Year;
-                            result.Month = date.Month;
-                            result.Day = date.Day;
-                            result.Success = true;
-                        }
+                        result.Year = date.Year;
+                        result.Month = date.Month;
+                        result.Day = date.Day;
+                        result.Success = true;
                     }
                     }
 
 
                     // TODO: Only consider success if date successfully parsed?
                     // TODO: Only consider success if date successfully parsed?
@@ -142,7 +132,8 @@ namespace Emby.Naming.TV
                         // or a 'p' or 'i' as what you would get with a pixel resolution specification.
                         // or a 'p' or 'i' as what you would get with a pixel resolution specification.
                         // It avoids erroneous parsing of something like "series-s09e14-1080p.mkv" as a multi-episode from E14 to E108
                         // It avoids erroneous parsing of something like "series-s09e14-1080p.mkv" as a multi-episode from E14 to E108
                         int nextIndex = endingNumberGroup.Index + endingNumberGroup.Length;
                         int nextIndex = endingNumberGroup.Index + endingNumberGroup.Length;
-                        if (nextIndex >= name.Length || "0123456789iIpP".IndexOf(name[nextIndex]) == -1)
+                        if (nextIndex >= name.Length
+                            || "0123456789iIpP".IndexOf(name[nextIndex]) == -1)
                         {
                         {
                             if (int.TryParse(endingNumberGroup.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out num))
                             if (int.TryParse(endingNumberGroup.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out num))
                             {
                             {
@@ -160,6 +151,7 @@ namespace Emby.Naming.TV
                     {
                     {
                         result.SeasonNumber = num;
                         result.SeasonNumber = num;
                     }
                     }
+
                     if (int.TryParse(match.Groups[2].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out num))
                     if (int.TryParse(match.Groups[2].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out num))
                     {
                     {
                         result.EpisodeNumber = num;
                         result.EpisodeNumber = num;
@@ -171,8 +163,11 @@ namespace Emby.Naming.TV
                 // Invalidate match when the season is 200 through 1927 or above 2500
                 // Invalidate match when the season is 200 through 1927 or above 2500
                 // because it is an error unless the TV show is intentionally using false season numbers.
                 // because it is an error unless the TV show is intentionally using false season numbers.
                 // It avoids erroneous parsing of something like "Series Special (1920x1080).mkv" as being season 1920 episode 1080.
                 // It avoids erroneous parsing of something like "Series Special (1920x1080).mkv" as being season 1920 episode 1080.
-                if (result.SeasonNumber >= 200 && result.SeasonNumber < 1928 || result.SeasonNumber > 2500)
+                if ((result.SeasonNumber >= 200 && result.SeasonNumber < 1928)
+                    || result.SeasonNumber > 2500)
+                {
                     result.Success = false;
                     result.Success = false;
+                }
 
 
                 result.IsByDate = expression.IsByDate;
                 result.IsByDate = expression.IsByDate;
             }
             }

+ 7 - 0
Emby.Naming/TV/EpisodePathParserResult.cs

@@ -3,14 +3,21 @@ namespace Emby.Naming.TV
     public class EpisodePathParserResult
     public class EpisodePathParserResult
     {
     {
         public int? SeasonNumber { get; set; }
         public int? SeasonNumber { get; set; }
+
         public int? EpisodeNumber { get; set; }
         public int? EpisodeNumber { get; set; }
+
         public int? EndingEpsiodeNumber { get; set; }
         public int? EndingEpsiodeNumber { get; set; }
+
         public string SeriesName { get; set; }
         public string SeriesName { get; set; }
+
         public bool Success { get; set; }
         public bool Success { get; set; }
 
 
         public bool IsByDate { get; set; }
         public bool IsByDate { get; set; }
+
         public int? Year { get; set; }
         public int? Year { get; set; }
+
         public int? Month { get; set; }
         public int? Month { get; set; }
+
         public int? Day { get; set; }
         public int? Day { get; set; }
     }
     }
 }
 }

+ 9 - 3
Emby.Naming/TV/EpisodeResolver.cs

@@ -15,7 +15,13 @@ namespace Emby.Naming.TV
             _options = options;
             _options = options;
         }
         }
 
 
-        public EpisodeInfo Resolve(string path, bool IsDirectory, bool? isNamed = null, bool? isOptimistic = null, bool? supportsAbsoluteNumbers = null, bool fillExtendedInfo = true)
+        public EpisodeInfo Resolve(
+            string path,
+            bool isDirectory,
+            bool? isNamed = null,
+            bool? isOptimistic = null,
+            bool? supportsAbsoluteNumbers = null,
+            bool fillExtendedInfo = true)
         {
         {
             if (string.IsNullOrEmpty(path))
             if (string.IsNullOrEmpty(path))
             {
             {
@@ -26,7 +32,7 @@ namespace Emby.Naming.TV
             string container = null;
             string container = null;
             string stubType = null;
             string stubType = null;
 
 
-            if (!IsDirectory)
+            if (!isDirectory)
             {
             {
                 var extension = Path.GetExtension(path);
                 var extension = Path.GetExtension(path);
                 // Check supported extensions
                 // Check supported extensions
@@ -52,7 +58,7 @@ namespace Emby.Naming.TV
             var format3DResult = new Format3DParser(_options).Parse(flags);
             var format3DResult = new Format3DParser(_options).Parse(flags);
 
 
             var parsingResult = new EpisodePathParser(_options)
             var parsingResult = new EpisodePathParser(_options)
-                .Parse(path, IsDirectory, isNamed, isOptimistic, supportsAbsoluteNumbers, fillExtendedInfo);
+                .Parse(path, isDirectory, isNamed, isOptimistic, supportsAbsoluteNumbers, fillExtendedInfo);
 
 
             return new EpisodeInfo
             return new EpisodeInfo
             {
             {

+ 20 - 22
Emby.Naming/TV/SeasonPathParser.cs

@@ -3,30 +3,24 @@ using System.Globalization;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
 using Emby.Naming.Common;
 using Emby.Naming.Common;
+using Emby.Naming.Extensions;
 
 
 namespace Emby.Naming.TV
 namespace Emby.Naming.TV
 {
 {
     public class SeasonPathParser
     public class SeasonPathParser
     {
     {
-        private readonly NamingOptions _options;
-
-        public SeasonPathParser(NamingOptions options)
-        {
-            _options = options;
-        }
-
         public SeasonPathParserResult Parse(string path, bool supportSpecialAliases, bool supportNumericSeasonFolders)
         public SeasonPathParserResult Parse(string path, bool supportSpecialAliases, bool supportNumericSeasonFolders)
         {
         {
             var result = new SeasonPathParserResult();
             var result = new SeasonPathParserResult();
 
 
             var seasonNumberInfo = GetSeasonNumberFromPath(path, supportSpecialAliases, supportNumericSeasonFolders);
             var seasonNumberInfo = GetSeasonNumberFromPath(path, supportSpecialAliases, supportNumericSeasonFolders);
 
 
-            result.SeasonNumber = seasonNumberInfo.Item1;
+            result.SeasonNumber = seasonNumberInfo.seasonNumber;
 
 
             if (result.SeasonNumber.HasValue)
             if (result.SeasonNumber.HasValue)
             {
             {
                 result.Success = true;
                 result.Success = true;
-                result.IsSeasonFolder = seasonNumberInfo.Item2;
+                result.IsSeasonFolder = seasonNumberInfo.isSeasonFolder;
             }
             }
 
 
             return result;
             return result;
@@ -35,7 +29,7 @@ namespace Emby.Naming.TV
         /// <summary>
         /// <summary>
         /// A season folder must contain one of these somewhere in the name
         /// A season folder must contain one of these somewhere in the name
         /// </summary>
         /// </summary>
-        private static readonly string[] SeasonFolderNames =
+        private static readonly string[] _seasonFolderNames =
         {
         {
             "season",
             "season",
             "sæson",
             "sæson",
@@ -54,19 +48,23 @@ namespace Emby.Naming.TV
         /// <param name="supportSpecialAliases">if set to <c>true</c> [support special aliases].</param>
         /// <param name="supportSpecialAliases">if set to <c>true</c> [support special aliases].</param>
         /// <param name="supportNumericSeasonFolders">if set to <c>true</c> [support numeric season folders].</param>
         /// <param name="supportNumericSeasonFolders">if set to <c>true</c> [support numeric season folders].</param>
         /// <returns>System.Nullable{System.Int32}.</returns>
         /// <returns>System.Nullable{System.Int32}.</returns>
-        private Tuple<int?, bool> GetSeasonNumberFromPath(string path, bool supportSpecialAliases, bool supportNumericSeasonFolders)
+        private static (int? seasonNumber, bool isSeasonFolder) GetSeasonNumberFromPath(
+            string path,
+            bool supportSpecialAliases,
+            bool supportNumericSeasonFolders)
         {
         {
-            var filename = Path.GetFileName(path);
+            var filename = Path.GetFileName(path) ?? string.Empty;
 
 
             if (supportSpecialAliases)
             if (supportSpecialAliases)
             {
             {
                 if (string.Equals(filename, "specials", StringComparison.OrdinalIgnoreCase))
                 if (string.Equals(filename, "specials", StringComparison.OrdinalIgnoreCase))
                 {
                 {
-                    return new Tuple<int?, bool>(0, true);
+                    return (0, true);
                 }
                 }
+
                 if (string.Equals(filename, "extras", StringComparison.OrdinalIgnoreCase))
                 if (string.Equals(filename, "extras", StringComparison.OrdinalIgnoreCase))
                 {
                 {
-                    return new Tuple<int?, bool>(0, true);
+                    return (0, true);
                 }
                 }
             }
             }
 
 
@@ -74,7 +72,7 @@ namespace Emby.Naming.TV
             {
             {
                 if (int.TryParse(filename, NumberStyles.Integer, CultureInfo.InvariantCulture, out var val))
                 if (int.TryParse(filename, NumberStyles.Integer, CultureInfo.InvariantCulture, out var val))
                 {
                 {
-                    return new Tuple<int?, bool>(val, true);
+                    return (val, true);
                 }
                 }
             }
             }
 
 
@@ -84,12 +82,12 @@ namespace Emby.Naming.TV
 
 
                 if (int.TryParse(testFilename, NumberStyles.Integer, CultureInfo.InvariantCulture, out var val))
                 if (int.TryParse(testFilename, NumberStyles.Integer, CultureInfo.InvariantCulture, out var val))
                 {
                 {
-                    return new Tuple<int?, bool>(val, true);
+                    return (val, true);
                 }
                 }
             }
             }
 
 
             // Look for one of the season folder names
             // Look for one of the season folder names
-            foreach (var name in SeasonFolderNames)
+            foreach (var name in _seasonFolderNames)
             {
             {
                 var index = filename.IndexOf(name, StringComparison.OrdinalIgnoreCase);
                 var index = filename.IndexOf(name, StringComparison.OrdinalIgnoreCase);
 
 
@@ -107,10 +105,10 @@ namespace Emby.Naming.TV
 
 
             var parts = filename.Split(new[] { '.', '_', ' ', '-' }, StringSplitOptions.RemoveEmptyEntries);
             var parts = filename.Split(new[] { '.', '_', ' ', '-' }, StringSplitOptions.RemoveEmptyEntries);
             var resultNumber = parts.Select(GetSeasonNumberFromPart).FirstOrDefault(i => i.HasValue);
             var resultNumber = parts.Select(GetSeasonNumberFromPart).FirstOrDefault(i => i.HasValue);
-            return new Tuple<int?, bool>(resultNumber, true);
+            return (resultNumber, true);
         }
         }
 
 
-        private int? GetSeasonNumberFromPart(string part)
+        private static int? GetSeasonNumberFromPart(string part)
         {
         {
             if (part.Length < 2 || !part.StartsWith("s", StringComparison.OrdinalIgnoreCase))
             if (part.Length < 2 || !part.StartsWith("s", StringComparison.OrdinalIgnoreCase))
             {
             {
@@ -132,7 +130,7 @@ namespace Emby.Naming.TV
         /// </summary>
         /// </summary>
         /// <param name="path">The path.</param>
         /// <param name="path">The path.</param>
         /// <returns>System.Nullable{System.Int32}.</returns>
         /// <returns>System.Nullable{System.Int32}.</returns>
-        private Tuple<int?, bool> GetSeasonNumberFromPathSubstring(string path)
+        private static (int? seasonNumber, bool isSeasonFolder) GetSeasonNumberFromPathSubstring(string path)
         {
         {
             var numericStart = -1;
             var numericStart = -1;
             var length = 0;
             var length = 0;
@@ -174,10 +172,10 @@ namespace Emby.Naming.TV
 
 
             if (numericStart == -1)
             if (numericStart == -1)
             {
             {
-                return new Tuple<int?, bool>(null, isSeasonFolder);
+                return (null, isSeasonFolder);
             }
             }
 
 
-            return new Tuple<int?, bool>(int.Parse(path.Substring(numericStart, length), CultureInfo.InvariantCulture), isSeasonFolder);
+            return (int.Parse(path.Substring(numericStart, length), CultureInfo.InvariantCulture), isSeasonFolder);
         }
         }
     }
     }
 }
 }

+ 2 - 0
Emby.Naming/TV/SeasonPathParserResult.cs

@@ -7,11 +7,13 @@ namespace Emby.Naming.TV
         /// </summary>
         /// </summary>
         /// <value>The season number.</value>
         /// <value>The season number.</value>
         public int? SeasonNumber { get; set; }
         public int? SeasonNumber { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets a value indicating whether this <see cref="SeasonPathParserResult"/> is success.
         /// Gets or sets a value indicating whether this <see cref="SeasonPathParserResult"/> is success.
         /// </summary>
         /// </summary>
         /// <value><c>true</c> if success; otherwise, <c>false</c>.</value>
         /// <value><c>true</c> if success; otherwise, <c>false</c>.</value>
         public bool Success { get; set; }
         public bool Success { get; set; }
+
         public bool IsSeasonFolder { get; set; }
         public bool IsSeasonFolder { get; set; }
     }
     }
 }
 }

+ 10 - 10
Emby.Naming/Video/CleanDateTimeParser.cs

@@ -27,8 +27,8 @@ namespace Emby.Naming.Video
             {
             {
                 var extension = Path.GetExtension(name) ?? string.Empty;
                 var extension = Path.GetExtension(name) ?? string.Empty;
                 // Check supported extensions
                 // Check supported extensions
-                if (!_options.VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase) &&
-                    !_options.AudioFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
+                if (!_options.VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase)
+                    && !_options.AudioFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
                 {
                 {
                     // Dummy up a file extension because the expressions will fail without one
                     // Dummy up a file extension because the expressions will fail without one
                     // This is tricky because we can't just check Path.GetExtension for empty
                     // This is tricky because we can't just check Path.GetExtension for empty
@@ -38,7 +38,6 @@ namespace Emby.Naming.Video
             }
             }
             catch (ArgumentException)
             catch (ArgumentException)
             {
             {
-
             }
             }
 
 
             var result = _options.CleanDateTimeRegexes.Select(i => Clean(name, i))
             var result = _options.CleanDateTimeRegexes.Select(i => Clean(name, i))
@@ -69,14 +68,15 @@ namespace Emby.Naming.Video
 
 
             var match = expression.Match(name);
             var match = expression.Match(name);
 
 
-            if (match.Success && match.Groups.Count == 4)
+            if (match.Success
+                && match.Groups.Count == 4
+                && match.Groups[1].Success
+                && match.Groups[2].Success
+                && int.TryParse(match.Groups[2].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var year))
             {
             {
-                if (match.Groups[1].Success && match.Groups[2].Success && int.TryParse(match.Groups[2].Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var year))
-                {
-                    name = match.Groups[1].Value;
-                    result.Year = year;
-                    result.HasChanged = true;
-                }
+                name = match.Groups[1].Value;
+                result.Year = year;
+                result.HasChanged = true;
             }
             }
 
 
             result.Name = name;
             result.Name = name;

+ 0 - 2
Emby.Naming/Video/ExtraResolver.cs

@@ -56,7 +56,6 @@ namespace Emby.Naming.Video
                     result.Rule = rule;
                     result.Rule = rule;
                 }
                 }
             }
             }
-
             else if (rule.RuleType == ExtraRuleType.Suffix)
             else if (rule.RuleType == ExtraRuleType.Suffix)
             {
             {
                 var filename = Path.GetFileNameWithoutExtension(path);
                 var filename = Path.GetFileNameWithoutExtension(path);
@@ -67,7 +66,6 @@ namespace Emby.Naming.Video
                     result.Rule = rule;
                     result.Rule = rule;
                 }
                 }
             }
             }
-
             else if (rule.RuleType == ExtraRuleType.Regex)
             else if (rule.RuleType == ExtraRuleType.Regex)
             {
             {
                 var filename = Path.GetFileName(path);
                 var filename = Path.GetFileName(path);

+ 2 - 2
Emby.Naming/Video/FileStack.cs

@@ -15,9 +15,9 @@ namespace Emby.Naming.Video
             Files = new List<string>();
             Files = new List<string>();
         }
         }
 
 
-        public bool ContainsFile(string file, bool IsDirectory)
+        public bool ContainsFile(string file, bool isDirectory)
         {
         {
-            if (IsDirectoryStack == IsDirectory)
+            if (IsDirectoryStack == isDirectory)
             {
             {
                 return Files.Contains(file, StringComparer.OrdinalIgnoreCase);
                 return Files.Contains(file, StringComparer.OrdinalIgnoreCase);
             }
             }

+ 7 - 3
Emby.Naming/Video/Format3DParser.cs

@@ -15,10 +15,12 @@ namespace Emby.Naming.Video
 
 
         public Format3DResult Parse(string path)
         public Format3DResult Parse(string path)
         {
         {
-            var delimeters = _options.VideoFlagDelimiters.ToList();
-            delimeters.Add(' ');
+            int oldLen = _options.VideoFlagDelimiters.Length;
+            var delimeters = new char[oldLen + 1];
+            _options.VideoFlagDelimiters.CopyTo(delimeters, 0);
+            delimeters[oldLen] = ' ';
 
 
-            return Parse(new FlagParser(_options).GetFlags(path, delimeters.ToArray()));
+            return Parse(new FlagParser(_options).GetFlags(path, delimeters));
         }
         }
 
 
         internal Format3DResult Parse(string[] videoFlags)
         internal Format3DResult Parse(string[] videoFlags)
@@ -66,8 +68,10 @@ namespace Emby.Naming.Video
                             format = flag;
                             format = flag;
                             result.Tokens.Add(rule.Token);
                             result.Tokens.Add(rule.Token);
                         }
                         }
+
                         break;
                         break;
                     }
                     }
+
                     foundPrefix = string.Equals(flag, rule.PreceedingToken, StringComparison.OrdinalIgnoreCase);
                     foundPrefix = string.Equals(flag, rule.PreceedingToken, StringComparison.OrdinalIgnoreCase);
                 }
                 }
 
 

+ 7 - 5
Emby.Naming/Video/Format3DResult.cs

@@ -4,25 +4,27 @@ namespace Emby.Naming.Video
 {
 {
     public class Format3DResult
     public class Format3DResult
     {
     {
+        public Format3DResult()
+        {
+            Tokens = new List<string>();
+        }
+
         /// <summary>
         /// <summary>
         /// Gets or sets a value indicating whether [is3 d].
         /// Gets or sets a value indicating whether [is3 d].
         /// </summary>
         /// </summary>
         /// <value><c>true</c> if [is3 d]; otherwise, <c>false</c>.</value>
         /// <value><c>true</c> if [is3 d]; otherwise, <c>false</c>.</value>
         public bool Is3D { get; set; }
         public bool Is3D { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the format3 d.
         /// Gets or sets the format3 d.
         /// </summary>
         /// </summary>
         /// <value>The format3 d.</value>
         /// <value>The format3 d.</value>
         public string Format3D { get; set; }
         public string Format3D { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the tokens.
         /// Gets or sets the tokens.
         /// </summary>
         /// </summary>
         /// <value>The tokens.</value>
         /// <value>The tokens.</value>
         public List<string> Tokens { get; set; }
         public List<string> Tokens { get; set; }
-
-        public Format3DResult()
-        {
-            Tokens = new List<string>();
-        }
     }
     }
 }
 }

+ 13 - 6
Emby.Naming/Video/StackResolver.cs

@@ -40,17 +40,24 @@ namespace Emby.Naming.Video
             var result = new StackResult();
             var result = new StackResult();
             foreach (var directory in files.GroupBy(file => file.IsDirectory ? file.FullName : Path.GetDirectoryName(file.FullName)))
             foreach (var directory in files.GroupBy(file => file.IsDirectory ? file.FullName : Path.GetDirectoryName(file.FullName)))
             {
             {
-                var stack = new FileStack();
-                stack.Name = Path.GetFileName(directory.Key);
-                stack.IsDirectoryStack = false;
+                var stack = new FileStack()
+                {
+                    Name = Path.GetFileName(directory.Key),
+                    IsDirectoryStack = false
+                };
                 foreach (var file in directory)
                 foreach (var file in directory)
                 {
                 {
                     if (file.IsDirectory)
                     if (file.IsDirectory)
+                    {
                         continue;
                         continue;
+                    }
+
                     stack.Files.Add(file.FullName);
                     stack.Files.Add(file.FullName);
                 }
                 }
+
                 result.Stacks.Add(stack);
                 result.Stacks.Add(stack);
             }
             }
+
             return result;
             return result;
         }
         }
 
 
@@ -114,16 +121,16 @@ namespace Emby.Naming.Video
                                 {
                                 {
                                     if (!string.Equals(volume1, volume2, StringComparison.OrdinalIgnoreCase))
                                     if (!string.Equals(volume1, volume2, StringComparison.OrdinalIgnoreCase))
                                     {
                                     {
-                                        if (string.Equals(ignore1, ignore2, StringComparison.OrdinalIgnoreCase) &&
-                                            string.Equals(extension1, extension2, StringComparison.OrdinalIgnoreCase))
+                                        if (string.Equals(ignore1, ignore2, StringComparison.OrdinalIgnoreCase)
+                                            && string.Equals(extension1, extension2, StringComparison.OrdinalIgnoreCase))
                                         {
                                         {
                                             if (stack.Files.Count == 0)
                                             if (stack.Files.Count == 0)
                                             {
                                             {
                                                 stack.Name = title1 + ignore1;
                                                 stack.Name = title1 + ignore1;
                                                 stack.IsDirectoryStack = file1.IsDirectory;
                                                 stack.IsDirectoryStack = file1.IsDirectory;
-                                                //stack.Name = title1 + ignore1 + extension1;
                                                 stack.Files.Add(file1.FullName);
                                                 stack.Files.Add(file1.FullName);
                                             }
                                             }
+
                                             stack.Files.Add(file2.FullName);
                                             stack.Files.Add(file2.FullName);
                                         }
                                         }
                                         else
                                         else

+ 20 - 12
Emby.Naming/Video/StubResolver.cs

@@ -9,24 +9,32 @@ namespace Emby.Naming.Video
     {
     {
         public static StubResult ResolveFile(string path, NamingOptions options)
         public static StubResult ResolveFile(string path, NamingOptions options)
         {
         {
-            var result = new StubResult();
-            var extension = Path.GetExtension(path) ?? string.Empty;
+            if (path == null)
+            {
+                return default(StubResult);
+            }
+
+            var extension = Path.GetExtension(path);
 
 
-            if (options.StubFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
+            if (!options.StubFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
             {
             {
-                result.IsStub = true;
+                return default(StubResult);
+            }
 
 
-                path = Path.GetFileNameWithoutExtension(path);
+            var result = new StubResult()
+            {
+                IsStub = true
+            };
 
 
-                var token = (Path.GetExtension(path) ?? string.Empty).TrimStart('.');
+            path = Path.GetFileNameWithoutExtension(path);
+            var token = Path.GetExtension(path).TrimStart('.');
 
 
-                foreach (var rule in options.StubTypes)
+            foreach (var rule in options.StubTypes)
+            {
+                if (string.Equals(rule.Token, token, StringComparison.OrdinalIgnoreCase))
                 {
                 {
-                    if (string.Equals(rule.Token, token, StringComparison.OrdinalIgnoreCase))
-                    {
-                        result.StubType = rule.StubType;
-                        break;
-                    }
+                    result.StubType = rule.StubType;
+                    break;
                 }
                 }
             }
             }
 
 

+ 1 - 0
Emby.Naming/Video/StubResult.cs

@@ -7,6 +7,7 @@ namespace Emby.Naming.Video
         /// </summary>
         /// </summary>
         /// <value><c>true</c> if this instance is stub; otherwise, <c>false</c>.</value>
         /// <value><c>true</c> if this instance is stub; otherwise, <c>false</c>.</value>
         public bool IsStub { get; set; }
         public bool IsStub { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the type of the stub.
         /// Gets or sets the type of the stub.
         /// </summary>
         /// </summary>

+ 1 - 0
Emby.Naming/Video/StubTypeRule.cs

@@ -7,6 +7,7 @@ namespace Emby.Naming.Video
         /// </summary>
         /// </summary>
         /// <value>The token.</value>
         /// <value>The token.</value>
         public string Token { get; set; }
         public string Token { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the type of the stub.
         /// Gets or sets the type of the stub.
         /// </summary>
         /// </summary>

+ 11 - 1
Emby.Naming/Video/VideoFileInfo.cs

@@ -1,4 +1,3 @@
-
 namespace Emby.Naming.Video
 namespace Emby.Naming.Video
 {
 {
     /// <summary>
     /// <summary>
@@ -11,56 +10,67 @@ namespace Emby.Naming.Video
         /// </summary>
         /// </summary>
         /// <value>The path.</value>
         /// <value>The path.</value>
         public string Path { get; set; }
         public string Path { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the container.
         /// Gets or sets the container.
         /// </summary>
         /// </summary>
         /// <value>The container.</value>
         /// <value>The container.</value>
         public string Container { get; set; }
         public string Container { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the name.
         /// Gets or sets the name.
         /// </summary>
         /// </summary>
         /// <value>The name.</value>
         /// <value>The name.</value>
         public string Name { get; set; }
         public string Name { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the year.
         /// Gets or sets the year.
         /// </summary>
         /// </summary>
         /// <value>The year.</value>
         /// <value>The year.</value>
         public int? Year { get; set; }
         public int? Year { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the type of the extra, e.g. trailer, theme song, behing the scenes, etc.
         /// Gets or sets the type of the extra, e.g. trailer, theme song, behing the scenes, etc.
         /// </summary>
         /// </summary>
         /// <value>The type of the extra.</value>
         /// <value>The type of the extra.</value>
         public string ExtraType { get; set; }
         public string ExtraType { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the extra rule.
         /// Gets or sets the extra rule.
         /// </summary>
         /// </summary>
         /// <value>The extra rule.</value>
         /// <value>The extra rule.</value>
         public ExtraRule ExtraRule { get; set; }
         public ExtraRule ExtraRule { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the format3 d.
         /// Gets or sets the format3 d.
         /// </summary>
         /// </summary>
         /// <value>The format3 d.</value>
         /// <value>The format3 d.</value>
         public string Format3D { get; set; }
         public string Format3D { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets a value indicating whether [is3 d].
         /// Gets or sets a value indicating whether [is3 d].
         /// </summary>
         /// </summary>
         /// <value><c>true</c> if [is3 d]; otherwise, <c>false</c>.</value>
         /// <value><c>true</c> if [is3 d]; otherwise, <c>false</c>.</value>
         public bool Is3D { get; set; }
         public bool Is3D { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets a value indicating whether this instance is stub.
         /// Gets or sets a value indicating whether this instance is stub.
         /// </summary>
         /// </summary>
         /// <value><c>true</c> if this instance is stub; otherwise, <c>false</c>.</value>
         /// <value><c>true</c> if this instance is stub; otherwise, <c>false</c>.</value>
         public bool IsStub { get; set; }
         public bool IsStub { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the type of the stub.
         /// Gets or sets the type of the stub.
         /// </summary>
         /// </summary>
         /// <value>The type of the stub.</value>
         /// <value>The type of the stub.</value>
         public string StubType { get; set; }
         public string StubType { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the type.
         /// Gets or sets the type.
         /// </summary>
         /// </summary>
         /// <value>The type.</value>
         /// <value>The type.</value>
         public bool IsDirectory { get; set; }
         public bool IsDirectory { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets the file name without extension.
         /// Gets the file name without extension.
         /// </summary>
         /// </summary>

+ 4 - 0
Emby.Naming/Video/VideoInfo.cs

@@ -12,21 +12,25 @@ namespace Emby.Naming.Video
         /// </summary>
         /// </summary>
         /// <value>The name.</value>
         /// <value>The name.</value>
         public string Name { get; set; }
         public string Name { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the year.
         /// Gets or sets the year.
         /// </summary>
         /// </summary>
         /// <value>The year.</value>
         /// <value>The year.</value>
         public int? Year { get; set; }
         public int? Year { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the files.
         /// Gets or sets the files.
         /// </summary>
         /// </summary>
         /// <value>The files.</value>
         /// <value>The files.</value>
         public List<VideoFileInfo> Files { get; set; }
         public List<VideoFileInfo> Files { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the extras.
         /// Gets or sets the extras.
         /// </summary>
         /// </summary>
         /// <value>The extras.</value>
         /// <value>The extras.</value>
         public List<VideoFileInfo> Extras { get; set; }
         public List<VideoFileInfo> Extras { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets or sets the alternate versions.
         /// Gets or sets the alternate versions.
         /// </summary>
         /// </summary>

+ 18 - 22
Emby.Naming/Video/VideoListResolver.cs

@@ -53,7 +53,7 @@ namespace Emby.Naming.Video
                     Name = stack.Name
                     Name = stack.Name
                 };
                 };
 
 
-                info.Year = info.Files.First().Year;
+                info.Year = info.Files[0].Year;
 
 
                 var extraBaseNames = new List<string>
                 var extraBaseNames = new List<string>
                 {
                 {
@@ -87,7 +87,7 @@ namespace Emby.Naming.Video
                     Name = media.Name
                     Name = media.Name
                 };
                 };
 
 
-                info.Year = info.Files.First().Year;
+                info.Year = info.Files[0].Year;
 
 
                 var extras = GetExtras(remainingFiles, new List<string> { media.FileNameWithoutExtension });
                 var extras = GetExtras(remainingFiles, new List<string> { media.FileNameWithoutExtension });
 
 
@@ -115,7 +115,7 @@ namespace Emby.Naming.Video
 
 
                 if (!string.IsNullOrEmpty(parentPath))
                 if (!string.IsNullOrEmpty(parentPath))
                 {
                 {
-                    var folderName = Path.GetFileName(Path.GetDirectoryName(videoPath));
+                    var folderName = Path.GetFileName(parentPath);
                     if (!string.IsNullOrEmpty(folderName))
                     if (!string.IsNullOrEmpty(folderName))
                     {
                     {
                         var extras = GetExtras(remainingFiles, new List<string> { folderName });
                         var extras = GetExtras(remainingFiles, new List<string> { folderName });
@@ -163,9 +163,7 @@ namespace Emby.Naming.Video
                 Year = i.Year
                 Year = i.Year
             }));
             }));
 
 
-            var orderedList = list.OrderBy(i => i.Name);
-
-            return orderedList;
+            return list.OrderBy(i => i.Name);
         }
         }
 
 
         private IEnumerable<VideoInfo> GetVideosGroupedByVersion(List<VideoInfo> videos)
         private IEnumerable<VideoInfo> GetVideosGroupedByVersion(List<VideoInfo> videos)
@@ -179,23 +177,21 @@ namespace Emby.Naming.Video
 
 
             var folderName = Path.GetFileName(Path.GetDirectoryName(videos[0].Files[0].Path));
             var folderName = Path.GetFileName(Path.GetDirectoryName(videos[0].Files[0].Path));
 
 
-            if (!string.IsNullOrEmpty(folderName) && folderName.Length > 1)
+            if (!string.IsNullOrEmpty(folderName)
+                && folderName.Length > 1
+                && videos.All(i => i.Files.Count == 1
+                && IsEligibleForMultiVersion(folderName, i.Files[0].Path))
+                && HaveSameYear(videos))
             {
             {
-                if (videos.All(i => i.Files.Count == 1 && IsEligibleForMultiVersion(folderName, i.Files[0].Path)))
-                {
-                    if (HaveSameYear(videos))
-                    {
-                        var ordered = videos.OrderBy(i => i.Name).ToList();
+                var ordered = videos.OrderBy(i => i.Name).ToList();
 
 
-                        list.Add(ordered[0]);
+                list.Add(ordered[0]);
 
 
-                        list[0].AlternateVersions = ordered.Skip(1).Select(i => i.Files[0]).ToList();
-                        list[0].Name = folderName;
-                        list[0].Extras.AddRange(ordered.Skip(1).SelectMany(i => i.Extras));
+                list[0].AlternateVersions = ordered.Skip(1).Select(i => i.Files[0]).ToList();
+                list[0].Name = folderName;
+                list[0].Extras.AddRange(ordered.Skip(1).SelectMany(i => i.Extras));
 
 
-                        return list;
-                    }
-                }
+                return list;
             }
             }
 
 
             return videos;
             return videos;
@@ -213,9 +209,9 @@ namespace Emby.Naming.Video
             if (testFilename.StartsWith(folderName, StringComparison.OrdinalIgnoreCase))
             if (testFilename.StartsWith(folderName, StringComparison.OrdinalIgnoreCase))
             {
             {
                 testFilename = testFilename.Substring(folderName.Length).Trim();
                 testFilename = testFilename.Substring(folderName.Length).Trim();
-                return string.IsNullOrEmpty(testFilename) ||
-                       testFilename.StartsWith("-") ||
-                       string.IsNullOrWhiteSpace(Regex.Replace(testFilename, @"\[([^]]*)\]", string.Empty)) ;
+                return string.IsNullOrEmpty(testFilename)
+                    || testFilename[0] == '-'
+                    || string.IsNullOrWhiteSpace(Regex.Replace(testFilename, @"\[([^]]*)\]", string.Empty));
             }
             }
 
 
             return false;
             return false;

+ 7 - 5
Emby.Naming/Video/VideoResolver.cs

@@ -38,10 +38,11 @@ namespace Emby.Naming.Video
         /// Resolves the specified path.
         /// Resolves the specified path.
         /// </summary>
         /// </summary>
         /// <param name="path">The path.</param>
         /// <param name="path">The path.</param>
-        /// <param name="IsDirectory">if set to <c>true</c> [is folder].</param>
+        /// <param name="isDirectory">if set to <c>true</c> [is folder].</param>
+        /// <param name="parseName">Whether or not the name should be parsed for info</param>
         /// <returns>VideoFileInfo.</returns>
         /// <returns>VideoFileInfo.</returns>
         /// <exception cref="ArgumentNullException">path</exception>
         /// <exception cref="ArgumentNullException">path</exception>
-        public VideoFileInfo Resolve(string path, bool IsDirectory, bool parseName = true)
+        public VideoFileInfo Resolve(string path, bool isDirectory, bool parseName = true)
         {
         {
             if (string.IsNullOrEmpty(path))
             if (string.IsNullOrEmpty(path))
             {
             {
@@ -52,9 +53,10 @@ namespace Emby.Naming.Video
             string container = null;
             string container = null;
             string stubType = null;
             string stubType = null;
 
 
-            if (!IsDirectory)
+            if (!isDirectory)
             {
             {
                 var extension = Path.GetExtension(path);
                 var extension = Path.GetExtension(path);
+
                 // Check supported extensions
                 // Check supported extensions
                 if (!_options.VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
                 if (!_options.VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
                 {
                 {
@@ -79,7 +81,7 @@ namespace Emby.Naming.Video
 
 
             var extraResult = new ExtraResolver(_options).GetExtraInfo(path);
             var extraResult = new ExtraResolver(_options).GetExtraInfo(path);
 
 
-            var name = IsDirectory
+            var name = isDirectory
                 ? Path.GetFileName(path)
                 ? Path.GetFileName(path)
                 : Path.GetFileNameWithoutExtension(path);
                 : Path.GetFileNameWithoutExtension(path);
 
 
@@ -108,7 +110,7 @@ namespace Emby.Naming.Video
                 Is3D = format3DResult.Is3D,
                 Is3D = format3DResult.Is3D,
                 Format3D = format3DResult.Format3D,
                 Format3D = format3DResult.Format3D,
                 ExtraType = extraResult.ExtraType,
                 ExtraType = extraResult.ExtraType,
-                IsDirectory = IsDirectory,
+                IsDirectory = isDirectory,
                 ExtraRule = extraResult.Rule
                 ExtraRule = extraResult.Rule
             };
             };
         }
         }

+ 1 - 0
Emby.Notifications/Emby.Notifications.csproj

@@ -3,6 +3,7 @@
   <PropertyGroup>
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
     <TargetFramework>netstandard2.0</TargetFramework>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+    <GenerateDocumentationFile>true</GenerateDocumentationFile>
   </PropertyGroup>
   </PropertyGroup>
 
 
   <ItemGroup>
   <ItemGroup>

+ 4 - 3
Emby.Notifications/NotificationManager.cs

@@ -1,5 +1,6 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Linq;
 using System.Linq;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
@@ -88,7 +89,7 @@ namespace Emby.Notifications
                         return _userManager.Users.Where(i => i.Policy.IsAdministrator)
                         return _userManager.Users.Where(i => i.Policy.IsAdministrator)
                                 .Select(i => i.Id);
                                 .Select(i => i.Id);
                     case SendToUserType.All:
                     case SendToUserType.All:
-                        return _userManager.Users.Select(i => i.Id);
+                        return _userManager.UsersIds;
                     case SendToUserType.Custom:
                     case SendToUserType.Custom:
                         return request.UserIds;
                         return request.UserIds;
                     default:
                     default:
@@ -101,7 +102,7 @@ namespace Emby.Notifications
                 var config = GetConfiguration();
                 var config = GetConfiguration();
 
 
                 return _userManager.Users
                 return _userManager.Users
-                    .Where(i => config.IsEnabledToSendToUser(request.NotificationType, i.Id.ToString("N"), i.Policy))
+                    .Where(i => config.IsEnabledToSendToUser(request.NotificationType, i.Id.ToString("N", CultureInfo.InvariantCulture), i.Policy))
                     .Select(i => i.Id);
                     .Select(i => i.Id);
             }
             }
 
 
@@ -197,7 +198,7 @@ namespace Emby.Notifications
             return _services.Select(i => new NameIdPair
             return _services.Select(i => new NameIdPair
             {
             {
                 Name = i.Name,
                 Name = i.Name,
-                Id = i.Name.GetMD5().ToString("N")
+                Id = i.Name.GetMD5().ToString("N", CultureInfo.InvariantCulture)
 
 
             }).OrderBy(i => i.Name);
             }).OrderBy(i => i.Name);
         }
         }

+ 2 - 1
Emby.Photos/Emby.Photos.csproj

@@ -10,12 +10,13 @@
   </ItemGroup>
   </ItemGroup>
 
 
   <ItemGroup>
   <ItemGroup>
-    <PackageReference Include="TagLibSharp" Version="2.2.0-beta" />
+    <PackageReference Include="TagLibSharp" Version="2.2.0" />
   </ItemGroup>
   </ItemGroup>
 
 
   <PropertyGroup>
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
     <TargetFramework>netstandard2.0</TargetFramework>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+    <GenerateDocumentationFile>true</GenerateDocumentationFile>
   </PropertyGroup>
   </PropertyGroup>
 
 
 </Project>
 </Project>

+ 25 - 14
Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs

@@ -1,14 +1,13 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Linq;
 using System.Linq;
 using System.Text;
 using System.Text;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
-using MediaBrowser.Common.Configuration;
 using MediaBrowser.Common.Plugins;
 using MediaBrowser.Common.Plugins;
 using MediaBrowser.Common.Updates;
 using MediaBrowser.Common.Updates;
 using MediaBrowser.Controller;
 using MediaBrowser.Controller;
 using MediaBrowser.Controller.Authentication;
 using MediaBrowser.Controller.Authentication;
-using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Devices;
 using MediaBrowser.Controller.Devices;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Library;
@@ -29,31 +28,39 @@ namespace Emby.Server.Implementations.Activity
 {
 {
     public class ActivityLogEntryPoint : IServerEntryPoint
     public class ActivityLogEntryPoint : IServerEntryPoint
     {
     {
+        private readonly ILogger _logger;
         private readonly IInstallationManager _installationManager;
         private readonly IInstallationManager _installationManager;
         private readonly ISessionManager _sessionManager;
         private readonly ISessionManager _sessionManager;
         private readonly ITaskManager _taskManager;
         private readonly ITaskManager _taskManager;
         private readonly IActivityManager _activityManager;
         private readonly IActivityManager _activityManager;
         private readonly ILocalizationManager _localization;
         private readonly ILocalizationManager _localization;
-        private readonly ILibraryManager _libraryManager;
         private readonly ISubtitleManager _subManager;
         private readonly ISubtitleManager _subManager;
         private readonly IUserManager _userManager;
         private readonly IUserManager _userManager;
-        private readonly IServerConfigurationManager _config;
         private readonly IServerApplicationHost _appHost;
         private readonly IServerApplicationHost _appHost;
         private readonly IDeviceManager _deviceManager;
         private readonly IDeviceManager _deviceManager;
 
 
-        public ActivityLogEntryPoint(ISessionManager sessionManager, IDeviceManager deviceManager, ITaskManager taskManager, IActivityManager activityManager, ILocalizationManager localization, IInstallationManager installationManager, ILibraryManager libraryManager, ISubtitleManager subManager, IUserManager userManager, IServerConfigurationManager config, IServerApplicationHost appHost)
+        public ActivityLogEntryPoint(
+            ILogger<ActivityLogEntryPoint> logger,
+            ISessionManager sessionManager,
+            IDeviceManager deviceManager,
+            ITaskManager taskManager,
+            IActivityManager activityManager,
+            ILocalizationManager localization,
+            IInstallationManager installationManager,
+            ISubtitleManager subManager,
+            IUserManager userManager,
+            IServerApplicationHost appHost)
         {
         {
+            _logger = logger;
             _sessionManager = sessionManager;
             _sessionManager = sessionManager;
+            _deviceManager = deviceManager;
             _taskManager = taskManager;
             _taskManager = taskManager;
             _activityManager = activityManager;
             _activityManager = activityManager;
             _localization = localization;
             _localization = localization;
             _installationManager = installationManager;
             _installationManager = installationManager;
-            _libraryManager = libraryManager;
             _subManager = subManager;
             _subManager = subManager;
             _userManager = userManager;
             _userManager = userManager;
-            _config = config;
             _appHost = appHost;
             _appHost = appHost;
-            _deviceManager = deviceManager;
         }
         }
 
 
         public Task RunAsync()
         public Task RunAsync()
@@ -69,7 +76,6 @@ namespace Emby.Server.Implementations.Activity
             _sessionManager.AuthenticationFailed += OnAuthenticationFailed;
             _sessionManager.AuthenticationFailed += OnAuthenticationFailed;
             _sessionManager.AuthenticationSucceeded += OnAuthenticationSucceeded;
             _sessionManager.AuthenticationSucceeded += OnAuthenticationSucceeded;
             _sessionManager.SessionEnded += OnSessionEnded;
             _sessionManager.SessionEnded += OnSessionEnded;
-
             _sessionManager.PlaybackStart += OnPlaybackStart;
             _sessionManager.PlaybackStart += OnPlaybackStart;
             _sessionManager.PlaybackStopped += OnPlaybackStopped;
             _sessionManager.PlaybackStopped += OnPlaybackStopped;
 
 
@@ -111,7 +117,7 @@ namespace Emby.Server.Implementations.Activity
             {
             {
                 Name = string.Format(_localization.GetLocalizedString("SubtitleDownloadFailureFromForItem"), e.Provider, Notifications.Notifications.GetItemName(e.Item)),
                 Name = string.Format(_localization.GetLocalizedString("SubtitleDownloadFailureFromForItem"), e.Provider, Notifications.Notifications.GetItemName(e.Item)),
                 Type = "SubtitleDownloadFailure",
                 Type = "SubtitleDownloadFailure",
-                ItemId = e.Item.Id.ToString("N"),
+                ItemId = e.Item.Id.ToString("N", CultureInfo.InvariantCulture),
                 ShortOverview = e.Exception.Message
                 ShortOverview = e.Exception.Message
             });
             });
         }
         }
@@ -122,7 +128,7 @@ namespace Emby.Server.Implementations.Activity
 
 
             if (item == null)
             if (item == null)
             {
             {
-                //_logger.LogWarning("PlaybackStopped reported with null media info.");
+                _logger.LogWarning("PlaybackStopped reported with null media info.");
                 return;
                 return;
             }
             }
 
 
@@ -153,7 +159,7 @@ namespace Emby.Server.Implementations.Activity
 
 
             if (item == null)
             if (item == null)
             {
             {
-                //_logger.LogWarning("PlaybackStart reported with null media info.");
+                _logger.LogWarning("PlaybackStart reported with null media info.");
                 return;
                 return;
             }
             }
 
 
@@ -201,6 +207,7 @@ namespace Emby.Server.Implementations.Activity
             {
             {
                 return NotificationType.AudioPlayback.ToString();
                 return NotificationType.AudioPlayback.ToString();
             }
             }
+
             if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
             if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
             {
             {
                 return NotificationType.VideoPlayback.ToString();
                 return NotificationType.VideoPlayback.ToString();
@@ -215,6 +222,7 @@ namespace Emby.Server.Implementations.Activity
             {
             {
                 return NotificationType.AudioPlaybackStopped.ToString();
                 return NotificationType.AudioPlaybackStopped.ToString();
             }
             }
+
             if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
             if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
             {
             {
                 return NotificationType.VideoPlaybackStopped.ToString();
                 return NotificationType.VideoPlaybackStopped.ToString();
@@ -338,7 +346,7 @@ namespace Emby.Server.Implementations.Activity
             });
             });
         }
         }
 
 
-        private void OnPluginUpdated(object sender, GenericEventArgs<Tuple<IPlugin, PackageVersionInfo>> e)
+        private void OnPluginUpdated(object sender, GenericEventArgs<(IPlugin, PackageVersionInfo)> e)
         {
         {
             CreateLogEntry(new ActivityLogEntry
             CreateLogEntry(new ActivityLogEntry
             {
             {
@@ -403,6 +411,7 @@ namespace Emby.Server.Implementations.Activity
                 {
                 {
                     vals.Add(e.Result.ErrorMessage);
                     vals.Add(e.Result.ErrorMessage);
                 }
                 }
+
                 if (!string.IsNullOrEmpty(e.Result.LongErrorMessage))
                 if (!string.IsNullOrEmpty(e.Result.LongErrorMessage))
                 {
                 {
                     vals.Add(e.Result.LongErrorMessage);
                     vals.Add(e.Result.LongErrorMessage);
@@ -412,7 +421,7 @@ namespace Emby.Server.Implementations.Activity
                 {
                 {
                     Name = string.Format(_localization.GetLocalizedString("ScheduledTaskFailedWithName"), task.Name),
                     Name = string.Format(_localization.GetLocalizedString("ScheduledTaskFailedWithName"), task.Name),
                     Type = NotificationType.TaskFailed.ToString(),
                     Type = NotificationType.TaskFailed.ToString(),
-                    Overview = string.Join(Environment.NewLine, vals.ToArray()),
+                    Overview = string.Join(Environment.NewLine, vals),
                     ShortOverview = runningTime,
                     ShortOverview = runningTime,
                     Severity = LogLevel.Error
                     Severity = LogLevel.Error
                 });
                 });
@@ -489,6 +498,7 @@ namespace Emby.Server.Implementations.Activity
             {
             {
                 values.Add(CreateValueString(span.Hours, "hour"));
                 values.Add(CreateValueString(span.Hours, "hour"));
             }
             }
+
             // Number of minutes
             // Number of minutes
             if (span.Minutes >= 1)
             if (span.Minutes >= 1)
             {
             {
@@ -512,6 +522,7 @@ namespace Emby.Server.Implementations.Activity
 
 
                 builder.Append(values[i]);
                 builder.Append(values[i]);
             }
             }
+
             // Return result
             // Return result
             return builder.ToString();
             return builder.ToString();
         }
         }

+ 11 - 16
Emby.Server.Implementations/Activity/ActivityRepository.cs

@@ -15,14 +15,14 @@ namespace Emby.Server.Implementations.Activity
 {
 {
     public class ActivityRepository : BaseSqliteRepository, IActivityRepository
     public class ActivityRepository : BaseSqliteRepository, IActivityRepository
     {
     {
-        private readonly CultureInfo _usCulture = new CultureInfo("en-US");
-        protected IFileSystem FileSystem { get; private set; }
+        private static readonly CultureInfo _usCulture = CultureInfo.ReadOnly(new CultureInfo("en-US"));
+        private readonly IFileSystem _fileSystem;
 
 
         public ActivityRepository(ILoggerFactory loggerFactory, IServerApplicationPaths appPaths, IFileSystem fileSystem)
         public ActivityRepository(ILoggerFactory loggerFactory, IServerApplicationPaths appPaths, IFileSystem fileSystem)
             : base(loggerFactory.CreateLogger(nameof(ActivityRepository)))
             : base(loggerFactory.CreateLogger(nameof(ActivityRepository)))
         {
         {
             DbFilePath = Path.Combine(appPaths.DataPath, "activitylog.db");
             DbFilePath = Path.Combine(appPaths.DataPath, "activitylog.db");
-            FileSystem = fileSystem;
+            _fileSystem = fileSystem;
         }
         }
 
 
         public void Initialize()
         public void Initialize()
@@ -35,7 +35,7 @@ namespace Emby.Server.Implementations.Activity
             {
             {
                 Logger.LogError(ex, "Error loading database file. Will reset and retry.");
                 Logger.LogError(ex, "Error loading database file. Will reset and retry.");
 
 
-                FileSystem.DeleteFile(DbFilePath);
+                _fileSystem.DeleteFile(DbFilePath);
 
 
                 InitializeInternal();
                 InitializeInternal();
             }
             }
@@ -43,10 +43,8 @@ namespace Emby.Server.Implementations.Activity
 
 
         private void InitializeInternal()
         private void InitializeInternal()
         {
         {
-            using (var connection = CreateConnection())
+            using (var connection = GetConnection())
             {
             {
-                RunDefaultInitialization(connection);
-
                 connection.RunQueries(new[]
                 connection.RunQueries(new[]
                 {
                 {
                     "create table if not exists ActivityLog (Id INTEGER PRIMARY KEY, Name TEXT NOT NULL, Overview TEXT, ShortOverview TEXT, Type TEXT NOT NULL, ItemId TEXT, UserId TEXT, DateCreated DATETIME NOT NULL, LogSeverity TEXT NOT NULL)",
                     "create table if not exists ActivityLog (Id INTEGER PRIMARY KEY, Name TEXT NOT NULL, Overview TEXT, ShortOverview TEXT, Type TEXT NOT NULL, ItemId TEXT, UserId TEXT, DateCreated DATETIME NOT NULL, LogSeverity TEXT NOT NULL)",
@@ -85,8 +83,7 @@ namespace Emby.Server.Implementations.Activity
                 throw new ArgumentNullException(nameof(entry));
                 throw new ArgumentNullException(nameof(entry));
             }
             }
 
 
-            using (WriteLock.Write())
-            using (var connection = CreateConnection())
+            using (var connection = GetConnection())
             {
             {
                 connection.RunInTransaction(db =>
                 connection.RunInTransaction(db =>
                 {
                 {
@@ -105,7 +102,7 @@ namespace Emby.Server.Implementations.Activity
                         }
                         }
                         else
                         else
                         {
                         {
-                            statement.TryBind("@UserId", entry.UserId.ToString("N"));
+                            statement.TryBind("@UserId", entry.UserId.ToString("N", CultureInfo.InvariantCulture));
                         }
                         }
 
 
                         statement.TryBind("@DateCreated", entry.Date.ToDateTimeParamValue());
                         statement.TryBind("@DateCreated", entry.Date.ToDateTimeParamValue());
@@ -124,8 +121,7 @@ namespace Emby.Server.Implementations.Activity
                 throw new ArgumentNullException(nameof(entry));
                 throw new ArgumentNullException(nameof(entry));
             }
             }
 
 
-            using (WriteLock.Write())
-            using (var connection = CreateConnection())
+            using (var connection = GetConnection())
             {
             {
                 connection.RunInTransaction(db =>
                 connection.RunInTransaction(db =>
                 {
                 {
@@ -145,7 +141,7 @@ namespace Emby.Server.Implementations.Activity
                         }
                         }
                         else
                         else
                         {
                         {
-                            statement.TryBind("@UserId", entry.UserId.ToString("N"));
+                            statement.TryBind("@UserId", entry.UserId.ToString("N", CultureInfo.InvariantCulture));
                         }
                         }
 
 
                         statement.TryBind("@DateCreated", entry.Date.ToDateTimeParamValue());
                         statement.TryBind("@DateCreated", entry.Date.ToDateTimeParamValue());
@@ -159,8 +155,7 @@ namespace Emby.Server.Implementations.Activity
 
 
         public QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, bool? hasUserId, int? startIndex, int? limit)
         public QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, bool? hasUserId, int? startIndex, int? limit)
         {
         {
-            using (WriteLock.Read())
-            using (var connection = CreateConnection(true))
+            using (var connection = GetConnection(true))
             {
             {
                 var commandText = BaseActivitySelectText;
                 var commandText = BaseActivitySelectText;
                 var whereClauses = new List<string>();
                 var whereClauses = new List<string>();
@@ -218,7 +213,7 @@ namespace Emby.Server.Implementations.Activity
                     var list = new List<ActivityLogEntry>();
                     var list = new List<ActivityLogEntry>();
                     var result = new QueryResult<ActivityLogEntry>();
                     var result = new QueryResult<ActivityLogEntry>();
 
 
-                    var statements = PrepareAllSafe(db, statementTexts).ToList();
+                    var statements = PrepareAll(db, statementTexts).ToList();
 
 
                     using (var statement = statements[0])
                     using (var statement = statements[0])
                     {
                     {

+ 20 - 17
Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs

@@ -10,6 +10,8 @@ namespace Emby.Server.Implementations.AppBase
     /// </summary>
     /// </summary>
     public abstract class BaseApplicationPaths : IApplicationPaths
     public abstract class BaseApplicationPaths : IApplicationPaths
     {
     {
+        private string _dataPath;
+
         /// <summary>
         /// <summary>
         /// Initializes a new instance of the <see cref="BaseApplicationPaths"/> class.
         /// Initializes a new instance of the <see cref="BaseApplicationPaths"/> class.
         /// </summary>
         /// </summary>
@@ -30,27 +32,27 @@ namespace Emby.Server.Implementations.AppBase
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// Gets the path to the program data folder
+        /// Gets the path to the program data folder.
         /// </summary>
         /// </summary>
         /// <value>The program data path.</value>
         /// <value>The program data path.</value>
-        public string ProgramDataPath { get; private set; }
+        public string ProgramDataPath { get; }
 
 
         /// <summary>
         /// <summary>
-        /// Gets the path to the web UI resources folder
+        /// Gets the path to the web UI resources folder.
         /// </summary>
         /// </summary>
         /// <value>The web UI resources path.</value>
         /// <value>The web UI resources path.</value>
-        public string WebPath { get; set; }
+        public string WebPath { get; }
 
 
         /// <summary>
         /// <summary>
-        /// Gets the path to the system folder
+        /// Gets the path to the system folder.
         /// </summary>
         /// </summary>
+        /// <value>The path to the system folder.</value>
         public string ProgramSystemPath { get; } = AppContext.BaseDirectory;
         public string ProgramSystemPath { get; } = AppContext.BaseDirectory;
 
 
         /// <summary>
         /// <summary>
-        /// Gets the folder path to the data directory
+        /// Gets the folder path to the data directory.
         /// </summary>
         /// </summary>
         /// <value>The data directory.</value>
         /// <value>The data directory.</value>
-        private string _dataPath;
         public string DataPath
         public string DataPath
         {
         {
             get => _dataPath;
             get => _dataPath;
@@ -58,8 +60,9 @@ namespace Emby.Server.Implementations.AppBase
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// Gets the magic strings used for virtual path manipulation.
+        /// Gets the magic string used for virtual path manipulation.
         /// </summary>
         /// </summary>
+        /// <value>The magic string used for virtual path manipulation.</value>
         public string VirtualDataPath { get; } = "%AppDataPath%";
         public string VirtualDataPath { get; } = "%AppDataPath%";
 
 
         /// <summary>
         /// <summary>
@@ -69,43 +72,43 @@ namespace Emby.Server.Implementations.AppBase
         public string ImageCachePath => Path.Combine(CachePath, "images");
         public string ImageCachePath => Path.Combine(CachePath, "images");
 
 
         /// <summary>
         /// <summary>
-        /// Gets the path to the plugin directory
+        /// Gets the path to the plugin directory.
         /// </summary>
         /// </summary>
         /// <value>The plugins path.</value>
         /// <value>The plugins path.</value>
         public string PluginsPath => Path.Combine(ProgramDataPath, "plugins");
         public string PluginsPath => Path.Combine(ProgramDataPath, "plugins");
 
 
         /// <summary>
         /// <summary>
-        /// Gets the path to the plugin configurations directory
+        /// Gets the path to the plugin configurations directory.
         /// </summary>
         /// </summary>
         /// <value>The plugin configurations path.</value>
         /// <value>The plugin configurations path.</value>
         public string PluginConfigurationsPath => Path.Combine(PluginsPath, "configurations");
         public string PluginConfigurationsPath => Path.Combine(PluginsPath, "configurations");
 
 
         /// <summary>
         /// <summary>
-        /// Gets the path to the log directory
+        /// Gets the path to the log directory.
         /// </summary>
         /// </summary>
         /// <value>The log directory path.</value>
         /// <value>The log directory path.</value>
-        public string LogDirectoryPath { get; private set; }
+        public string LogDirectoryPath { get; }
 
 
         /// <summary>
         /// <summary>
-        /// Gets the path to the application configuration root directory
+        /// Gets the path to the application configuration root directory.
         /// </summary>
         /// </summary>
         /// <value>The configuration directory path.</value>
         /// <value>The configuration directory path.</value>
-        public string ConfigurationDirectoryPath { get; private set; }
+        public string ConfigurationDirectoryPath { get; }
 
 
         /// <summary>
         /// <summary>
-        /// Gets the path to the system configuration file
+        /// Gets the path to the system configuration file.
         /// </summary>
         /// </summary>
         /// <value>The system configuration file path.</value>
         /// <value>The system configuration file path.</value>
         public string SystemConfigurationFilePath => Path.Combine(ConfigurationDirectoryPath, "system.xml");
         public string SystemConfigurationFilePath => Path.Combine(ConfigurationDirectoryPath, "system.xml");
 
 
         /// <summary>
         /// <summary>
-        /// Gets the folder path to the cache directory
+        /// Gets or sets the folder path to the cache directory.
         /// </summary>
         /// </summary>
         /// <value>The cache directory.</value>
         /// <value>The cache directory.</value>
         public string CachePath { get; set; }
         public string CachePath { get; set; }
 
 
         /// <summary>
         /// <summary>
-        /// Gets the folder path to the temp directory within the cache folder
+        /// Gets the folder path to the temp directory within the cache folder.
         /// </summary>
         /// </summary>
         /// <value>The temp directory.</value>
         /// <value>The temp directory.</value>
         public string TempDirectory => Path.Combine(CachePath, "temp");
         public string TempDirectory => Path.Combine(CachePath, "temp");

+ 51 - 41
Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs

@@ -1,6 +1,7 @@
 using System;
 using System;
 using System.Collections.Concurrent;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Globalization;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
 using System.Threading;
 using System.Threading;
@@ -19,11 +20,44 @@ namespace Emby.Server.Implementations.AppBase
     /// </summary>
     /// </summary>
     public abstract class BaseConfigurationManager : IConfigurationManager
     public abstract class BaseConfigurationManager : IConfigurationManager
     {
     {
+        private readonly IFileSystem _fileSystem;
+
+        private readonly ConcurrentDictionary<string, object> _configurations = new ConcurrentDictionary<string, object>();
+
+        private ConfigurationStore[] _configurationStores = Array.Empty<ConfigurationStore>();
+        private IConfigurationFactory[] _configurationFactories = Array.Empty<IConfigurationFactory>();
+
         /// <summary>
         /// <summary>
-        /// Gets the type of the configuration.
+        /// The _configuration loaded.
         /// </summary>
         /// </summary>
-        /// <value>The type of the configuration.</value>
-        protected abstract Type ConfigurationType { get; }
+        private bool _configurationLoaded;
+
+        /// <summary>
+        /// The _configuration sync lock.
+        /// </summary>
+        private object _configurationSyncLock = new object();
+
+        /// <summary>
+        /// The _configuration.
+        /// </summary>
+        private BaseApplicationConfiguration _configuration;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="BaseConfigurationManager" /> class.
+        /// </summary>
+        /// <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;
+            XmlSerializer = xmlSerializer;
+            _fileSystem = fileSystem;
+            Logger = loggerFactory.CreateLogger(GetType().Name);
+
+            UpdateCachePath();
+        }
 
 
         /// <summary>
         /// <summary>
         /// Occurs when [configuration updated].
         /// Occurs when [configuration updated].
@@ -40,6 +74,12 @@ namespace Emby.Server.Implementations.AppBase
         /// </summary>
         /// </summary>
         public event EventHandler<ConfigurationUpdateEventArgs> NamedConfigurationUpdated;
         public event EventHandler<ConfigurationUpdateEventArgs> NamedConfigurationUpdated;
 
 
+        /// <summary>
+        /// Gets the type of the configuration.
+        /// </summary>
+        /// <value>The type of the configuration.</value>
+        protected abstract Type ConfigurationType { get; }
+
         /// <summary>
         /// <summary>
         /// Gets the logger.
         /// Gets the logger.
         /// </summary>
         /// </summary>
@@ -56,20 +96,7 @@ namespace Emby.Server.Implementations.AppBase
         /// </summary>
         /// </summary>
         /// <value>The application paths.</value>
         /// <value>The application paths.</value>
         public IApplicationPaths CommonApplicationPaths { get; private set; }
         public IApplicationPaths CommonApplicationPaths { get; private set; }
-        public readonly IFileSystem FileSystem;
 
 
-        /// <summary>
-        /// The _configuration loaded
-        /// </summary>
-        private bool _configurationLoaded;
-        /// <summary>
-        /// The _configuration sync lock
-        /// </summary>
-        private object _configurationSyncLock = new object();
-        /// <summary>
-        /// The _configuration
-        /// </summary>
-        private BaseApplicationConfiguration _configuration;
         /// <summary>
         /// <summary>
         /// Gets the system configuration
         /// Gets the system configuration
         /// </summary>
         /// </summary>
@@ -90,26 +117,6 @@ namespace Emby.Server.Implementations.AppBase
             }
             }
         }
         }
 
 
-        private ConfigurationStore[] _configurationStores = { };
-        private IConfigurationFactory[] _configurationFactories = { };
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="BaseConfigurationManager" /> class.
-        /// </summary>
-        /// <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;
-            XmlSerializer = xmlSerializer;
-            FileSystem = fileSystem;
-            Logger = loggerFactory.CreateLogger(GetType().Name);
-
-            UpdateCachePath();
-        }
-
         public virtual void AddParts(IEnumerable<IConfigurationFactory> factories)
         public virtual void AddParts(IEnumerable<IConfigurationFactory> factories)
         {
         {
             _configurationFactories = factories.ToArray();
             _configurationFactories = factories.ToArray();
@@ -171,6 +178,7 @@ namespace Emby.Server.Implementations.AppBase
         private void UpdateCachePath()
         private void UpdateCachePath()
         {
         {
             string cachePath;
             string cachePath;
+
             // If the configuration file has no entry (i.e. not set in UI)
             // If the configuration file has no entry (i.e. not set in UI)
             if (string.IsNullOrWhiteSpace(CommonConfiguration.CachePath))
             if (string.IsNullOrWhiteSpace(CommonConfiguration.CachePath))
             {
             {
@@ -207,12 +215,16 @@ namespace Emby.Server.Implementations.AppBase
             var newPath = newConfig.CachePath;
             var newPath = newConfig.CachePath;
 
 
             if (!string.IsNullOrWhiteSpace(newPath)
             if (!string.IsNullOrWhiteSpace(newPath)
-                && !string.Equals(CommonConfiguration.CachePath ?? string.Empty, newPath))
+                && !string.Equals(CommonConfiguration.CachePath ?? string.Empty, newPath, StringComparison.Ordinal))
             {
             {
                 // Validate
                 // Validate
                 if (!Directory.Exists(newPath))
                 if (!Directory.Exists(newPath))
                 {
                 {
-                    throw new FileNotFoundException(string.Format("{0} does not exist.", newPath));
+                    throw new FileNotFoundException(
+                        string.Format(
+                            CultureInfo.InvariantCulture,
+                            "{0} does not exist.",
+                            newPath));
                 }
                 }
 
 
                 EnsureWriteAccess(newPath);
                 EnsureWriteAccess(newPath);
@@ -223,11 +235,9 @@ namespace Emby.Server.Implementations.AppBase
         {
         {
             var file = Path.Combine(path, Guid.NewGuid().ToString());
             var file = Path.Combine(path, Guid.NewGuid().ToString());
             File.WriteAllText(file, string.Empty);
             File.WriteAllText(file, string.Empty);
-            FileSystem.DeleteFile(file);
+            _fileSystem.DeleteFile(file);
         }
         }
 
 
-        private readonly ConcurrentDictionary<string, object> _configurations = new ConcurrentDictionary<string, object>();
-
         private string GetConfigurationFile(string key)
         private string GetConfigurationFile(string key)
         {
         {
             return Path.Combine(CommonApplicationPaths.ConfigurationDirectoryPath, key.ToLowerInvariant() + ".xml");
             return Path.Combine(CommonApplicationPaths.ConfigurationDirectoryPath, key.ToLowerInvariant() + ".xml");

+ 120 - 128
Emby.Server.Implementations/ApplicationHost.cs

@@ -6,6 +6,8 @@ using System.Globalization;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
 using System.Net;
 using System.Net;
+using System.Net.Http;
+using System.Net.Sockets;
 using System.Reflection;
 using System.Reflection;
 using System.Runtime.InteropServices;
 using System.Runtime.InteropServices;
 using System.Security.Cryptography.X509Certificates;
 using System.Security.Cryptography.X509Certificates;
@@ -106,9 +108,9 @@ using Microsoft.AspNetCore.Hosting;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Http.Extensions;
 using Microsoft.AspNetCore.Http.Extensions;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.DependencyInjection.Extensions;
 using Microsoft.Extensions.DependencyInjection.Extensions;
+using Microsoft.Extensions.Logging;
 using ServiceStack;
 using ServiceStack;
 using OperatingSystem = MediaBrowser.Common.System.OperatingSystem;
 using OperatingSystem = MediaBrowser.Common.System.OperatingSystem;
 
 
@@ -119,6 +121,10 @@ namespace Emby.Server.Implementations
     /// </summary>
     /// </summary>
     public abstract class ApplicationHost : IServerApplicationHost, IDisposable
     public abstract class ApplicationHost : IServerApplicationHost, IDisposable
     {
     {
+        private SqliteUserRepository _userRepository;
+
+        private SqliteDisplayPreferencesRepository _displayPreferencesRepository;
+
         /// <summary>
         /// <summary>
         /// Gets a value indicating whether this instance can self restart.
         /// Gets a value indicating whether this instance can self restart.
         /// </summary>
         /// </summary>
@@ -231,11 +237,6 @@ namespace Emby.Server.Implementations
         /// <value>The server configuration manager.</value>
         /// <value>The server configuration manager.</value>
         public IServerConfigurationManager ServerConfigurationManager => (IServerConfigurationManager)ConfigurationManager;
         public IServerConfigurationManager ServerConfigurationManager => (IServerConfigurationManager)ConfigurationManager;
 
 
-        protected virtual IResourceFileManager CreateResourceFileManager()
-        {
-            return new ResourceFileManager(HttpResultFactory, LoggerFactory, FileSystemManager);
-        }
-
         /// <summary>
         /// <summary>
         /// Gets or sets the user manager.
         /// Gets or sets the user manager.
         /// </summary>
         /// </summary>
@@ -294,8 +295,6 @@ namespace Emby.Server.Implementations
         /// <value>The user data repository.</value>
         /// <value>The user data repository.</value>
         private IUserDataManager UserDataManager { get; set; }
         private IUserDataManager UserDataManager { get; set; }
 
 
-        private IUserRepository UserRepository { get; set; }
-
         internal SqliteItemRepository ItemRepository { get; set; }
         internal SqliteItemRepository ItemRepository { get; set; }
 
 
         private INotificationManager NotificationManager { get; set; }
         private INotificationManager NotificationManager { get; set; }
@@ -316,8 +315,6 @@ namespace Emby.Server.Implementations
 
 
         private IMediaSourceManager MediaSourceManager { get; set; }
         private IMediaSourceManager MediaSourceManager { get; set; }
 
 
-        private IPlaylistManager PlaylistManager { get; set; }
-
         private readonly IConfiguration _configuration;
         private readonly IConfiguration _configuration;
 
 
         /// <summary>
         /// <summary>
@@ -326,14 +323,6 @@ namespace Emby.Server.Implementations
         /// <value>The installation manager.</value>
         /// <value>The installation manager.</value>
         protected IInstallationManager InstallationManager { get; private set; }
         protected IInstallationManager InstallationManager { get; private set; }
 
 
-        /// <summary>
-        /// Gets or sets the zip client.
-        /// </summary>
-        /// <value>The zip client.</value>
-        protected IZipClient ZipClient { get; private set; }
-
-        protected IHttpResultFactory HttpResultFactory { get; private set; }
-
         protected IAuthService AuthService { get; private set; }
         protected IAuthService AuthService { get; private set; }
 
 
         public IStartupOptions StartupOptions { get; }
         public IStartupOptions StartupOptions { get; }
@@ -389,7 +378,7 @@ namespace Emby.Server.Implementations
 
 
             fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));
             fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));
 
 
-            NetworkManager.NetworkChanged += NetworkManager_NetworkChanged;
+            NetworkManager.NetworkChanged += OnNetworkChanged;
         }
         }
 
 
         public string ExpandVirtualPath(string path)
         public string ExpandVirtualPath(string path)
@@ -413,7 +402,7 @@ namespace Emby.Server.Implementations
             return ServerConfigurationManager.Configuration.LocalNetworkSubnets;
             return ServerConfigurationManager.Configuration.LocalNetworkSubnets;
         }
         }
 
 
-        private void NetworkManager_NetworkChanged(object sender, EventArgs e)
+        private void OnNetworkChanged(object sender, EventArgs e)
         {
         {
             _validAddressResults.Clear();
             _validAddressResults.Clear();
         }
         }
@@ -421,10 +410,10 @@ namespace Emby.Server.Implementations
         public string ApplicationVersion { get; } = typeof(ApplicationHost).Assembly.GetName().Version.ToString(3);
         public string ApplicationVersion { get; } = typeof(ApplicationHost).Assembly.GetName().Version.ToString(3);
 
 
         /// <summary>
         /// <summary>
-        /// Gets the current application user agent
+        /// Gets the current application user agent.
         /// </summary>
         /// </summary>
         /// <value>The application user agent.</value>
         /// <value>The application user agent.</value>
-        public string ApplicationUserAgent => Name.Replace(' ','-') + "/" + ApplicationVersion;
+        public string ApplicationUserAgent => Name.Replace(' ', '-') + "/" + ApplicationVersion;
 
 
         /// <summary>
         /// <summary>
         /// Gets the email address for use within a comment section of a user agent field.
         /// Gets the email address for use within a comment section of a user agent field.
@@ -432,14 +421,11 @@ namespace Emby.Server.Implementations
         /// </summary>
         /// </summary>
         public string ApplicationUserAgentAddress { get; } = "team@jellyfin.org";
         public string ApplicationUserAgentAddress { get; } = "team@jellyfin.org";
 
 
-        private string _productName;
-
         /// <summary>
         /// <summary>
-        /// Gets the current application name
+        /// Gets the current application name.
         /// </summary>
         /// </summary>
         /// <value>The application name.</value>
         /// <value>The application name.</value>
-        public string ApplicationProductName
-            => _productName ?? (_productName = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).ProductName);
+        public string ApplicationProductName { get; } = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).ProductName;
 
 
         private DeviceId _deviceId;
         private DeviceId _deviceId;
 
 
@@ -473,8 +459,8 @@ namespace Emby.Server.Implementations
         /// <summary>
         /// <summary>
         /// Creates an instance of type and resolves all constructor dependencies
         /// Creates an instance of type and resolves all constructor dependencies
         /// </summary>
         /// </summary>
-        /// /// <typeparam name="T">The type</typeparam>
-        /// <returns>T</returns>
+        /// /// <typeparam name="T">The type.</typeparam>
+        /// <returns>T.</returns>
         public T CreateInstance<T>()
         public T CreateInstance<T>()
             => ActivatorUtilities.CreateInstance<T>(_serviceProvider);
             => ActivatorUtilities.CreateInstance<T>(_serviceProvider);
 
 
@@ -516,13 +502,8 @@ namespace Emby.Server.Implementations
             return AllConcreteTypes.Where(i => currentType.IsAssignableFrom(i));
             return AllConcreteTypes.Where(i => currentType.IsAssignableFrom(i));
         }
         }
 
 
-        /// <summary>
-        /// Gets the exports.
-        /// </summary>
-        /// <typeparam name="T">The type</typeparam>
-        /// <param name="manageLifetime">if set to <c>true</c> [manage lifetime].</param>
-        /// <returns>IEnumerable{``0}.</returns>
-        public IEnumerable<T> GetExports<T>(bool manageLifetime = true)
+        /// <inheritdoc />
+        public IReadOnlyCollection<T> GetExports<T>(bool manageLifetime = true)
         {
         {
             var parts = GetExportTypes<T>()
             var parts = GetExportTypes<T>()
                 .Select(CreateInstanceSafe)
                 .Select(CreateInstanceSafe)
@@ -544,6 +525,7 @@ namespace Emby.Server.Implementations
         /// <summary>
         /// <summary>
         /// Runs the startup tasks.
         /// Runs the startup tasks.
         /// </summary>
         /// </summary>
+        /// <returns><see cref="Task" />.</returns>
         public async Task RunStartupTasksAsync()
         public async Task RunStartupTasksAsync()
         {
         {
             Logger.LogInformation("Running startup tasks");
             Logger.LogInformation("Running startup tasks");
@@ -556,7 +538,7 @@ namespace Emby.Server.Implementations
 
 
             Logger.LogInformation("ServerId: {0}", SystemId);
             Logger.LogInformation("ServerId: {0}", SystemId);
 
 
-            var entryPoints = GetExports<IServerEntryPoint>().ToList();
+            var entryPoints = GetExports<IServerEntryPoint>();
 
 
             var stopWatch = new Stopwatch();
             var stopWatch = new Stopwatch();
             stopWatch.Start();
             stopWatch.Start();
@@ -607,10 +589,15 @@ namespace Emby.Server.Implementations
 
 
                 foreach (var plugin in Plugins)
                 foreach (var plugin in Plugins)
                 {
                 {
-                    pluginBuilder.AppendLine(string.Format("{0} {1}", plugin.Name, plugin.Version));
+                    pluginBuilder.AppendLine(
+                        string.Format(
+                            CultureInfo.InvariantCulture,
+                            "{0} {1}",
+                            plugin.Name,
+                            plugin.Version));
                 }
                 }
 
 
-                Logger.LogInformation("Plugins: {plugins}", pluginBuilder.ToString());
+                Logger.LogInformation("Plugins: {Plugins}", pluginBuilder.ToString());
             }
             }
 
 
             DiscoverTypes();
             DiscoverTypes();
@@ -632,7 +619,7 @@ namespace Emby.Server.Implementations
 
 
                     if (EnableHttps && Certificate != null)
                     if (EnableHttps && Certificate != null)
                     {
                     {
-                        options.ListenAnyIP(HttpsPort, listenOptions => { listenOptions.UseHttps(Certificate); });
+                        options.ListenAnyIP(HttpsPort, listenOptions => listenOptions.UseHttps(Certificate));
                     }
                     }
                 })
                 })
                 .UseContentRoot(contentRoot)
                 .UseContentRoot(contentRoot)
@@ -646,6 +633,7 @@ namespace Emby.Server.Implementations
                     app.UseWebSockets();
                     app.UseWebSockets();
 
 
                     app.UseResponseCompression();
                     app.UseResponseCompression();
+
                     // TODO app.UseMiddleware<WebSocketMiddleware>();
                     // TODO app.UseMiddleware<WebSocketMiddleware>();
                     app.Use(ExecuteWebsocketHandlerAsync);
                     app.Use(ExecuteWebsocketHandlerAsync);
                     app.Use(ExecuteHttpHandlerAsync);
                     app.Use(ExecuteHttpHandlerAsync);
@@ -679,16 +667,9 @@ namespace Emby.Server.Implementations
             var localPath = context.Request.Path.ToString();
             var localPath = context.Request.Path.ToString();
 
 
             var req = new WebSocketSharpRequest(request, response, request.Path, Logger);
             var req = new WebSocketSharpRequest(request, response, request.Path, Logger);
-            await HttpServer.RequestHandler(req, request.GetDisplayUrl(), request.Host.ToString(), localPath, CancellationToken.None).ConfigureAwait(false);
-        }
-
-        protected virtual IHttpClient CreateHttpClient()
-        {
-            return new HttpClientManager.HttpClientManager(ApplicationPaths, LoggerFactory, FileSystemManager, () => ApplicationUserAgent);
+            await HttpServer.RequestHandler(req, request.GetDisplayUrl(), request.Host.ToString(), localPath, context.RequestAborted).ConfigureAwait(false);
         }
         }
 
 
-        public static IStreamHelper StreamHelper { get; set; }
-
         /// <summary>
         /// <summary>
         /// Registers resources that classes will depend on
         /// Registers resources that classes will depend on
         /// </summary>
         /// </summary>
@@ -712,7 +693,11 @@ namespace Emby.Server.Implementations
             serviceCollection.AddSingleton(FileSystemManager);
             serviceCollection.AddSingleton(FileSystemManager);
             serviceCollection.AddSingleton<TvDbClientManager>();
             serviceCollection.AddSingleton<TvDbClientManager>();
 
 
-            HttpClient = CreateHttpClient();
+            HttpClient = new HttpClientManager.HttpClientManager(
+                ApplicationPaths,
+                LoggerFactory.CreateLogger<HttpClientManager.HttpClientManager>(),
+                FileSystemManager,
+                () => ApplicationUserAgent);
             serviceCollection.AddSingleton(HttpClient);
             serviceCollection.AddSingleton(HttpClient);
 
 
             serviceCollection.AddSingleton(NetworkManager);
             serviceCollection.AddSingleton(NetworkManager);
@@ -728,8 +713,7 @@ namespace Emby.Server.Implementations
             ProcessFactory = new ProcessFactory();
             ProcessFactory = new ProcessFactory();
             serviceCollection.AddSingleton(ProcessFactory);
             serviceCollection.AddSingleton(ProcessFactory);
 
 
-            ApplicationHost.StreamHelper = new StreamHelper();
-            serviceCollection.AddSingleton(StreamHelper);
+            serviceCollection.AddSingleton(typeof(IStreamHelper), typeof(StreamHelper));
 
 
             serviceCollection.AddSingleton(typeof(ICryptoProvider), typeof(CryptographyProvider));
             serviceCollection.AddSingleton(typeof(ICryptoProvider), typeof(CryptographyProvider));
 
 
@@ -738,18 +722,16 @@ namespace Emby.Server.Implementations
 
 
             serviceCollection.AddSingleton(typeof(IInstallationManager), typeof(InstallationManager));
             serviceCollection.AddSingleton(typeof(IInstallationManager), typeof(InstallationManager));
 
 
-            ZipClient = new ZipClient();
-            serviceCollection.AddSingleton(ZipClient);
+            serviceCollection.AddSingleton(typeof(IZipClient), typeof(ZipClient));
 
 
-            HttpResultFactory = new HttpResultFactory(LoggerFactory, FileSystemManager, JsonSerializer, StreamHelper);
-            serviceCollection.AddSingleton(HttpResultFactory);
+            serviceCollection.AddSingleton(typeof(IHttpResultFactory), typeof(HttpResultFactory));
 
 
             serviceCollection.AddSingleton<IServerApplicationHost>(this);
             serviceCollection.AddSingleton<IServerApplicationHost>(this);
             serviceCollection.AddSingleton<IServerApplicationPaths>(ApplicationPaths);
             serviceCollection.AddSingleton<IServerApplicationPaths>(ApplicationPaths);
 
 
             serviceCollection.AddSingleton(ServerConfigurationManager);
             serviceCollection.AddSingleton(ServerConfigurationManager);
 
 
-            LocalizationManager = new LocalizationManager(ServerConfigurationManager, JsonSerializer, LoggerFactory);
+            LocalizationManager = new LocalizationManager(ServerConfigurationManager, JsonSerializer, LoggerFactory.CreateLogger<LocalizationManager>());
             await LocalizationManager.LoadAll().ConfigureAwait(false);
             await LocalizationManager.LoadAll().ConfigureAwait(false);
             serviceCollection.AddSingleton<ILocalizationManager>(LocalizationManager);
             serviceCollection.AddSingleton<ILocalizationManager>(LocalizationManager);
 
 
@@ -758,12 +740,12 @@ namespace Emby.Server.Implementations
             UserDataManager = new UserDataManager(LoggerFactory, ServerConfigurationManager, () => UserManager);
             UserDataManager = new UserDataManager(LoggerFactory, ServerConfigurationManager, () => UserManager);
             serviceCollection.AddSingleton(UserDataManager);
             serviceCollection.AddSingleton(UserDataManager);
 
 
-            UserRepository = GetUserRepository();
-            // This is only needed for disposal purposes. If removing this, make sure to have the manager handle disposing it
-            serviceCollection.AddSingleton(UserRepository);
-
-            var displayPreferencesRepo = new SqliteDisplayPreferencesRepository(LoggerFactory, JsonSerializer, ApplicationPaths, FileSystemManager);
-            serviceCollection.AddSingleton<IDisplayPreferencesRepository>(displayPreferencesRepo);
+            _displayPreferencesRepository = new SqliteDisplayPreferencesRepository(
+                LoggerFactory.CreateLogger<SqliteDisplayPreferencesRepository>(),
+                JsonSerializer,
+                ApplicationPaths,
+                FileSystemManager);
+            serviceCollection.AddSingleton<IDisplayPreferencesRepository>(_displayPreferencesRepository);
 
 
             ItemRepository = new SqliteItemRepository(ServerConfigurationManager, this, JsonSerializer, LoggerFactory, LocalizationManager);
             ItemRepository = new SqliteItemRepository(ServerConfigurationManager, this, JsonSerializer, LoggerFactory, LocalizationManager);
             serviceCollection.AddSingleton<IItemRepository>(ItemRepository);
             serviceCollection.AddSingleton<IItemRepository>(ItemRepository);
@@ -771,7 +753,10 @@ namespace Emby.Server.Implementations
             AuthenticationRepository = GetAuthenticationRepository();
             AuthenticationRepository = GetAuthenticationRepository();
             serviceCollection.AddSingleton(AuthenticationRepository);
             serviceCollection.AddSingleton(AuthenticationRepository);
 
 
-            UserManager = new UserManager(LoggerFactory, ServerConfigurationManager, UserRepository, XmlSerializer, NetworkManager, () => ImageProcessor, () => DtoService, this, JsonSerializer, FileSystemManager);
+            _userRepository = GetUserRepository();
+
+            UserManager = new UserManager(LoggerFactory.CreateLogger<UserManager>(), _userRepository, XmlSerializer, NetworkManager, () => ImageProcessor, () => DtoService, this, JsonSerializer, FileSystemManager);
+
             serviceCollection.AddSingleton(UserManager);
             serviceCollection.AddSingleton(UserManager);
 
 
             LibraryManager = new LibraryManager(this, LoggerFactory, TaskManager, UserManager, ServerConfigurationManager, UserDataManager, () => LibraryMonitor, FileSystemManager, () => ProviderManager, () => UserViewManager);
             LibraryManager = new LibraryManager(this, LoggerFactory, TaskManager, UserManager, ServerConfigurationManager, UserDataManager, () => LibraryMonitor, FileSystemManager, () => ProviderManager, () => UserViewManager);
@@ -791,7 +776,7 @@ namespace Emby.Server.Implementations
 
 
             HttpServer = new HttpListenerHost(
             HttpServer = new HttpListenerHost(
                 this,
                 this,
-                LoggerFactory,
+                LoggerFactory.CreateLogger<HttpListenerHost>(),
                 ServerConfigurationManager,
                 ServerConfigurationManager,
                 _configuration,
                 _configuration,
                 NetworkManager,
                 NetworkManager,
@@ -804,14 +789,13 @@ namespace Emby.Server.Implementations
 
 
             serviceCollection.AddSingleton(HttpServer);
             serviceCollection.AddSingleton(HttpServer);
 
 
-            ImageProcessor = GetImageProcessor();
+            ImageProcessor = new ImageProcessor(LoggerFactory.CreateLogger<ImageProcessor>(), ServerConfigurationManager.ApplicationPaths, FileSystemManager, ImageEncoder, () => LibraryManager, () => MediaEncoder);
             serviceCollection.AddSingleton(ImageProcessor);
             serviceCollection.AddSingleton(ImageProcessor);
 
 
             TVSeriesManager = new TVSeriesManager(UserManager, UserDataManager, LibraryManager, ServerConfigurationManager);
             TVSeriesManager = new TVSeriesManager(UserManager, UserDataManager, LibraryManager, ServerConfigurationManager);
             serviceCollection.AddSingleton(TVSeriesManager);
             serviceCollection.AddSingleton(TVSeriesManager);
 
 
             DeviceManager = new DeviceManager(AuthenticationRepository, JsonSerializer, LibraryManager, LocalizationManager, UserManager, FileSystemManager, LibraryMonitor, ServerConfigurationManager);
             DeviceManager = new DeviceManager(AuthenticationRepository, JsonSerializer, LibraryManager, LocalizationManager, UserManager, FileSystemManager, LibraryMonitor, ServerConfigurationManager);
-
             serviceCollection.AddSingleton(DeviceManager);
             serviceCollection.AddSingleton(DeviceManager);
 
 
             MediaSourceManager = new MediaSourceManager(ItemRepository, ApplicationPaths, LocalizationManager, UserManager, LibraryManager, LoggerFactory, JsonSerializer, FileSystemManager, UserDataManager, () => MediaEncoder);
             MediaSourceManager = new MediaSourceManager(ItemRepository, ApplicationPaths, LocalizationManager, UserManager, LibraryManager, LoggerFactory, JsonSerializer, FileSystemManager, UserDataManager, () => MediaEncoder);
@@ -826,10 +810,10 @@ namespace Emby.Server.Implementations
             DtoService = new DtoService(LoggerFactory, LibraryManager, UserDataManager, ItemRepository, ImageProcessor, ProviderManager, this, () => MediaSourceManager, () => LiveTvManager);
             DtoService = new DtoService(LoggerFactory, LibraryManager, UserDataManager, ItemRepository, ImageProcessor, ProviderManager, this, () => MediaSourceManager, () => LiveTvManager);
             serviceCollection.AddSingleton(DtoService);
             serviceCollection.AddSingleton(DtoService);
 
 
-            ChannelManager = new ChannelManager(UserManager, DtoService, LibraryManager, LoggerFactory, ServerConfigurationManager, FileSystemManager, UserDataManager, JsonSerializer, LocalizationManager, HttpClient, ProviderManager);
+            ChannelManager = new ChannelManager(UserManager, DtoService, LibraryManager, LoggerFactory, ServerConfigurationManager, FileSystemManager, UserDataManager, JsonSerializer, ProviderManager);
             serviceCollection.AddSingleton(ChannelManager);
             serviceCollection.AddSingleton(ChannelManager);
 
 
-            SessionManager = new SessionManager(UserDataManager, LoggerFactory, LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, JsonSerializer, this, HttpClient, AuthenticationRepository, DeviceManager, MediaSourceManager);
+            SessionManager = new SessionManager(UserDataManager, LoggerFactory, LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, this, AuthenticationRepository, DeviceManager, MediaSourceManager);
             serviceCollection.AddSingleton(SessionManager);
             serviceCollection.AddSingleton(SessionManager);
 
 
             serviceCollection.AddSingleton<IDlnaManager>(
             serviceCollection.AddSingleton<IDlnaManager>(
@@ -838,8 +822,7 @@ namespace Emby.Server.Implementations
             CollectionManager = new CollectionManager(LibraryManager, ApplicationPaths, LocalizationManager, FileSystemManager, LibraryMonitor, LoggerFactory, ProviderManager);
             CollectionManager = new CollectionManager(LibraryManager, ApplicationPaths, LocalizationManager, FileSystemManager, LibraryMonitor, LoggerFactory, ProviderManager);
             serviceCollection.AddSingleton(CollectionManager);
             serviceCollection.AddSingleton(CollectionManager);
 
 
-            PlaylistManager = new PlaylistManager(LibraryManager, FileSystemManager, LibraryMonitor, LoggerFactory, UserManager, ProviderManager);
-            serviceCollection.AddSingleton(PlaylistManager);
+            serviceCollection.AddSingleton(typeof(IPlaylistManager), typeof(PlaylistManager));
 
 
             LiveTvManager = new LiveTvManager(this, ServerConfigurationManager, LoggerFactory, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, FileSystemManager, () => ChannelManager);
             LiveTvManager = new LiveTvManager(this, ServerConfigurationManager, LoggerFactory, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, FileSystemManager, () => ChannelManager);
             serviceCollection.AddSingleton(LiveTvManager);
             serviceCollection.AddSingleton(LiveTvManager);
@@ -880,15 +863,15 @@ namespace Emby.Server.Implementations
             serviceCollection.AddSingleton<IAuthorizationContext>(authContext);
             serviceCollection.AddSingleton<IAuthorizationContext>(authContext);
             serviceCollection.AddSingleton<ISessionContext>(new SessionContext(UserManager, authContext, SessionManager));
             serviceCollection.AddSingleton<ISessionContext>(new SessionContext(UserManager, authContext, SessionManager));
 
 
-            AuthService = new AuthService(UserManager, authContext, ServerConfigurationManager, SessionManager, NetworkManager);
+            AuthService = new AuthService(authContext, ServerConfigurationManager, SessionManager, NetworkManager);
             serviceCollection.AddSingleton(AuthService);
             serviceCollection.AddSingleton(AuthService);
 
 
             SubtitleEncoder = new MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder(LibraryManager, LoggerFactory, ApplicationPaths, FileSystemManager, MediaEncoder, JsonSerializer, HttpClient, MediaSourceManager, ProcessFactory);
             SubtitleEncoder = new MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder(LibraryManager, LoggerFactory, ApplicationPaths, FileSystemManager, MediaEncoder, JsonSerializer, HttpClient, MediaSourceManager, ProcessFactory);
             serviceCollection.AddSingleton(SubtitleEncoder);
             serviceCollection.AddSingleton(SubtitleEncoder);
 
 
-            serviceCollection.AddSingleton(CreateResourceFileManager());
+            serviceCollection.AddSingleton(typeof(IResourceFileManager), typeof(ResourceFileManager));
 
 
-            displayPreferencesRepo.Initialize();
+            _displayPreferencesRepository.Initialize();
 
 
             var userDataRepo = new SqliteUserDataRepository(LoggerFactory, ApplicationPaths);
             var userDataRepo = new SqliteUserDataRepository(LoggerFactory, ApplicationPaths);
 
 
@@ -957,18 +940,16 @@ namespace Emby.Server.Implementations
             }
             }
         }
         }
 
 
-        private IImageProcessor GetImageProcessor()
-        {
-            return new ImageProcessor(LoggerFactory, ServerConfigurationManager.ApplicationPaths, FileSystemManager, ImageEncoder, () => LibraryManager, () => MediaEncoder);
-        }
-
         /// <summary>
         /// <summary>
         /// Gets the user repository.
         /// Gets the user repository.
         /// </summary>
         /// </summary>
-        /// <returns>Task{IUserRepository}.</returns>
-        private IUserRepository GetUserRepository()
+        /// <returns><see cref="Task{SqliteUserRepository}" />.</returns>
+        private SqliteUserRepository GetUserRepository()
         {
         {
-            var repo = new SqliteUserRepository(LoggerFactory, ApplicationPaths, JsonSerializer);
+            var repo = new SqliteUserRepository(
+                LoggerFactory.CreateLogger<SqliteUserRepository>(),
+                ApplicationPaths,
+                JsonSerializer);
 
 
             repo.Initialize();
             repo.Initialize();
 
 
@@ -1014,7 +995,6 @@ namespace Emby.Server.Implementations
             Video.LiveTvManager = LiveTvManager;
             Video.LiveTvManager = LiveTvManager;
             Folder.UserViewManager = UserViewManager;
             Folder.UserViewManager = UserViewManager;
             UserView.TVSeriesManager = TVSeriesManager;
             UserView.TVSeriesManager = TVSeriesManager;
-            UserView.PlaylistManager = PlaylistManager;
             UserView.CollectionManager = CollectionManager;
             UserView.CollectionManager = CollectionManager;
             BaseItem.MediaSourceManager = MediaSourceManager;
             BaseItem.MediaSourceManager = MediaSourceManager;
             CollectionFolder.XmlSerializer = XmlSerializer;
             CollectionFolder.XmlSerializer = XmlSerializer;
@@ -1052,8 +1032,8 @@ namespace Emby.Server.Implementations
                 .Cast<IServerEntryPoint>()
                 .Cast<IServerEntryPoint>()
                 .ToList();
                 .ToList();
 
 
-            await Task.WhenAll(StartEntryPoints(entries, true));
-            await Task.WhenAll(StartEntryPoints(entries, false));
+            await Task.WhenAll(StartEntryPoints(entries, true)).ConfigureAwait(false);
+            await Task.WhenAll(StartEntryPoints(entries, false)).ConfigureAwait(false);
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -1092,7 +1072,7 @@ namespace Emby.Server.Implementations
                 GetExports<IMetadataSaver>(),
                 GetExports<IMetadataSaver>(),
                 GetExports<IExternalId>());
                 GetExports<IExternalId>());
 
 
-            ImageProcessor.AddParts(GetExports<IImageEnhancer>());
+            ImageProcessor.ImageEnhancers = GetExports<IImageEnhancer>();
 
 
             LiveTvManager.AddParts(GetExports<ILiveTvService>(), GetExports<ITunerHost>(), GetExports<IListingsProvider>());
             LiveTvManager.AddParts(GetExports<ILiveTvService>(), GetExports<ITunerHost>(), GetExports<IListingsProvider>());
 
 
@@ -1228,7 +1208,7 @@ namespace Emby.Server.Implementations
 
 
             // Generate self-signed cert
             // Generate self-signed cert
             var certHost = GetHostnameFromExternalDns(ServerConfigurationManager.Configuration.WanDdns);
             var certHost = GetHostnameFromExternalDns(ServerConfigurationManager.Configuration.WanDdns);
-            var certPath = Path.Combine(ServerConfigurationManager.ApplicationPaths.ProgramDataPath, "ssl", "cert_" + (certHost + "2").GetMD5().ToString("N") + ".pfx");
+            var certPath = Path.Combine(ServerConfigurationManager.ApplicationPaths.ProgramDataPath, "ssl", "cert_" + (certHost + "2").GetMD5().ToString("N", CultureInfo.InvariantCulture) + ".pfx");
             const string Password = "embycert";
             const string Password = "embycert";
 
 
             return new CertificateInfo
             return new CertificateInfo
@@ -1466,15 +1446,10 @@ namespace Emby.Server.Implementations
             };
             };
         }
         }
 
 
-        public WakeOnLanInfo[] GetWakeOnLanInfo()
-        {
-            return NetworkManager.GetMacAddresses()
-                .Select(i => new WakeOnLanInfo
-                {
-                    MacAddress = i
-                })
-                .ToArray();
-        }
+        public IEnumerable<WakeOnLanInfo> GetWakeOnLanInfo()
+            => NetworkManager.GetMacAddresses()
+                .Select(i => new WakeOnLanInfo(i))
+                .ToList();
 
 
         public async Task<PublicSystemInfo> GetPublicSystemInfo(CancellationToken cancellationToken)
         public async Task<PublicSystemInfo> GetPublicSystemInfo(CancellationToken cancellationToken)
         {
         {
@@ -1490,6 +1465,7 @@ namespace Emby.Server.Implementations
             {
             {
                 wanAddress = GetWanApiUrl(ServerConfigurationManager.Configuration.WanDdns);
                 wanAddress = GetWanApiUrl(ServerConfigurationManager.Configuration.WanDdns);
             }
             }
+
             return new PublicSystemInfo
             return new PublicSystemInfo
             {
             {
                 Version = ApplicationVersion,
                 Version = ApplicationVersion,
@@ -1537,14 +1513,12 @@ namespace Emby.Server.Implementations
                 {
                 {
                     Url = Url,
                     Url = Url,
                     LogErrorResponseBody = false,
                     LogErrorResponseBody = false,
-                    LogErrors = false,
-                    LogRequest = false,
-                    TimeoutMs = 10000,
                     BufferContent = false,
                     BufferContent = false,
                     CancellationToken = cancellationToken
                     CancellationToken = cancellationToken
                 }).ConfigureAwait(false))
                 }).ConfigureAwait(false))
                 {
                 {
-                    return GetWanApiUrl(response.ReadToEnd().Trim());
+                    string res = await response.ReadToEndAsync().ConfigureAwait(false);
+                    return GetWanApiUrl(res.Trim());
                 }
                 }
             }
             }
             catch (Exception ex)
             catch (Exception ex)
@@ -1555,14 +1529,32 @@ namespace Emby.Server.Implementations
             return null;
             return null;
         }
         }
 
 
-        public string GetLocalApiUrl(IpAddressInfo ipAddress)
+        /// <summary>
+        /// Removes the scope id from IPv6 addresses.
+        /// </summary>
+        /// <param name="address">The IPv6 address.</param>
+        /// <returns>The IPv6 address without the scope id.</returns>
+        private string RemoveScopeId(string address)
+        {
+            var index = address.IndexOf('%');
+            if (index == -1)
+            {
+                return address;
+            }
+
+            return address.Substring(0, index);
+        }
+
+        public string GetLocalApiUrl(IPAddress ipAddress)
         {
         {
-            if (ipAddress.AddressFamily == IpAddressFamily.InterNetworkV6)
+            if (ipAddress.AddressFamily == AddressFamily.InterNetworkV6)
             {
             {
-                return GetLocalApiUrl("[" + ipAddress.Address + "]");
+                var str = RemoveScopeId(ipAddress.ToString());
+
+                return GetLocalApiUrl("[" + str + "]");
             }
             }
 
 
-            return GetLocalApiUrl(ipAddress.Address);
+            return GetLocalApiUrl(ipAddress.ToString());
         }
         }
 
 
         public string GetLocalApiUrl(string host)
         public string GetLocalApiUrl(string host)
@@ -1573,19 +1565,22 @@ namespace Emby.Server.Implementations
                     host,
                     host,
                     HttpsPort.ToString(CultureInfo.InvariantCulture));
                     HttpsPort.ToString(CultureInfo.InvariantCulture));
             }
             }
+
             return string.Format("http://{0}:{1}",
             return string.Format("http://{0}:{1}",
                     host,
                     host,
                     HttpPort.ToString(CultureInfo.InvariantCulture));
                     HttpPort.ToString(CultureInfo.InvariantCulture));
         }
         }
 
 
-        public string GetWanApiUrl(IpAddressInfo ipAddress)
+        public string GetWanApiUrl(IPAddress ipAddress)
         {
         {
-            if (ipAddress.AddressFamily == IpAddressFamily.InterNetworkV6)
+            if (ipAddress.AddressFamily == AddressFamily.InterNetworkV6)
             {
             {
-                return GetWanApiUrl("[" + ipAddress.Address + "]");
+                var str = RemoveScopeId(ipAddress.ToString());
+
+                return GetWanApiUrl("[" + str + "]");
             }
             }
 
 
-            return GetWanApiUrl(ipAddress.Address);
+            return GetWanApiUrl(ipAddress.ToString());
         }
         }
 
 
         public string GetWanApiUrl(string host)
         public string GetWanApiUrl(string host)
@@ -1596,17 +1591,18 @@ namespace Emby.Server.Implementations
                     host,
                     host,
                     ServerConfigurationManager.Configuration.PublicHttpsPort.ToString(CultureInfo.InvariantCulture));
                     ServerConfigurationManager.Configuration.PublicHttpsPort.ToString(CultureInfo.InvariantCulture));
             }
             }
+
             return string.Format("http://{0}:{1}",
             return string.Format("http://{0}:{1}",
                     host,
                     host,
                     ServerConfigurationManager.Configuration.PublicPort.ToString(CultureInfo.InvariantCulture));
                     ServerConfigurationManager.Configuration.PublicPort.ToString(CultureInfo.InvariantCulture));
         }
         }
 
 
-        public Task<List<IpAddressInfo>> GetLocalIpAddresses(CancellationToken cancellationToken)
+        public Task<List<IPAddress>> GetLocalIpAddresses(CancellationToken cancellationToken)
         {
         {
             return GetLocalIpAddressesInternal(true, 0, cancellationToken);
             return GetLocalIpAddressesInternal(true, 0, cancellationToken);
         }
         }
 
 
-        private async Task<List<IpAddressInfo>> GetLocalIpAddressesInternal(bool allowLoopback, int limit, CancellationToken cancellationToken)
+        private async Task<List<IPAddress>> GetLocalIpAddressesInternal(bool allowLoopback, int limit, CancellationToken cancellationToken)
         {
         {
             var addresses = ServerConfigurationManager
             var addresses = ServerConfigurationManager
                 .Configuration
                 .Configuration
@@ -1620,13 +1616,13 @@ namespace Emby.Server.Implementations
                 addresses.AddRange(NetworkManager.GetLocalIpAddresses(ServerConfigurationManager.Configuration.IgnoreVirtualInterfaces));
                 addresses.AddRange(NetworkManager.GetLocalIpAddresses(ServerConfigurationManager.Configuration.IgnoreVirtualInterfaces));
             }
             }
 
 
-            var resultList = new List<IpAddressInfo>();
+            var resultList = new List<IPAddress>();
 
 
             foreach (var address in addresses)
             foreach (var address in addresses)
             {
             {
                 if (!allowLoopback)
                 if (!allowLoopback)
                 {
                 {
-                    if (address.Equals(IpAddressInfo.Loopback) || address.Equals(IpAddressInfo.IPv6Loopback))
+                    if (address.Equals(IPAddress.Loopback) || address.Equals(IPAddress.IPv6Loopback))
                     {
                     {
                         continue;
                         continue;
                     }
                     }
@@ -1647,7 +1643,7 @@ namespace Emby.Server.Implementations
             return resultList;
             return resultList;
         }
         }
 
 
-        private IpAddressInfo NormalizeConfiguredLocalAddress(string address)
+        private IPAddress NormalizeConfiguredLocalAddress(string address)
         {
         {
             var index = address.Trim('/').IndexOf('/');
             var index = address.Trim('/').IndexOf('/');
 
 
@@ -1656,7 +1652,7 @@ namespace Emby.Server.Implementations
                 address = address.Substring(index + 1);
                 address = address.Substring(index + 1);
             }
             }
 
 
-            if (NetworkManager.TryParseIpAddress(address.Trim('/'), out IpAddressInfo result))
+            if (IPAddress.TryParse(address.Trim('/'), out IPAddress result))
             {
             {
                 return result;
                 return result;
             }
             }
@@ -1666,10 +1662,10 @@ namespace Emby.Server.Implementations
 
 
         private readonly ConcurrentDictionary<string, bool> _validAddressResults = new ConcurrentDictionary<string, bool>(StringComparer.OrdinalIgnoreCase);
         private readonly ConcurrentDictionary<string, bool> _validAddressResults = new ConcurrentDictionary<string, bool>(StringComparer.OrdinalIgnoreCase);
 
 
-        private async Task<bool> IsIpAddressValidAsync(IpAddressInfo address, CancellationToken cancellationToken)
+        private async Task<bool> IsIpAddressValidAsync(IPAddress address, CancellationToken cancellationToken)
         {
         {
-            if (address.Equals(IpAddressInfo.Loopback) ||
-                address.Equals(IpAddressInfo.IPv6Loopback))
+            if (address.Equals(IPAddress.Loopback)
+                || address.Equals(IPAddress.IPv6Loopback))
             {
             {
                 return true;
                 return true;
             }
             }
@@ -1682,12 +1678,6 @@ namespace Emby.Server.Implementations
                 return cachedResult;
                 return cachedResult;
             }
             }
 
 
-#if DEBUG
-            const bool LogPing = true;
-#else
-            const bool LogPing = false;
-#endif
-
             try
             try
             {
             {
                 using (var response = await HttpClient.SendAsync(
                 using (var response = await HttpClient.SendAsync(
@@ -1695,17 +1685,13 @@ namespace Emby.Server.Implementations
                     {
                     {
                         Url = apiUrl,
                         Url = apiUrl,
                         LogErrorResponseBody = false,
                         LogErrorResponseBody = false,
-                        LogErrors = LogPing,
-                        LogRequest = LogPing,
-                        TimeoutMs = 5000,
                         BufferContent = false,
                         BufferContent = false,
-
                         CancellationToken = cancellationToken
                         CancellationToken = cancellationToken
-                    }, "POST").ConfigureAwait(false))
+                    }, HttpMethod.Post).ConfigureAwait(false))
                 {
                 {
                     using (var reader = new StreamReader(response.Content))
                     using (var reader = new StreamReader(response.Content))
                     {
                     {
-                        var result = reader.ReadToEnd();
+                        var result = await reader.ReadToEndAsync().ConfigureAwait(false);
                         var valid = string.Equals(Name, result, StringComparison.OrdinalIgnoreCase);
                         var valid = string.Equals(Name, result, StringComparison.OrdinalIgnoreCase);
 
 
                         _validAddressResults.AddOrUpdate(apiUrl, valid, (k, v) => valid);
                         _validAddressResults.AddOrUpdate(apiUrl, valid, (k, v) => valid);
@@ -1898,8 +1884,14 @@ namespace Emby.Server.Implementations
                         Logger.LogError(ex, "Error disposing {Type}", part.GetType().Name);
                         Logger.LogError(ex, "Error disposing {Type}", part.GetType().Name);
                     }
                     }
                 }
                 }
+
+                _userRepository?.Dispose();
+                _displayPreferencesRepository.Dispose();
             }
             }
 
 
+            _userRepository = null;
+            _displayPreferencesRepository = null;
+
             _disposed = true;
             _disposed = true;
         }
         }
     }
     }

+ 9 - 17
Emby.Server.Implementations/Channels/ChannelManager.cs

@@ -1,12 +1,12 @@
 using System;
 using System;
 using System.Collections.Concurrent;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Globalization;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using MediaBrowser.Common.Extensions;
 using MediaBrowser.Common.Extensions;
-using MediaBrowser.Common.Net;
 using MediaBrowser.Common.Progress;
 using MediaBrowser.Common.Progress;
 using MediaBrowser.Controller.Channels;
 using MediaBrowser.Controller.Channels;
 using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Configuration;
@@ -20,7 +20,6 @@ using MediaBrowser.Controller.Providers;
 using MediaBrowser.Model.Channels;
 using MediaBrowser.Model.Channels;
 using MediaBrowser.Model.Dto;
 using MediaBrowser.Model.Dto;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Globalization;
 using MediaBrowser.Model.IO;
 using MediaBrowser.Model.IO;
 using MediaBrowser.Model.Querying;
 using MediaBrowser.Model.Querying;
 using MediaBrowser.Model.Serialization;
 using MediaBrowser.Model.Serialization;
@@ -40,11 +39,8 @@ namespace Emby.Server.Implementations.Channels
         private readonly IServerConfigurationManager _config;
         private readonly IServerConfigurationManager _config;
         private readonly IFileSystem _fileSystem;
         private readonly IFileSystem _fileSystem;
         private readonly IJsonSerializer _jsonSerializer;
         private readonly IJsonSerializer _jsonSerializer;
-        private readonly IHttpClient _httpClient;
         private readonly IProviderManager _providerManager;
         private readonly IProviderManager _providerManager;
 
 
-        private readonly ILocalizationManager _localization;
-
         public ChannelManager(
         public ChannelManager(
             IUserManager userManager,
             IUserManager userManager,
             IDtoService dtoService,
             IDtoService dtoService,
@@ -54,8 +50,6 @@ namespace Emby.Server.Implementations.Channels
             IFileSystem fileSystem,
             IFileSystem fileSystem,
             IUserDataManager userDataManager,
             IUserDataManager userDataManager,
             IJsonSerializer jsonSerializer,
             IJsonSerializer jsonSerializer,
-            ILocalizationManager localization,
-            IHttpClient httpClient,
             IProviderManager providerManager)
             IProviderManager providerManager)
         {
         {
             _userManager = userManager;
             _userManager = userManager;
@@ -66,8 +60,6 @@ namespace Emby.Server.Implementations.Channels
             _fileSystem = fileSystem;
             _fileSystem = fileSystem;
             _userDataManager = userDataManager;
             _userDataManager = userDataManager;
             _jsonSerializer = jsonSerializer;
             _jsonSerializer = jsonSerializer;
-            _localization = localization;
-            _httpClient = httpClient;
             _providerManager = providerManager;
             _providerManager = providerManager;
         }
         }
 
 
@@ -215,7 +207,7 @@ namespace Emby.Server.Implementations.Channels
 
 
                     try
                     try
                     {
                     {
-                        return GetChannelProvider(i).IsEnabledFor(user.Id.ToString("N"));
+                        return GetChannelProvider(i).IsEnabledFor(user.Id.ToString("N", CultureInfo.InvariantCulture));
                     }
                     }
                     catch
                     catch
                     {
                     {
@@ -520,7 +512,7 @@ namespace Emby.Server.Implementations.Channels
                 IncludeItemTypes = new[] { typeof(Channel).Name },
                 IncludeItemTypes = new[] { typeof(Channel).Name },
                 OrderBy = new ValueTuple<string, SortOrder>[] { new ValueTuple<string, SortOrder>(ItemSortBy.SortName, SortOrder.Ascending) }
                 OrderBy = new ValueTuple<string, SortOrder>[] { new ValueTuple<string, SortOrder>(ItemSortBy.SortName, SortOrder.Ascending) }
 
 
-            }).Select(i => GetChannelFeatures(i.ToString("N"))).ToArray();
+            }).Select(i => GetChannelFeatures(i.ToString("N", CultureInfo.InvariantCulture))).ToArray();
         }
         }
 
 
         public ChannelFeatures GetChannelFeatures(string id)
         public ChannelFeatures GetChannelFeatures(string id)
@@ -561,7 +553,7 @@ namespace Emby.Server.Implementations.Channels
                 SupportsSortOrderToggle = features.SupportsSortOrderToggle,
                 SupportsSortOrderToggle = features.SupportsSortOrderToggle,
                 SupportsLatestMedia = supportsLatest,
                 SupportsLatestMedia = supportsLatest,
                 Name = channel.Name,
                 Name = channel.Name,
-                Id = channel.Id.ToString("N"),
+                Id = channel.Id.ToString("N", CultureInfo.InvariantCulture),
                 SupportsContentDownloading = features.SupportsContentDownloading,
                 SupportsContentDownloading = features.SupportsContentDownloading,
                 AutoRefreshLevels = features.AutoRefreshLevels
                 AutoRefreshLevels = features.AutoRefreshLevels
             };
             };
@@ -749,7 +741,7 @@ namespace Emby.Server.Implementations.Channels
             bool sortDescending,
             bool sortDescending,
             CancellationToken cancellationToken)
             CancellationToken cancellationToken)
         {
         {
-            var userId = user == null ? null : user.Id.ToString("N");
+            var userId = user == null ? null : user.Id.ToString("N", CultureInfo.InvariantCulture);
 
 
             var cacheLength = CacheLength;
             var cacheLength = CacheLength;
             var cachePath = GetChannelDataCachePath(channel, userId, externalFolderId, sortField, sortDescending);
             var cachePath = GetChannelDataCachePath(channel, userId, externalFolderId, sortField, sortDescending);
@@ -845,7 +837,7 @@ namespace Emby.Server.Implementations.Channels
             ChannelItemSortField? sortField,
             ChannelItemSortField? sortField,
             bool sortDescending)
             bool sortDescending)
         {
         {
-            var channelId = GetInternalChannelId(channel.Name).ToString("N");
+            var channelId = GetInternalChannelId(channel.Name).ToString("N", CultureInfo.InvariantCulture);
 
 
             var userCacheKey = string.Empty;
             var userCacheKey = string.Empty;
 
 
@@ -855,10 +847,10 @@ namespace Emby.Server.Implementations.Channels
                 userCacheKey = hasCacheKey.GetCacheKey(userId) ?? string.Empty;
                 userCacheKey = hasCacheKey.GetCacheKey(userId) ?? string.Empty;
             }
             }
 
 
-            var filename = string.IsNullOrEmpty(externalFolderId) ? "root" : externalFolderId.GetMD5().ToString("N");
+            var filename = string.IsNullOrEmpty(externalFolderId) ? "root" : externalFolderId.GetMD5().ToString("N", CultureInfo.InvariantCulture);
             filename += userCacheKey;
             filename += userCacheKey;
 
 
-            var version = ((channel.DataVersion ?? string.Empty) + "2").GetMD5().ToString("N");
+            var version = ((channel.DataVersion ?? string.Empty) + "2").GetMD5().ToString("N", CultureInfo.InvariantCulture);
 
 
             if (sortField.HasValue)
             if (sortField.HasValue)
             {
             {
@@ -869,7 +861,7 @@ namespace Emby.Server.Implementations.Channels
                 filename += "-sortDescending";
                 filename += "-sortDescending";
             }
             }
 
 
-            filename = filename.GetMD5().ToString("N");
+            filename = filename.GetMD5().ToString("N", CultureInfo.InvariantCulture);
 
 
             return Path.Combine(_config.ApplicationPaths.CachePath,
             return Path.Combine(_config.ApplicationPaths.CachePath,
                 "channels",
                 "channels",

+ 2 - 1
Emby.Server.Implementations/Collections/CollectionManager.cs

@@ -1,5 +1,6 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Globalization;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
 using System.Threading;
 using System.Threading;
@@ -182,7 +183,7 @@ namespace Emby.Server.Implementations.Collections
 
 
         public void AddToCollection(Guid collectionId, IEnumerable<Guid> ids)
         public void AddToCollection(Guid collectionId, IEnumerable<Guid> ids)
         {
         {
-            AddToCollection(collectionId, ids.Select(i => i.ToString("N")), true, new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem)));
+            AddToCollection(collectionId, ids.Select(i => i.ToString("N", CultureInfo.InvariantCulture)), true, new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem)));
         }
         }
 
 
         private void AddToCollection(Guid collectionId, IEnumerable<string> ids, bool fireEvent, MetadataRefreshOptions refreshOptions)
         private void AddToCollection(Guid collectionId, IEnumerable<string> ids, bool fireEvent, MetadataRefreshOptions refreshOptions)

+ 2 - 2
Emby.Server.Implementations/ConfigurationOptions.cs

@@ -6,8 +6,8 @@ namespace Emby.Server.Implementations
     {
     {
         public static readonly Dictionary<string, string> Configuration = new Dictionary<string, string>
         public static readonly Dictionary<string, string> Configuration = new Dictionary<string, string>
         {
         {
-            {"HttpListenerHost:DefaultRedirectPath", "web/index.html"},
-            {"MusicBrainz:BaseUrl", "https://www.musicbrainz.org"}
+            { "HttpListenerHost:DefaultRedirectPath", "web/index.html" },
+            { "MusicBrainz:BaseUrl", "https://www.musicbrainz.org" }
         };
         };
     }
     }
 }
 }

+ 49 - 37
Emby.Server.Implementations/Cryptography/CryptographyProvider.cs

@@ -8,7 +8,7 @@ using MediaBrowser.Model.Cryptography;
 
 
 namespace Emby.Server.Implementations.Cryptography
 namespace Emby.Server.Implementations.Cryptography
 {
 {
-    public class CryptographyProvider : ICryptoProvider
+    public class CryptographyProvider : ICryptoProvider, IDisposable
     {
     {
         private static readonly HashSet<string> _supportedHashMethods = new HashSet<string>()
         private static readonly HashSet<string> _supportedHashMethods = new HashSet<string>()
             {
             {
@@ -28,26 +28,28 @@ namespace Emby.Server.Implementations.Cryptography
                 "System.Security.Cryptography.SHA512"
                 "System.Security.Cryptography.SHA512"
             };
             };
 
 
-        public string DefaultHashMethod => "PBKDF2";
-
         private RandomNumberGenerator _randomNumberGenerator;
         private RandomNumberGenerator _randomNumberGenerator;
 
 
         private const int _defaultIterations = 1000;
         private const int _defaultIterations = 1000;
 
 
+        private bool _disposed = false;
+
         public CryptographyProvider()
         public CryptographyProvider()
         {
         {
-            //FIXME: When we get DotNet Standard 2.1 we need to revisit how we do the crypto
-            //Currently supported hash methods from https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.cryptoconfig?view=netcore-2.1
-            //there might be a better way to autogenerate this list as dotnet updates, but I couldn't find one
-            //Please note the default method of PBKDF2 is not included, it cannot be used to generate hashes cleanly as it is actually a pbkdf with sha1
+            // FIXME: When we get DotNet Standard 2.1 we need to revisit how we do the crypto
+            // Currently supported hash methods from https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.cryptoconfig?view=netcore-2.1
+            // there might be a better way to autogenerate this list as dotnet updates, but I couldn't find one
+            // Please note the default method of PBKDF2 is not included, it cannot be used to generate hashes cleanly as it is actually a pbkdf with sha1
             _randomNumberGenerator = RandomNumberGenerator.Create();
             _randomNumberGenerator = RandomNumberGenerator.Create();
         }
         }
 
 
+        public string DefaultHashMethod => "PBKDF2";
+
+        [Obsolete("Use System.Security.Cryptography.MD5 directly")]
         public Guid GetMD5(string str)
         public Guid GetMD5(string str)
-        {
-            return new Guid(ComputeMD5(Encoding.Unicode.GetBytes(str)));
-        }
+            => new Guid(ComputeMD5(Encoding.Unicode.GetBytes(str)));
 
 
+        [Obsolete("Use System.Security.Cryptography.SHA1 directly")]
         public byte[] ComputeSHA1(byte[] bytes)
         public byte[] ComputeSHA1(byte[] bytes)
         {
         {
             using (var provider = SHA1.Create())
             using (var provider = SHA1.Create())
@@ -56,6 +58,7 @@ namespace Emby.Server.Implementations.Cryptography
             }
             }
         }
         }
 
 
+        [Obsolete("Use System.Security.Cryptography.MD5 directly")]
         public byte[] ComputeMD5(Stream str)
         public byte[] ComputeMD5(Stream str)
         {
         {
             using (var provider = MD5.Create())
             using (var provider = MD5.Create())
@@ -64,6 +67,7 @@ namespace Emby.Server.Implementations.Cryptography
             }
             }
         }
         }
 
 
+        [Obsolete("Use System.Security.Cryptography.MD5 directly")]
         public byte[] ComputeMD5(byte[] bytes)
         public byte[] ComputeMD5(byte[] bytes)
         {
         {
             using (var provider = MD5.Create())
             using (var provider = MD5.Create())
@@ -73,9 +77,7 @@ namespace Emby.Server.Implementations.Cryptography
         }
         }
 
 
         public IEnumerable<string> GetSupportedHashMethods()
         public IEnumerable<string> GetSupportedHashMethods()
-        {
-            return _supportedHashMethods;
-        }
+            => _supportedHashMethods;
 
 
         private byte[] PBKDF2(string method, byte[] bytes, byte[] salt, int iterations)
         private byte[] PBKDF2(string method, byte[] bytes, byte[] salt, int iterations)
         {
         {
@@ -93,14 +95,10 @@ namespace Emby.Server.Implementations.Cryptography
         }
         }
 
 
         public byte[] ComputeHash(string hashMethod, byte[] bytes)
         public byte[] ComputeHash(string hashMethod, byte[] bytes)
-        {
-            return ComputeHash(hashMethod, bytes, Array.Empty<byte>());
-        }
+            => ComputeHash(hashMethod, bytes, Array.Empty<byte>());
 
 
         public byte[] ComputeHashWithDefaultMethod(byte[] bytes)
         public byte[] ComputeHashWithDefaultMethod(byte[] bytes)
-        {
-            return ComputeHash(DefaultHashMethod, bytes);
-        }
+            => ComputeHash(DefaultHashMethod, bytes);
 
 
         public byte[] ComputeHash(string hashMethod, byte[] bytes, byte[] salt)
         public byte[] ComputeHash(string hashMethod, byte[] bytes, byte[] salt)
         {
         {
@@ -125,37 +123,27 @@ namespace Emby.Server.Implementations.Cryptography
                     }
                     }
                 }
                 }
             }
             }
-            else
-            {
-                throw new CryptographicException($"Requested hash method is not supported: {hashMethod}");
-            }
+
+            throw new CryptographicException($"Requested hash method is not supported: {hashMethod}");
+
         }
         }
 
 
         public byte[] ComputeHashWithDefaultMethod(byte[] bytes, byte[] salt)
         public byte[] ComputeHashWithDefaultMethod(byte[] bytes, byte[] salt)
-        {
-            return PBKDF2(DefaultHashMethod, bytes, salt, _defaultIterations);
-        }
+            => PBKDF2(DefaultHashMethod, bytes, salt, _defaultIterations);
 
 
         public byte[] ComputeHash(PasswordHash hash)
         public byte[] ComputeHash(PasswordHash hash)
         {
         {
             int iterations = _defaultIterations;
             int iterations = _defaultIterations;
             if (!hash.Parameters.ContainsKey("iterations"))
             if (!hash.Parameters.ContainsKey("iterations"))
             {
             {
-                hash.Parameters.Add("iterations", _defaultIterations.ToString(CultureInfo.InvariantCulture));
+                hash.Parameters.Add("iterations", iterations.ToString(CultureInfo.InvariantCulture));
             }
             }
-            else
+            else if (!int.TryParse(hash.Parameters["iterations"], out iterations))
             {
             {
-                try
-                {
-                    iterations = int.Parse(hash.Parameters["iterations"]);
-                }
-                catch (Exception e)
-                {
-                    throw new InvalidDataException($"Couldn't successfully parse iterations value from string: {hash.Parameters["iterations"]}", e);
-                }
+                throw new InvalidDataException($"Couldn't successfully parse iterations value from string: {hash.Parameters["iterations"]}");
             }
             }
 
 
-            return PBKDF2(hash.Id, hash.HashBytes, hash.SaltBytes, iterations);
+            return PBKDF2(hash.Id, hash.Hash, hash.Salt, iterations);
         }
         }
 
 
         public byte[] GenerateSalt()
         public byte[] GenerateSalt()
@@ -164,5 +152,29 @@ namespace Emby.Server.Implementations.Cryptography
             _randomNumberGenerator.GetBytes(salt);
             _randomNumberGenerator.GetBytes(salt);
             return salt;
             return salt;
         }
         }
+
+        /// <inheritdoc />
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
+
+        protected virtual void Dispose(bool disposing)
+        {
+            if (_disposed)
+            {
+                return;
+            }
+
+            if (disposing)
+            {
+                _randomNumberGenerator.Dispose();
+            }
+
+            _randomNumberGenerator = null;
+
+            _disposed = true;
+        }
     }
     }
 }
 }

+ 172 - 263
Emby.Server.Implementations/Data/BaseSqliteRepository.cs

@@ -1,183 +1,144 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
-using System.Globalization;
 using System.Linq;
 using System.Linq;
 using System.Threading;
 using System.Threading;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Logging;
-using SQLitePCL;
 using SQLitePCL.pretty;
 using SQLitePCL.pretty;
 
 
 namespace Emby.Server.Implementations.Data
 namespace Emby.Server.Implementations.Data
 {
 {
     public abstract class BaseSqliteRepository : IDisposable
     public abstract class BaseSqliteRepository : IDisposable
     {
     {
-        protected string DbFilePath { get; set; }
-        protected ReaderWriterLockSlim WriteLock;
-
-        protected ILogger Logger { get; private set; }
+        private bool _disposed = false;
 
 
         protected BaseSqliteRepository(ILogger logger)
         protected BaseSqliteRepository(ILogger logger)
         {
         {
             Logger = logger;
             Logger = logger;
-
-            WriteLock = new ReaderWriterLockSlim(LockRecursionPolicy.NoRecursion);
         }
         }
 
 
-        protected TransactionMode TransactionMode => TransactionMode.Deferred;
+        /// <summary>
+        /// Gets or sets the path to the DB file.
+        /// </summary>
+        /// <value>Path to the DB file.</value>
+        protected string DbFilePath { get; set; }
 
 
-        protected TransactionMode ReadTransactionMode => TransactionMode.Deferred;
+        /// <summary>
+        /// Gets the logger.
+        /// </summary>
+        /// <value>The logger.</value>
+        protected ILogger Logger { get; }
 
 
-        internal static int ThreadSafeMode { get; set; }
+        /// <summary>
+        /// Gets the default connection flags.
+        /// </summary>
+        /// <value>The default connection flags.</value>
+        protected virtual ConnectionFlags DefaultConnectionFlags => ConnectionFlags.NoMutex;
 
 
-        static BaseSqliteRepository()
-        {
-            SQLite3.EnableSharedCache = false;
+        /// <summary>
+        /// Gets the transaction mode.
+        /// </summary>
+        /// <value>The transaction mode.</value>>
+        protected TransactionMode TransactionMode => TransactionMode.Deferred;
 
 
-            int rc = raw.sqlite3_config(raw.SQLITE_CONFIG_MEMSTATUS, 0);
-            //CheckOk(rc);
+        /// <summary>
+        /// Gets the transaction mode for read-only operations.
+        /// </summary>
+        /// <value>The transaction mode.</value>
+        protected TransactionMode ReadTransactionMode => TransactionMode.Deferred;
 
 
-            rc = raw.sqlite3_config(raw.SQLITE_CONFIG_MULTITHREAD, 1);
-            //rc = raw.sqlite3_config(raw.SQLITE_CONFIG_SINGLETHREAD, 1);
-            //rc = raw.sqlite3_config(raw.SQLITE_CONFIG_SERIALIZED, 1);
-            //CheckOk(rc);
+        /// <summary>
+        /// Gets the cache size.
+        /// </summary>
+        /// <value>The cache size or null.</value>
+        protected virtual int? CacheSize => null;
 
 
-            rc = raw.sqlite3_enable_shared_cache(1);
+        /// <summary>
+        /// Gets the journal mode.
+        /// </summary>
+        /// <value>The journal mode.</value>
+        protected virtual string JournalMode => "WAL";
 
 
-            ThreadSafeMode = raw.sqlite3_threadsafe();
-        }
+        /// <summary>
+        /// Gets the page size.
+        /// </summary>
+        /// <value>The page size or null.</value>
+        protected virtual int? PageSize => null;
+
+        /// <summary>
+        /// Gets the temp store mode.
+        /// </summary>
+        /// <value>The temp store mode.</value>
+        /// <see cref="TempStoreMode"/>
+        protected virtual TempStoreMode TempStore => TempStoreMode.Default;
 
 
-        private static bool _versionLogged;
+        /// <summary>
+        /// Gets the synchronous mode.
+        /// </summary>
+        /// <value>The synchronous mode or null.</value>
+        /// <see cref="SynchronousMode"/>
+        protected virtual SynchronousMode? Synchronous => null;
 
 
-        private string _defaultWal;
-        protected ManagedConnection _connection;
+        /// <summary>
+        /// Gets or sets the write lock.
+        /// </summary>
+        /// <value>The write lock.</value>
+        protected SemaphoreSlim WriteLock { get; set; } = new SemaphoreSlim(1, 1);
 
 
-        protected virtual bool EnableSingleConnection => true;
+        /// <summary>
+        /// Gets or sets the write connection.
+        /// </summary>
+        /// <value>The write connection.</value>
+        protected SQLiteDatabaseConnection WriteConnection { get; set; }
 
 
-        protected ManagedConnection CreateConnection(bool isReadOnly = false)
+        protected ManagedConnection GetConnection(bool _ = false)
         {
         {
-            if (_connection != null)
+            WriteLock.Wait();
+            if (WriteConnection != null)
             {
             {
-                return _connection;
+                return new ManagedConnection(WriteConnection, WriteLock);
             }
             }
 
 
-            lock (WriteLock)
-            {
-                if (!_versionLogged)
-                {
-                    _versionLogged = true;
-                    Logger.LogInformation("Sqlite version: " + SQLite3.Version);
-                    Logger.LogInformation("Sqlite compiler options: " + string.Join(",", SQLite3.CompilerOptions.ToArray()));
-                }
-
-                ConnectionFlags connectionFlags;
-
-                if (isReadOnly)
-                {
-                    //Logger.LogInformation("Opening read connection");
-                    //connectionFlags = ConnectionFlags.ReadOnly;
-                    connectionFlags = ConnectionFlags.Create;
-                    connectionFlags |= ConnectionFlags.ReadWrite;
-                }
-                else
-                {
-                    //Logger.LogInformation("Opening write connection");
-                    connectionFlags = ConnectionFlags.Create;
-                    connectionFlags |= ConnectionFlags.ReadWrite;
-                }
+            WriteConnection = SQLite3.Open(
+                DbFilePath,
+                DefaultConnectionFlags | ConnectionFlags.Create | ConnectionFlags.ReadWrite,
+                null);
 
 
-                if (EnableSingleConnection)
-                {
-                    connectionFlags |= ConnectionFlags.PrivateCache;
-                }
-                else
-                {
-                    connectionFlags |= ConnectionFlags.SharedCached;
-                }
-
-                connectionFlags |= ConnectionFlags.NoMutex;
-
-                var db = SQLite3.Open(DbFilePath, connectionFlags, null);
-
-                try
-                {
-                    if (string.IsNullOrWhiteSpace(_defaultWal))
-                    {
-                        _defaultWal = db.Query("PRAGMA journal_mode").SelectScalarString().First();
-
-                        Logger.LogInformation("Default journal_mode for {0} is {1}", DbFilePath, _defaultWal);
-                    }
-
-                    var queries = new List<string>
-                    {
-                        //"PRAGMA cache size=-10000"
-                        //"PRAGMA read_uncommitted = true",
-                        "PRAGMA synchronous=Normal"
-                    };
-
-                    if (CacheSize.HasValue)
-                    {
-                        queries.Add("PRAGMA cache_size=" + CacheSize.Value.ToString(CultureInfo.InvariantCulture));
-                    }
+            if (CacheSize.HasValue)
+            {
+                WriteConnection.Execute("PRAGMA cache_size=" + CacheSize.Value);
+            }
 
 
-                    if (EnableTempStoreMemory)
-                    {
-                        queries.Add("PRAGMA temp_store = memory");
-                    }
-                    else
-                    {
-                        queries.Add("PRAGMA temp_store = file");
-                    }
+            if (!string.IsNullOrWhiteSpace(JournalMode))
+            {
+                WriteConnection.Execute("PRAGMA journal_mode=" + JournalMode);
+            }
 
 
-                    foreach (var query in queries)
-                    {
-                        db.Execute(query);
-                    }
-                }
-                catch
-                {
-                    using (db)
-                    {
+            if (Synchronous.HasValue)
+            {
+                WriteConnection.Execute("PRAGMA synchronous=" + (int)Synchronous.Value);
+            }
 
 
-                    }
+            if (PageSize.HasValue)
+            {
+                WriteConnection.Execute("PRAGMA page_size=" + PageSize.Value);
+            }
 
 
-                    throw;
-                }
+            WriteConnection.Execute("PRAGMA temp_store=" + (int)TempStore);
 
 
-                _connection = new ManagedConnection(db, false);
+            // Configuration and pragmas can affect VACUUM so it needs to be last.
+            WriteConnection.Execute("VACUUM");
 
 
-                return _connection;
-            }
+            return new ManagedConnection(WriteConnection, WriteLock);
         }
         }
 
 
         public IStatement PrepareStatement(ManagedConnection connection, string sql)
         public IStatement PrepareStatement(ManagedConnection connection, string sql)
-        {
-            return connection.PrepareStatement(sql);
-        }
-
-        public IStatement PrepareStatementSafe(ManagedConnection connection, string sql)
-        {
-            return connection.PrepareStatement(sql);
-        }
+            => connection.PrepareStatement(sql);
 
 
         public IStatement PrepareStatement(IDatabaseConnection connection, string sql)
         public IStatement PrepareStatement(IDatabaseConnection connection, string sql)
-        {
-            return connection.PrepareStatement(sql);
-        }
-
-        public IStatement PrepareStatementSafe(IDatabaseConnection connection, string sql)
-        {
-            return connection.PrepareStatement(sql);
-        }
-
-        public List<IStatement> PrepareAll(IDatabaseConnection connection, IEnumerable<string> sql)
-        {
-            return PrepareAllSafe(connection, sql);
-        }
+            => connection.PrepareStatement(sql);
 
 
-        public List<IStatement> PrepareAllSafe(IDatabaseConnection connection, IEnumerable<string> sql)
-        {
-            return sql.Select(connection.PrepareStatement).ToList();
-        }
+        public IEnumerable<IStatement> PrepareAll(IDatabaseConnection connection, IEnumerable<string> sql)
+            => sql.Select(connection.PrepareStatement);
 
 
         protected bool TableExists(ManagedConnection connection, string name)
         protected bool TableExists(ManagedConnection connection, string name)
         {
         {
@@ -199,40 +160,33 @@ namespace Emby.Server.Implementations.Data
             }, ReadTransactionMode);
             }, ReadTransactionMode);
         }
         }
 
 
-        protected void RunDefaultInitialization(ManagedConnection db)
+        protected List<string> GetColumnNames(IDatabaseConnection connection, string table)
         {
         {
-            var queries = new List<string>
-            {
-                "PRAGMA journal_mode=WAL",
-                "PRAGMA page_size=4096",
-                "PRAGMA synchronous=Normal"
-            };
+            var columnNames = new List<string>();
 
 
-            if (EnableTempStoreMemory)
-            {
-                queries.AddRange(new List<string>
-                {
-                    "pragma default_temp_store = memory",
-                    "pragma temp_store = memory"
-                });
-            }
-            else
+            foreach (var row in connection.Query("PRAGMA table_info(" + table + ")"))
             {
             {
-                queries.AddRange(new List<string>
+                if (row[1].SQLiteType != SQLiteType.Null)
                 {
                 {
-                    "pragma temp_store = file"
-                });
+                    var name = row[1].ToString();
+
+                    columnNames.Add(name);
+                }
             }
             }
 
 
-            db.ExecuteAll(string.Join(";", queries));
-            Logger.LogInformation("PRAGMA synchronous=" + db.Query("PRAGMA synchronous").SelectScalarString().First());
+            return columnNames;
         }
         }
 
 
-        protected virtual bool EnableTempStoreMemory => false;
+        protected void AddColumn(IDatabaseConnection connection, string table, string columnName, string type, List<string> existingColumnNames)
+        {
+            if (existingColumnNames.Contains(columnName, StringComparer.OrdinalIgnoreCase))
+            {
+                return;
+            }
 
 
-        protected virtual int? CacheSize => null;
+            connection.Execute("alter table " + table + " add column " + columnName + " " + type + " NULL");
+        }
 
 
-        private bool _disposed;
         protected void CheckDisposed()
         protected void CheckDisposed()
         {
         {
             if (_disposed)
             if (_disposed)
@@ -241,139 +195,94 @@ namespace Emby.Server.Implementations.Data
             }
             }
         }
         }
 
 
+        /// <inheritdoc />
         public void Dispose()
         public void Dispose()
         {
         {
-            _disposed = true;
             Dispose(true);
             Dispose(true);
+            GC.SuppressFinalize(this);
         }
         }
 
 
-        private readonly object _disposeLock = new object();
-
         /// <summary>
         /// <summary>
         /// Releases unmanaged and - optionally - managed resources.
         /// Releases unmanaged and - optionally - managed resources.
         /// </summary>
         /// </summary>
         /// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
         /// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
         protected virtual void Dispose(bool dispose)
         protected virtual void Dispose(bool dispose)
         {
         {
-            if (dispose)
+            if (_disposed)
             {
             {
-                DisposeConnection();
+                return;
             }
             }
-        }
 
 
-        private void DisposeConnection()
-        {
-            try
+            if (dispose)
             {
             {
-                lock (_disposeLock)
+                WriteLock.Wait();
+                try
                 {
                 {
-                    using (WriteLock.Write())
-                    {
-                        if (_connection != null)
-                        {
-                            using (_connection)
-                            {
-                                _connection.Close();
-                            }
-                            _connection = null;
-                        }
-
-                        CloseConnection();
-                    }
+                    WriteConnection?.Dispose();
                 }
                 }
+                finally
+                {
+                    WriteLock.Release();
+                }
+
+                WriteLock.Dispose();
             }
             }
-            catch (Exception ex)
-            {
-                Logger.LogError(ex, "Error disposing database");
-            }
-        }
 
 
-        protected virtual void CloseConnection()
-        {
+            WriteConnection = null;
+            WriteLock = null;
 
 
+            _disposed = true;
         }
         }
+    }
 
 
-        protected List<string> GetColumnNames(IDatabaseConnection connection, string table)
-        {
-            var list = new List<string>();
-
-            foreach (var row in connection.Query("PRAGMA table_info(" + table + ")"))
-            {
-                if (row[1].SQLiteType != SQLiteType.Null)
-                {
-                    var name = row[1].ToString();
-
-                    list.Add(name);
-                }
-            }
+    /// <summary>
+    /// The disk synchronization mode, controls how aggressively SQLite will write data
+    /// all the way out to physical storage.
+    /// </summary>
+    public enum SynchronousMode
+    {
+        /// <summary>
+        /// SQLite continues without syncing as soon as it has handed data off to the operating system
+        /// </summary>
+        Off = 0,
 
 
-            return list;
-        }
+        /// <summary>
+        /// SQLite database engine will still sync at the most critical moments
+        /// </summary>
+        Normal = 1,
 
 
-        protected void AddColumn(IDatabaseConnection connection, string table, string columnName, string type, List<string> existingColumnNames)
-        {
-            if (existingColumnNames.Contains(columnName, StringComparer.OrdinalIgnoreCase))
-            {
-                return;
-            }
+        /// <summary>
+        /// SQLite database engine will use the xSync method of the VFS
+        /// to ensure that all content is safely written to the disk surface prior to continuing.
+        /// </summary>
+        Full = 2,
 
 
-            connection.Execute("alter table " + table + " add column " + columnName + " " + type + " NULL");
-        }
+        /// <summary>
+        /// EXTRA synchronous is like FULL with the addition that the directory containing a rollback journal
+        /// is synced after that journal is unlinked to commit a transaction in DELETE mode.
+        /// </summary>
+        Extra = 3
     }
     }
 
 
-    public static class ReaderWriterLockSlimExtensions
+    /// <summary>
+    /// Storage mode used by temporary database files.
+    /// </summary>
+    public enum TempStoreMode
     {
     {
-        private sealed class ReadLockToken : IDisposable
-        {
-            private ReaderWriterLockSlim _sync;
-            public ReadLockToken(ReaderWriterLockSlim sync)
-            {
-                _sync = sync;
-                sync.EnterReadLock();
-            }
-            public void Dispose()
-            {
-                if (_sync != null)
-                {
-                    _sync.ExitReadLock();
-                    _sync = null;
-                }
-            }
-        }
-        private sealed class WriteLockToken : IDisposable
-        {
-            private ReaderWriterLockSlim _sync;
-            public WriteLockToken(ReaderWriterLockSlim sync)
-            {
-                _sync = sync;
-                sync.EnterWriteLock();
-            }
-            public void Dispose()
-            {
-                if (_sync != null)
-                {
-                    _sync.ExitWriteLock();
-                    _sync = null;
-                }
-            }
-        }
+        /// <summary>
+        /// The compile-time C preprocessor macro SQLITE_TEMP_STORE
+        /// is used to determine where temporary tables and indices are stored.
+        /// </summary>
+        Default = 0,
 
 
-        public static IDisposable Read(this ReaderWriterLockSlim obj)
-        {
-            //if (BaseSqliteRepository.ThreadSafeMode > 0)
-            //{
-            //    return new DummyToken();
-            //}
-            return new WriteLockToken(obj);
-        }
+        /// <summary>
+        /// Temporary tables and indices are stored in a file.
+        /// </summary>
+        File = 1,
 
 
-        public static IDisposable Write(this ReaderWriterLockSlim obj)
-        {
-            //if (BaseSqliteRepository.ThreadSafeMode > 0)
-            //{
-            //    return new DummyToken();
-            //}
-            return new WriteLockToken(obj);
-        }
+        /// <summary>
+        /// Temporary tables and indices are kept in as if they were pure in-memory databases memory.
+        /// </summary>
+        Memory = 2
     }
     }
 }
 }

+ 23 - 24
Emby.Server.Implementations/Data/ManagedConnection.cs

@@ -1,79 +1,78 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Threading;
 using SQLitePCL.pretty;
 using SQLitePCL.pretty;
 
 
 namespace Emby.Server.Implementations.Data
 namespace Emby.Server.Implementations.Data
 {
 {
     public class ManagedConnection : IDisposable
     public class ManagedConnection : IDisposable
     {
     {
-        private SQLiteDatabaseConnection db;
-        private readonly bool _closeOnDispose;
+        private SQLiteDatabaseConnection _db;
+        private readonly SemaphoreSlim _writeLock;
+        private bool _disposed = false;
 
 
-        public ManagedConnection(SQLiteDatabaseConnection db, bool closeOnDispose)
+        public ManagedConnection(SQLiteDatabaseConnection db, SemaphoreSlim writeLock)
         {
         {
-            this.db = db;
-            _closeOnDispose = closeOnDispose;
+            _db = db;
+            _writeLock = writeLock;
         }
         }
 
 
         public IStatement PrepareStatement(string sql)
         public IStatement PrepareStatement(string sql)
         {
         {
-            return db.PrepareStatement(sql);
+            return _db.PrepareStatement(sql);
         }
         }
 
 
         public IEnumerable<IStatement> PrepareAll(string sql)
         public IEnumerable<IStatement> PrepareAll(string sql)
         {
         {
-            return db.PrepareAll(sql);
+            return _db.PrepareAll(sql);
         }
         }
 
 
         public void ExecuteAll(string sql)
         public void ExecuteAll(string sql)
         {
         {
-            db.ExecuteAll(sql);
+            _db.ExecuteAll(sql);
         }
         }
 
 
         public void Execute(string sql, params object[] values)
         public void Execute(string sql, params object[] values)
         {
         {
-            db.Execute(sql, values);
+            _db.Execute(sql, values);
         }
         }
 
 
         public void RunQueries(string[] sql)
         public void RunQueries(string[] sql)
         {
         {
-            db.RunQueries(sql);
+            _db.RunQueries(sql);
         }
         }
 
 
         public void RunInTransaction(Action<IDatabaseConnection> action, TransactionMode mode)
         public void RunInTransaction(Action<IDatabaseConnection> action, TransactionMode mode)
         {
         {
-            db.RunInTransaction(action, mode);
+            _db.RunInTransaction(action, mode);
         }
         }
 
 
         public T RunInTransaction<T>(Func<IDatabaseConnection, T> action, TransactionMode mode)
         public T RunInTransaction<T>(Func<IDatabaseConnection, T> action, TransactionMode mode)
         {
         {
-            return db.RunInTransaction(action, mode);
+            return _db.RunInTransaction(action, mode);
         }
         }
 
 
         public IEnumerable<IReadOnlyList<IResultSetValue>> Query(string sql)
         public IEnumerable<IReadOnlyList<IResultSetValue>> Query(string sql)
         {
         {
-            return db.Query(sql);
+            return _db.Query(sql);
         }
         }
 
 
         public IEnumerable<IReadOnlyList<IResultSetValue>> Query(string sql, params object[] values)
         public IEnumerable<IReadOnlyList<IResultSetValue>> Query(string sql, params object[] values)
         {
         {
-            return db.Query(sql, values);
-        }
-
-        public void Close()
-        {
-            using (db)
-            {
-
-            }
+            return _db.Query(sql, values);
         }
         }
 
 
         public void Dispose()
         public void Dispose()
         {
         {
-            if (_closeOnDispose)
+            if (_disposed)
             {
             {
-                Close();
+                return;
             }
             }
+
+            _writeLock.Release();
+
+            _db = null; // Don't dispose it
+            _disposed = true;
         }
         }
     }
     }
 }
 }

+ 37 - 56
Emby.Server.Implementations/Data/SqliteDisplayPreferencesRepository.cs

@@ -1,5 +1,6 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Globalization;
 using System.IO;
 using System.IO;
 using System.Threading;
 using System.Threading;
 using MediaBrowser.Common.Configuration;
 using MediaBrowser.Common.Configuration;
@@ -18,13 +19,13 @@ namespace Emby.Server.Implementations.Data
     /// </summary>
     /// </summary>
     public class SqliteDisplayPreferencesRepository : BaseSqliteRepository, IDisplayPreferencesRepository
     public class SqliteDisplayPreferencesRepository : BaseSqliteRepository, IDisplayPreferencesRepository
     {
     {
-        protected IFileSystem FileSystem { get; private set; }
+        private readonly IFileSystem _fileSystem;
 
 
-        public SqliteDisplayPreferencesRepository(ILoggerFactory loggerFactory, IJsonSerializer jsonSerializer, IApplicationPaths appPaths, IFileSystem fileSystem)
-            : base(loggerFactory.CreateLogger(nameof(SqliteDisplayPreferencesRepository)))
+        public SqliteDisplayPreferencesRepository(ILogger<SqliteDisplayPreferencesRepository> logger, IJsonSerializer jsonSerializer, IApplicationPaths appPaths, IFileSystem fileSystem)
+            : base(logger)
         {
         {
             _jsonSerializer = jsonSerializer;
             _jsonSerializer = jsonSerializer;
-            FileSystem = fileSystem;
+            _fileSystem = fileSystem;
             DbFilePath = Path.Combine(appPaths.DataPath, "displaypreferences.db");
             DbFilePath = Path.Combine(appPaths.DataPath, "displaypreferences.db");
         }
         }
 
 
@@ -49,7 +50,7 @@ namespace Emby.Server.Implementations.Data
             {
             {
                 Logger.LogError(ex, "Error loading database file. Will reset and retry.");
                 Logger.LogError(ex, "Error loading database file. Will reset and retry.");
 
 
-                FileSystem.DeleteFile(DbFilePath);
+                _fileSystem.DeleteFile(DbFilePath);
 
 
                 InitializeInternal();
                 InitializeInternal();
             }
             }
@@ -61,10 +62,8 @@ namespace Emby.Server.Implementations.Data
         /// <returns>Task.</returns>
         /// <returns>Task.</returns>
         private void InitializeInternal()
         private void InitializeInternal()
         {
         {
-            using (var connection = CreateConnection())
+            using (var connection = GetConnection())
             {
             {
-                RunDefaultInitialization(connection);
-
                 string[] queries = {
                 string[] queries = {
 
 
                     "create table if not exists userdisplaypreferences (id GUID NOT NULL, userId GUID NOT NULL, client text NOT NULL, data BLOB NOT NULL)",
                     "create table if not exists userdisplaypreferences (id GUID NOT NULL, userId GUID NOT NULL, client text NOT NULL, data BLOB NOT NULL)",
@@ -98,15 +97,12 @@ namespace Emby.Server.Implementations.Data
 
 
             cancellationToken.ThrowIfCancellationRequested();
             cancellationToken.ThrowIfCancellationRequested();
 
 
-            using (WriteLock.Write())
+            using (var connection = GetConnection())
             {
             {
-                using (var connection = CreateConnection())
+                connection.RunInTransaction(db =>
                 {
                 {
-                    connection.RunInTransaction(db =>
-                    {
-                        SaveDisplayPreferences(displayPreferences, userId, client, db);
-                    }, TransactionMode);
-                }
+                    SaveDisplayPreferences(displayPreferences, userId, client, db);
+                }, TransactionMode);
             }
             }
         }
         }
 
 
@@ -142,18 +138,15 @@ namespace Emby.Server.Implementations.Data
 
 
             cancellationToken.ThrowIfCancellationRequested();
             cancellationToken.ThrowIfCancellationRequested();
 
 
-            using (WriteLock.Write())
+            using (var connection = GetConnection())
             {
             {
-                using (var connection = CreateConnection())
+                connection.RunInTransaction(db =>
                 {
                 {
-                    connection.RunInTransaction(db =>
+                    foreach (var displayPreference in displayPreferences)
                     {
                     {
-                        foreach (var displayPreference in displayPreferences)
-                        {
-                            SaveDisplayPreferences(displayPreference, userId, displayPreference.Client, db);
-                        }
-                    }, TransactionMode);
-                }
+                        SaveDisplayPreferences(displayPreference, userId, displayPreference.Client, db);
+                    }
+                }, TransactionMode);
             }
             }
         }
         }
 
 
@@ -174,27 +167,24 @@ namespace Emby.Server.Implementations.Data
 
 
             var guidId = displayPreferencesId.GetMD5();
             var guidId = displayPreferencesId.GetMD5();
 
 
-            using (WriteLock.Read())
+            using (var connection = GetConnection(true))
             {
             {
-                using (var connection = CreateConnection(true))
+                using (var statement = connection.PrepareStatement("select data from userdisplaypreferences where id = @id and userId=@userId and client=@client"))
                 {
                 {
-                    using (var statement = connection.PrepareStatement("select data from userdisplaypreferences where id = @id and userId=@userId and client=@client"))
-                    {
-                        statement.TryBind("@id", guidId.ToGuidBlob());
-                        statement.TryBind("@userId", userId.ToGuidBlob());
-                        statement.TryBind("@client", client);
-
-                        foreach (var row in statement.ExecuteQuery())
-                        {
-                            return Get(row);
-                        }
-                    }
+                    statement.TryBind("@id", guidId.ToGuidBlob());
+                    statement.TryBind("@userId", userId.ToGuidBlob());
+                    statement.TryBind("@client", client);
 
 
-                    return new DisplayPreferences
+                    foreach (var row in statement.ExecuteQuery())
                     {
                     {
-                        Id = guidId.ToString("N")
-                    };
+                        return Get(row);
+                    }
                 }
                 }
+
+                return new DisplayPreferences
+                {
+                    Id = guidId.ToString("N", CultureInfo.InvariantCulture)
+                };
             }
             }
         }
         }
 
 
@@ -208,18 +198,15 @@ namespace Emby.Server.Implementations.Data
         {
         {
             var list = new List<DisplayPreferences>();
             var list = new List<DisplayPreferences>();
 
 
-            using (WriteLock.Read())
+            using (var connection = GetConnection(true))
             {
             {
-                using (var connection = CreateConnection(true))
+                using (var statement = connection.PrepareStatement("select data from userdisplaypreferences where userId=@userId"))
                 {
                 {
-                    using (var statement = connection.PrepareStatement("select data from userdisplaypreferences where userId=@userId"))
-                    {
-                        statement.TryBind("@userId", userId.ToGuidBlob());
+                    statement.TryBind("@userId", userId.ToGuidBlob());
 
 
-                        foreach (var row in statement.ExecuteQuery())
-                        {
-                            list.Add(Get(row));
-                        }
+                    foreach (var row in statement.ExecuteQuery())
+                    {
+                        list.Add(Get(row));
                     }
                     }
                 }
                 }
             }
             }
@@ -228,13 +215,7 @@ namespace Emby.Server.Implementations.Data
         }
         }
 
 
         private DisplayPreferences Get(IReadOnlyList<IResultSetValue> row)
         private DisplayPreferences Get(IReadOnlyList<IResultSetValue> row)
-        {
-            using (var stream = new MemoryStream(row[0].ToBlob()))
-            {
-                stream.Position = 0;
-                return _jsonSerializer.DeserializeFromStream<DisplayPreferences>(stream);
-            }
-        }
+            => _jsonSerializer.DeserializeFromString<DisplayPreferences>(row.GetString(0));
 
 
         public void SaveDisplayPreferences(DisplayPreferences displayPreferences, string userId, string client, CancellationToken cancellationToken)
         public void SaveDisplayPreferences(DisplayPreferences displayPreferences, string userId, string client, CancellationToken cancellationToken)
         {
         {

+ 3 - 6
Emby.Server.Implementations/Data/SqliteExtensions.cs

@@ -18,10 +18,6 @@ namespace Emby.Server.Implementations.Data
 
 
             connection.RunInTransaction(conn =>
             connection.RunInTransaction(conn =>
             {
             {
-                //foreach (var query in queries)
-                //{
-                //    conn.Execute(query);
-                //}
                 conn.ExecuteAll(string.Join(";", queries));
                 conn.ExecuteAll(string.Join(";", queries));
             });
             });
         }
         }
@@ -38,7 +34,8 @@ namespace Emby.Server.Implementations.Data
 
 
         public static Guid ReadGuidFromBlob(this IResultSetValue result)
         public static Guid ReadGuidFromBlob(this IResultSetValue result)
         {
         {
-            return new Guid(result.ToBlob());
+            // TODO: Remove ToArray when upgrading to netstandard2.1
+            return new Guid(result.ToBlob().ToArray());
         }
         }
 
 
         public static string ToDateTimeParamValue(this DateTime dateValue)
         public static string ToDateTimeParamValue(this DateTime dateValue)
@@ -141,7 +138,7 @@ namespace Emby.Server.Implementations.Data
             }
             }
         }
         }
 
 
-        public static void Attach(ManagedConnection db, string path, string alias)
+        public static void Attach(SQLiteDatabaseConnection db, string path, string alias)
         {
         {
             var commandText = string.Format("attach @path as {0};", alias);
             var commandText = string.Format("attach @path as {0};", alias);
 
 

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 264 - 316
Emby.Server.Implementations/Data/SqliteItemRepository.cs


+ 33 - 57
Emby.Server.Implementations/Data/SqliteUserDataRepository.cs

@@ -7,7 +7,6 @@ using MediaBrowser.Common.Configuration;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Persistence;
 using MediaBrowser.Controller.Persistence;
-using MediaBrowser.Model.IO;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Logging;
 using SQLitePCL.pretty;
 using SQLitePCL.pretty;
 
 
@@ -33,19 +32,19 @@ namespace Emby.Server.Implementations.Data
         /// Opens the connection to the database
         /// Opens the connection to the database
         /// </summary>
         /// </summary>
         /// <returns>Task.</returns>
         /// <returns>Task.</returns>
-        public void Initialize(ReaderWriterLockSlim writeLock, ManagedConnection managedConnection, IUserManager userManager)
+        public void Initialize(IUserManager userManager, SemaphoreSlim dbLock, SQLiteDatabaseConnection dbConnection)
         {
         {
-            _connection = managedConnection;
-
             WriteLock.Dispose();
             WriteLock.Dispose();
-            WriteLock = writeLock;
+            WriteLock = dbLock;
+            WriteConnection?.Dispose();
+            WriteConnection = dbConnection;
 
 
-            using (var connection = CreateConnection())
+            using (var connection = GetConnection())
             {
             {
                 var userDatasTableExists = TableExists(connection, "UserDatas");
                 var userDatasTableExists = TableExists(connection, "UserDatas");
                 var userDataTableExists = TableExists(connection, "userdata");
                 var userDataTableExists = TableExists(connection, "userdata");
 
 
-                var users = userDatasTableExists ? null : userManager.Users.ToArray();
+                var users = userDatasTableExists ? null : userManager.Users;
 
 
                 connection.RunInTransaction(db =>
                 connection.RunInTransaction(db =>
                 {
                 {
@@ -85,7 +84,7 @@ namespace Emby.Server.Implementations.Data
             }
             }
         }
         }
 
 
-        private void ImportUserIds(IDatabaseConnection db, User[] users)
+        private void ImportUserIds(IDatabaseConnection db, IEnumerable<User> users)
         {
         {
             var userIdsWithUserData = GetAllUserIdsWithUserData(db);
             var userIdsWithUserData = GetAllUserIdsWithUserData(db);
 
 
@@ -129,8 +128,6 @@ namespace Emby.Server.Implementations.Data
             return list;
             return list;
         }
         }
 
 
-        protected override bool EnableTempStoreMemory => true;
-
         /// <summary>
         /// <summary>
         /// Saves the user data.
         /// Saves the user data.
         /// </summary>
         /// </summary>
@@ -178,15 +175,12 @@ namespace Emby.Server.Implementations.Data
         {
         {
             cancellationToken.ThrowIfCancellationRequested();
             cancellationToken.ThrowIfCancellationRequested();
 
 
-            using (WriteLock.Write())
+            using (var connection = GetConnection())
             {
             {
-                using (var connection = CreateConnection())
+                connection.RunInTransaction(db =>
                 {
                 {
-                    connection.RunInTransaction(db =>
-                    {
-                        SaveUserData(db, internalUserId, key, userData);
-                    }, TransactionMode);
-                }
+                    SaveUserData(db, internalUserId, key, userData);
+                }, TransactionMode);
             }
             }
         }
         }
 
 
@@ -249,18 +243,15 @@ namespace Emby.Server.Implementations.Data
         {
         {
             cancellationToken.ThrowIfCancellationRequested();
             cancellationToken.ThrowIfCancellationRequested();
 
 
-            using (WriteLock.Write())
+            using (var connection = GetConnection())
             {
             {
-                using (var connection = CreateConnection())
+                connection.RunInTransaction(db =>
                 {
                 {
-                    connection.RunInTransaction(db =>
+                    foreach (var userItemData in userDataList)
                     {
                     {
-                        foreach (var userItemData in userDataList)
-                        {
-                            SaveUserData(db, internalUserId, userItemData.Key, userItemData);
-                        }
-                    }, TransactionMode);
-                }
+                        SaveUserData(db, internalUserId, userItemData.Key, userItemData);
+                    }
+                }, TransactionMode);
             }
             }
         }
         }
 
 
@@ -281,28 +272,26 @@ namespace Emby.Server.Implementations.Data
             {
             {
                 throw new ArgumentNullException(nameof(internalUserId));
                 throw new ArgumentNullException(nameof(internalUserId));
             }
             }
+
             if (string.IsNullOrEmpty(key))
             if (string.IsNullOrEmpty(key))
             {
             {
                 throw new ArgumentNullException(nameof(key));
                 throw new ArgumentNullException(nameof(key));
             }
             }
 
 
-            using (WriteLock.Read())
+            using (var connection = GetConnection(true))
             {
             {
-                using (var connection = CreateConnection(true))
+                using (var statement = connection.PrepareStatement("select key,userid,rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex from UserDatas where key =@Key and userId=@UserId"))
                 {
                 {
-                    using (var statement = connection.PrepareStatement("select key,userid,rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex from UserDatas where key =@Key and userId=@UserId"))
-                    {
-                        statement.TryBind("@UserId", internalUserId);
-                        statement.TryBind("@Key", key);
+                    statement.TryBind("@UserId", internalUserId);
+                    statement.TryBind("@Key", key);
 
 
-                        foreach (var row in statement.ExecuteQuery())
-                        {
-                            return ReadRow(row);
-                        }
+                    foreach (var row in statement.ExecuteQuery())
+                    {
+                        return ReadRow(row);
                     }
                     }
-
-                    return null;
                 }
                 }
+
+                return null;
             }
             }
         }
         }
 
 
@@ -335,18 +324,15 @@ namespace Emby.Server.Implementations.Data
 
 
             var list = new List<UserItemData>();
             var list = new List<UserItemData>();
 
 
-            using (WriteLock.Read())
+            using (var connection = GetConnection())
             {
             {
-                using (var connection = CreateConnection())
+                using (var statement = connection.PrepareStatement("select key,userid,rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex from UserDatas where userId=@UserId"))
                 {
                 {
-                    using (var statement = connection.PrepareStatement("select key,userid,rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex from UserDatas where userId=@UserId"))
-                    {
-                        statement.TryBind("@UserId", internalUserId);
+                    statement.TryBind("@UserId", internalUserId);
 
 
-                        foreach (var row in statement.ExecuteQuery())
-                        {
-                            list.Add(ReadRow(row));
-                        }
+                    foreach (var row in statement.ExecuteQuery())
+                    {
+                        list.Add(ReadRow(row));
                     }
                     }
                 }
                 }
             }
             }
@@ -392,15 +378,5 @@ namespace Emby.Server.Implementations.Data
 
 
             return userData;
             return userData;
         }
         }
-
-        protected override void Dispose(bool dispose)
-        {
-            // handled by library database
-        }
-
-        protected override void CloseConnection()
-        {
-            // handled by library database
-        }
     }
     }
 }
 }

+ 67 - 93
Emby.Server.Implementations/Data/SqliteUserRepository.cs

@@ -18,10 +18,10 @@ namespace Emby.Server.Implementations.Data
         private readonly IJsonSerializer _jsonSerializer;
         private readonly IJsonSerializer _jsonSerializer;
 
 
         public SqliteUserRepository(
         public SqliteUserRepository(
-            ILoggerFactory loggerFactory,
+            ILogger<SqliteUserRepository> logger,
             IServerApplicationPaths appPaths,
             IServerApplicationPaths appPaths,
             IJsonSerializer jsonSerializer)
             IJsonSerializer jsonSerializer)
-            : base(loggerFactory.CreateLogger(nameof(SqliteUserRepository)))
+            : base(logger)
         {
         {
             _jsonSerializer = jsonSerializer;
             _jsonSerializer = jsonSerializer;
 
 
@@ -35,15 +35,12 @@ namespace Emby.Server.Implementations.Data
         public string Name => "SQLite";
         public string Name => "SQLite";
 
 
         /// <summary>
         /// <summary>
-        /// Opens the connection to the database
+        /// Opens the connection to the database.
         /// </summary>
         /// </summary>
-        /// <returns>Task.</returns>
         public void Initialize()
         public void Initialize()
         {
         {
-            using (var connection = CreateConnection())
+            using (var connection = GetConnection())
             {
             {
-                RunDefaultInitialization(connection);
-
                 var localUsersTableExists = TableExists(connection, "LocalUsersv2");
                 var localUsersTableExists = TableExists(connection, "LocalUsersv2");
 
 
                 connection.RunQueries(new[] {
                 connection.RunQueries(new[] {
@@ -56,7 +53,7 @@ namespace Emby.Server.Implementations.Data
                     TryMigrateToLocalUsersTable(connection);
                     TryMigrateToLocalUsersTable(connection);
                 }
                 }
 
 
-                RemoveEmptyPasswordHashes();
+                RemoveEmptyPasswordHashes(connection);
             }
             }
         }
         }
 
 
@@ -75,9 +72,9 @@ namespace Emby.Server.Implementations.Data
             }
             }
         }
         }
 
 
-        private void RemoveEmptyPasswordHashes()
+        private void RemoveEmptyPasswordHashes(ManagedConnection connection)
         {
         {
-            foreach (var user in RetrieveAllUsers())
+            foreach (var user in RetrieveAllUsers(connection))
             {
             {
                 // If the user password is the sha1 hash of the empty string, remove it
                 // If the user password is the sha1 hash of the empty string, remove it
                 if (!string.Equals(user.Password, "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709", StringComparison.Ordinal)
                 if (!string.Equals(user.Password, "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709", StringComparison.Ordinal)
@@ -89,22 +86,16 @@ namespace Emby.Server.Implementations.Data
                 user.Password = null;
                 user.Password = null;
                 var serialized = _jsonSerializer.SerializeToBytes(user);
                 var serialized = _jsonSerializer.SerializeToBytes(user);
 
 
-                using (WriteLock.Write())
-                using (var connection = CreateConnection())
+                connection.RunInTransaction(db =>
                 {
                 {
-                    connection.RunInTransaction(db =>
+                    using (var statement = db.PrepareStatement("update LocalUsersv2 set data=@data where Id=@InternalId"))
                     {
                     {
-                        using (var statement = db.PrepareStatement("update LocalUsersv2 set data=@data where Id=@InternalId"))
-                        {
-                            statement.TryBind("@InternalId", user.InternalId);
-                            statement.TryBind("@data", serialized);
-                            statement.MoveNext();
-                        }
-
-                    }, TransactionMode);
-                }
+                        statement.TryBind("@InternalId", user.InternalId);
+                        statement.TryBind("@data", serialized);
+                        statement.MoveNext();
+                    }
+                }, TransactionMode);
             }
             }
-
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -119,31 +110,28 @@ namespace Emby.Server.Implementations.Data
 
 
             var serialized = _jsonSerializer.SerializeToBytes(user);
             var serialized = _jsonSerializer.SerializeToBytes(user);
 
 
-            using (WriteLock.Write())
+            using (var connection = GetConnection())
             {
             {
-                using (var connection = CreateConnection())
+                connection.RunInTransaction(db =>
                 {
                 {
-                    connection.RunInTransaction(db =>
+                    using (var statement = db.PrepareStatement("insert into LocalUsersv2 (guid, data) values (@guid, @data)"))
                     {
                     {
-                        using (var statement = db.PrepareStatement("insert into LocalUsersv2 (guid, data) values (@guid, @data)"))
-                        {
-                            statement.TryBind("@guid", user.Id.ToGuidBlob());
-                            statement.TryBind("@data", serialized);
+                        statement.TryBind("@guid", user.Id.ToGuidBlob());
+                        statement.TryBind("@data", serialized);
 
 
-                            statement.MoveNext();
-                        }
+                        statement.MoveNext();
+                    }
 
 
-                        var createdUser = GetUser(user.Id, false);
+                    var createdUser = GetUser(user.Id, connection);
 
 
-                        if (createdUser == null)
-                        {
-                            throw new ApplicationException("created user should never be null");
-                        }
+                    if (createdUser == null)
+                    {
+                        throw new ApplicationException("created user should never be null");
+                    }
 
 
-                        user.InternalId = createdUser.InternalId;
+                    user.InternalId = createdUser.InternalId;
 
 
-                    }, TransactionMode);
-                }
+                }, TransactionMode);
             }
             }
         }
         }
 
 
@@ -156,39 +144,30 @@ namespace Emby.Server.Implementations.Data
 
 
             var serialized = _jsonSerializer.SerializeToBytes(user);
             var serialized = _jsonSerializer.SerializeToBytes(user);
 
 
-            using (WriteLock.Write())
+            using (var connection = GetConnection())
             {
             {
-                using (var connection = CreateConnection())
+                connection.RunInTransaction(db =>
                 {
                 {
-                    connection.RunInTransaction(db =>
+                    using (var statement = db.PrepareStatement("update LocalUsersv2 set data=@data where Id=@InternalId"))
                     {
                     {
-                        using (var statement = db.PrepareStatement("update LocalUsersv2 set data=@data where Id=@InternalId"))
-                        {
-                            statement.TryBind("@InternalId", user.InternalId);
-                            statement.TryBind("@data", serialized);
-                            statement.MoveNext();
-                        }
-
-                    }, TransactionMode);
-                }
+                        statement.TryBind("@InternalId", user.InternalId);
+                        statement.TryBind("@data", serialized);
+                        statement.MoveNext();
+                    }
+
+                }, TransactionMode);
             }
             }
         }
         }
 
 
-        private User GetUser(Guid guid, bool openLock)
+        private User GetUser(Guid guid, ManagedConnection connection)
         {
         {
-            using (openLock ? WriteLock.Read() : null)
+            using (var statement = connection.PrepareStatement("select id,guid,data from LocalUsersv2 where guid=@guid"))
             {
             {
-                using (var connection = CreateConnection(true))
-                {
-                    using (var statement = connection.PrepareStatement("select id,guid,data from LocalUsersv2 where guid=@guid"))
-                    {
-                        statement.TryBind("@guid", guid);
+                statement.TryBind("@guid", guid);
 
 
-                        foreach (var row in statement.ExecuteQuery())
-                        {
-                            return GetUser(row);
-                        }
-                    }
+                foreach (var row in statement.ExecuteQuery())
+                {
+                    return GetUser(row);
                 }
                 }
             }
             }
 
 
@@ -200,14 +179,10 @@ namespace Emby.Server.Implementations.Data
             var id = row[0].ToInt64();
             var id = row[0].ToInt64();
             var guid = row[1].ReadGuidFromBlob();
             var guid = row[1].ReadGuidFromBlob();
 
 
-            using (var stream = new MemoryStream(row[2].ToBlob()))
-            {
-                stream.Position = 0;
-                var user = _jsonSerializer.DeserializeFromStream<User>(stream);
-                user.InternalId = id;
-                user.Id = guid;
-                return user;
-            }
+            var user = _jsonSerializer.DeserializeFromString<User>(row.GetString(2));
+            user.InternalId = id;
+            user.Id = guid;
+            return user;
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -216,20 +191,22 @@ namespace Emby.Server.Implementations.Data
         /// <returns>IEnumerable{User}.</returns>
         /// <returns>IEnumerable{User}.</returns>
         public List<User> RetrieveAllUsers()
         public List<User> RetrieveAllUsers()
         {
         {
-            var list = new List<User>();
-
-            using (WriteLock.Read())
+            using (var connection = GetConnection(true))
             {
             {
-                using (var connection = CreateConnection(true))
-                {
-                    foreach (var row in connection.Query("select id,guid,data from LocalUsersv2"))
-                    {
-                        list.Add(GetUser(row));
-                    }
-                }
+                return new List<User>(RetrieveAllUsers(connection));
             }
             }
+        }
 
 
-            return list;
+        /// <summary>
+        /// Retrieve all users from the database
+        /// </summary>
+        /// <returns>IEnumerable{User}.</returns>
+        private IEnumerable<User> RetrieveAllUsers(ManagedConnection connection)
+        {
+            foreach (var row in connection.Query("select id,guid,data from LocalUsersv2"))
+            {
+                yield return GetUser(row);
+            }
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -245,19 +222,16 @@ namespace Emby.Server.Implementations.Data
                 throw new ArgumentNullException(nameof(user));
                 throw new ArgumentNullException(nameof(user));
             }
             }
 
 
-            using (WriteLock.Write())
+            using (var connection = GetConnection())
             {
             {
-                using (var connection = CreateConnection())
+                connection.RunInTransaction(db =>
                 {
                 {
-                    connection.RunInTransaction(db =>
+                    using (var statement = db.PrepareStatement("delete from LocalUsersv2 where Id=@id"))
                     {
                     {
-                        using (var statement = db.PrepareStatement("delete from LocalUsersv2 where Id=@id"))
-                        {
-                            statement.TryBind("@id", user.InternalId);
-                            statement.MoveNext();
-                        }
-                    }, TransactionMode);
-                }
+                        statement.TryBind("@id", user.InternalId);
+                        statement.MoveNext();
+                    }
+                }, TransactionMode);
             }
             }
         }
         }
     }
     }

+ 2 - 2
Emby.Server.Implementations/Devices/DeviceId.cs

@@ -1,8 +1,8 @@
 using System;
 using System;
+using System.Globalization;
 using System.IO;
 using System.IO;
 using System.Text;
 using System.Text;
 using MediaBrowser.Common.Configuration;
 using MediaBrowser.Common.Configuration;
-using MediaBrowser.Model.IO;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Logging;
 
 
 namespace Emby.Server.Implementations.Devices
 namespace Emby.Server.Implementations.Devices
@@ -67,7 +67,7 @@ namespace Emby.Server.Implementations.Devices
 
 
         private static string GetNewId()
         private static string GetNewId()
         {
         {
-            return Guid.NewGuid().ToString("N");
+            return Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
         }
         }
 
 
         private string GetDeviceId()
         private string GetDeviceId()

+ 2 - 2
Emby.Server.Implementations/Devices/DeviceManager.cs

@@ -1,11 +1,11 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Globalization;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using MediaBrowser.Common.Configuration;
 using MediaBrowser.Common.Configuration;
 using MediaBrowser.Common.Extensions;
 using MediaBrowser.Common.Extensions;
-using MediaBrowser.Common.Net;
 using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Devices;
 using MediaBrowser.Controller.Devices;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities;
@@ -195,7 +195,7 @@ namespace Emby.Server.Implementations.Devices
 
 
         private string GetDevicePath(string id)
         private string GetDevicePath(string id)
         {
         {
-            return Path.Combine(GetDevicesPath(), id.GetMD5().ToString("N"));
+            return Path.Combine(GetDevicesPath(), id.GetMD5().ToString("N", CultureInfo.InvariantCulture));
         }
         }
 
 
         public ContentUploadHistory GetCameraUploadHistory(string deviceId)
         public ContentUploadHistory GetCameraUploadHistory(string deviceId)

+ 20 - 25
Emby.Server.Implementations/Dto/DtoService.cs

@@ -1,5 +1,6 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Globalization;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
@@ -89,14 +90,11 @@ namespace Emby.Server.Implementations.Dto
             var channelTuples = new List<Tuple<BaseItemDto, LiveTvChannel>>();
             var channelTuples = new List<Tuple<BaseItemDto, LiveTvChannel>>();
 
 
             var index = 0;
             var index = 0;
-            var allCollectionFolders = _libraryManager.GetUserRootFolder().Children.OfType<Folder>().ToList();
-
             foreach (var item in items)
             foreach (var item in items)
             {
             {
-                var dto = GetBaseItemDtoInternal(item, options, allCollectionFolders, user, owner);
+                var dto = GetBaseItemDtoInternal(item, options, user, owner);
 
 
-                var tvChannel = item as LiveTvChannel;
-                if (tvChannel != null)
+                if (item is LiveTvChannel tvChannel)
                 {
                 {
                     channelTuples.Add(new Tuple<BaseItemDto, LiveTvChannel>(dto, tvChannel));
                     channelTuples.Add(new Tuple<BaseItemDto, LiveTvChannel>(dto, tvChannel));
                 }
                 }
@@ -105,9 +103,7 @@ namespace Emby.Server.Implementations.Dto
                     programTuples.Add(new Tuple<BaseItem, BaseItemDto>(item, dto));
                     programTuples.Add(new Tuple<BaseItem, BaseItemDto>(item, dto));
                 }
                 }
 
 
-                var byName = item as IItemByName;
-
-                if (byName != null)
+                if (item is IItemByName byName)
                 {
                 {
                     if (options.ContainsField(ItemFields.ItemCounts))
                     if (options.ContainsField(ItemFields.ItemCounts))
                     {
                     {
@@ -130,8 +126,7 @@ namespace Emby.Server.Implementations.Dto
 
 
             if (programTuples.Count > 0)
             if (programTuples.Count > 0)
             {
             {
-                var task = _livetvManager().AddInfoToProgramDto(programTuples, options.Fields, user);
-                Task.WaitAll(task);
+                _livetvManager().AddInfoToProgramDto(programTuples, options.Fields, user).GetAwaiter().GetResult();
             }
             }
 
 
             if (channelTuples.Count > 0)
             if (channelTuples.Count > 0)
@@ -144,8 +139,7 @@ namespace Emby.Server.Implementations.Dto
 
 
         public BaseItemDto GetBaseItemDto(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null)
         public BaseItemDto GetBaseItemDto(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null)
         {
         {
-            var allCollectionFolders = _libraryManager.GetUserRootFolder().Children.OfType<Folder>().ToList();
-            var dto = GetBaseItemDtoInternal(item, options, allCollectionFolders, user, owner);
+            var dto = GetBaseItemDtoInternal(item, options, user, owner);
             var tvChannel = item as LiveTvChannel;
             var tvChannel = item as LiveTvChannel;
             if (tvChannel != null)
             if (tvChannel != null)
             {
             {
@@ -188,7 +182,7 @@ namespace Emby.Server.Implementations.Dto
             });
             });
         }
         }
 
 
-        private BaseItemDto GetBaseItemDtoInternal(BaseItem item, DtoOptions options, List<Folder> allCollectionFolders, User user = null, BaseItem owner = null)
+        private BaseItemDto GetBaseItemDtoInternal(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null)
         {
         {
             var dto = new BaseItemDto
             var dto = new BaseItemDto
             {
             {
@@ -220,7 +214,7 @@ namespace Emby.Server.Implementations.Dto
 
 
             if (options.ContainsField(ItemFields.DisplayPreferencesId))
             if (options.ContainsField(ItemFields.DisplayPreferencesId))
             {
             {
-                dto.DisplayPreferencesId = item.DisplayPreferencesId.ToString("N");
+                dto.DisplayPreferencesId = item.DisplayPreferencesId.ToString("N", CultureInfo.InvariantCulture);
             }
             }
 
 
             if (user != null)
             if (user != null)
@@ -312,6 +306,7 @@ namespace Emby.Server.Implementations.Dto
                         {
                         {
                             path = path.TrimStart('.');
                             path = path.TrimStart('.');
                         }
                         }
+
                         if (!string.IsNullOrEmpty(path) && containers.Contains(path, StringComparer.OrdinalIgnoreCase))
                         if (!string.IsNullOrEmpty(path) && containers.Contains(path, StringComparer.OrdinalIgnoreCase))
                         {
                         {
                             fileExtensionContainer = path;
                             fileExtensionContainer = path;
@@ -325,8 +320,7 @@ namespace Emby.Server.Implementations.Dto
 
 
         public BaseItemDto GetItemByNameDto(BaseItem item, DtoOptions options, List<BaseItem> taggedItems, User user = null)
         public BaseItemDto GetItemByNameDto(BaseItem item, DtoOptions options, List<BaseItem> taggedItems, User user = null)
         {
         {
-            var allCollectionFolders = _libraryManager.GetUserRootFolder().Children.OfType<Folder>().ToList();
-            var dto = GetBaseItemDtoInternal(item, options, allCollectionFolders, user);
+            var dto = GetBaseItemDtoInternal(item, options, user);
 
 
             if (taggedItems != null && options.ContainsField(ItemFields.ItemCounts))
             if (taggedItems != null && options.ContainsField(ItemFields.ItemCounts))
             {
             {
@@ -451,7 +445,7 @@ namespace Emby.Server.Implementations.Dto
         /// <exception cref="ArgumentNullException">item</exception>
         /// <exception cref="ArgumentNullException">item</exception>
         public string GetDtoId(BaseItem item)
         public string GetDtoId(BaseItem item)
         {
         {
-            return item.Id.ToString("N");
+            return item.Id.ToString("N", CultureInfo.InvariantCulture);
         }
         }
 
 
         private static void SetBookProperties(BaseItemDto dto, Book item)
         private static void SetBookProperties(BaseItemDto dto, Book item)
@@ -615,7 +609,7 @@ namespace Emby.Server.Implementations.Dto
                 if (dictionary.TryGetValue(person.Name, out Person entity))
                 if (dictionary.TryGetValue(person.Name, out Person entity))
                 {
                 {
                     baseItemPerson.PrimaryImageTag = GetImageCacheTag(entity, ImageType.Primary);
                     baseItemPerson.PrimaryImageTag = GetImageCacheTag(entity, ImageType.Primary);
-                    baseItemPerson.Id = entity.Id.ToString("N");
+                    baseItemPerson.Id = entity.Id.ToString("N", CultureInfo.InvariantCulture);
                     list.Add(baseItemPerson);
                     list.Add(baseItemPerson);
                 }
                 }
             }
             }
@@ -900,7 +894,7 @@ namespace Emby.Server.Implementations.Dto
                 //var artistItems = _libraryManager.GetArtists(new InternalItemsQuery
                 //var artistItems = _libraryManager.GetArtists(new InternalItemsQuery
                 //{
                 //{
                 //    EnableTotalRecordCount = false,
                 //    EnableTotalRecordCount = false,
-                //    ItemIds = new[] { item.Id.ToString("N") }
+                //    ItemIds = new[] { item.Id.ToString("N", CultureInfo.InvariantCulture) }
                 //});
                 //});
 
 
                 //dto.ArtistItems = artistItems.Items
                 //dto.ArtistItems = artistItems.Items
@@ -910,7 +904,7 @@ namespace Emby.Server.Implementations.Dto
                 //        return new NameIdPair
                 //        return new NameIdPair
                 //        {
                 //        {
                 //            Name = artist.Name,
                 //            Name = artist.Name,
-                //            Id = artist.Id.ToString("N")
+                //            Id = artist.Id.ToString("N", CultureInfo.InvariantCulture)
                 //        };
                 //        };
                 //    })
                 //    })
                 //    .ToList();
                 //    .ToList();
@@ -953,7 +947,7 @@ namespace Emby.Server.Implementations.Dto
                 //var artistItems = _libraryManager.GetAlbumArtists(new InternalItemsQuery
                 //var artistItems = _libraryManager.GetAlbumArtists(new InternalItemsQuery
                 //{
                 //{
                 //    EnableTotalRecordCount = false,
                 //    EnableTotalRecordCount = false,
-                //    ItemIds = new[] { item.Id.ToString("N") }
+                //    ItemIds = new[] { item.Id.ToString("N", CultureInfo.InvariantCulture) }
                 //});
                 //});
 
 
                 //dto.AlbumArtists = artistItems.Items
                 //dto.AlbumArtists = artistItems.Items
@@ -963,7 +957,7 @@ namespace Emby.Server.Implementations.Dto
                 //        return new NameIdPair
                 //        return new NameIdPair
                 //        {
                 //        {
                 //            Name = artist.Name,
                 //            Name = artist.Name,
-                //            Id = artist.Id.ToString("N")
+                //            Id = artist.Id.ToString("N", CultureInfo.InvariantCulture)
                 //        };
                 //        };
                 //    })
                 //    })
                 //    .ToList();
                 //    .ToList();
@@ -1051,14 +1045,15 @@ namespace Emby.Server.Implementations.Dto
                         }
                         }
                         else
                         else
                         {
                         {
-                            mediaStreams = dto.MediaSources.Where(i => string.Equals(i.Id, item.Id.ToString("N"), StringComparison.OrdinalIgnoreCase))
+                            string id = item.Id.ToString("N", CultureInfo.InvariantCulture);
+                            mediaStreams = dto.MediaSources.Where(i => string.Equals(i.Id, id, StringComparison.OrdinalIgnoreCase))
                                 .SelectMany(i => i.MediaStreams)
                                 .SelectMany(i => i.MediaStreams)
                                 .ToArray();
                                 .ToArray();
                         }
                         }
                     }
                     }
                     else
                     else
                     {
                     {
-                        mediaStreams = _mediaSourceManager().GetStaticMediaSources(item, true).First().MediaStreams.ToArray();
+                        mediaStreams = _mediaSourceManager().GetStaticMediaSources(item, true)[0].MediaStreams.ToArray();
                     }
                     }
 
 
                     dto.MediaStreams = mediaStreams;
                     dto.MediaStreams = mediaStreams;
@@ -1369,7 +1364,7 @@ namespace Emby.Server.Implementations.Dto
                 return null;
                 return null;
             }
             }
 
 
-            var supportedEnhancers = _imageProcessor.GetSupportedEnhancers(item, ImageType.Primary);
+            var supportedEnhancers = _imageProcessor.GetSupportedEnhancers(item, ImageType.Primary).ToArray();
 
 
             ImageDimensions size;
             ImageDimensions size;
 
 

+ 10 - 8
Emby.Server.Implementations/Emby.Server.Implementations.csproj

@@ -20,6 +20,7 @@
   </ItemGroup>
   </ItemGroup>
 
 
   <ItemGroup>
   <ItemGroup>
+    <PackageReference Include="IPNetwork2" Version="2.4.0.126" />
     <PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.0" />
     <PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.0" />
     <PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" />
     <PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" />
     <PackageReference Include="Microsoft.AspNetCore.Hosting.Server.Abstractions" Version="2.2.0" />
     <PackageReference Include="Microsoft.AspNetCore.Hosting.Server.Abstractions" Version="2.2.0" />
@@ -31,10 +32,9 @@
     <PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
     <PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
     <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" />
     <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" />
     <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.2.0" />
     <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.2.0" />
-    <PackageReference Include="ServiceStack.Text.Core" Version="5.4.0" />
-    <PackageReference Include="sharpcompress" Version="0.22.0" />
-    <PackageReference Include="SQLitePCL.pretty.netstandard" Version="1.0.0" />
-    <PackageReference Include="UTF.Unknown" Version="1.0.0-beta1" />
+    <PackageReference Include="ServiceStack.Text.Core" Version="5.6.0" />
+    <PackageReference Include="sharpcompress" Version="0.23.0" />
+    <PackageReference Include="SQLitePCL.pretty.netstandard" Version="2.0.1" />
   </ItemGroup>
   </ItemGroup>
 
 
   <ItemGroup>
   <ItemGroup>
@@ -44,16 +44,18 @@
   <PropertyGroup>
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
     <TargetFramework>netstandard2.0</TargetFramework>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+    <GenerateDocumentationFile>true</GenerateDocumentationFile>
   </PropertyGroup>
   </PropertyGroup>
 
 
-  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
-    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+  <PropertyGroup>
+    <!-- We need at least C# 7.3 to compare tuples-->
+    <LangVersion>latest</LangVersion>
   </PropertyGroup>
   </PropertyGroup>
 
 
   <!-- Code analysers-->
   <!-- Code analysers-->
   <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
   <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
-    <PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.3" />
-    <PackageReference Include="StyleCop.Analyzers" Version="1.0.2" />
+    <PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.4" />
+    <PackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
     <PackageReference Include="SerilogAnalyzer" Version="0.15.0" />
     <PackageReference Include="SerilogAnalyzer" Version="0.15.0" />
   </ItemGroup>
   </ItemGroup>
 
 

+ 8 - 8
Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs

@@ -100,7 +100,7 @@ namespace Emby.Server.Implementations.EntryPoints
             _lastProgressMessageTimes[item.Id] = DateTime.UtcNow;
             _lastProgressMessageTimes[item.Id] = DateTime.UtcNow;
 
 
             var dict = new Dictionary<string, string>();
             var dict = new Dictionary<string, string>();
-            dict["ItemId"] = item.Id.ToString("N");
+            dict["ItemId"] = item.Id.ToString("N", CultureInfo.InvariantCulture);
             dict["Progress"] = progress.ToString(CultureInfo.InvariantCulture);
             dict["Progress"] = progress.ToString(CultureInfo.InvariantCulture);
 
 
             try
             try
@@ -116,7 +116,7 @@ namespace Emby.Server.Implementations.EntryPoints
             foreach (var collectionFolder in collectionFolders)
             foreach (var collectionFolder in collectionFolders)
             {
             {
                 var collectionFolderDict = new Dictionary<string, string>();
                 var collectionFolderDict = new Dictionary<string, string>();
-                collectionFolderDict["ItemId"] = collectionFolder.Id.ToString("N");
+                collectionFolderDict["ItemId"] = collectionFolder.Id.ToString("N", CultureInfo.InvariantCulture);
                 collectionFolderDict["Progress"] = (collectionFolder.GetRefreshProgress() ?? 0).ToString(CultureInfo.InvariantCulture);
                 collectionFolderDict["Progress"] = (collectionFolder.GetRefreshProgress() ?? 0).ToString(CultureInfo.InvariantCulture);
 
 
                 try
                 try
@@ -378,15 +378,15 @@ namespace Emby.Server.Implementations.EntryPoints
 
 
             return new LibraryUpdateInfo
             return new LibraryUpdateInfo
             {
             {
-                ItemsAdded = itemsAdded.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToArray(),
+                ItemsAdded = itemsAdded.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture)).Distinct().ToArray(),
 
 
-                ItemsUpdated = itemsUpdated.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToArray(),
+                ItemsUpdated = itemsUpdated.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture)).Distinct().ToArray(),
 
 
-                ItemsRemoved = itemsRemoved.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, true)).Select(i => i.Id.ToString("N")).Distinct().ToArray(),
+                ItemsRemoved = itemsRemoved.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, true)).Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture)).Distinct().ToArray(),
 
 
-                FoldersAddedTo = foldersAddedTo.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToArray(),
+                FoldersAddedTo = foldersAddedTo.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture)).Distinct().ToArray(),
 
 
-                FoldersRemovedFrom = foldersRemovedFrom.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToArray(),
+                FoldersRemovedFrom = foldersRemovedFrom.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N", CultureInfo.InvariantCulture)).Distinct().ToArray(),
 
 
                 CollectionFolders = GetTopParentIds(newAndRemoved, allUserRootChildren).ToArray()
                 CollectionFolders = GetTopParentIds(newAndRemoved, allUserRootChildren).ToArray()
             };
             };
@@ -422,7 +422,7 @@ namespace Emby.Server.Implementations.EntryPoints
                 var collectionFolders = _libraryManager.GetCollectionFolders(item, allUserRootChildren);
                 var collectionFolders = _libraryManager.GetCollectionFolders(item, allUserRootChildren);
                 foreach (var folder in allUserRootChildren)
                 foreach (var folder in allUserRootChildren)
                 {
                 {
-                    list.Add(folder.Id.ToString("N"));
+                    list.Add(folder.Id.ToString("N", CultureInfo.InvariantCulture));
                 }
                 }
             }
             }
 
 

+ 1 - 3
Emby.Server.Implementations/EntryPoints/RefreshUsersMetadata.cs

@@ -50,9 +50,7 @@ namespace Emby.Server.Implementations.EntryPoints
 
 
         public async Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
         public async Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
         {
         {
-            var users = _userManager.Users.ToList();
-
-            foreach (var user in users)
+            foreach (var user in _userManager.Users)
             {
             {
                 cancellationToken.ThrowIfCancellationRequested();
                 cancellationToken.ThrowIfCancellationRequested();
 
 

+ 2 - 1
Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs

@@ -1,5 +1,6 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using MediaBrowser.Common.Plugins;
 using MediaBrowser.Common.Plugins;
@@ -134,7 +135,7 @@ namespace Emby.Server.Implementations.EntryPoints
         /// <param name="e">The e.</param>
         /// <param name="e">The e.</param>
         void userManager_UserDeleted(object sender, GenericEventArgs<User> e)
         void userManager_UserDeleted(object sender, GenericEventArgs<User> e)
         {
         {
-            SendMessageToUserSession(e.Argument, "UserDeleted", e.Argument.Id.ToString("N"));
+            SendMessageToUserSession(e.Argument, "UserDeleted", e.Argument.Id.ToString("N", CultureInfo.InvariantCulture));
         }
         }
 
 
         void _userManager_UserPolicyUpdated(object sender, GenericEventArgs<User> e)
         void _userManager_UserPolicyUpdated(object sender, GenericEventArgs<User> e)

+ 3 - 3
Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs

@@ -1,5 +1,6 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Linq;
 using System.Linq;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
@@ -8,7 +9,6 @@ using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Plugins;
 using MediaBrowser.Controller.Plugins;
 using MediaBrowser.Controller.Session;
 using MediaBrowser.Controller.Session;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Extensions;
 using MediaBrowser.Model.Session;
 using MediaBrowser.Model.Session;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Logging;
 
 
@@ -125,12 +125,12 @@ namespace Emby.Server.Implementations.EntryPoints
                 .Select(i =>
                 .Select(i =>
                 {
                 {
                     var dto = _userDataManager.GetUserDataDto(i, user);
                     var dto = _userDataManager.GetUserDataDto(i, user);
-                    dto.ItemId = i.Id.ToString("N");
+                    dto.ItemId = i.Id.ToString("N", CultureInfo.InvariantCulture);
                     return dto;
                     return dto;
                 })
                 })
                 .ToArray();
                 .ToArray();
 
 
-            var userIdString = userId.ToString("N");
+            var userIdString = userId.ToString("N", CultureInfo.InvariantCulture);
 
 
             return new UserDataChangeInfo
             return new UserDataChangeInfo
             {
             {

+ 0 - 18
Emby.Server.Implementations/HttpClientManager/HttpClientInfo.cs

@@ -1,18 +0,0 @@
-using System;
-using System.Net.Http;
-
-namespace Emby.Server.Implementations.HttpClientManager
-{
-    /// <summary>
-    /// Class HttpClientInfo
-    /// </summary>
-    public class HttpClientInfo
-    {
-        /// <summary>
-        /// Gets or sets the last timeout.
-        /// </summary>
-        /// <value>The last timeout.</value>
-        public DateTime LastTimeout { get; set; }
-        public HttpClient HttpClient { get; set; }
-    }
-}

+ 104 - 555
Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs

@@ -1,13 +1,10 @@
 using System;
 using System;
 using System.Collections.Concurrent;
 using System.Collections.Concurrent;
-using System.Collections.Generic;
 using System.Globalization;
 using System.Globalization;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
 using System.Net;
 using System.Net;
-using System.Net.Cache;
-using System.Text;
-using System.Threading;
+using System.Net.Http;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using MediaBrowser.Common.Configuration;
 using MediaBrowser.Common.Configuration;
 using MediaBrowser.Common.Extensions;
 using MediaBrowser.Common.Extensions;
@@ -20,81 +17,52 @@ using Microsoft.Net.Http.Headers;
 namespace Emby.Server.Implementations.HttpClientManager
 namespace Emby.Server.Implementations.HttpClientManager
 {
 {
     /// <summary>
     /// <summary>
-    /// Class HttpClientManager
+    /// Class HttpClientManager.
     /// </summary>
     /// </summary>
     public class HttpClientManager : IHttpClient
     public class HttpClientManager : IHttpClient
     {
     {
-        /// <summary>
-        /// When one request to a host times out, we'll ban all other requests for this period of time, to prevent scans from stalling
-        /// </summary>
-        private const int TimeoutSeconds = 30;
-
-        /// <summary>
-        /// The _logger
-        /// </summary>
         private readonly ILogger _logger;
         private readonly ILogger _logger;
-
-        /// <summary>
-        /// The _app paths
-        /// </summary>
         private readonly IApplicationPaths _appPaths;
         private readonly IApplicationPaths _appPaths;
-
         private readonly IFileSystem _fileSystem;
         private readonly IFileSystem _fileSystem;
         private readonly Func<string> _defaultUserAgentFn;
         private readonly Func<string> _defaultUserAgentFn;
 
 
+        /// <summary>
+        /// Holds a dictionary of http clients by host.  Use GetHttpClient(host) to retrieve or create a client for web requests.
+        /// DON'T dispose it after use.
+        /// </summary>
+        /// <value>The HTTP clients.</value>
+        private readonly ConcurrentDictionary<string, HttpClient> _httpClients = new ConcurrentDictionary<string, HttpClient>();
+
         /// <summary>
         /// <summary>
         /// Initializes a new instance of the <see cref="HttpClientManager" /> class.
         /// Initializes a new instance of the <see cref="HttpClientManager" /> class.
         /// </summary>
         /// </summary>
         public HttpClientManager(
         public HttpClientManager(
             IApplicationPaths appPaths,
             IApplicationPaths appPaths,
-            ILoggerFactory loggerFactory,
+            ILogger<HttpClientManager> logger,
             IFileSystem fileSystem,
             IFileSystem fileSystem,
             Func<string> defaultUserAgentFn)
             Func<string> defaultUserAgentFn)
         {
         {
-            if (appPaths == null)
-            {
-                throw new ArgumentNullException(nameof(appPaths));
-            }
-            if (loggerFactory == null)
-            {
-                throw new ArgumentNullException(nameof(loggerFactory));
-            }
-
-            _logger = loggerFactory.CreateLogger("HttpClient");
+            _logger = logger ?? throw new ArgumentNullException(nameof(logger));
             _fileSystem = fileSystem;
             _fileSystem = fileSystem;
-            _appPaths = appPaths;
+            _appPaths = appPaths ?? throw new ArgumentNullException(nameof(appPaths));
             _defaultUserAgentFn = defaultUserAgentFn;
             _defaultUserAgentFn = defaultUserAgentFn;
-
-            // http://stackoverflow.com/questions/566437/http-post-returns-the-error-417-expectation-failed-c
-            ServicePointManager.Expect100Continue = false;
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// Holds a dictionary of http clients by host.  Use GetHttpClient(host) to retrieve or create a client for web requests.
-        /// DON'T dispose it after use.
-        /// </summary>
-        /// <value>The HTTP clients.</value>
-        private readonly ConcurrentDictionary<string, HttpClientInfo> _httpClients = new ConcurrentDictionary<string, HttpClientInfo>();
-
-        /// <summary>
-        /// Gets
+        /// Gets the correct http client for the given url.
         /// </summary>
         /// </summary>
-        /// <param name="host">The host.</param>
-        /// <param name="enableHttpCompression">if set to <c>true</c> [enable HTTP compression].</param>
+        /// <param name="url">The url.</param>
         /// <returns>HttpClient.</returns>
         /// <returns>HttpClient.</returns>
-        /// <exception cref="ArgumentNullException">host</exception>
-        private HttpClientInfo GetHttpClient(string host, bool enableHttpCompression)
+        private HttpClient GetHttpClient(string url)
         {
         {
-            if (string.IsNullOrEmpty(host))
-            {
-                throw new ArgumentNullException(nameof(host));
-            }
-
-            var key = host + enableHttpCompression;
+            var key = GetHostFromUrl(url);
 
 
             if (!_httpClients.TryGetValue(key, out var client))
             if (!_httpClients.TryGetValue(key, out var client))
             {
             {
-                client = new HttpClientInfo();
+                client = new HttpClient()
+                {
+                    BaseAddress = new Uri(url)
+                };
 
 
                 _httpClients.TryAdd(key, client);
                 _httpClients.TryAdd(key, client);
             }
             }
@@ -102,119 +70,84 @@ namespace Emby.Server.Implementations.HttpClientManager
             return client;
             return client;
         }
         }
 
 
-        private WebRequest GetRequest(HttpRequestOptions options, string method)
+        private HttpRequestMessage GetRequestMessage(HttpRequestOptions options, HttpMethod method)
         {
         {
             string url = options.Url;
             string url = options.Url;
-
             var uriAddress = new Uri(url);
             var uriAddress = new Uri(url);
             string userInfo = uriAddress.UserInfo;
             string userInfo = uriAddress.UserInfo;
             if (!string.IsNullOrWhiteSpace(userInfo))
             if (!string.IsNullOrWhiteSpace(userInfo))
             {
             {
-                _logger.LogInformation("Found userInfo in url: {0} ... url: {1}", userInfo, url);
-                url = url.Replace(userInfo + "@", string.Empty);
+                _logger.LogWarning("Found userInfo in url: {0} ... url: {1}", userInfo, url);
+                url = url.Replace(userInfo + '@', string.Empty);
             }
             }
 
 
-            var request = WebRequest.Create(url);
+            var request = new HttpRequestMessage(method, url);
 
 
-            if (request is HttpWebRequest httpWebRequest)
-            {
-                AddRequestHeaders(httpWebRequest, options);
+            AddRequestHeaders(request, options);
 
 
-                if (options.EnableHttpCompression)
-                {
-                    httpWebRequest.AutomaticDecompression = DecompressionMethods.Deflate;
-                    if (options.DecompressionMethod.HasValue
-                        && options.DecompressionMethod.Value == CompressionMethod.Gzip)
-                    {
-                        httpWebRequest.AutomaticDecompression = DecompressionMethods.GZip;
-                    }
-                }
-                else
-                {
-                    httpWebRequest.AutomaticDecompression = DecompressionMethods.None;
-                }
-
-                httpWebRequest.KeepAlive = options.EnableKeepAlive;
-
-                if (!string.IsNullOrEmpty(options.Host))
-                {
-                    httpWebRequest.Host = options.Host;
-                }
-
-                if (!string.IsNullOrEmpty(options.Referer))
-                {
-                    httpWebRequest.Referer = options.Referer;
-                }
+            switch (options.DecompressionMethod)
+            {
+                case CompressionMethod.Deflate | CompressionMethod.Gzip:
+                    request.Headers.Add(HeaderNames.AcceptEncoding, new[] { "gzip", "deflate" });
+                    break;
+                case CompressionMethod.Deflate:
+                    request.Headers.Add(HeaderNames.AcceptEncoding, "deflate");
+                    break;
+                case CompressionMethod.Gzip:
+                    request.Headers.Add(HeaderNames.AcceptEncoding, "gzip");
+                    break;
+                default:
+                    break;
             }
             }
 
 
-            request.CachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache);
+            if (options.EnableKeepAlive)
+            {
+                request.Headers.Add(HeaderNames.Connection, "Keep-Alive");
+            }
 
 
-            request.Method = method;
-            request.Timeout = options.TimeoutMs;
+            // request.Headers.Add(HeaderNames.CacheControl, "no-cache");
 
 
+            /*
             if (!string.IsNullOrWhiteSpace(userInfo))
             if (!string.IsNullOrWhiteSpace(userInfo))
             {
             {
                 var parts = userInfo.Split(':');
                 var parts = userInfo.Split(':');
                 if (parts.Length == 2)
                 if (parts.Length == 2)
                 {
                 {
-                    request.Credentials = GetCredential(url, parts[0], parts[1]);
-                    // TODO: .net core ??
-                    request.PreAuthenticate = true;
+                    request.Headers.Add(HeaderNames., GetCredential(url, parts[0], parts[1]);
                 }
                 }
             }
             }
+            */
 
 
             return request;
             return request;
         }
         }
 
 
-        private static CredentialCache GetCredential(string url, string username, string password)
-        {
-            //ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
-            var credentialCache = new CredentialCache();
-            credentialCache.Add(new Uri(url), "Basic", new NetworkCredential(username, password));
-            return credentialCache;
-        }
-
-        private void AddRequestHeaders(HttpWebRequest request, HttpRequestOptions options)
+        private void AddRequestHeaders(HttpRequestMessage request, HttpRequestOptions options)
         {
         {
             var hasUserAgent = false;
             var hasUserAgent = false;
 
 
             foreach (var header in options.RequestHeaders)
             foreach (var header in options.RequestHeaders)
             {
             {
-                if (string.Equals(header.Key, HeaderNames.Accept, StringComparison.OrdinalIgnoreCase))
-                {
-                    request.Accept = header.Value;
-                }
-                else if (string.Equals(header.Key, HeaderNames.UserAgent, StringComparison.OrdinalIgnoreCase))
+                if (string.Equals(header.Key, HeaderNames.UserAgent, StringComparison.OrdinalIgnoreCase))
                 {
                 {
-                    SetUserAgent(request, header.Value);
                     hasUserAgent = true;
                     hasUserAgent = true;
                 }
                 }
-                else
-                {
-                    request.Headers.Set(header.Key, header.Value);
-                }
+
+                request.Headers.Add(header.Key, header.Value);
             }
             }
 
 
             if (!hasUserAgent && options.EnableDefaultUserAgent)
             if (!hasUserAgent && options.EnableDefaultUserAgent)
             {
             {
-                SetUserAgent(request, _defaultUserAgentFn());
+                request.Headers.Add(HeaderNames.UserAgent, _defaultUserAgentFn());
             }
             }
         }
         }
 
 
-        private static void SetUserAgent(HttpWebRequest request, string userAgent)
-        {
-            request.UserAgent = userAgent;
-        }
-
         /// <summary>
         /// <summary>
         /// Gets the response internal.
         /// Gets the response internal.
         /// </summary>
         /// </summary>
         /// <param name="options">The options.</param>
         /// <param name="options">The options.</param>
         /// <returns>Task{HttpResponseInfo}.</returns>
         /// <returns>Task{HttpResponseInfo}.</returns>
         public Task<HttpResponseInfo> GetResponse(HttpRequestOptions options)
         public Task<HttpResponseInfo> GetResponse(HttpRequestOptions options)
-        {
-            return SendAsync(options, "GET");
-        }
+            => SendAsync(options, HttpMethod.Get);
 
 
         /// <summary>
         /// <summary>
         /// Performs a GET request and returns the resulting stream
         /// Performs a GET request and returns the resulting stream
@@ -233,9 +166,16 @@ namespace Emby.Server.Implementations.HttpClientManager
         /// <param name="options">The options.</param>
         /// <param name="options">The options.</param>
         /// <param name="httpMethod">The HTTP method.</param>
         /// <param name="httpMethod">The HTTP method.</param>
         /// <returns>Task{HttpResponseInfo}.</returns>
         /// <returns>Task{HttpResponseInfo}.</returns>
-        /// <exception cref="HttpException">
-        /// </exception>
-        public async Task<HttpResponseInfo> SendAsync(HttpRequestOptions options, string httpMethod)
+        public Task<HttpResponseInfo> SendAsync(HttpRequestOptions options, string httpMethod)
+            => SendAsync(options, new HttpMethod(httpMethod));
+
+        /// <summary>
+        /// send as an asynchronous operation.
+        /// </summary>
+        /// <param name="options">The options.</param>
+        /// <param name="httpMethod">The HTTP method.</param>
+        /// <returns>Task{HttpResponseInfo}.</returns>
+        public async Task<HttpResponseInfo> SendAsync(HttpRequestOptions options, HttpMethod httpMethod)
         {
         {
             if (options.CacheMode == CacheMode.None)
             if (options.CacheMode == CacheMode.None)
             {
             {
@@ -243,7 +183,7 @@ namespace Emby.Server.Implementations.HttpClientManager
             }
             }
 
 
             var url = options.Url;
             var url = options.Url;
-            var urlHash = url.ToLowerInvariant().GetMD5().ToString("N");
+            var urlHash = url.ToUpperInvariant().GetMD5().ToString("N", CultureInfo.InvariantCulture);
 
 
             var responseCachePath = Path.Combine(_appPaths.CachePath, "httpclient", urlHash);
             var responseCachePath = Path.Combine(_appPaths.CachePath, "httpclient", urlHash);
 
 
@@ -286,7 +226,13 @@ namespace Emby.Server.Implementations.HttpClientManager
         {
         {
             Directory.CreateDirectory(Path.GetDirectoryName(responseCachePath));
             Directory.CreateDirectory(Path.GetDirectoryName(responseCachePath));
 
 
-            using (var fileStream = _fileSystem.GetFileStream(responseCachePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.None, true))
+            using (var fileStream = new FileStream(
+                responseCachePath,
+                FileMode.Create,
+                FileAccess.Write,
+                FileShare.None,
+                StreamDefaults.DefaultFileStreamBufferSize,
+                true))
             {
             {
                 await response.Content.CopyToAsync(fileStream).ConfigureAwait(false);
                 await response.Content.CopyToAsync(fileStream).ConfigureAwait(false);
 
 
@@ -294,358 +240,61 @@ namespace Emby.Server.Implementations.HttpClientManager
             }
             }
         }
         }
 
 
-        private async Task<HttpResponseInfo> SendAsyncInternal(HttpRequestOptions options, string httpMethod)
+        private async Task<HttpResponseInfo> SendAsyncInternal(HttpRequestOptions options, HttpMethod httpMethod)
         {
         {
             ValidateParams(options);
             ValidateParams(options);
 
 
             options.CancellationToken.ThrowIfCancellationRequested();
             options.CancellationToken.ThrowIfCancellationRequested();
 
 
-            var client = GetHttpClient(GetHostFromUrl(options.Url), options.EnableHttpCompression);
+            var client = GetHttpClient(options.Url);
 
 
-            if ((DateTime.UtcNow - client.LastTimeout).TotalSeconds < TimeoutSeconds)
-            {
-                throw new HttpException(string.Format("Cancelling connection to {0} due to a previous timeout.", options.Url))
-                {
-                    IsTimedOut = true
-                };
-            }
+            var httpWebRequest = GetRequestMessage(options, httpMethod);
 
 
-            var httpWebRequest = GetRequest(options, httpMethod);
-
-            if (options.RequestContentBytes != null ||
-                !string.IsNullOrEmpty(options.RequestContent) ||
-                string.Equals(httpMethod, "post", StringComparison.OrdinalIgnoreCase))
+            if (options.RequestContentBytes != null
+                || !string.IsNullOrEmpty(options.RequestContent)
+                || httpMethod == HttpMethod.Post)
             {
             {
-                try
+                if (options.RequestContentBytes != null)
                 {
                 {
-                    var bytes = options.RequestContentBytes ?? Encoding.UTF8.GetBytes(options.RequestContent ?? string.Empty);
-
-                    var contentType = options.RequestContentType ?? "application/x-www-form-urlencoded";
-
-                    if (options.AppendCharsetToMimeType)
-                    {
-                        contentType = contentType.TrimEnd(';') + "; charset=\"utf-8\"";
-                    }
-
-                    httpWebRequest.ContentType = contentType;
-                    (await httpWebRequest.GetRequestStreamAsync().ConfigureAwait(false)).Write(bytes, 0, bytes.Length);
+                    httpWebRequest.Content = new ByteArrayContent(options.RequestContentBytes);
                 }
                 }
-                catch (Exception ex)
+                else if (options.RequestContent != null)
                 {
                 {
-                    throw new HttpException(ex.Message) { IsTimedOut = true };
-                }
-            }
-
-            if (options.ResourcePool != null)
-            {
-                await options.ResourcePool.WaitAsync(options.CancellationToken).ConfigureAwait(false);
-            }
-
-            if ((DateTime.UtcNow - client.LastTimeout).TotalSeconds < TimeoutSeconds)
-            {
-                options.ResourcePool?.Release();
-
-                throw new HttpException($"Connection to {options.Url} timed out") { IsTimedOut = true };
-            }
-
-            if (options.LogRequest)
-            {
-                if (options.LogRequestAsDebug)
-                {
-                    _logger.LogDebug("HttpClientManager {0}: {1}", httpMethod.ToUpper(CultureInfo.CurrentCulture), options.Url);
+                    httpWebRequest.Content = new StringContent(
+                        options.RequestContent,
+                        null,
+                        options.RequestContentType);
                 }
                 }
                 else
                 else
                 {
                 {
-                    _logger.LogInformation("HttpClientManager {0}: {1}", httpMethod.ToUpper(CultureInfo.CurrentCulture), options.Url);
+                    httpWebRequest.Content = new ByteArrayContent(Array.Empty<byte>());
                 }
                 }
             }
             }
 
 
-            try
-            {
-                options.CancellationToken.ThrowIfCancellationRequested();
-
-                if (!options.BufferContent)
-                {
-                    var response = await GetResponseAsync(httpWebRequest, TimeSpan.FromMilliseconds(options.TimeoutMs)).ConfigureAwait(false);
-
-                    var httpResponse = (HttpWebResponse)response;
-
-                    EnsureSuccessStatusCode(client, httpResponse, options);
-
-                    options.CancellationToken.ThrowIfCancellationRequested();
-
-                    return GetResponseInfo(httpResponse, httpResponse.GetResponseStream(), GetContentLength(httpResponse), httpResponse);
-                }
-
-                using (var response = await GetResponseAsync(httpWebRequest, TimeSpan.FromMilliseconds(options.TimeoutMs)).ConfigureAwait(false))
-                {
-                    var httpResponse = (HttpWebResponse)response;
-
-                    EnsureSuccessStatusCode(client, httpResponse, options);
-
-                    options.CancellationToken.ThrowIfCancellationRequested();
-
-                    using (var stream = httpResponse.GetResponseStream())
-                    {
-                        var memoryStream = new MemoryStream();
-                        await stream.CopyToAsync(memoryStream).ConfigureAwait(false);
-
-                        memoryStream.Position = 0;
-
-                        return GetResponseInfo(httpResponse, memoryStream, memoryStream.Length, null);
-                    }
-                }
-            }
-            catch (OperationCanceledException ex)
-            {
-                throw GetCancellationException(options, client, options.CancellationToken, ex);
-            }
-            catch (Exception ex)
-            {
-                throw GetException(ex, options, client);
-            }
-            finally
-            {
-                options.ResourcePool?.Release();
-            }
-        }
+            options.CancellationToken.ThrowIfCancellationRequested();
 
 
-        private HttpResponseInfo GetResponseInfo(HttpWebResponse httpResponse, Stream content, long? contentLength, IDisposable disposable)
-        {
-            var responseInfo = new HttpResponseInfo(disposable)
-            {
-                Content = content,
-                StatusCode = httpResponse.StatusCode,
-                ContentType = httpResponse.ContentType,
-                ContentLength = contentLength,
-                ResponseUrl = httpResponse.ResponseUri.ToString()
-            };
+            var response = await client.SendAsync(
+                httpWebRequest,
+                options.BufferContent || options.CacheMode == CacheMode.Unconditional ? HttpCompletionOption.ResponseContentRead : HttpCompletionOption.ResponseHeadersRead,
+                options.CancellationToken).ConfigureAwait(false);
 
 
-            if (httpResponse.Headers != null)
-            {
-                SetHeaders(httpResponse.Headers, responseInfo);
-            }
+            await EnsureSuccessStatusCode(response, options).ConfigureAwait(false);
 
 
-            return responseInfo;
-        }
+            options.CancellationToken.ThrowIfCancellationRequested();
 
 
-        private HttpResponseInfo GetResponseInfo(HttpWebResponse httpResponse, string tempFile, long? contentLength)
-        {
-            var responseInfo = new HttpResponseInfo
+            var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
+            return new HttpResponseInfo(response.Headers, response.Content.Headers)
             {
             {
-                TempFilePath = tempFile,
-                StatusCode = httpResponse.StatusCode,
-                ContentType = httpResponse.ContentType,
-                ContentLength = contentLength
+                Content = stream,
+                StatusCode = response.StatusCode,
+                ContentType = response.Content.Headers.ContentType?.MediaType,
+                ContentLength = response.Content.Headers.ContentLength,
+                ResponseUrl = response.Content.Headers.ContentLocation?.ToString()
             };
             };
-
-            if (httpResponse.Headers != null)
-            {
-                SetHeaders(httpResponse.Headers, responseInfo);
-            }
-
-            return responseInfo;
-        }
-
-        private static void SetHeaders(WebHeaderCollection headers, HttpResponseInfo responseInfo)
-        {
-            foreach (var key in headers.AllKeys)
-            {
-                responseInfo.Headers[key] = headers[key];
-            }
         }
         }
 
 
         public Task<HttpResponseInfo> Post(HttpRequestOptions options)
         public Task<HttpResponseInfo> Post(HttpRequestOptions options)
-        {
-            return SendAsync(options, "POST");
-        }
-
-        /// <summary>
-        /// Performs a POST request
-        /// </summary>
-        /// <param name="options">The options.</param>
-        /// <param name="postData">Params to add to the POST data.</param>
-        /// <returns>stream on success, null on failure</returns>
-        public async Task<Stream> Post(HttpRequestOptions options, Dictionary<string, string> postData)
-        {
-            options.SetPostData(postData);
-
-            var response = await Post(options).ConfigureAwait(false);
-
-            return response.Content;
-        }
-
-        /// <summary>
-        /// Downloads the contents of a given url into a temporary location
-        /// </summary>
-        /// <param name="options">The options.</param>
-        /// <returns>Task{System.String}.</returns>
-        public async Task<string> GetTempFile(HttpRequestOptions options)
-        {
-            var response = await GetTempFileResponse(options).ConfigureAwait(false);
-
-            return response.TempFilePath;
-        }
-
-        public async Task<HttpResponseInfo> GetTempFileResponse(HttpRequestOptions options)
-        {
-            ValidateParams(options);
-
-            Directory.CreateDirectory(_appPaths.TempDirectory);
-
-            var tempFile = Path.Combine(_appPaths.TempDirectory, Guid.NewGuid() + ".tmp");
-
-            if (options.Progress == null)
-            {
-                throw new ArgumentException("Options did not have a Progress value.", nameof(options));
-            }
-
-            options.CancellationToken.ThrowIfCancellationRequested();
-
-            var httpWebRequest = GetRequest(options, "GET");
-
-            if (options.ResourcePool != null)
-            {
-                await options.ResourcePool.WaitAsync(options.CancellationToken).ConfigureAwait(false);
-            }
-
-            options.Progress.Report(0);
-
-            if (options.LogRequest)
-            {
-                if (options.LogRequestAsDebug)
-                {
-                    _logger.LogDebug("HttpClientManager.GetTempFileResponse url: {0}", options.Url);
-                }
-                else
-                {
-                    _logger.LogInformation("HttpClientManager.GetTempFileResponse url: {0}", options.Url);
-                }
-            }
-
-            var client = GetHttpClient(GetHostFromUrl(options.Url), options.EnableHttpCompression);
-
-            try
-            {
-                options.CancellationToken.ThrowIfCancellationRequested();
-
-                using (var response = await httpWebRequest.GetResponseAsync().ConfigureAwait(false))
-                {
-                    var httpResponse = (HttpWebResponse)response;
-
-                    EnsureSuccessStatusCode(client, httpResponse, options);
-
-                    options.CancellationToken.ThrowIfCancellationRequested();
-
-                    var contentLength = GetContentLength(httpResponse);
-
-                    using (var stream = httpResponse.GetResponseStream())
-                    using (var fs = _fileSystem.GetFileStream(tempFile, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true))
-                    {
-                        await stream.CopyToAsync(fs, StreamDefaults.DefaultCopyToBufferSize, options.CancellationToken).ConfigureAwait(false);
-                    }
-
-                    options.Progress.Report(100);
-
-                    return GetResponseInfo(httpResponse, tempFile, contentLength);
-                }
-            }
-            catch (Exception ex)
-            {
-                DeleteTempFile(tempFile);
-                throw GetException(ex, options, client);
-            }
-            finally
-            {
-                options.ResourcePool?.Release();
-            }
-        }
-
-        private static long? GetContentLength(HttpWebResponse response)
-        {
-            var length = response.ContentLength;
-
-            if (length == 0)
-            {
-                return null;
-            }
-
-            return length;
-        }
-
-        protected static readonly CultureInfo UsCulture = new CultureInfo("en-US");
-
-        private Exception GetException(Exception ex, HttpRequestOptions options, HttpClientInfo client)
-        {
-            if (ex is HttpException)
-            {
-                return ex;
-            }
-
-            var webException = ex as WebException
-                               ?? ex.InnerException as WebException;
-
-            if (webException != null)
-            {
-                if (options.LogErrors)
-                {
-                    _logger.LogError(webException, "Error {status} getting response from {url}", webException.Status, options.Url);
-                }
-
-                var exception = new HttpException(webException.Message, webException);
-
-                using (var response = webException.Response as HttpWebResponse)
-                {
-                    if (response != null)
-                    {
-                        exception.StatusCode = response.StatusCode;
-
-                        if ((int)response.StatusCode == 429)
-                        {
-                            client.LastTimeout = DateTime.UtcNow;
-                        }
-                    }
-                }
-
-                if (!exception.StatusCode.HasValue)
-                {
-                    if (webException.Status == WebExceptionStatus.NameResolutionFailure ||
-                        webException.Status == WebExceptionStatus.ConnectFailure)
-                    {
-                        exception.IsTimedOut = true;
-                    }
-                }
-
-                return exception;
-            }
-
-            var operationCanceledException = ex as OperationCanceledException
-                                             ?? ex.InnerException as OperationCanceledException;
-
-            if (operationCanceledException != null)
-            {
-                return GetCancellationException(options, client, options.CancellationToken, operationCanceledException);
-            }
-
-            if (options.LogErrors)
-            {
-                _logger.LogError(ex, "Error getting response from {url}", options.Url);
-            }
-
-            return ex;
-        }
-
-        private void DeleteTempFile(string file)
-        {
-            try
-            {
-                _fileSystem.DeleteFile(file);
-            }
-            catch (IOException)
-            {
-                // Might not have been created at all. No need to worry.
-            }
-        }
+            => SendAsync(options, HttpMethod.Post);
 
 
         private void ValidateParams(HttpRequestOptions options)
         private void ValidateParams(HttpRequestOptions options)
         {
         {
@@ -678,123 +327,23 @@ namespace Emby.Server.Implementations.HttpClientManager
             return url;
             return url;
         }
         }
 
 
-        /// <summary>
-        /// Throws the cancellation exception.
-        /// </summary>
-        /// <param name="options">The options.</param>
-        /// <param name="client">The client.</param>
-        /// <param name="cancellationToken">The cancellation token.</param>
-        /// <param name="exception">The exception.</param>
-        /// <returns>Exception.</returns>
-        private Exception GetCancellationException(HttpRequestOptions options, HttpClientInfo client, CancellationToken cancellationToken, OperationCanceledException exception)
-        {
-            // If the HttpClient's timeout is reached, it will cancel the Task internally
-            if (!cancellationToken.IsCancellationRequested)
-            {
-                var msg = string.Format("Connection to {0} timed out", options.Url);
-
-                if (options.LogErrors)
-                {
-                    _logger.LogError(msg);
-                }
-
-                client.LastTimeout = DateTime.UtcNow;
-
-                // Throw an HttpException so that the caller doesn't think it was cancelled by user code
-                return new HttpException(msg, exception)
-                {
-                    IsTimedOut = true
-                };
-            }
-
-            return exception;
-        }
-
-        private void EnsureSuccessStatusCode(HttpClientInfo client, HttpWebResponse response, HttpRequestOptions options)
+        private async Task EnsureSuccessStatusCode(HttpResponseMessage response, HttpRequestOptions options)
         {
         {
-            var statusCode = response.StatusCode;
-
-            var isSuccessful = statusCode >= HttpStatusCode.OK && statusCode <= (HttpStatusCode)299;
-
-            if (isSuccessful)
+            if (response.IsSuccessStatusCode)
             {
             {
                 return;
                 return;
             }
             }
 
 
             if (options.LogErrorResponseBody)
             if (options.LogErrorResponseBody)
             {
             {
-                try
-                {
-                    using (var stream = response.GetResponseStream())
-                    {
-                        if (stream != null)
-                        {
-                            using (var reader = new StreamReader(stream))
-                            {
-                                var msg = reader.ReadToEnd();
-
-                                _logger.LogError(msg);
-                            }
-                        }
-                    }
-                }
-                catch
-                {
-
-                }
+                var msg = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
+                _logger.LogError("HTTP request failed with message: {Message}", msg);
             }
             }
 
 
-            throw new HttpException(response.StatusDescription)
+            throw new HttpException(response.ReasonPhrase)
             {
             {
                 StatusCode = response.StatusCode
                 StatusCode = response.StatusCode
             };
             };
         }
         }
-
-        private static Task<WebResponse> GetResponseAsync(WebRequest request, TimeSpan timeout)
-        {
-            var taskCompletion = new TaskCompletionSource<WebResponse>();
-
-            var asyncTask = Task.Factory.FromAsync(request.BeginGetResponse, request.EndGetResponse, null);
-
-            ThreadPool.RegisterWaitForSingleObject((asyncTask as IAsyncResult).AsyncWaitHandle, TimeoutCallback, request, timeout, true);
-            var callback = new TaskCallback { taskCompletion = taskCompletion };
-            asyncTask.ContinueWith(callback.OnSuccess, TaskContinuationOptions.NotOnFaulted);
-
-            // Handle errors
-            asyncTask.ContinueWith(callback.OnError, TaskContinuationOptions.OnlyOnFaulted);
-
-            return taskCompletion.Task;
-        }
-
-        private static void TimeoutCallback(object state, bool timedOut)
-        {
-            if (timedOut && state != null)
-            {
-                var request = (WebRequest)state;
-                request.Abort();
-            }
-        }
-
-        private class TaskCallback
-        {
-            public TaskCompletionSource<WebResponse> taskCompletion;
-
-            public void OnSuccess(Task<WebResponse> task)
-            {
-                taskCompletion.TrySetResult(task.Result);
-            }
-
-            public void OnError(Task<WebResponse> task)
-            {
-                if (task.Exception == null)
-                {
-                    taskCompletion.TrySetException(Enumerable.Empty<Exception>());
-                }
-                else
-                {
-                    taskCompletion.TrySetException(task.Exception);
-                }
-            }
-        }
     }
     }
 }
 }

+ 107 - 67
Emby.Server.Implementations/HttpServer/FileWriter.cs

@@ -1,50 +1,43 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Globalization;
 using System.Globalization;
+using System.IO;
 using System.Linq;
 using System.Linq;
 using System.Net;
 using System.Net;
+using System.Runtime.InteropServices;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
-using Emby.Server.Implementations.IO;
 using MediaBrowser.Model.IO;
 using MediaBrowser.Model.IO;
 using MediaBrowser.Model.Services;
 using MediaBrowser.Model.Services;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Logging;
+using Microsoft.AspNetCore.Http;
 using Microsoft.Net.Http.Headers;
 using Microsoft.Net.Http.Headers;
 
 
 namespace Emby.Server.Implementations.HttpServer
 namespace Emby.Server.Implementations.HttpServer
 {
 {
     public class FileWriter : IHttpResult
     public class FileWriter : IHttpResult
     {
     {
-        private readonly IStreamHelper _streamHelper;
-        private ILogger Logger { get; set; }
-        private readonly IFileSystem _fileSystem;
-
-        private string RangeHeader { get; set; }
-        private bool IsHeadRequest { get; set; }
-
-        private long RangeStart { get; set; }
-        private long RangeEnd { get; set; }
-        private long RangeLength { get; set; }
-        public long TotalContentLength { get; set; }
+        private static readonly CultureInfo UsCulture = CultureInfo.ReadOnly(new CultureInfo("en-US"));
 
 
-        public Action OnComplete { get; set; }
-        public Action OnError { get; set; }
-        private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
-        public List<Cookie> Cookies { get; private set; }
+        private static readonly string[] _skipLogExtensions = {
+            ".js",
+            ".html",
+            ".css"
+        };
 
 
-        public FileShareMode FileShare { get; set; }
+        private readonly IStreamHelper _streamHelper;
+        private readonly ILogger _logger;
+        private readonly IFileSystem _fileSystem;
 
 
         /// <summary>
         /// <summary>
         /// The _options
         /// The _options
         /// </summary>
         /// </summary>
         private readonly IDictionary<string, string> _options = new Dictionary<string, string>();
         private readonly IDictionary<string, string> _options = new Dictionary<string, string>();
+
         /// <summary>
         /// <summary>
-        /// Gets the options.
+        /// The _requested ranges
         /// </summary>
         /// </summary>
-        /// <value>The options.</value>
-        public IDictionary<string, string> Headers => _options;
-
-        public string Path { get; set; }
+        private List<KeyValuePair<long, long?>> _requestedRanges;
 
 
         public FileWriter(string path, string contentType, string rangeHeader, ILogger logger, IFileSystem fileSystem, IStreamHelper streamHelper)
         public FileWriter(string path, string contentType, string rangeHeader, ILogger logger, IFileSystem fileSystem, IStreamHelper streamHelper)
         {
         {
@@ -57,7 +50,7 @@ namespace Emby.Server.Implementations.HttpServer
             _fileSystem = fileSystem;
             _fileSystem = fileSystem;
 
 
             Path = path;
             Path = path;
-            Logger = logger;
+            _logger = logger;
             RangeHeader = rangeHeader;
             RangeHeader = rangeHeader;
 
 
             Headers[HeaderNames.ContentType] = contentType;
             Headers[HeaderNames.ContentType] = contentType;
@@ -80,39 +73,34 @@ namespace Emby.Server.Implementations.HttpServer
             Cookies = new List<Cookie>();
             Cookies = new List<Cookie>();
         }
         }
 
 
-        /// <summary>
-        /// Sets the range values.
-        /// </summary>
-        private void SetRangeValues()
-        {
-            var requestedRange = RequestedRanges[0];
+        private string RangeHeader { get; set; }
 
 
-            // If the requested range is "0-", we can optimize by just doing a stream copy
-            if (!requestedRange.Value.HasValue)
-            {
-                RangeEnd = TotalContentLength - 1;
-            }
-            else
-            {
-                RangeEnd = requestedRange.Value.Value;
-            }
+        private bool IsHeadRequest { get; set; }
 
 
-            RangeStart = requestedRange.Key;
-            RangeLength = 1 + RangeEnd - RangeStart;
+        private long RangeStart { get; set; }
 
 
-            // Content-Length is the length of what we're serving, not the original content
-            var lengthString = RangeLength.ToString(CultureInfo.InvariantCulture);
-            Headers[HeaderNames.ContentLength] = lengthString;
-            var rangeString = $"bytes {RangeStart}-{RangeEnd}/{TotalContentLength}";
-            Headers[HeaderNames.ContentRange] = rangeString;
+        private long RangeEnd { get; set; }
 
 
-            Logger.LogInformation("Setting range response values for {0}. RangeRequest: {1} Content-Length: {2}, Content-Range: {3}", Path, RangeHeader, lengthString, rangeString);
-        }
+        private long RangeLength { get; set; }
+
+        public long TotalContentLength { get; set; }
+
+        public Action OnComplete { get; set; }
+
+        public Action OnError { get; set; }
+
+        public List<Cookie> Cookies { get; private set; }
+
+        public FileShareMode FileShare { get; set; }
 
 
         /// <summary>
         /// <summary>
-        /// The _requested ranges
+        /// Gets the options.
         /// </summary>
         /// </summary>
-        private List<KeyValuePair<long, long?>> _requestedRanges;
+        /// <value>The options.</value>
+        public IDictionary<string, string> Headers => _options;
+
+        public string Path { get; set; }
+
         /// <summary>
         /// <summary>
         /// Gets the requested ranges.
         /// Gets the requested ranges.
         /// </summary>
         /// </summary>
@@ -139,6 +127,7 @@ namespace Emby.Server.Implementations.HttpServer
                         {
                         {
                             start = long.Parse(vals[0], UsCulture);
                             start = long.Parse(vals[0], UsCulture);
                         }
                         }
+
                         if (!string.IsNullOrEmpty(vals[1]))
                         if (!string.IsNullOrEmpty(vals[1]))
                         {
                         {
                             end = long.Parse(vals[1], UsCulture);
                             end = long.Parse(vals[1], UsCulture);
@@ -152,13 +141,50 @@ namespace Emby.Server.Implementations.HttpServer
             }
             }
         }
         }
 
 
-        private static readonly string[] SkipLogExtensions = {
-            ".js",
-            ".html",
-            ".css"
-        };
+        public string ContentType { get; set; }
+
+        public IRequest RequestContext { get; set; }
+
+        public object Response { get; set; }
+
+        public int Status { get; set; }
+
+        public HttpStatusCode StatusCode
+        {
+            get => (HttpStatusCode)Status;
+            set => Status = (int)value;
+        }
+
+        /// <summary>
+        /// Sets the range values.
+        /// </summary>
+        private void SetRangeValues()
+        {
+            var requestedRange = RequestedRanges[0];
+
+            // If the requested range is "0-", we can optimize by just doing a stream copy
+            if (!requestedRange.Value.HasValue)
+            {
+                RangeEnd = TotalContentLength - 1;
+            }
+            else
+            {
+                RangeEnd = requestedRange.Value.Value;
+            }
+
+            RangeStart = requestedRange.Key;
+            RangeLength = 1 + RangeEnd - RangeStart;
+
+            // Content-Length is the length of what we're serving, not the original content
+            var lengthString = RangeLength.ToString(CultureInfo.InvariantCulture);
+            Headers[HeaderNames.ContentLength] = lengthString;
+            var rangeString = $"bytes {RangeStart}-{RangeEnd}/{TotalContentLength}";
+            Headers[HeaderNames.ContentRange] = rangeString;
 
 
-        public async Task WriteToAsync(IResponse response, CancellationToken cancellationToken)
+            _logger.LogInformation("Setting range response values for {0}. RangeRequest: {1} Content-Length: {2}, Content-Range: {3}", Path, RangeHeader, lengthString, rangeString);
+        }
+
+        public async Task WriteToAsync(HttpResponse response, CancellationToken cancellationToken)
         {
         {
             try
             try
             {
             {
@@ -176,16 +202,16 @@ namespace Emby.Server.Implementations.HttpServer
                 {
                 {
                     var extension = System.IO.Path.GetExtension(path);
                     var extension = System.IO.Path.GetExtension(path);
 
 
-                    if (extension == null || !SkipLogExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
+                    if (extension == null || !_skipLogExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
                     {
                     {
-                        Logger.LogDebug("Transmit file {0}", path);
+                        _logger.LogDebug("Transmit file {0}", path);
                     }
                     }
 
 
                     offset = 0;
                     offset = 0;
                     count = 0;
                     count = 0;
                 }
                 }
 
 
-                await response.TransmitFile(path, offset, count, FileShare, _fileSystem, _streamHelper, cancellationToken).ConfigureAwait(false);
+                await TransmitFile(response.Body, path, offset, count, FileShare, cancellationToken).ConfigureAwait(false);
             }
             }
             finally
             finally
             {
             {
@@ -193,18 +219,32 @@ namespace Emby.Server.Implementations.HttpServer
             }
             }
         }
         }
 
 
-        public string ContentType { get; set; }
-
-        public IRequest RequestContext { get; set; }
+        public async Task TransmitFile(Stream stream, string path, long offset, long count, FileShareMode fileShareMode, CancellationToken cancellationToken)
+        {
+            var fileOpenOptions = FileOpenOptions.SequentialScan;
 
 
-        public object Response { get; set; }
+            // use non-async filestream along with read due to https://github.com/dotnet/corefx/issues/6039
+            if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+            {
+                fileOpenOptions |= FileOpenOptions.Asynchronous;
+            }
 
 
-        public int Status { get; set; }
+            using (var fs = _fileSystem.GetFileStream(path, FileOpenMode.Open, FileAccessMode.Read, fileShareMode, fileOpenOptions))
+            {
+                if (offset > 0)
+                {
+                    fs.Position = offset;
+                }
 
 
-        public HttpStatusCode StatusCode
-        {
-            get => (HttpStatusCode)Status;
-            set => Status = (int)value;
+                if (count > 0)
+                {
+                    await _streamHelper.CopyToAsync(fs, stream, count, cancellationToken).ConfigureAwait(false);
+                }
+                else
+                {
+                    await fs.CopyToAsync(stream, StreamDefaults.DefaultCopyToBufferSize, cancellationToken).ConfigureAwait(false);
+                }
+            }
         }
         }
     }
     }
 }
 }

+ 65 - 182
Emby.Server.Implementations/HttpServer/HttpListenerHost.cs

@@ -5,9 +5,9 @@ using System.IO;
 using System.Linq;
 using System.Linq;
 using System.Net.Sockets;
 using System.Net.Sockets;
 using System.Reflection;
 using System.Reflection;
-using System.Text;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
+using Emby.Server.Implementations.Configuration;
 using Emby.Server.Implementations.Net;
 using Emby.Server.Implementations.Net;
 using Emby.Server.Implementations.Services;
 using Emby.Server.Implementations.Services;
 using MediaBrowser.Common.Extensions;
 using MediaBrowser.Common.Extensions;
@@ -30,11 +30,7 @@ namespace Emby.Server.Implementations.HttpServer
 {
 {
     public class HttpListenerHost : IHttpServer, IDisposable
     public class HttpListenerHost : IHttpServer, IDisposable
     {
     {
-        private string DefaultRedirectPath { get; set; }
-        public string[] UrlPrefixes { get; private set; }
-
-        public event EventHandler<GenericEventArgs<IWebSocketConnection>> WebSocketConnected;
-
+        private readonly ILogger _logger;
         private readonly IServerConfigurationManager _config;
         private readonly IServerConfigurationManager _config;
         private readonly INetworkManager _networkManager;
         private readonly INetworkManager _networkManager;
         private readonly IServerApplicationHost _appHost;
         private readonly IServerApplicationHost _appHost;
@@ -42,18 +38,15 @@ namespace Emby.Server.Implementations.HttpServer
         private readonly IXmlSerializer _xmlSerializer;
         private readonly IXmlSerializer _xmlSerializer;
         private readonly IHttpListener _socketListener;
         private readonly IHttpListener _socketListener;
         private readonly Func<Type, Func<string, object>> _funcParseFn;
         private readonly Func<Type, Func<string, object>> _funcParseFn;
-
-        public Action<IRequest, IResponse, object>[] ResponseFilters { get; set; }
-
+        private readonly string _defaultRedirectPath;
         private readonly Dictionary<Type, Type> ServiceOperationsMap = new Dictionary<Type, Type>();
         private readonly Dictionary<Type, Type> ServiceOperationsMap = new Dictionary<Type, Type>();
-        public static HttpListenerHost Instance { get; protected set; }
-
         private IWebSocketListener[] _webSocketListeners = Array.Empty<IWebSocketListener>();
         private IWebSocketListener[] _webSocketListeners = Array.Empty<IWebSocketListener>();
         private readonly List<IWebSocketConnection> _webSocketConnections = new List<IWebSocketConnection>();
         private readonly List<IWebSocketConnection> _webSocketConnections = new List<IWebSocketConnection>();
+        private bool _disposed = false;
 
 
         public HttpListenerHost(
         public HttpListenerHost(
             IServerApplicationHost applicationHost,
             IServerApplicationHost applicationHost,
-            ILoggerFactory loggerFactory,
+            ILogger<HttpListenerHost> logger,
             IServerConfigurationManager config,
             IServerConfigurationManager config,
             IConfiguration configuration,
             IConfiguration configuration,
             INetworkManager networkManager,
             INetworkManager networkManager,
@@ -62,9 +55,9 @@ namespace Emby.Server.Implementations.HttpServer
             IHttpListener socketListener)
             IHttpListener socketListener)
         {
         {
             _appHost = applicationHost;
             _appHost = applicationHost;
-            Logger = loggerFactory.CreateLogger("HttpServer");
+            _logger = logger;
             _config = config;
             _config = config;
-            DefaultRedirectPath = configuration["HttpListenerHost:DefaultRedirectPath"];
+            _defaultRedirectPath = configuration["HttpListenerHost:DefaultRedirectPath"];
             _networkManager = networkManager;
             _networkManager = networkManager;
             _jsonSerializer = jsonSerializer;
             _jsonSerializer = jsonSerializer;
             _xmlSerializer = xmlSerializer;
             _xmlSerializer = xmlSerializer;
@@ -74,12 +67,20 @@ namespace Emby.Server.Implementations.HttpServer
             _funcParseFn = t => s => JsvReader.GetParseFn(t)(s);
             _funcParseFn = t => s => JsvReader.GetParseFn(t)(s);
 
 
             Instance = this;
             Instance = this;
-            ResponseFilters = Array.Empty<Action<IRequest, IResponse, object>>();
+            ResponseFilters = Array.Empty<Action<IRequest, HttpResponse, object>>();
         }
         }
 
 
+        public Action<IRequest, HttpResponse, object>[] ResponseFilters { get; set; }
+
+        public static HttpListenerHost Instance { get; protected set; }
+
+        public string[] UrlPrefixes { get; private set; }
+
         public string GlobalResponse { get; set; }
         public string GlobalResponse { get; set; }
 
 
-        protected ILogger Logger { get; }
+        public ServiceController ServiceController { get; private set; }
+
+        public event EventHandler<GenericEventArgs<IWebSocketConnection>> WebSocketConnected;
 
 
         public object CreateInstance(Type type)
         public object CreateInstance(Type type)
         {
         {
@@ -91,7 +92,7 @@ namespace Emby.Server.Implementations.HttpServer
         /// and no more processing should be done.
         /// and no more processing should be done.
         /// </summary>
         /// </summary>
         /// <returns></returns>
         /// <returns></returns>
-        public void ApplyRequestFilters(IRequest req, IResponse res, object requestDto)
+        public void ApplyRequestFilters(IRequest req, HttpResponse res, object requestDto)
         {
         {
             //Exec all RequestFilter attributes with Priority < 0
             //Exec all RequestFilter attributes with Priority < 0
             var attributes = GetRequestFilterAttributes(requestDto.GetType());
             var attributes = GetRequestFilterAttributes(requestDto.GetType());
@@ -145,7 +146,7 @@ namespace Emby.Server.Implementations.HttpServer
                 return;
                 return;
             }
             }
 
 
-            var connection = new WebSocketConnection(e.WebSocket, e.Endpoint, _jsonSerializer, Logger)
+            var connection = new WebSocketConnection(e.WebSocket, e.Endpoint, _jsonSerializer, _logger)
             {
             {
                 OnReceive = ProcessWebSocketMessageReceived,
                 OnReceive = ProcessWebSocketMessageReceived,
                 Url = e.Url,
                 Url = e.Url,
@@ -215,16 +216,16 @@ namespace Emby.Server.Implementations.HttpServer
 
 
                 if (logExceptionStackTrace)
                 if (logExceptionStackTrace)
                 {
                 {
-                    Logger.LogError(ex, "Error processing request");
+                    _logger.LogError(ex, "Error processing request");
                 }
                 }
                 else if (logExceptionMessage)
                 else if (logExceptionMessage)
                 {
                 {
-                    Logger.LogError(ex.Message);
+                    _logger.LogError(ex.Message);
                 }
                 }
 
 
                 var httpRes = httpReq.Response;
                 var httpRes = httpReq.Response;
 
 
-                if (httpRes.OriginalResponse.HasStarted)
+                if (httpRes.HasStarted)
                 {
                 {
                     return;
                     return;
                 }
                 }
@@ -233,11 +234,11 @@ namespace Emby.Server.Implementations.HttpServer
                 httpRes.StatusCode = statusCode;
                 httpRes.StatusCode = statusCode;
 
 
                 httpRes.ContentType = "text/html";
                 httpRes.ContentType = "text/html";
-                await Write(httpRes, NormalizeExceptionMessage(ex.Message)).ConfigureAwait(false);
+                await httpRes.WriteAsync(NormalizeExceptionMessage(ex.Message)).ConfigureAwait(false);
             }
             }
             catch (Exception errorEx)
             catch (Exception errorEx)
             {
             {
-                Logger.LogError(errorEx, "Error this.ProcessRequest(context)(Exception while writing error to the response)");
+                _logger.LogError(errorEx, "Error this.ProcessRequest(context)(Exception while writing error to the response)");
             }
             }
         }
         }
 
 
@@ -431,7 +432,7 @@ namespace Emby.Server.Implementations.HttpServer
                 {
                 {
                     httpRes.StatusCode = 503;
                     httpRes.StatusCode = 503;
                     httpRes.ContentType = "text/plain";
                     httpRes.ContentType = "text/plain";
-                    await Write(httpRes, "Server shutting down").ConfigureAwait(false);
+                    await httpRes.WriteAsync("Server shutting down", cancellationToken).ConfigureAwait(false);
                     return;
                     return;
                 }
                 }
 
 
@@ -439,7 +440,7 @@ namespace Emby.Server.Implementations.HttpServer
                 {
                 {
                     httpRes.StatusCode = 400;
                     httpRes.StatusCode = 400;
                     httpRes.ContentType = "text/plain";
                     httpRes.ContentType = "text/plain";
-                    await Write(httpRes, "Invalid host").ConfigureAwait(false);
+                    await httpRes.WriteAsync("Invalid host", cancellationToken).ConfigureAwait(false);
                     return;
                     return;
                 }
                 }
 
 
@@ -447,7 +448,7 @@ namespace Emby.Server.Implementations.HttpServer
                 {
                 {
                     httpRes.StatusCode = 403;
                     httpRes.StatusCode = 403;
                     httpRes.ContentType = "text/plain";
                     httpRes.ContentType = "text/plain";
-                    await Write(httpRes, "Forbidden").ConfigureAwait(false);
+                    await httpRes.WriteAsync("Forbidden", cancellationToken).ConfigureAwait(false);
                     return;
                     return;
                 }
                 }
 
 
@@ -460,101 +461,35 @@ namespace Emby.Server.Implementations.HttpServer
                 if (string.Equals(httpReq.Verb, "OPTIONS", StringComparison.OrdinalIgnoreCase))
                 if (string.Equals(httpReq.Verb, "OPTIONS", StringComparison.OrdinalIgnoreCase))
                 {
                 {
                     httpRes.StatusCode = 200;
                     httpRes.StatusCode = 200;
-                    httpRes.AddHeader("Access-Control-Allow-Origin", "*");
-                    httpRes.AddHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, PATCH, OPTIONS");
-                    httpRes.AddHeader("Access-Control-Allow-Headers", "Content-Type, Authorization, Range, X-MediaBrowser-Token, X-Emby-Authorization");
+                    httpRes.Headers.Add("Access-Control-Allow-Origin", "*");
+                    httpRes.Headers.Add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, PATCH, OPTIONS");
+                    httpRes.Headers.Add("Access-Control-Allow-Headers", "Content-Type, Authorization, Range, X-MediaBrowser-Token, X-Emby-Authorization");
                     httpRes.ContentType = "text/plain";
                     httpRes.ContentType = "text/plain";
-                    await Write(httpRes, string.Empty).ConfigureAwait(false);
+                    await httpRes.WriteAsync(string.Empty, cancellationToken).ConfigureAwait(false);
                     return;
                     return;
                 }
                 }
 
 
                 urlToLog = GetUrlToLog(urlString);
                 urlToLog = GetUrlToLog(urlString);
-                Logger.LogDebug("HTTP {HttpMethod} {Url} UserAgent: {UserAgent} \nHeaders: {@Headers}", urlToLog, httpReq.UserAgent ?? string.Empty, httpReq.HttpMethod, httpReq.Headers);
-
-                if (string.Equals(localPath, "/emby/", StringComparison.OrdinalIgnoreCase) ||
-                    string.Equals(localPath, "/mediabrowser/", StringComparison.OrdinalIgnoreCase))
-                {
-                    RedirectToUrl(httpRes, DefaultRedirectPath);
-                    return;
-                }
 
 
-                if (string.Equals(localPath, "/emby", StringComparison.OrdinalIgnoreCase) ||
-                    string.Equals(localPath, "/mediabrowser", StringComparison.OrdinalIgnoreCase))
+                if (string.Equals(localPath, "/" + _config.Configuration.BaseUrl + "/", StringComparison.OrdinalIgnoreCase)
+                    || string.Equals(localPath, "/" + _config.Configuration.BaseUrl, StringComparison.OrdinalIgnoreCase))
                 {
                 {
-                    RedirectToUrl(httpRes, "emby/" + DefaultRedirectPath);
-                    return;
-                }
-
-                if (localPath.IndexOf("mediabrowser/web", StringComparison.OrdinalIgnoreCase) != -1)
-                {
-                    httpRes.StatusCode = 200;
-                    httpRes.ContentType = "text/html";
-                    var newUrl = urlString.Replace("mediabrowser", "emby", StringComparison.OrdinalIgnoreCase)
-                        .Replace("/dashboard/", "/web/", StringComparison.OrdinalIgnoreCase);
-
-                    if (!string.Equals(newUrl, urlString, StringComparison.OrdinalIgnoreCase))
-                    {
-                        await Write(httpRes,
-                            "<!doctype html><html><head><title>Emby</title></head><body>Please update your Emby bookmark to <a href=\"" +
-                            newUrl + "\">" + newUrl + "</a></body></html>").ConfigureAwait(false);
-                        return;
-                    }
-                }
-
-                if (localPath.IndexOf("dashboard/", StringComparison.OrdinalIgnoreCase) != -1 &&
-                    localPath.IndexOf("web/dashboard", StringComparison.OrdinalIgnoreCase) == -1)
-                {
-                    httpRes.StatusCode = 200;
-                    httpRes.ContentType = "text/html";
-                    var newUrl = urlString.Replace("mediabrowser", "emby", StringComparison.OrdinalIgnoreCase)
-                        .Replace("/dashboard/", "/web/", StringComparison.OrdinalIgnoreCase);
-
-                    if (!string.Equals(newUrl, urlString, StringComparison.OrdinalIgnoreCase))
-                    {
-                        await Write(httpRes,
-                            "<!doctype html><html><head><title>Emby</title></head><body>Please update your Emby bookmark to <a href=\"" +
-                            newUrl + "\">" + newUrl + "</a></body></html>").ConfigureAwait(false);
-                        return;
-                    }
-                }
-
-                if (string.Equals(localPath, "/web", StringComparison.OrdinalIgnoreCase))
-                {
-                    RedirectToUrl(httpRes, DefaultRedirectPath);
-                    return;
-                }
-
-                if (string.Equals(localPath, "/web/", StringComparison.OrdinalIgnoreCase))
-                {
-                    RedirectToUrl(httpRes, "../" + DefaultRedirectPath);
+                    httpRes.Redirect("/" + _config.Configuration.BaseUrl + "/" + _defaultRedirectPath);
                     return;
                     return;
                 }
                 }
 
 
                 if (string.Equals(localPath, "/", StringComparison.OrdinalIgnoreCase))
                 if (string.Equals(localPath, "/", StringComparison.OrdinalIgnoreCase))
                 {
                 {
-                    RedirectToUrl(httpRes, DefaultRedirectPath);
+                    httpRes.Redirect(_defaultRedirectPath);
                     return;
                     return;
                 }
                 }
 
 
                 if (string.IsNullOrEmpty(localPath))
                 if (string.IsNullOrEmpty(localPath))
                 {
                 {
-                    RedirectToUrl(httpRes, "/" + DefaultRedirectPath);
+                    httpRes.Redirect("/" + _defaultRedirectPath);
                     return;
                     return;
                 }
                 }
 
 
-                if (!string.Equals(httpReq.QueryString["r"], "0", StringComparison.OrdinalIgnoreCase))
-                {
-                    if (localPath.EndsWith("web/dashboard.html", StringComparison.OrdinalIgnoreCase))
-                    {
-                        RedirectToUrl(httpRes, "index.html#!/dashboard.html");
-                    }
-
-                    if (localPath.EndsWith("web/home.html", StringComparison.OrdinalIgnoreCase))
-                    {
-                        RedirectToUrl(httpRes, "index.html");
-                    }
-                }
-
                 if (!string.IsNullOrEmpty(GlobalResponse))
                 if (!string.IsNullOrEmpty(GlobalResponse))
                 {
                 {
                     // We don't want the address pings in ApplicationHost to fail
                     // We don't want the address pings in ApplicationHost to fail
@@ -562,16 +497,15 @@ namespace Emby.Server.Implementations.HttpServer
                     {
                     {
                         httpRes.StatusCode = 503;
                         httpRes.StatusCode = 503;
                         httpRes.ContentType = "text/html";
                         httpRes.ContentType = "text/html";
-                        await Write(httpRes, GlobalResponse).ConfigureAwait(false);
+                        await httpRes.WriteAsync(GlobalResponse, cancellationToken).ConfigureAwait(false);
                         return;
                         return;
                     }
                     }
                 }
                 }
 
 
                 var handler = GetServiceHandler(httpReq);
                 var handler = GetServiceHandler(httpReq);
-
                 if (handler != null)
                 if (handler != null)
                 {
                 {
-                    await handler.ProcessRequestAsync(this, httpReq, httpRes, Logger, cancellationToken).ConfigureAwait(false);
+                    await handler.ProcessRequestAsync(this, httpReq, httpRes, _logger, cancellationToken).ConfigureAwait(false);
                 }
                 }
                 else
                 else
                 {
                 {
@@ -598,11 +532,7 @@ namespace Emby.Server.Implementations.HttpServer
                 var elapsed = stopWatch.Elapsed;
                 var elapsed = stopWatch.Elapsed;
                 if (elapsed.TotalMilliseconds > 500)
                 if (elapsed.TotalMilliseconds > 500)
                 {
                 {
-                    Logger.LogWarning("HTTP Response {StatusCode} to {RemoteIp}. Time (slow): {Elapsed:g}. {Url}", httpRes.StatusCode, remoteIp, elapsed, urlToLog);
-                }
-                else
-                {
-                    Logger.LogDebug("HTTP Response {StatusCode} to {RemoteIp}. Time: {Elapsed:g}. {Url}", httpRes.StatusCode, remoteIp, elapsed, urlToLog);
+                    _logger.LogWarning("HTTP Response {StatusCode} to {RemoteIp}. Time (slow): {Elapsed:g}. {Url}", httpRes.StatusCode, remoteIp, elapsed, urlToLog);
                 }
                 }
             }
             }
         }
         }
@@ -619,18 +549,11 @@ namespace Emby.Server.Implementations.HttpServer
                 return new ServiceHandler(restPath, contentType);
                 return new ServiceHandler(restPath, contentType);
             }
             }
 
 
-            Logger.LogError("Could not find handler for {PathInfo}", pathInfo);
+            _logger.LogError("Could not find handler for {PathInfo}", pathInfo);
             return null;
             return null;
         }
         }
 
 
-        private static Task Write(IResponse response, string text)
-        {
-            var bOutput = Encoding.UTF8.GetBytes(text);
-            response.OriginalResponse.ContentLength = bOutput.Length;
-            return response.OutputStream.WriteAsync(bOutput, 0, bOutput.Length);
-        }
-
-        private void RedirectToSecureUrl(IHttpRequest httpReq, IResponse httpRes, string url)
+        private void RedirectToSecureUrl(IHttpRequest httpReq, HttpResponse httpRes, string url)
         {
         {
             if (Uri.TryCreate(url, UriKind.Absolute, out Uri uri))
             if (Uri.TryCreate(url, UriKind.Absolute, out Uri uri))
             {
             {
@@ -640,23 +563,11 @@ namespace Emby.Server.Implementations.HttpServer
                     Scheme = "https"
                     Scheme = "https"
                 };
                 };
                 url = builder.Uri.ToString();
                 url = builder.Uri.ToString();
-
-                RedirectToUrl(httpRes, url);
-            }
-            else
-            {
-                RedirectToUrl(httpRes, url);
             }
             }
-        }
 
 
-        public static void RedirectToUrl(IResponse httpRes, string url)
-        {
-            httpRes.StatusCode = 302;
-            httpRes.AddHeader("Location", url);
+            httpRes.Redirect(url);
         }
         }
 
 
-        public ServiceController ServiceController { get; private set; }
-
         /// <summary>
         /// <summary>
         /// Adds the rest handlers.
         /// Adds the rest handlers.
         /// </summary>
         /// </summary>
@@ -672,9 +583,9 @@ namespace Emby.Server.Implementations.HttpServer
             var types = services.Select(r => r.GetType());
             var types = services.Select(r => r.GetType());
             ServiceController.Init(this, types);
             ServiceController.Init(this, types);
 
 
-            ResponseFilters = new Action<IRequest, IResponse, object>[]
+            ResponseFilters = new Action<IRequest, HttpResponse, object>[]
             {
             {
-                new ResponseFilter(Logger).FilterResponse
+                new ResponseFilter(_logger).FilterResponse
             };
             };
         }
         }
 
 
@@ -685,22 +596,14 @@ namespace Emby.Server.Implementations.HttpServer
 
 
             foreach (var route in clone)
             foreach (var route in clone)
             {
             {
-                routes.Add(new RouteAttribute(NormalizeEmbyRoutePath(route.Path), route.Verbs)
+                routes.Add(new RouteAttribute(NormalizeCustomRoutePath(_config.Configuration.BaseUrl, route.Path), route.Verbs)
                 {
                 {
                     Notes = route.Notes,
                     Notes = route.Notes,
                     Priority = route.Priority,
                     Priority = route.Priority,
                     Summary = route.Summary
                     Summary = route.Summary
                 });
                 });
 
 
-                routes.Add(new RouteAttribute(NormalizeMediaBrowserRoutePath(route.Path), route.Verbs)
-                {
-                    Notes = route.Notes,
-                    Priority = route.Priority,
-                    Summary = route.Summary
-                });
-
-                // needed because apps add /emby, and some users also add /emby, thereby double prefixing
-                routes.Add(new RouteAttribute(DoubleNormalizeEmbyRoutePath(route.Path), route.Verbs)
+                routes.Add(new RouteAttribute(NormalizeOldRoutePath(route.Path), route.Verbs)
                 {
                 {
                     Notes = route.Notes,
                     Notes = route.Notes,
                     Priority = route.Priority,
                     Priority = route.Priority,
@@ -741,8 +644,8 @@ namespace Emby.Server.Implementations.HttpServer
             return _socketListener.ProcessWebSocketRequest(context);
             return _socketListener.ProcessWebSocketRequest(context);
         }
         }
 
 
-        //TODO Add Jellyfin Route Path Normalizer
-        private static string NormalizeEmbyRoutePath(string path)
+        // this method was left for compatibility with third party clients
+        private static string NormalizeOldRoutePath(string path)
         {
         {
             if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase))
             if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase))
             {
             {
@@ -752,44 +655,33 @@ namespace Emby.Server.Implementations.HttpServer
             return "emby/" + path;
             return "emby/" + path;
         }
         }
 
 
-        private static string NormalizeMediaBrowserRoutePath(string path)
+        private static string NormalizeCustomRoutePath(string baseUrl, string path)
         {
         {
             if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase))
             if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase))
             {
             {
-                return "/mediabrowser" + path;
+                return "/" + baseUrl + path;
             }
             }
 
 
-            return "mediabrowser/" + path;
+            return baseUrl + "/" + path;
         }
         }
 
 
-        private static string DoubleNormalizeEmbyRoutePath(string path)
+        /// <inheritdoc />
+        public void Dispose()
         {
         {
-            if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase))
-            {
-                return "/emby/emby" + path;
-            }
-
-            return "emby/emby/" + path;
+            Dispose(true);
+            GC.SuppressFinalize(this);
         }
         }
 
 
-        private bool _disposed;
-        private readonly object _disposeLock = new object();
-
         protected virtual void Dispose(bool disposing)
         protected virtual void Dispose(bool disposing)
         {
         {
             if (_disposed) return;
             if (_disposed) return;
 
 
-            lock (_disposeLock)
+            if (disposing)
             {
             {
-                if (_disposed) return;
-
-                _disposed = true;
-
-                if (disposing)
-                {
-                    Stop();
-                }
+                Stop();
             }
             }
+
+            _disposed = true;
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -803,26 +695,17 @@ namespace Emby.Server.Implementations.HttpServer
                 return Task.CompletedTask;
                 return Task.CompletedTask;
             }
             }
 
 
-            Logger.LogDebug("Websocket message received: {0}", result.MessageType);
+            _logger.LogDebug("Websocket message received: {0}", result.MessageType);
 
 
-            var tasks = _webSocketListeners.Select(i => Task.Run(async () =>
+            IEnumerable<Task> GetTasks()
             {
             {
-                try
+                foreach (var x in _webSocketListeners)
                 {
                 {
-                    await i.ProcessMessage(result).ConfigureAwait(false);
+                    yield return x.ProcessMessageAsync(result);
                 }
                 }
-                catch (Exception ex)
-                {
-                    Logger.LogError(ex, "{0} failed processing WebSocket message {1}", i.GetType().Name, result.MessageType ?? string.Empty);
-                }
-            }));
-
-            return Task.WhenAll(tasks);
-        }
+            }
 
 
-        public void Dispose()
-        {
-            Dispose(true);
+            return Task.WhenAll(GetTasks());
         }
         }
     }
     }
 }
 }

+ 15 - 11
Emby.Server.Implementations/HttpServer/ResponseFilter.cs

@@ -2,6 +2,7 @@ using System;
 using System.Globalization;
 using System.Globalization;
 using System.Text;
 using System.Text;
 using MediaBrowser.Model.Services;
 using MediaBrowser.Model.Services;
+using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Logging;
 using Microsoft.Net.Http.Headers;
 using Microsoft.Net.Http.Headers;
 
 
@@ -9,7 +10,7 @@ namespace Emby.Server.Implementations.HttpServer
 {
 {
     public class ResponseFilter
     public class ResponseFilter
     {
     {
-        private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
+        private static readonly CultureInfo _usCulture = CultureInfo.ReadOnly(new CultureInfo("en-US"));
         private readonly ILogger _logger;
         private readonly ILogger _logger;
 
 
         public ResponseFilter(ILogger logger)
         public ResponseFilter(ILogger logger)
@@ -23,12 +24,12 @@ namespace Emby.Server.Implementations.HttpServer
         /// <param name="req">The req.</param>
         /// <param name="req">The req.</param>
         /// <param name="res">The res.</param>
         /// <param name="res">The res.</param>
         /// <param name="dto">The dto.</param>
         /// <param name="dto">The dto.</param>
-        public void FilterResponse(IRequest req, IResponse res, object dto)
+        public void FilterResponse(IRequest req, HttpResponse res, object dto)
         {
         {
             // Try to prevent compatibility view
             // Try to prevent compatibility view
-            res.AddHeader("Access-Control-Allow-Headers", "Accept, Accept-Language, Authorization, Cache-Control, Content-Disposition, Content-Encoding, Content-Language, Content-Length, Content-MD5, Content-Range, Content-Type, Date, Host, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, Origin, OriginToken, Pragma, Range, Slug, Transfer-Encoding, Want-Digest, X-MediaBrowser-Token, X-Emby-Authorization");
-            res.AddHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, PATCH, OPTIONS");
-            res.AddHeader("Access-Control-Allow-Origin", "*");
+            res.Headers.Add("Access-Control-Allow-Headers", "Accept, Accept-Language, Authorization, Cache-Control, Content-Disposition, Content-Encoding, Content-Language, Content-Length, Content-MD5, Content-Range, Content-Type, Date, Host, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, Origin, OriginToken, Pragma, Range, Slug, Transfer-Encoding, Want-Digest, X-MediaBrowser-Token, X-Emby-Authorization");
+            res.Headers.Add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, PATCH, OPTIONS");
+            res.Headers.Add("Access-Control-Allow-Origin", "*");
 
 
             if (dto is Exception exception)
             if (dto is Exception exception)
             {
             {
@@ -39,7 +40,7 @@ namespace Emby.Server.Implementations.HttpServer
                     var error = exception.Message.Replace(Environment.NewLine, " ");
                     var error = exception.Message.Replace(Environment.NewLine, " ");
                     error = RemoveControlCharacters(error);
                     error = RemoveControlCharacters(error);
 
 
-                    res.AddHeader("X-Application-Error-Code", error);
+                    res.Headers.Add("X-Application-Error-Code", error);
                 }
                 }
             }
             }
 
 
@@ -54,12 +55,11 @@ namespace Emby.Server.Implementations.HttpServer
                 if (hasHeaders.Headers.TryGetValue(HeaderNames.ContentLength, out string contentLength)
                 if (hasHeaders.Headers.TryGetValue(HeaderNames.ContentLength, out string contentLength)
                     && !string.IsNullOrEmpty(contentLength))
                     && !string.IsNullOrEmpty(contentLength))
                 {
                 {
-                    var length = long.Parse(contentLength, UsCulture);
+                    var length = long.Parse(contentLength, _usCulture);
 
 
                     if (length > 0)
                     if (length > 0)
                     {
                     {
-                        res.OriginalResponse.ContentLength = length;
-                        res.SendChunked = false;
+                        res.ContentLength = length;
                     }
                     }
                 }
                 }
             }
             }
@@ -72,9 +72,12 @@ namespace Emby.Server.Implementations.HttpServer
         /// <returns>System.String.</returns>
         /// <returns>System.String.</returns>
         public static string RemoveControlCharacters(string inString)
         public static string RemoveControlCharacters(string inString)
         {
         {
-            if (inString == null) return null;
+            if (inString == null)
+            {
+                return null;
+            }
 
 
-            var newString = new StringBuilder();
+            var newString = new StringBuilder(inString.Length);
 
 
             foreach (var ch in inString)
             foreach (var ch in inString)
             {
             {
@@ -83,6 +86,7 @@ namespace Emby.Server.Implementations.HttpServer
                     newString.Append(ch);
                     newString.Append(ch);
                 }
                 }
             }
             }
+
             return newString.ToString();
             return newString.ToString();
         }
         }
     }
     }

+ 23 - 25
Emby.Server.Implementations/HttpServer/Security/AuthService.cs

@@ -3,7 +3,6 @@ using System.Linq;
 using MediaBrowser.Common.Net;
 using MediaBrowser.Common.Net;
 using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities;
-using MediaBrowser.Controller.Library;
 using MediaBrowser.Controller.Net;
 using MediaBrowser.Controller.Net;
 using MediaBrowser.Controller.Security;
 using MediaBrowser.Controller.Security;
 using MediaBrowser.Controller.Session;
 using MediaBrowser.Controller.Session;
@@ -13,28 +12,23 @@ namespace Emby.Server.Implementations.HttpServer.Security
 {
 {
     public class AuthService : IAuthService
     public class AuthService : IAuthService
     {
     {
+        private readonly IAuthorizationContext _authorizationContext;
+        private readonly ISessionManager _sessionManager;
         private readonly IServerConfigurationManager _config;
         private readonly IServerConfigurationManager _config;
+        private readonly INetworkManager _networkManager;
 
 
-        public AuthService(IUserManager userManager, IAuthorizationContext authorizationContext, IServerConfigurationManager config, ISessionManager sessionManager, INetworkManager networkManager)
+        public AuthService(
+            IAuthorizationContext authorizationContext,
+            IServerConfigurationManager config,
+            ISessionManager sessionManager,
+            INetworkManager networkManager)
         {
         {
-            AuthorizationContext = authorizationContext;
+            _authorizationContext = authorizationContext;
             _config = config;
             _config = config;
-            SessionManager = sessionManager;
-            UserManager = userManager;
-            NetworkManager = networkManager;
+            _sessionManager = sessionManager;
+            _networkManager = networkManager;
         }
         }
 
 
-        public IUserManager UserManager { get; private set; }
-        public IAuthorizationContext AuthorizationContext { get; private set; }
-        public ISessionManager SessionManager { get; private set; }
-        public INetworkManager NetworkManager { get; private set; }
-
-        /// <summary>
-        /// Redirect the client to a specific URL if authentication failed.
-        /// If this property is null, simply `401 Unauthorized` is returned.
-        /// </summary>
-        public string HtmlRedirect { get; set; }
-
         public void Authenticate(IRequest request, IAuthenticationAttributes authAttribtues)
         public void Authenticate(IRequest request, IAuthenticationAttributes authAttribtues)
         {
         {
             ValidateUser(request, authAttribtues);
             ValidateUser(request, authAttribtues);
@@ -43,7 +37,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
         private void ValidateUser(IRequest request, IAuthenticationAttributes authAttribtues)
         private void ValidateUser(IRequest request, IAuthenticationAttributes authAttribtues)
         {
         {
             // This code is executed before the service
             // This code is executed before the service
-            var auth = AuthorizationContext.GetAuthorizationInfo(request);
+            var auth = _authorizationContext.GetAuthorizationInfo(request);
 
 
             if (!IsExemptFromAuthenticationToken(authAttribtues, request))
             if (!IsExemptFromAuthenticationToken(authAttribtues, request))
             {
             {
@@ -80,7 +74,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
                 !string.IsNullOrEmpty(auth.Client) &&
                 !string.IsNullOrEmpty(auth.Client) &&
                 !string.IsNullOrEmpty(auth.Device))
                 !string.IsNullOrEmpty(auth.Device))
             {
             {
-                SessionManager.LogSessionActivity(auth.Client,
+                _sessionManager.LogSessionActivity(auth.Client,
                     auth.Version,
                     auth.Version,
                     auth.DeviceId,
                     auth.DeviceId,
                     auth.Device,
                     auth.Device,
@@ -89,7 +83,9 @@ namespace Emby.Server.Implementations.HttpServer.Security
             }
             }
         }
         }
 
 
-        private void ValidateUserAccess(User user, IRequest request,
+        private void ValidateUserAccess(
+            User user,
+            IRequest request,
             IAuthenticationAttributes authAttribtues,
             IAuthenticationAttributes authAttribtues,
             AuthorizationInfo auth)
             AuthorizationInfo auth)
         {
         {
@@ -101,7 +97,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
                 };
                 };
             }
             }
 
 
-            if (!user.Policy.EnableRemoteAccess && !NetworkManager.IsInLocalNetwork(request.RemoteIp))
+            if (!user.Policy.EnableRemoteAccess && !_networkManager.IsInLocalNetwork(request.RemoteIp))
             {
             {
                 throw new SecurityException("User account has been disabled.")
                 throw new SecurityException("User account has been disabled.")
                 {
                 {
@@ -109,11 +105,11 @@ namespace Emby.Server.Implementations.HttpServer.Security
                 };
                 };
             }
             }
 
 
-            if (!user.Policy.IsAdministrator &&
-                !authAttribtues.EscapeParentalControl &&
-                !user.IsParentalScheduleAllowed())
+            if (!user.Policy.IsAdministrator
+                && !authAttribtues.EscapeParentalControl
+                && !user.IsParentalScheduleAllowed())
             {
             {
-                request.Response.AddHeader("X-Application-Error-Code", "ParentalControl");
+                request.Response.Headers.Add("X-Application-Error-Code", "ParentalControl");
 
 
                 throw new SecurityException("This user account is not allowed access at this time.")
                 throw new SecurityException("This user account is not allowed access at this time.")
                 {
                 {
@@ -183,6 +179,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
                     };
                     };
                 }
                 }
             }
             }
+
             if (roles.Contains("delete", StringComparer.OrdinalIgnoreCase))
             if (roles.Contains("delete", StringComparer.OrdinalIgnoreCase))
             {
             {
                 if (user == null || !user.Policy.EnableContentDeletion)
                 if (user == null || !user.Policy.EnableContentDeletion)
@@ -193,6 +190,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
                     };
                     };
                 }
                 }
             }
             }
+
             if (roles.Contains("download", StringComparer.OrdinalIgnoreCase))
             if (roles.Contains("download", StringComparer.OrdinalIgnoreCase))
             {
             {
                 if (user == null || !user.Policy.EnableContentDownloading)
                 if (user == null || !user.Policy.EnableContentDownloading)

+ 9 - 17
Emby.Server.Implementations/IO/IsoManager.cs

@@ -1,5 +1,6 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Linq;
 using System.Linq;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
@@ -8,12 +9,12 @@ using MediaBrowser.Model.IO;
 namespace Emby.Server.Implementations.IO
 namespace Emby.Server.Implementations.IO
 {
 {
     /// <summary>
     /// <summary>
-    /// Class IsoManager
+    /// Class IsoManager.
     /// </summary>
     /// </summary>
     public class IsoManager : IIsoManager
     public class IsoManager : IIsoManager
     {
     {
         /// <summary>
         /// <summary>
-        /// The _mounters
+        /// The _mounters.
         /// </summary>
         /// </summary>
         private readonly List<IIsoMounter> _mounters = new List<IIsoMounter>();
         private readonly List<IIsoMounter> _mounters = new List<IIsoMounter>();
 
 
@@ -22,9 +23,7 @@ namespace Emby.Server.Implementations.IO
         /// </summary>
         /// </summary>
         /// <param name="isoPath">The iso path.</param>
         /// <param name="isoPath">The iso path.</param>
         /// <param name="cancellationToken">The cancellation token.</param>
         /// <param name="cancellationToken">The cancellation token.</param>
-        /// <returns>IsoMount.</returns>
-        /// <exception cref="ArgumentNullException">isoPath</exception>
-        /// <exception cref="ArgumentException"></exception>
+        /// <returns><see creaf="IsoMount" />.</returns>
         public Task<IIsoMount> Mount(string isoPath, CancellationToken cancellationToken)
         public Task<IIsoMount> Mount(string isoPath, CancellationToken cancellationToken)
         {
         {
             if (string.IsNullOrEmpty(isoPath))
             if (string.IsNullOrEmpty(isoPath))
@@ -36,7 +35,11 @@ namespace Emby.Server.Implementations.IO
 
 
             if (mounter == null)
             if (mounter == null)
             {
             {
-                throw new ArgumentException(string.Format("No mounters are able to mount {0}", isoPath));
+                throw new ArgumentException(
+                    string.Format(
+                        CultureInfo.InvariantCulture,
+                        "No mounters are able to mount {0}",
+                        isoPath));
             }
             }
 
 
             return mounter.Mount(isoPath, cancellationToken);
             return mounter.Mount(isoPath, cancellationToken);
@@ -60,16 +63,5 @@ namespace Emby.Server.Implementations.IO
         {
         {
             _mounters.AddRange(mounters);
             _mounters.AddRange(mounters);
         }
         }
-
-        /// <summary>
-        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
-        /// </summary>
-        public void Dispose()
-        {
-            foreach (var mounter in _mounters)
-            {
-                mounter.Dispose();
-            }
-        }
     }
     }
 }
 }

+ 8 - 11
Emby.Server.Implementations/IO/ManagedFileSystem.cs

@@ -1,5 +1,6 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Globalization;
 using System.Diagnostics;
 using System.Diagnostics;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
@@ -20,16 +21,14 @@ namespace Emby.Server.Implementations.IO
         protected ILogger Logger;
         protected ILogger Logger;
 
 
         private readonly List<IShortcutHandler> _shortcutHandlers = new List<IShortcutHandler>();
         private readonly List<IShortcutHandler> _shortcutHandlers = new List<IShortcutHandler>();
-
         private readonly string _tempPath;
         private readonly string _tempPath;
-
         private readonly bool _isEnvironmentCaseInsensitive;
         private readonly bool _isEnvironmentCaseInsensitive;
 
 
         public ManagedFileSystem(
         public ManagedFileSystem(
-            ILoggerFactory loggerFactory,
+            ILogger<ManagedFileSystem> logger,
             IApplicationPaths applicationPaths)
             IApplicationPaths applicationPaths)
         {
         {
-            Logger = loggerFactory.CreateLogger("FileSystem");
+            Logger = logger;
             _tempPath = applicationPaths.TempDirectory;
             _tempPath = applicationPaths.TempDirectory;
 
 
             _isEnvironmentCaseInsensitive = OperatingSystem.Id == OperatingSystemId.Windows;
             _isEnvironmentCaseInsensitive = OperatingSystem.Id == OperatingSystemId.Windows;
@@ -557,7 +556,7 @@ namespace Emby.Server.Implementations.IO
                 throw new ArgumentNullException(nameof(file2));
                 throw new ArgumentNullException(nameof(file2));
             }
             }
 
 
-            var temp1 = Path.Combine(_tempPath, Guid.NewGuid().ToString("N"));
+            var temp1 = Path.Combine(_tempPath, Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture));
 
 
             // Copying over will fail against hidden files
             // Copying over will fail against hidden files
             SetHidden(file1, false);
             SetHidden(file1, false);
@@ -647,7 +646,6 @@ namespace Emby.Server.Implementations.IO
         public virtual bool IsPathFile(string path)
         public virtual bool IsPathFile(string path)
         {
         {
             // Cannot use Path.IsPathRooted because it returns false under mono when using windows-based paths, e.g. C:\\
             // Cannot use Path.IsPathRooted because it returns false under mono when using windows-based paths, e.g. C:\\
-
             if (path.IndexOf("://", StringComparison.OrdinalIgnoreCase) != -1 &&
             if (path.IndexOf("://", StringComparison.OrdinalIgnoreCase) != -1 &&
                 !path.StartsWith("file://", StringComparison.OrdinalIgnoreCase))
                 !path.StartsWith("file://", StringComparison.OrdinalIgnoreCase))
             {
             {
@@ -655,8 +653,6 @@ namespace Emby.Server.Implementations.IO
             }
             }
 
 
             return true;
             return true;
-
-            //return Path.IsPathRooted(path);
         }
         }
 
 
         public virtual void DeleteFile(string path)
         public virtual void DeleteFile(string path)
@@ -667,13 +663,14 @@ namespace Emby.Server.Implementations.IO
 
 
         public virtual List<FileSystemMetadata> GetDrives()
         public virtual List<FileSystemMetadata> GetDrives()
         {
         {
-            // Only include drives in the ready state or this method could end up being very slow, waiting for drives to timeout
-            return DriveInfo.GetDrives().Where(d => d.IsReady).Select(d => new FileSystemMetadata
+            // check for ready state to avoid waiting for drives to timeout
+            // some drives on linux have no actual size or are used for other purposes
+            return DriveInfo.GetDrives().Where(d => d.IsReady && d.TotalSize != 0 && d.DriveType != DriveType.Ram)
+                .Select(d => new FileSystemMetadata
             {
             {
                 Name = d.Name,
                 Name = d.Name,
                 FullName = d.RootDirectory.FullName,
                 FullName = d.RootDirectory.FullName,
                 IsDirectory = true
                 IsDirectory = true
-
             }).ToList();
             }).ToList();
         }
         }
 
 

Vissa filer visades inte eftersom för många filer har ändrats