浏览代码

Make files readonly

Stepan Goremykin 1 年之前
父节点
当前提交
526f9a825c

+ 2 - 2
Emby.Dlna/PlayTo/PlayToManager.cs

@@ -39,9 +39,9 @@ namespace Emby.Dlna.PlayTo
         private readonly IMediaSourceManager _mediaSourceManager;
         private readonly IMediaSourceManager _mediaSourceManager;
         private readonly IMediaEncoder _mediaEncoder;
         private readonly IMediaEncoder _mediaEncoder;
 
 
+        private readonly SemaphoreSlim _sessionLock = new SemaphoreSlim(1, 1);
+        private readonly CancellationTokenSource _disposeCancellationTokenSource = new CancellationTokenSource();
         private bool _disposed;
         private bool _disposed;
-        private SemaphoreSlim _sessionLock = new SemaphoreSlim(1, 1);
-        private CancellationTokenSource _disposeCancellationTokenSource = new CancellationTokenSource();
 
 
         public PlayToManager(ILogger logger, ISessionManager sessionManager, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IServerApplicationHost appHost, IImageProcessor imageProcessor, IDeviceDiscovery deviceDiscovery, IHttpClientFactory httpClientFactory, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, IMediaEncoder mediaEncoder)
         public PlayToManager(ILogger logger, ISessionManager sessionManager, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IServerApplicationHost appHost, IImageProcessor imageProcessor, IDeviceDiscovery deviceDiscovery, IHttpClientFactory httpClientFactory, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, IMediaEncoder mediaEncoder)
         {
         {

+ 2 - 4
Emby.Server.Implementations/AppBase/BaseApplicationPaths.cs

@@ -10,8 +10,6 @@ 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>
@@ -33,7 +31,7 @@ namespace Emby.Server.Implementations.AppBase
             CachePath = cacheDirectoryPath;
             CachePath = cacheDirectoryPath;
             WebPath = webDirectoryPath;
             WebPath = webDirectoryPath;
 
 
-            _dataPath = Directory.CreateDirectory(Path.Combine(ProgramDataPath, "data")).FullName;
+            DataPath = Directory.CreateDirectory(Path.Combine(ProgramDataPath, "data")).FullName;
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -55,7 +53,7 @@ namespace Emby.Server.Implementations.AppBase
         /// 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>
-        public string DataPath => _dataPath;
+        public string DataPath { get; }
 
 
         /// <inheritdoc />
         /// <inheritdoc />
         public string VirtualDataPath => "%AppDataPath%";
         public string VirtualDataPath => "%AppDataPath%";

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

@@ -40,9 +40,9 @@ namespace Emby.Server.Implementations.EntryPoints
         /// <summary>
         /// <summary>
         /// The UDP server.
         /// The UDP server.
         /// </summary>
         /// </summary>
-        private List<UdpServer> _udpServers;
-        private CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
-        private bool _disposed = false;
+        private readonly List<UdpServer> _udpServers;
+        private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
+        private bool _disposed;
 
 
         /// <summary>
         /// <summary>
         /// Initializes a new instance of the <see cref="UdpServerEntryPoint" /> class.
         /// Initializes a new instance of the <see cref="UdpServerEntryPoint" /> class.

+ 1 - 1
MediaBrowser.Controller/LiveTv/LiveTvProgram.cs

@@ -20,7 +20,7 @@ namespace MediaBrowser.Controller.LiveTv
 {
 {
     public class LiveTvProgram : BaseItem, IHasLookupInfo<ItemLookupInfo>, IHasStartDate, IHasProgramAttributes
     public class LiveTvProgram : BaseItem, IHasLookupInfo<ItemLookupInfo>, IHasStartDate, IHasProgramAttributes
     {
     {
-        private static string EmbyServiceName = "Emby";
+        private const string EmbyServiceName = "Emby";
 
 
         public LiveTvProgram()
         public LiveTvProgram()
         {
         {

+ 1 - 1
MediaBrowser.Controller/Net/BasePeriodicWebSocketListener.cs

@@ -34,7 +34,7 @@ namespace MediaBrowser.Controller.Net
         /// <summary>
         /// <summary>
         /// The logger.
         /// The logger.
         /// </summary>
         /// </summary>
-        protected ILogger<BasePeriodicWebSocketListener<TReturnDataType, TStateType>> Logger;
+        protected readonly ILogger<BasePeriodicWebSocketListener<TReturnDataType, TStateType>> Logger;
 
 
         protected BasePeriodicWebSocketListener(ILogger<BasePeriodicWebSocketListener<TReturnDataType, TStateType>> logger)
         protected BasePeriodicWebSocketListener(ILogger<BasePeriodicWebSocketListener<TReturnDataType, TStateType>> logger)
         {
         {

+ 1 - 1
MediaBrowser.MediaEncoding/BdInfo/BdInfoFileInfo.cs

@@ -8,7 +8,7 @@ namespace MediaBrowser.MediaEncoding.BdInfo;
 /// </summary>
 /// </summary>
 public class BdInfoFileInfo : BDInfo.IO.IFileInfo
 public class BdInfoFileInfo : BDInfo.IO.IFileInfo
 {
 {
-    private FileSystemMetadata _impl;
+    private readonly FileSystemMetadata _impl;
 
 
     /// <summary>
     /// <summary>
     /// Initializes a new instance of the <see cref="BdInfoFileInfo" /> class.
     /// Initializes a new instance of the <see cref="BdInfoFileInfo" /> class.

+ 1 - 1
MediaBrowser.XbmcMetadata/Providers/BaseNfoProvider.cs

@@ -13,7 +13,7 @@ namespace MediaBrowser.XbmcMetadata.Providers
     public abstract class BaseNfoProvider<T> : ILocalMetadataProvider<T>, IHasItemChangeMonitor
     public abstract class BaseNfoProvider<T> : ILocalMetadataProvider<T>, IHasItemChangeMonitor
         where T : BaseItem, new()
         where T : BaseItem, new()
     {
     {
-        private IFileSystem _fileSystem;
+        private readonly IFileSystem _fileSystem;
 
 
         protected BaseNfoProvider(IFileSystem fileSystem)
         protected BaseNfoProvider(IFileSystem fileSystem)
         {
         {