Big migration to .NET Core

Changes:
- Removed the [Display] attribute, replaced with custom attribute
- Changed StringComparison.InvariantCultureIgnoreCase to
OrdinalIgnoreCase
- Removed [Serializable]
- Support net45 and netcoreapp1.0 (also added net451, net452 and net46)
- Removed ObjectHelper

Hacks: I referenced the core project by direct DLL references, rather
than as projects due to issues with VS2015u3.

#188
This commit is contained in:
Michael Bisbjerg 2016-07-18 21:24:52 +02:00
parent f43fb99fb2
commit 93a39eaeaa
34 changed files with 4406 additions and 413 deletions

View File

@ -1,10 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TMDbLib", "TMDbLib\TMDbLib.csproj", "{C0006F17-212A-474F-983E-7DA2F91E0233}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApplication", "TestApplication\TestApplication.csproj", "{E2324DA0-C17D-42B1-BABF-7699E40DFEFE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TMDbLibTests", "TMDbLibTests\TMDbLibTests.csproj", "{00AB08ED-9484-4AAE-9C8C-D19E40325E16}"
@ -16,16 +14,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{545A7C
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TMDbLib", "TMDbLib\TMDbLib.xproj", "{A7D4744C-9EF2-4CC3-B786-E8E568874933}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C0006F17-212A-474F-983E-7DA2F91E0233}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C0006F17-212A-474F-983E-7DA2F91E0233}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C0006F17-212A-474F-983E-7DA2F91E0233}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C0006F17-212A-474F-983E-7DA2F91E0233}.Release|Any CPU.Build.0 = Release|Any CPU
{E2324DA0-C17D-42B1-BABF-7699E40DFEFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E2324DA0-C17D-42B1-BABF-7699E40DFEFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E2324DA0-C17D-42B1-BABF-7699E40DFEFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -34,6 +30,10 @@ Global
{00AB08ED-9484-4AAE-9C8C-D19E40325E16}.Debug|Any CPU.Build.0 = Debug|Any CPU
{00AB08ED-9484-4AAE-9C8C-D19E40325E16}.Release|Any CPU.ActiveCfg = Release|Any CPU
{00AB08ED-9484-4AAE-9C8C-D19E40325E16}.Release|Any CPU.Build.0 = Release|Any CPU
{A7D4744C-9EF2-4CC3-B786-E8E568874933}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A7D4744C-9EF2-4CC3-B786-E8E568874933}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A7D4744C-9EF2-4CC3-B786-E8E568874933}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A7D4744C-9EF2-4CC3-B786-E8E568874933}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -113,9 +113,9 @@ namespace TMDbLib.Client
ApiKey = apiKey;
// Cleanup the provided url so that we don't get any issues when we are configuring the client
if (baseUrl.StartsWith("http://", StringComparison.InvariantCultureIgnoreCase))
if (baseUrl.StartsWith("http://", StringComparison.OrdinalIgnoreCase))
baseUrl = baseUrl.Substring("http://".Length);
else if (baseUrl.StartsWith("https://", StringComparison.InvariantCultureIgnoreCase))
else if (baseUrl.StartsWith("https://", StringComparison.OrdinalIgnoreCase))
baseUrl = baseUrl.Substring("https://".Length);
string httpScheme = useSsl ? "https" : "http";

View File

@ -1,4 +1,4 @@
using System.ComponentModel.DataAnnotations;
using TMDbLib.Utilities;
using System.Globalization;
using System.Threading.Tasks;
using TMDbLib.Objects.Account;
@ -7,7 +7,6 @@ using TMDbLib.Objects.General;
using TMDbLib.Objects.Lists;
using TMDbLib.Objects.Search;
using TMDbLib.Rest;
using TMDbLib.Utilities;
namespace TMDbLib.Client
{
@ -236,19 +235,19 @@ namespace TMDbLib.Client
private enum AccountListsMethods
{
[Display(Description = "favorite/movies")]
[EnumValue("favorite/movies")]
FavoriteMovies,
[Display(Description = "favorite/tv")]
[EnumValue("favorite/tv")]
FavoriteTv,
[Display(Description = "rated/movies")]
[EnumValue("rated/movies")]
RatedMovies,
[Display(Description = "rated/tv")]
[EnumValue("rated/tv")]
RatedTv,
[Display(Description = "rated/tv/episodes")]
[EnumValue("rated/tv/episodes")]
RatedTvEpisodes,
[Display(Description = "watchlist/movies")]
[EnumValue("watchlist/movies")]
MovieWatchlist,
[Display(Description = "watchlist/tv")]
[EnumValue("watchlist/tv")]
TvWatchlist,
}
}

