diff options
| author | Andrew Rabert <6550543+nvllsvm@users.noreply.github.com> | 2019-01-22 18:13:47 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-22 18:13:47 -0500 |
| commit | 28483bdb54be96ae83e0fded097f534d7e26ba1e (patch) | |
| tree | e7f4b92326417ebf55eecdf68a01d2c3b9e660d7 /MediaBrowser.Controller/Entities/BaseItemExtensions.cs | |
| parent | 920c39454c05e979eabe81877269cd4517a03ccf (diff) | |
| parent | 8106c8393b711a7e1d40487e3caf2b014decbe28 (diff) | |
Merge pull request #651 from jellyfin/release-10.1.0
Release 10.1.0
Diffstat (limited to 'MediaBrowser.Controller/Entities/BaseItemExtensions.cs')
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItemExtensions.cs | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItemExtensions.cs b/MediaBrowser.Controller/Entities/BaseItemExtensions.cs index 8ab1788b5..9c955a724 100644 --- a/MediaBrowser.Controller/Entities/BaseItemExtensions.cs +++ b/MediaBrowser.Controller/Entities/BaseItemExtensions.cs @@ -1,14 +1,6 @@ -using System; using System.Linq; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Querying; namespace MediaBrowser.Controller.Entities { @@ -62,17 +54,17 @@ namespace MediaBrowser.Controller.Entities item.SetImagePath(imageType, BaseItem.FileSystem.GetFileInfo(file)); } } - + /// <summary> /// Copies all properties on object. Skips properties that do not exist. /// </summary> /// <param name="source">The source object.</param> /// <param name="dest">The destination object.</param> - public static void DeepCopy<T, TU>(this T source, TU dest) + public static void DeepCopy<T, TU>(this T source, TU dest) where T : BaseItem where TU : BaseItem { - var sourceProps = typeof (T).GetProperties().Where(x => x.CanRead).ToList(); + var sourceProps = typeof(T).GetProperties().Where(x => x.CanRead).ToList(); var destProps = typeof(TU).GetProperties() .Where(x => x.CanWrite) .ToList(); @@ -82,7 +74,7 @@ namespace MediaBrowser.Controller.Entities if (destProps.Any(x => x.Name == sourceProp.Name)) { var p = destProps.First(x => x.Name == sourceProp.Name); - p.SetValue(dest, sourceProp.GetValue(source, null), null); + p.SetValue(dest, sourceProp.GetValue(source, null), null); } } @@ -93,7 +85,7 @@ namespace MediaBrowser.Controller.Entities /// Copies all properties on newly created object. Skips properties that do not exist. /// </summary> /// <param name="source">The source object.</param> - public static TU DeepCopy<T, TU>(this T source) + public static TU DeepCopy<T, TU>(this T source) where T : BaseItem where TU : BaseItem, new() { |
