فهرست منبع

Fix partial set of MediaBrowser.Controller/Entities warnings

Rich Lander 3 سال پیش
والد
کامیت
a7cc77e7fa

+ 9 - 9
MediaBrowser.Controller/Entities/AggregateFolder.cs

@@ -1,6 +1,6 @@
 #nullable disable
 
-#pragma warning disable CS1591
+#pragma warning disable CA1819, CS1591
 
 using System;
 using System.Collections.Concurrent;
@@ -23,6 +23,9 @@ namespace MediaBrowser.Controller.Entities
     public class AggregateFolder : Folder
     {
         private bool _requiresRefresh;
+        private Guid[] _childrenIds = null;
+        private readonly object _childIdsLock = new object();
+
 
         public AggregateFolder()
         {
@@ -32,11 +35,6 @@ namespace MediaBrowser.Controller.Entities
         [JsonIgnore]
         public override bool IsPhysicalRoot => true;
 
-        public override bool CanDelete()
-        {
-            return false;
-        }
-
         [JsonIgnore]
         public override bool SupportsPlayedStatus => false;
 
@@ -55,15 +53,17 @@ namespace MediaBrowser.Controller.Entities
         public override string[] PhysicalLocations => PhysicalLocationsList;
 
         public string[] PhysicalLocationsList { get; set; }
+        public override bool CanDelete()
+        {
+            return false;
+        }
+
 
         protected override FileSystemMetadata[] GetFileSystemChildren(IDirectoryService directoryService)
         {
             return CreateResolveArgs(directoryService, true).FileSystemChildren;
         }
 
-        private Guid[] _childrenIds = null;
-        private readonly object _childIdsLock = new object();
-
         protected override List<BaseItem> LoadChildren()
         {
             lock (_childIdsLock)

+ 1 - 1
MediaBrowser.Controller/Entities/Folder.cs

@@ -1,6 +1,6 @@
 #nullable disable
 
-#pragma warning disable CS1591
+#pragma warning disable CA1721, CA1819, CS1591
 
 using System;
 using System.Collections.Generic;

+ 1 - 1
MediaBrowser.Controller/Entities/ICollectionFolder.cs

@@ -1,6 +1,6 @@
 #nullable disable
 
-#pragma warning disable CS1591
+#pragma warning disable CA1819, CS1591
 
 using System;
 

+ 27 - 27
MediaBrowser.Controller/Entities/InternalItemsQuery.cs

@@ -1,4 +1,4 @@
-#pragma warning disable CS1591
+#pragma warning disable CA1819, CA2227, CS1591
 
 using System;
 using System.Collections.Generic;
@@ -12,6 +12,15 @@ namespace MediaBrowser.Controller.Entities
 {
     public class InternalItemsQuery
     {
+        public InternalItemsQuery(User? user)
+            : this()
+        {
+            if (user != null)
+            {
+                SetUser(user);
+            }
+        }
+
         public bool Recursive { get; set; }
 
         public int? StartIndex { get; set; }
@@ -186,23 +195,6 @@ namespace MediaBrowser.Controller.Entities
 
         public Guid[] TopParentIds { get; set; }
 
-        public BaseItem? Parent
-        {
-            set
-            {
-                if (value == null)
-                {
-                    ParentId = Guid.Empty;
-                    ParentType = null;
-                }
-                else
-                {
-                    ParentId = value.Id;
-                    ParentType = value.GetType().Name;
-                }
-            }
-        }
-
         public string[] PresetViews { get; set; }
 
         public TrailerType[] TrailerTypes { get; set; }
@@ -270,6 +262,23 @@ namespace MediaBrowser.Controller.Entities
         /// </summary>
         public bool? DisplayAlbumFolders { get; set; }
 
+        public BaseItem? Parent
+        {
+            set
+            {
+                if (value == null)
+                {
+                    ParentId = Guid.Empty;
+                    ParentType = null;
+                }
+                else
+                {
+                    ParentId = value.Id;
+                    ParentType = value.GetType().Name;
+                }
+            }
+        }
+
         public InternalItemsQuery()
         {
             AlbumArtistIds = Array.Empty<Guid>();
@@ -310,15 +319,6 @@ namespace MediaBrowser.Controller.Entities
             Years = Array.Empty<int>();
         }
 
-        public InternalItemsQuery(User? user)
-            : this()
-        {
-            if (user != null)
-            {
-                SetUser(user);
-            }
-        }
-
         public void SetUser(User user)
         {
             MaxParentalRating = user.MaxParentalAgeRating;

+ 14 - 14
MediaBrowser.Controller/Entities/Person.cs

@@ -16,6 +16,20 @@ namespace MediaBrowser.Controller.Entities
     /// </summary>
     public class Person : BaseItem, IItemByName, IHasLookupInfo<PersonLookupInfo>
     {
+        /// <summary>
+        /// Gets the folder containing the item.
+        /// If the item is a folder, it returns the folder itself.
+        /// </summary>
+        /// <value>The containing folder path.</value>
+        [JsonIgnore]
+        public override string ContainingFolderPath => Path;
+
+        /// <summary>
+        /// Gets a value indicating whether to enable alpha numeric sorting.
+        /// </summary>
+        [JsonIgnore]
+        public override bool EnableAlphaNumericSorting => false;
+
         public override List<string> GetUserDataKeys()
         {
             var list = base.GetUserDataKeys();
@@ -49,14 +63,6 @@ namespace MediaBrowser.Controller.Entities
             return LibraryManager.GetItemList(query);
         }
 
-        /// <summary>
-        /// Gets the folder containing the item.
-        /// If the item is a folder, it returns the folder itself.
-        /// </summary>
-        /// <value>The containing folder path.</value>
-        [JsonIgnore]
-        public override string ContainingFolderPath => Path;
-
         public override bool CanDelete()
         {
             return false;
@@ -67,12 +73,6 @@ namespace MediaBrowser.Controller.Entities
             return true;
         }
 
-        /// <summary>
-        /// Gets a value indicating whether to enable alpha numeric sorting.
-        /// </summary>
-        [JsonIgnore]
-        public override bool EnableAlphaNumericSorting => false;
-
         [JsonIgnore]
         public override bool SupportsPeople => false;
 

+ 1 - 1
MediaBrowser.Controller/Entities/PersonInfo.cs

@@ -1,6 +1,6 @@
 #nullable disable
 
-#pragma warning disable CS1591
+#pragma warning disable CA2227, CS1591
 
 using System;
 using System.Collections.Generic;

+ 24 - 24
MediaBrowser.Controller/Entities/Photo.cs

@@ -36,6 +36,30 @@ namespace MediaBrowser.Controller.Entities
             }
         }
 
+        public string CameraMake { get; set; }
+
+        public string CameraModel { get; set; }
+
+        public string Software { get; set; }
+
+        public double? ExposureTime { get; set; }
+
+        public double? FocalLength { get; set; }
+
+        public ImageOrientation? Orientation { get; set; }
+
+        public double? Aperture { get; set; }
+
+        public double? ShutterSpeed { get; set; }
+
+        public double? Latitude { get; set; }
+
+        public double? Longitude { get; set; }
+
+        public double? Altitude { get; set; }
+
+        public int? IsoSpeedRating { get; set; }
+
         public override bool CanDownload()
         {
             return true;
@@ -69,29 +93,5 @@ namespace MediaBrowser.Controller.Entities
 
             return base.GetDefaultPrimaryImageAspectRatio();
         }
-
-        public string CameraMake { get; set; }
-
-        public string CameraModel { get; set; }
-
-        public string Software { get; set; }
-
-        public double? ExposureTime { get; set; }
-
-        public double? FocalLength { get; set; }
-
-        public ImageOrientation? Orientation { get; set; }
-
-        public double? Aperture { get; set; }
-
-        public double? ShutterSpeed { get; set; }
-
-        public double? Latitude { get; set; }
-
-        public double? Longitude { get; set; }
-
-        public double? Altitude { get; set; }
-
-        public int? IsoSpeedRating { get; set; }
     }
 }

+ 16 - 16
MediaBrowser.Controller/Entities/Studio.cs

@@ -15,19 +15,6 @@ namespace MediaBrowser.Controller.Entities
     /// </summary>
     public class Studio : BaseItem, IItemByName
     {
-        public override List<string> GetUserDataKeys()
-        {
-            var list = base.GetUserDataKeys();
-
-            list.Insert(0, GetType().Name + "-" + (Name ?? string.Empty).RemoveDiacritics());
-            return list;
-        }
-
-        public override string CreatePresentationUniqueKey()
-        {
-            return GetUserDataKeys()[0];
-        }
-
         /// <summary>
         /// Gets the folder containing the item.
         /// If the item is a folder, it returns the folder itself.
@@ -42,6 +29,22 @@ namespace MediaBrowser.Controller.Entities
         [JsonIgnore]
         public override bool SupportsAncestors => false;
 
+        [JsonIgnore]
+        public override bool SupportsPeople => false;
+
+        public override List<string> GetUserDataKeys()
+        {
+            var list = base.GetUserDataKeys();
+
+            list.Insert(0, GetType().Name + "-" + (Name ?? string.Empty).RemoveDiacritics());
+            return list;
+        }
+
+        public override string CreatePresentationUniqueKey()
+        {
+            return GetUserDataKeys()[0];
+        }
+
         public override double GetDefaultPrimaryImageAspectRatio()
         {
             double value = 16;
@@ -67,9 +70,6 @@ namespace MediaBrowser.Controller.Entities
             return LibraryManager.GetItemList(query);
         }
 
-        [JsonIgnore]
-        public override bool SupportsPeople => false;
-
         public static string GetPath(string name)
         {
             return GetPath(name, true);

+ 4 - 4
MediaBrowser.Controller/Entities/Trailer.cs

@@ -1,6 +1,6 @@
 #nullable disable
 
-#pragma warning disable CS1591
+#pragma warning disable CA1819, CS1591
 
 using System;
 using System.Collections.Generic;
@@ -23,6 +23,9 @@ namespace MediaBrowser.Controller.Entities
             TrailerTypes = Array.Empty<TrailerType>();
         }
 
+        [JsonIgnore]
+        public override bool StopRefreshIfLocalMetadataFound => false;
+
         public TrailerType[] TrailerTypes { get; set; }
 
         public override double GetDefaultPrimaryImageAspectRatio()
@@ -97,8 +100,5 @@ namespace MediaBrowser.Controller.Entities
 
             return list;
         }
-
-        [JsonIgnore]
-        public override bool StopRefreshIfLocalMetadataFound => false;
     }
 }

+ 11 - 11
MediaBrowser.Controller/Entities/Year.cs

@@ -15,6 +15,17 @@ namespace MediaBrowser.Controller.Entities
     /// </summary>
     public class Year : BaseItem, IItemByName
     {
+        [JsonIgnore]
+        public override bool SupportsAncestors => false;
+
+        public override bool CanDelete()
+        {
+            return false;
+        }
+
+        [JsonIgnore]
+        public override bool SupportsPeople => false;
+
         public override List<string> GetUserDataKeys()
         {
             var list = base.GetUserDataKeys();
@@ -39,14 +50,6 @@ namespace MediaBrowser.Controller.Entities
             return value;
         }
 
-        [JsonIgnore]
-        public override bool SupportsAncestors => false;
-
-        public override bool CanDelete()
-        {
-            return false;
-        }
-
         public override bool IsSaveLocalMetadataEnabled()
         {
             return true;
@@ -76,9 +79,6 @@ namespace MediaBrowser.Controller.Entities
             return null;
         }
 
-        [JsonIgnore]
-        public override bool SupportsPeople => false;
-
         public static string GetPath(string name)
         {
             return GetPath(name, true);

+ 1 - 1
MediaBrowser.Controller/Providers/IDirectoryService.cs

@@ -1,4 +1,4 @@
-#pragma warning disable CS1591
+#pragma warning disable CA1819, CS1591
 
 using System.Collections.Generic;
 using MediaBrowser.Model.IO;