View File

@ -1,11 +1,11 @@
using System.ComponentModel.DataAnnotations;
using TMDbLib.Utilities;
namespace TMDbLib.Objects.Account
{
public enum AccountSortBy
{
Undefined = 0,
[Display(Description = "created_at")]
[EnumValue("created_at")]
CreatedAt = 1,
}
}

View File

@ -1,14 +1,14 @@
using System;
using System.ComponentModel.DataAnnotations;
using TMDbLib.Utilities;
namespace TMDbLib.Objects.Collections
{
[Flags]
public enum CollectionMethods
{
[Display(Description = "Undefined")]
[EnumValue("Undefined")]
Undefined = 0,
[Display(Description = "images")]
[EnumValue("images")]
Images = 1
}
}

View File

@ -1,14 +1,14 @@
using System;
using System.ComponentModel.DataAnnotations;
using TMDbLib.Utilities;
namespace TMDbLib.Objects.Companies
{
[Flags]
public enum CompanyMethods
{
[Display(Description = "Undefined")]
[EnumValue("Undefined")]
Undefined = 0,
[Display(Description = "movies")]
[EnumValue("movies")]
Movies = 1
}
}

View File

@ -1,5 +1,5 @@
using System;
using System.ComponentModel.DataAnnotations;
using TMDbLib.Utilities;
namespace TMDbLib.Objects.Discover
{
@ -7,33 +7,33 @@ namespace TMDbLib.Objects.Discover
{
[Obsolete]
Undefined,
[Display(Description = "popularity.asc")]
[EnumValue("popularity.asc")]
Popularity,
[Display(Description = "popularity.desc")]
[EnumValue("popularity.desc")]
PopularityDesc,
[Display(Description = "release_date.asc")]
[EnumValue("release_date.asc")]
ReleaseDate,
[Display(Description = "release_date.desc")]
[EnumValue("release_date.desc")]
ReleaseDateDesc,
[Display(Description = "revenue.asc")]
[EnumValue("revenue.asc")]
Revenue,
[Display(Description = "revenue.desc")]
[EnumValue("revenue.desc")]
RevenueDesc,
[Display(Description = "primary_release_date.asc")]
[EnumValue("primary_release_date.asc")]
PrimaryReleaseDate,
[Display(Description = "primary_release_date.desc")]
[EnumValue("primary_release_date.desc")]
PrimaryReleaseDateDesc,
[Display(Description = "original_title.asc")]
[EnumValue("original_title.asc")]
OriginalTitle,
[Display(Description = "original_title.desc")]
[EnumValue("original_title.desc")]
OriginalTitleDesc,
[Display(Description = "vote_average.asc")]
[EnumValue("vote_average.asc")]
VoteAverage,
[Display(Description = "vote_average.desc")]
[EnumValue("vote_average.desc")]
VoteAverageDesc,
[Display(Description = "vote_count.asc")]
[EnumValue("vote_count.asc")]
VoteCount,
[Display(Description = "vote_count.desc")]
[EnumValue("vote_count.desc")]
VoteCountDesc
}
}

View File

