diff options
| author | LogicalPhallacy <44458166+LogicalPhallacy@users.noreply.github.com> | 2019-01-23 00:31:35 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-23 00:31:35 -0800 |
| commit | 404bd04cbc17dc8c8bf4a5c9aa3ca9c5cd85aa68 (patch) | |
| tree | 3d267c6ceef9439a034c113095e10e4d619e7c70 /MediaBrowser.Controller/Entities/BaseItemExtensions.cs | |
| parent | 8ff89fdc0c30f595a171ffc550f907ef22b6212a (diff) | |
| parent | e05e002b8bb4d13eb2b80b56a0aad8903ddb701e (diff) | |
Merge pull request #8 from jellyfin/master
rebase to latest master
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() { |