@ -1,5 +1,5 @@
using System;
using System.ComponentModel.DataAnnotations;
using TMDbLib.Utilities;
namespace TMDbLib.Objects.Discover
{
@ -7,17 +7,17 @@ namespace TMDbLib.Objects.Discover
{
[Obsolete]
Undefined,
[Display(Description = "vote_average.asc")]
[EnumValue("vote_average.asc")]
VoteAverage,
[Display(Description = "vote_average.desc")]
[EnumValue("vote_average.desc")]
VoteAverageDesc,
[Display(Description = "first_air_date.asc")]
[EnumValue("first_air_date.asc")]
FirstAirDate,
[Display(Description = "first_air_date.desc")]
[EnumValue("first_air_date.desc")]
FirstAirDateDesc,
[Display(Description = "popularity.asc")]
[EnumValue("popularity.asc")]
Popularity,
[Display(Description = "popularity.desc")]
[EnumValue("popularity.desc")]
PopularityDesc
}
}

View File

@ -1,18 +1,18 @@
using System.ComponentModel.DataAnnotations;
using TMDbLib.Utilities;
namespace TMDbLib.Objects.Find
{
public enum FindExternalSource
{
[Display(Description = "imdb_id")]
[EnumValue("imdb_id")]
Imdb,
[Display(Description = "freebase_mid")]
[EnumValue("freebase_mid")]
FreeBaseMid,
[Display(Description = "freebase_id")]
[EnumValue("freebase_id")]
FreeBaseId,
[Display(Description = "tvrage_id")]
[EnumValue("tvrage_id")]
TvRage,
[Display(Description = "tvdb_id")]
[EnumValue("tvdb_id")]
TvDb
}
}

View File

@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace TMDbLib.Objects.General
{
[Serializable]
public class ConfigImageTypes
{
[JsonProperty("base_url")]

View File

@ -1,4 +1,4 @@
using System.ComponentModel.DataAnnotations;
using TMDbLib.Utilities;
namespace TMDbLib.Objects.General
{
@ -6,10 +6,10 @@ namespace TMDbLib.Objects.General
{
Unknown,
[Display(Description = "movie")]
[EnumValue("movie")]
Movie,
[Display(Description = "tv")]
[EnumValue("tv")]
TVShow
}
}

View File

@ -1,13 +1,13 @@
using System.ComponentModel.DataAnnotations;
using TMDbLib.Utilities;
namespace TMDbLib.Objects.General
{
public enum SortOrder
{
Undefined = 0,
[Display(Description = "asc")]
[EnumValue("asc")]
Ascending = 1,
[Display(Description = "desc")]
[EnumValue("desc")]
Descending = 2
}
}

View File

@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace TMDbLib.Objects.General
{
[Serializable]
public class TMDbConfig
{
[JsonProperty("images")]

View File

@ -1,41 +1,41 @@
using System;
using System.ComponentModel.DataAnnotations;
using TMDbLib.Utilities;
namespace TMDbLib.Objects.Movies
{
[Flags]
public enum MovieMethods
{
[Display(Description = "Undefined")]
[EnumValue("Undefined")]
Undefined = 0,
[Display(Description = "alternative_titles")]
[EnumValue("alternative_titles")]
AlternativeTitles = 1,
[Display(Description = "credits")]
[EnumValue("credits")]
Credits = 2,
[Display(Description = "images")]
[EnumValue("images")]
Images = 4,
[Display(Description = "keywords")]
[EnumValue("keywords")]
Keywords = 8,
[Display(Description = "releases")]
[EnumValue("releases")]
Releases = 16,
[Display(Description = "videos")]
[EnumValue("videos")]
Videos = 32,
[Display(Description = "translations")]
[EnumValue("translations")]
Translations = 64,
[Display(Description = "similar")]
[EnumValue("similar")]
Similar = 128,
[Display(Description = "reviews")]
[EnumValue("reviews")]
Reviews = 256,
[Display(Description = "lists")]
[EnumValue("lists")]
Lists = 512,
[Display(Description = "changes")]
[EnumValue("changes")]
Changes = 1024,
/// <summary>
/// Requires a valid user session to be set on the client object
/// </summary>
[Display(Description = "account_states")]
[EnumValue("account_states")]
AccountStates = 2048,
[Display(Description = "release_dates")]
[EnumValue("release_dates")]
ReleaseDates = 4096
}
}

View File

@ -1,24 +1,24 @@
using System;
using System.ComponentModel.DataAnnotations;
using TMDbLib.Utilities;
namespace TMDbLib.Objects.People
{
[Flags]
public enum PersonMethods
{
[Display(Description = "Undefined")]
[EnumValue("Undefined")]
Undefined = 0,
[Display(Description = "movie_credits")]
[EnumValue("movie_credits")]
MovieCredits = 1,
[Display(Description = "tv_credits")]
[EnumValue("tv_credits")]
TvCredits = 2,
[Display(Description = "external_ids")]
[EnumValue("external_ids")]
ExternalIds = 4,
[Display(Description = "images")]
[EnumValue("images")]
Images = 8,
[Display(Description = "tagged_images")]
[EnumValue("tagged_images")]
TaggedImages = 16,
[Display(Description = "changes")]
[EnumValue("changes")]
Changes = 32
}
}

View File

@ -1,22 +1,22 @@
using System;
using System.ComponentModel.DataAnnotations;
using TMDbLib.Utilities;
namespace TMDbLib.Objects.TvShows
{
[Flags]
public enum TvEpisodeMethods
{
[Display(Description = "Undefined")]
[EnumValue("Undefined")]
Undefined = 0,
[Display(Description = "credits")]
[EnumValue("credits")]
Credits = 1,
[Display(Description = "images")]
[EnumValue("images")]
Images = 2,
[Display(Description = "external_ids")]
[EnumValue("external_ids")]
ExternalIds = 4,
[Display(Description = "videos")]
[EnumValue("videos")]
Videos = 8,
[Display(Description = "account_states")]
[EnumValue("account_states")]
AccountStates = 16,
}
}

View File

@ -1,22 +1,22 @@
using System;
using System.ComponentModel.DataAnnotations;
using TMDbLib.Utilities;
namespace TMDbLib.Objects.TvShows
{
[Flags]
public enum TvSeasonMethods
{
[Display(Description = "Undefined")]
[EnumValue("Undefined")]
Undefined = 0,
[Display(Description = "credits")]
[EnumValue("credits")]
Credits = 1,
[Display(Description = "images")]
[EnumValue("images")]
Images = 2,
[Display(Description = "external_ids")]
[EnumValue("external_ids")]
ExternalIds = 4,
[Display(Description = "videos")]
[EnumValue("videos")]
Videos = 8,
[Display(Description = "account_states")]
[EnumValue("account_states")]
AccountStates = 16,
}
}

View File

@ -1,16 +1,16 @@
using System.ComponentModel.DataAnnotations;
using TMDbLib.Utilities;
namespace TMDbLib.Objects.Movies
{
public enum TvShowListType
{
[Display(Description = "on_the_air")]
[EnumValue("on_the_air")]
OnTheAir,
[Display(Description = "airing_today")]
[EnumValue("airing_today")]
AiringToday,
[Display(Description = "top_rated")]
[EnumValue("top_rated")]
TopRated,
[Display(Description = "popular")]
[EnumValue("popular")]
Popular
}
}

View File

@ -1,34 +1,34 @@
using System;
using System.ComponentModel.DataAnnotations;
using TMDbLib.Utilities;
namespace TMDbLib.Objects.TvShows
{
[Flags]
public enum TvShowMethods
{
[Display(Description = "Undefined")]
[EnumValue("Undefined")]
Undefined = 0,
[Display(Description = "credits")]
[EnumValue("credits")]
Credits = 1,
[Display(Description = "images")]
[EnumValue("images")]
Images = 2,
[Display(Description = "external_ids")]
[EnumValue("external_ids")]
ExternalIds = 4,
[Display(Description = "content_ratings")]
[EnumValue("content_ratings")]
ContentRatings = 8,
[Display(Description = "alternative_titles")]
[EnumValue("alternative_titles")]
AlternativeTitles = 16,
[Display(Description = "keywords")]
[EnumValue("keywords")]
Keywords = 32,
[Display(Description = "similar")]
[EnumValue("similar")]
Similar = 64,
[Display(Description = "videos")]
[EnumValue("videos")]
Videos = 128,
[Display(Description = "translations")]
[EnumValue("translations")]
Translations = 256,
[Display(Description = "account_states")]
[EnumValue("account_states")]
AccountStates = 512,
[Display(Description = "changes")]
[EnumValue("changes")]
Changes = 1024
}
}

View File

@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TMDbLib")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -19,17 +19,4 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c8cd805d-f17a-4919-9adb-b5f50d72f32a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.0.3")]
[assembly: AssemblyFileVersion("0.9.0.3")]
[assembly: Guid("c8cd805d-f17a-4919-9adb-b5f50d72f32a")]

View File

@ -1,228 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C0006F17-212A-474F-983E-7DA2F91E0233}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TMDbLib</RootNamespace>
<AssemblyName>TMDbLib</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Runtime.Serialization" />
</ItemGroup>
<ItemGroup>
<Compile Include="Helpers\TmdbNullIntAsZero.cs" />
<Compile Include="Helpers\TmdbUtcTimeConverter.cs" />
<Compile Include="Objects\Search\SearchTvSeason.cs" />
<Compile Include="Utilities\SimpleNamedValueCollection.cs" />
<Compile Include="Utilities\CustomDatetimeFormatConverter.cs" />
<Compile Include="Utilities\ObjectHelper.cs" />
<Compile Include="Rest\RestClient.cs" />
<Compile Include="Objects\Discover\DiscoverBase.cs" />
<Compile Include="Objects\Discover\DiscoverMovie.cs" />
<Compile Include="Objects\Discover\DiscoverTv.cs" />
<Compile Include="Client\TMDbClientCredit.cs" />
<Compile Include="Client\TMDbClientGuestSessions.cs" />
<Compile Include="Objects\Certifications\CertificationItem.cs" />
<Compile Include="Objects\Certifications\CertificationsContainer.cs" />
<Compile Include="Client\TMDbClientCertifications.cs" />
<Compile Include="Client\TMDbClientTimezones.cs" />
<Compile Include="Objects\General\Media.cs" />
<Compile Include="Objects\Movies\ReleaseDateItem.cs" />
<Compile Include="Objects\Movies\ReleaseDatesContainer.cs" />
<Compile Include="Objects\Movies\ReleaseDateType.cs" />
<Compile Include="Objects\People\TaggedImage.cs" />
<Compile Include="Objects\People\TvCredits.cs" />
<Compile Include="Objects\People\TvJob.cs" />
<Compile Include="Objects\People\TvRole.cs" />
<Compile Include="Objects\Credit\CreditEpisode.cs" />
<Compile Include="Objects\Credit\Credit.cs" />
<Compile Include="Objects\Credit\CreditMedia.cs" />
<Compile Include="Objects\Credit\CreditPerson.cs" />
<Compile Include="Objects\Credit\CreditSeason.cs" />
<Compile Include="Objects\Movies\MovieWithRating.cs" />
<Compile Include="Objects\Timezones\Timezones.cs" />
<Compile Include="Client\TMDbClientJobs.cs" />
<Compile Include="Client\TMDbClientReviews.cs" />
<Compile Include="Objects\Account\Avatar.cs" />
<Compile Include="Objects\Account\Gravatar.cs" />
<Compile Include="Objects\Find\FindContainer.cs" />
<Compile Include="Client\TMDbClientFind.cs" />
<Compile Include="Client\TMDbClientAccount.cs" />
<Compile Include="Client\TMDbClientAuthentication.cs" />
<Compile Include="Client\TMDbClientNetworks.cs" />
<Compile Include="Client\TMDbClientTvEpisodes.cs" />
<Compile Include="Client\TMDbClientTvSeasons.cs" />
<Compile Include="Client\TMDbClientDiscover.cs" />
<Compile Include="Client\TMDbClientTvShows.cs" />
<Compile Include="Objects\Account\AccountDetails.cs" />
<Compile Include="Objects\Find\FindExternalSource.cs" />
<Compile Include="Objects\General\ResultContainer.cs" />
<Compile Include="Objects\General\MediaType.cs" />
<Compile Include="Objects\General\PostReply.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Objects\General\SortOrder.cs" />
<Compile Include="Objects\Account\AccountMovieSortBy.cs" />
<Compile Include="Objects\Authentication\GuestSession.cs" />
<Compile Include="Objects\Authentication\UserSessionRequiredException.cs" />
<Compile Include="Objects\Authentication\GuestSessionRequiredException.cs" />
<Compile Include="Objects\Authentication\SessionType.cs" />
<Compile Include="Objects\Authentication\Token.cs" />
<Compile Include="Objects\Authentication\UserSession.cs" />
<Compile Include="Objects\Discover\DiscoverMovieSortBy.cs" />
<Compile Include="Objects\Discover\DiscoverTvShowSortBy.cs" />
<Compile Include="Objects\General\PosterImages.cs" />
<Compile Include="Objects\General\StillImages.cs" />
<Compile Include="Objects\Genres\GenreContainer.cs" />
<Compile Include="Objects\Changes\ChangesListItem.cs" />
<Compile Include="Objects\Companies\Company.cs" />
<Compile Include="Objects\Companies\CompanyMovies.cs" />
<Compile Include="Objects\Companies\CompanyMethods.cs" />
<Compile Include="Objects\Companies\ParentCompany.cs" />
<Compile Include="Objects\General\ProfileImage.cs" />
<Compile Include="Objects\Collections\CollectionMethods.cs" />
<Compile Include="Objects\Collections\Part.cs" />
<Compile Include="Objects\Collections\Collection.cs" />
<Compile Include="Objects\General\Images.cs" />
<Compile Include="Objects\General\SearchContainerWithId.cs" />
<Compile Include="Objects\General\Job.cs" />
<Compile Include="Objects\Jobs\JobContainer.cs" />
<Compile Include="Objects\Lists\List.cs" />
<Compile Include="Objects\General\SearchContainer.cs" />
<Compile Include="Objects\Lists\ListCreateReply.cs" />
<Compile Include="Objects\Lists\ListStatus.cs" />
<Compile Include="Objects\General\AccountState.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Objects\General\MediaKnownFor.cs" />
<Compile Include="Objects\Movies\MovieListType.cs" />
<Compile Include="Client\TMDbClientChanges.cs" />
<Compile Include="Client\TMDbClientKeywords.cs" />
<Compile Include="Client\TMDbClientSearch.cs" />
<Compile Include="Client\TMDbClientGenres.cs" />
<Compile Include="Client\TMDbClientCompanies.cs" />
<Compile Include="Client\TMDbClientLists.cs" />
<Compile Include="Client\TMDbClientPeople.cs" />
<Compile Include="Client\TMDbClientCollections.cs" />
<Compile Include="Client\TMDbClientMovies.cs" />
<Compile Include="Objects\Movies\AlternativeTitles.cs" />
<Compile Include="Objects\General\AlternativeTitle.cs" />
<Compile Include="Objects\General\ImageData.cs" />
<Compile Include="Objects\Movies\BelongsToCollection.cs" />
<Compile Include="Objects\Movies\Cast.cs" />
<Compile Include="Objects\Movies\Credits.cs" />
<Compile Include="Objects\Changes\Change.cs" />
<Compile Include="Objects\Changes\ChangesContainer.cs" />
<Compile Include="Objects\General\Keyword.cs" />
<Compile Include="Objects\Movies\ListResult.cs" />
<Compile Include="Objects\Movies\ProductionCompany.cs" />
<Compile Include="Objects\Movies\Country.cs" />
<Compile Include="Objects\General\Genre.cs" />
<Compile Include="Objects\General\ImagesWithId.cs" />
<Compile Include="Objects\Changes\ChangeItem.cs" />
<Compile Include="Objects\Movies\KeywordsContainer.cs" />
<Compile Include="Objects\Movies\Movie.cs" />
<Compile Include="Objects\Movies\MovieMethods.cs" />
<Compile Include="Objects\General\ConfigImageTypes.cs" />
<Compile Include="Objects\Movies\ProductionCountry.cs" />
<Compile Include="Objects\Movies\Releases.cs" />
<Compile Include="Objects\General\MovieResult.cs" />
<Compile Include="Objects\Movies\SpokenLanguage.cs" />
<Compile Include="Objects\Movies\Translation.cs" />
<Compile Include="Objects\Movies\TranslationsContainer.cs" />
<Compile Include="Client\TMDbClient.cs" />
<Compile Include="Objects\Search\SearchMulti.cs" />
<Compile Include="Objects\People\MovieCredits.cs" />
<Compile Include="Objects\People\MovieJob.cs" />
<Compile Include="Objects\People\MovieRole.cs" />
<Compile Include="Objects\People\PersonListType.cs" />
<Compile Include="Objects\People\Person.cs" />
<Compile Include="Objects\People\PersonMethods.cs" />
<Compile Include="Objects\General\PersonResult.cs" />
<Compile Include="Objects\People\ProfileImages.cs" />
<Compile Include="Objects\Reviews\Review.cs" />
<Compile Include="Objects\Search\SearchResultCollection.cs" />
<Compile Include="Objects\Search\SearchMovie.cs" />
<Compile Include="Objects\Search\SearchCompany.cs" />
<Compile Include="Objects\Search\SearchKeyword.cs" />
<Compile Include="Objects\Search\SearchList.cs" />
<Compile Include="Objects\Search\SearchPerson.cs" />
<Compile Include="Objects\Search\SearchTv.cs" />
<Compile Include="Objects\Search\SearchTvEpisode.cs" />
<Compile Include="Objects\TvShows\Cast.cs" />
<Compile Include="Objects\TvShows\ContentRating.cs" />
<Compile Include="Objects\TvShows\Credits.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Objects\General\Crew.cs" />
<Compile Include="Objects\General\ExternalIds.cs" />
<Compile Include="Objects\General\Video.cs" />
<Compile Include="Objects\TvShows\TvEpisodeAccountState.cs" />
<Compile Include="Objects\TvShows\TvEpisodeWithRating.cs" />
<Compile Include="Objects\TvShows\TvShowListType.cs" />
<Compile Include="Objects\TvShows\Network.cs" />
<Compile Include="Objects\TvShows\TvEpisode.cs" />
<Compile Include="Objects\TvShows\TvSeason.cs" />
<Compile Include="Objects\TvShows\TvEpisodeMethods.cs" />
<Compile Include="Objects\TvShows\TvShow.cs" />
<Compile Include="Objects\TvShows\TvSeasonMethods.cs" />
<Compile Include="Objects\TvShows\TvShowMethods.cs" />
<Compile Include="Objects\TvShows\TvShowWithRating.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Objects\General\TMDbConfig.cs" />
<Compile Include="Objects\Exceptions\RequestLimitExceededException.cs" />
<Compile Include="Utilities\CustomDeserialization.cs" />
<Compile Include="Utilities\EnumExtensions.cs" />
<Compile Include="Rest\ParameterType.cs" />
<Compile Include="Rest\RestRequest.cs" />
<Compile Include="Rest\RestResponse.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

19
TMDbLib/TMDbLib.xproj Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>a7d4744c-9ef2-4cc3-b786-e8e568874933</ProjectGuid>
<RootNamespace>TMDbLib</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ActiveDebugProfile>Start</ActiveDebugProfile>
</PropertyGroup>
</Project>

View File

@ -12,7 +12,7 @@ namespace TMDbLib.Utilities
public CustomDatetimeFormatConverter()
{
CultureInfo = CultureInfo.GetCultureInfo("en-US");
CultureInfo = new CultureInfo("en-US");
DatetimeFormat = "yyyy-MM-dd HH:mm:ss UTC";
}

View File

@ -1,5 +1,4 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Reflection;
namespace TMDbLib.Utilities
@ -9,21 +8,22 @@ namespace TMDbLib.Utilities
public static string GetDescription<T>(this T enumerationValue) where T : struct
{
Type type = enumerationValue.GetType();
if (!type.IsEnum)
TypeInfo typeInfo = type.GetTypeInfo();
if (!typeInfo.IsEnum)
{
throw new ArgumentException("EnumerationValue must be of Enum type", "enumerationValue");
throw new ArgumentException("EnumerationValue must be of Enum type", nameof(enumerationValue));
}
// Tries to find a DisplayAttribute for a potential friendly name for the enum
MemberInfo[] memberInfo = type.GetMember(enumerationValue.ToString());
MemberInfo[] memberInfo = typeInfo.GetMember(enumerationValue.ToString());
if (memberInfo.Length > 0)
{
object[] attrs = memberInfo[0].GetCustomAttributes(typeof(DisplayAttribute), false);
if (attrs.Length > 0)
EnumValueAttribute attr = memberInfo[0].GetCustomAttribute<EnumValueAttribute>();
if (attr != null)
{
//Pull out the description value
return ((DisplayAttribute)attrs[0]).Description;
// Pull out the Value
return attr.Value;
}
}

View File

@ -0,0 +1,15 @@
using System;
namespace TMDbLib.Utilities
{
[AttributeUsage(AttributeTargets.Field)]
public class EnumValueAttribute : Attribute
{
public string Value { get; }
public EnumValueAttribute(string value)
{
Value = value;
}
}
}

View File

@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.Reflection;
namespace TMDbLib.Utilities
{
internal static class ObjectHelper
{
private static readonly Type StringType = typeof(string);
public static IEnumerable<KeyValuePair<string, string>> GetStringProperties(this object obj)
{
foreach (var prop in obj.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
{
if (prop.PropertyType != StringType)
continue;
yield return new KeyValuePair<string, string>(prop.Name, prop.GetValue(obj, null) as string);
}
}
}
}

View File

@ -24,7 +24,7 @@ namespace TMDbLib.Utilities
{
foreach (KeyValuePair<string, string> pair in _list)
{
if (pair.Key.Equals(key, StringComparison.InvariantCultureIgnoreCase))
if (pair.Key.Equals(key, StringComparison.OrdinalIgnoreCase))
return pair.Value;
}
@ -33,7 +33,7 @@ namespace TMDbLib.Utilities
public bool Remove(string key)
{
return _list.RemoveAll(s => s.Key.Equals(key, StringComparison.InvariantCultureIgnoreCase)) > 0;
return _list.RemoveAll(s => s.Key.Equals(key, StringComparison.OrdinalIgnoreCase)) > 0;
}
public string this[string index]

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
<package id="System.Net.Http" version="4.0.0" targetFramework="net45" />
</packages>

36
TMDbLib/project.json Normal file
View File

@ -0,0 +1,36 @@
{
"version": "0.9.1.0-alpha",
"dependencies": {
"Newtonsoft.Json": "7.0.1"
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50",
"dependencies": {
"NETStandard.Library": "1.6.0"
}
},
"net45": {
"dependencies": {
"System.Net.Http": "4.0.0"
}
},
"net451": {
"dependencies": {
"System.Net.Http": "4.0.0"
}
},
"net452": {
"dependencies": {
"System.Net.Http": "4.0.0"
}
},
"net46": {
"dependencies": {
"System.Net.Http": "4.0.0"
}
}
}
}

4193
TMDbLib/project.lock.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -96,7 +96,7 @@
<Compile Include="UtilsTest.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TMDbLib\TMDbLib.csproj">
<ProjectReference Include="..\TMDbLib\TMDbLib.xproj">
<Project>{c0006f17-212a-474f-983e-7da2f91e0233}</Project>
<Name>TMDbLib</Name>
</ProjectReference>

View File

@ -1,11 +1,11 @@
using System.ComponentModel.DataAnnotations;
using TMDbLib.Utilities;
namespace TMDbLibTests.TestClasses
{
enum EnumTestEnum
{
A,
[Display(Description = "B-Description")]
[EnumValue("B-Description")]
B
}
}

View File

@ -38,6 +38,10 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="TMDbLib, Version=0.9.0.3, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\TMDbLib\bin\Debug\net45\TMDbLib.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
@ -47,13 +51,6 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TMDbLib\TMDbLib.csproj">
<Project>{c0006f17-212a-474f-983e-7da2f91e0233}</Project>
<Name>TMDbLib</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.